]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/3574'
[rails.git] / vendor / assets / iD / iD.js
1 (() => {
2   var __create = Object.create;
3   var __defProp = Object.defineProperty;
4   var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5   var __getOwnPropNames = Object.getOwnPropertyNames;
6   var __getProtoOf = Object.getPrototypeOf;
7   var __hasOwnProp = Object.prototype.hasOwnProperty;
8   var __commonJS = (cb, mod) => function __require() {
9     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10   };
11   var __export = (target, all) => {
12     for (var name2 in all)
13       __defProp(target, name2, { get: all[name2], enumerable: true });
14   };
15   var __copyProps = (to, from, except, desc) => {
16     if (from && typeof from === "object" || typeof from === "function") {
17       for (let key of __getOwnPropNames(from))
18         if (!__hasOwnProp.call(to, key) && key !== except)
19           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20     }
21     return to;
22   };
23   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
24
25   // node_modules/diacritics/index.js
26   var require_diacritics = __commonJS({
27     "node_modules/diacritics/index.js"(exports2) {
28       exports2.remove = removeDiacritics2;
29       var replacementList = [
30         {
31           base: " ",
32           chars: "\xA0"
33         },
34         {
35           base: "0",
36           chars: "\u07C0"
37         },
38         {
39           base: "A",
40           chars: "\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"
41         },
42         {
43           base: "AA",
44           chars: "\uA732"
45         },
46         {
47           base: "AE",
48           chars: "\xC6\u01FC\u01E2"
49         },
50         {
51           base: "AO",
52           chars: "\uA734"
53         },
54         {
55           base: "AU",
56           chars: "\uA736"
57         },
58         {
59           base: "AV",
60           chars: "\uA738\uA73A"
61         },
62         {
63           base: "AY",
64           chars: "\uA73C"
65         },
66         {
67           base: "B",
68           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
69         },
70         {
71           base: "C",
72           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
73         },
74         {
75           base: "D",
76           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
77         },
78         {
79           base: "Dh",
80           chars: "\xD0"
81         },
82         {
83           base: "DZ",
84           chars: "\u01F1\u01C4"
85         },
86         {
87           base: "Dz",
88           chars: "\u01F2\u01C5"
89         },
90         {
91           base: "E",
92           chars: "\u025B\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E\u1D07"
93         },
94         {
95           base: "F",
96           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
97         },
98         {
99           base: "G",
100           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
101         },
102         {
103           base: "H",
104           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
105         },
106         {
107           base: "I",
108           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
109         },
110         {
111           base: "J",
112           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
113         },
114         {
115           base: "K",
116           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
117         },
118         {
119           base: "L",
120           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
121         },
122         {
123           base: "LJ",
124           chars: "\u01C7"
125         },
126         {
127           base: "Lj",
128           chars: "\u01C8"
129         },
130         {
131           base: "M",
132           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
133         },
134         {
135           base: "N",
136           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
137         },
138         {
139           base: "NJ",
140           chars: "\u01CA"
141         },
142         {
143           base: "Nj",
144           chars: "\u01CB"
145         },
146         {
147           base: "O",
148           chars: "\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"
149         },
150         {
151           base: "OE",
152           chars: "\u0152"
153         },
154         {
155           base: "OI",
156           chars: "\u01A2"
157         },
158         {
159           base: "OO",
160           chars: "\uA74E"
161         },
162         {
163           base: "OU",
164           chars: "\u0222"
165         },
166         {
167           base: "P",
168           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
169         },
170         {
171           base: "Q",
172           chars: "\u24C6\uFF31\uA756\uA758\u024A"
173         },
174         {
175           base: "R",
176           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
177         },
178         {
179           base: "S",
180           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
181         },
182         {
183           base: "T",
184           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
185         },
186         {
187           base: "Th",
188           chars: "\xDE"
189         },
190         {
191           base: "TZ",
192           chars: "\uA728"
193         },
194         {
195           base: "U",
196           chars: "\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"
197         },
198         {
199           base: "V",
200           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
201         },
202         {
203           base: "VY",
204           chars: "\uA760"
205         },
206         {
207           base: "W",
208           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
209         },
210         {
211           base: "X",
212           chars: "\u24CD\uFF38\u1E8A\u1E8C"
213         },
214         {
215           base: "Y",
216           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
217         },
218         {
219           base: "Z",
220           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
221         },
222         {
223           base: "a",
224           chars: "\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0251"
225         },
226         {
227           base: "aa",
228           chars: "\uA733"
229         },
230         {
231           base: "ae",
232           chars: "\xE6\u01FD\u01E3"
233         },
234         {
235           base: "ao",
236           chars: "\uA735"
237         },
238         {
239           base: "au",
240           chars: "\uA737"
241         },
242         {
243           base: "av",
244           chars: "\uA739\uA73B"
245         },
246         {
247           base: "ay",
248           chars: "\uA73D"
249         },
250         {
251           base: "b",
252           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
253         },
254         {
255           base: "c",
256           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
257         },
258         {
259           base: "d",
260           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
261         },
262         {
263           base: "dh",
264           chars: "\xF0"
265         },
266         {
267           base: "dz",
268           chars: "\u01F3\u01C6"
269         },
270         {
271           base: "e",
272           chars: "\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u01DD"
273         },
274         {
275           base: "f",
276           chars: "\u24D5\uFF46\u1E1F\u0192"
277         },
278         {
279           base: "ff",
280           chars: "\uFB00"
281         },
282         {
283           base: "fi",
284           chars: "\uFB01"
285         },
286         {
287           base: "fl",
288           chars: "\uFB02"
289         },
290         {
291           base: "ffi",
292           chars: "\uFB03"
293         },
294         {
295           base: "ffl",
296           chars: "\uFB04"
297         },
298         {
299           base: "g",
300           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
301         },
302         {
303           base: "h",
304           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
305         },
306         {
307           base: "hv",
308           chars: "\u0195"
309         },
310         {
311           base: "i",
312           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
313         },
314         {
315           base: "j",
316           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
317         },
318         {
319           base: "k",
320           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
321         },
322         {
323           base: "l",
324           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
325         },
326         {
327           base: "lj",
328           chars: "\u01C9"
329         },
330         {
331           base: "m",
332           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
333         },
334         {
335           base: "n",
336           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
337         },
338         {
339           base: "nj",
340           chars: "\u01CC"
341         },
342         {
343           base: "o",
344           chars: "\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\uA74B\uA74D\u0275\u0254\u1D11"
345         },
346         {
347           base: "oe",
348           chars: "\u0153"
349         },
350         {
351           base: "oi",
352           chars: "\u01A3"
353         },
354         {
355           base: "oo",
356           chars: "\uA74F"
357         },
358         {
359           base: "ou",
360           chars: "\u0223"
361         },
362         {
363           base: "p",
364           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
365         },
366         {
367           base: "q",
368           chars: "\u24E0\uFF51\u024B\uA757\uA759"
369         },
370         {
371           base: "r",
372           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
373         },
374         {
375           base: "s",
376           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
377         },
378         {
379           base: "ss",
380           chars: "\xDF"
381         },
382         {
383           base: "t",
384           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
385         },
386         {
387           base: "th",
388           chars: "\xFE"
389         },
390         {
391           base: "tz",
392           chars: "\uA729"
393         },
394         {
395           base: "u",
396           chars: "\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"
397         },
398         {
399           base: "v",
400           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
401         },
402         {
403           base: "vy",
404           chars: "\uA761"
405         },
406         {
407           base: "w",
408           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
409         },
410         {
411           base: "x",
412           chars: "\u24E7\uFF58\u1E8B\u1E8D"
413         },
414         {
415           base: "y",
416           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
417         },
418         {
419           base: "z",
420           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
421         }
422       ];
423       var diacriticsMap = {};
424       for (i2 = 0; i2 < replacementList.length; i2 += 1) {
425         chars = replacementList[i2].chars;
426         for (j2 = 0; j2 < chars.length; j2 += 1) {
427           diacriticsMap[chars[j2]] = replacementList[i2].base;
428         }
429       }
430       var chars;
431       var j2;
432       var i2;
433       function removeDiacritics2(str2) {
434         return str2.replace(/[^\u0000-\u007e]/g, function(c) {
435           return diacriticsMap[c] || c;
436         });
437       }
438       exports2.replacementList = replacementList;
439       exports2.diacriticsMap = diacriticsMap;
440     }
441   });
442
443   // node_modules/alif-toolkit/lib/isArabic.js
444   var require_isArabic = __commonJS({
445     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
446       "use strict";
447       Object.defineProperty(exports2, "__esModule", { value: true });
448       var arabicBlocks = [
449         [1536, 1791],
450         [1872, 1919],
451         [2208, 2303],
452         [64336, 65023],
453         [65136, 65279],
454         [69216, 69247],
455         [126064, 126143],
456         [126464, 126719]
457       ];
458       function isArabic(char) {
459         if (char.length > 1) {
460           throw new Error("isArabic works on only one-character strings");
461         }
462         let code = char.charCodeAt(0);
463         for (let i2 = 0; i2 < arabicBlocks.length; i2++) {
464           let block2 = arabicBlocks[i2];
465           if (code >= block2[0] && code <= block2[1]) {
466             return true;
467           }
468         }
469         return false;
470       }
471       exports2.isArabic = isArabic;
472       function isMath(char) {
473         if (char.length > 2) {
474           throw new Error("isMath works on only one-character strings");
475         }
476         let code = char.charCodeAt(0);
477         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
478       }
479       exports2.isMath = isMath;
480     }
481   });
482
483   // node_modules/alif-toolkit/lib/unicode-arabic.js
484   var require_unicode_arabic = __commonJS({
485     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
486       "use strict";
487       Object.defineProperty(exports2, "__esModule", { value: true });
488       var arabicReference = {
489         "alef": {
490           "normal": [
491             "\u0627"
492           ],
493           "madda_above": {
494             "normal": [
495               "\u0627\u0653",
496               "\u0622"
497             ],
498             "isolated": "\uFE81",
499             "final": "\uFE82"
500           },
501           "hamza_above": {
502             "normal": [
503               "\u0627\u0654",
504               "\u0623"
505             ],
506             "isolated": "\uFE83",
507             "final": "\uFE84"
508           },
509           "hamza_below": {
510             "normal": [
511               "\u0627\u0655",
512               "\u0625"
513             ],
514             "isolated": "\uFE87",
515             "final": "\uFE88"
516           },
517           "wasla": {
518             "normal": "\u0671",
519             "isolated": "\uFB50",
520             "final": "\uFB51"
521           },
522           "wavy_hamza_above": [
523             "\u0672"
524           ],
525           "wavy_hamza_below": [
526             "\u0627\u065F",
527             "\u0673"
528           ],
529           "high_hamza": [
530             "\u0675",
531             "\u0627\u0674"
532           ],
533           "indic_two_above": [
534             "\u0773"
535           ],
536           "indic_three_above": [
537             "\u0774"
538           ],
539           "fathatan": {
540             "normal": [
541               "\u0627\u064B"
542             ],
543             "final": "\uFD3C",
544             "isolated": "\uFD3D"
545           },
546           "isolated": "\uFE8D",
547           "final": "\uFE8E"
548         },
549         "beh": {
550           "normal": [
551             "\u0628"
552           ],
553           "dotless": [
554             "\u066E"
555           ],
556           "three_dots_horizontally_below": [
557             "\u0750"
558           ],
559           "dot_below_three_dots_above": [
560             "\u0751"
561           ],
562           "three_dots_pointing_upwards_below": [
563             "\u0752"
564           ],
565           "three_dots_pointing_upwards_below_two_dots_above": [
566             "\u0753"
567           ],
568           "two_dots_below_dot_above": [
569             "\u0754"
570           ],
571           "inverted_small_v_below": [
572             "\u0755"
573           ],
574           "small_v": [
575             "\u0756"
576           ],
577           "small_v_below": [
578             "\u08A0"
579           ],
580           "hamza_above": [
581             "\u08A1"
582           ],
583           "small_meem_above": [
584             "\u08B6"
585           ],
586           "isolated": "\uFE8F",
587           "final": "\uFE90",
588           "initial": "\uFE91",
589           "medial": "\uFE92"
590         },
591         "teh marbuta": {
592           "normal": [
593             "\u0629"
594           ],
595           "isolated": "\uFE93",
596           "final": "\uFE94"
597         },
598         "teh": {
599           "normal": [
600             "\u062A"
601           ],
602           "ring": [
603             "\u067C"
604           ],
605           "three_dots_above_downwards": [
606             "\u067D"
607           ],
608           "small_teh_above": [
609             "\u08B8"
610           ],
611           "isolated": "\uFE95",
612           "final": "\uFE96",
613           "initial": "\uFE97",
614           "medial": "\uFE98"
615         },
616         "theh": {
617           "normal": [
618             "\u062B"
619           ],
620           "isolated": "\uFE99",
621           "final": "\uFE9A",
622           "initial": "\uFE9B",
623           "medial": "\uFE9C"
624         },
625         "jeem": {
626           "normal": [
627             "\u062C"
628           ],
629           "two_dots_above": [
630             "\u08A2"
631           ],
632           "isolated": "\uFE9D",
633           "final": "\uFE9E",
634           "initial": "\uFE9F",
635           "medial": "\uFEA0"
636         },
637         "hah": {
638           "normal": [
639             "\u062D"
640           ],
641           "hamza_above": [
642             "\u0681"
643           ],
644           "two_dots_vertical_above": [
645             "\u0682"
646           ],
647           "three_dots_above": [
648             "\u0685"
649           ],
650           "two_dots_above": [
651             "\u0757"
652           ],
653           "three_dots_pointing_upwards_below": [
654             "\u0758"
655           ],
656           "small_tah_below": [
657             "\u076E"
658           ],
659           "small_tah_two_dots": [
660             "\u076F"
661           ],
662           "small_tah_above": [
663             "\u0772"
664           ],
665           "indic_four_below": [
666             "\u077C"
667           ],
668           "isolated": "\uFEA1",
669           "final": "\uFEA2",
670           "initial": "\uFEA3",
671           "medial": "\uFEA4"
672         },
673         "khah": {
674           "normal": [
675             "\u062E"
676           ],
677           "isolated": "\uFEA5",
678           "final": "\uFEA6",
679           "initial": "\uFEA7",
680           "medial": "\uFEA8"
681         },
682         "dal": {
683           "normal": [
684             "\u062F"
685           ],
686           "ring": [
687             "\u0689"
688           ],
689           "dot_below": [
690             "\u068A"
691           ],
692           "dot_below_small_tah": [
693             "\u068B"
694           ],
695           "three_dots_above_downwards": [
696             "\u068F"
697           ],
698           "four_dots_above": [
699             "\u0690"
700           ],
701           "inverted_v": [
702             "\u06EE"
703           ],
704           "two_dots_vertically_below_small_tah": [
705             "\u0759"
706           ],
707           "inverted_small_v_below": [
708             "\u075A"
709           ],
710           "three_dots_below": [
711             "\u08AE"
712           ],
713           "isolated": "\uFEA9",
714           "final": "\uFEAA"
715         },
716         "thal": {
717           "normal": [
718             "\u0630"
719           ],
720           "isolated": "\uFEAB",
721           "final": "\uFEAC"
722         },
723         "reh": {
724           "normal": [
725             "\u0631"
726           ],
727           "small_v": [
728             "\u0692"
729           ],
730           "ring": [
731             "\u0693"
732           ],
733           "dot_below": [
734             "\u0694"
735           ],
736           "small_v_below": [
737             "\u0695"
738           ],
739           "dot_below_dot_above": [
740             "\u0696"
741           ],
742           "two_dots_above": [
743             "\u0697"
744           ],
745           "four_dots_above": [
746             "\u0699"
747           ],
748           "inverted_v": [
749             "\u06EF"
750           ],
751           "stroke": [
752             "\u075B"
753           ],
754           "two_dots_vertically_above": [
755             "\u076B"
756           ],
757           "hamza_above": [
758             "\u076C"
759           ],
760           "small_tah_two_dots": [
761             "\u0771"
762           ],
763           "loop": [
764             "\u08AA"
765           ],
766           "small_noon_above": [
767             "\u08B9"
768           ],
769           "isolated": "\uFEAD",
770           "final": "\uFEAE"
771         },
772         "zain": {
773           "normal": [
774             "\u0632"
775           ],
776           "inverted_v_above": [
777             "\u08B2"
778           ],
779           "isolated": "\uFEAF",
780           "final": "\uFEB0"
781         },
782         "seen": {
783           "normal": [
784             "\u0633"
785           ],
786           "dot_below_dot_above": [
787             "\u069A"
788           ],
789           "three_dots_below": [
790             "\u069B"
791           ],
792           "three_dots_below_three_dots_above": [
793             "\u069C"
794           ],
795           "four_dots_above": [
796             "\u075C"
797           ],
798           "two_dots_vertically_above": [
799             "\u076D"
800           ],
801           "small_tah_two_dots": [
802             "\u0770"
803           ],
804           "indic_four_above": [
805             "\u077D"
806           ],
807           "inverted_v": [
808             "\u077E"
809           ],
810           "isolated": "\uFEB1",
811           "final": "\uFEB2",
812           "initial": "\uFEB3",
813           "medial": "\uFEB4"
814         },
815         "sheen": {
816           "normal": [
817             "\u0634"
818           ],
819           "dot_below": [
820             "\u06FA"
821           ],
822           "isolated": "\uFEB5",
823           "final": "\uFEB6",
824           "initial": "\uFEB7",
825           "medial": "\uFEB8"
826         },
827         "sad": {
828           "normal": [
829             "\u0635"
830           ],
831           "two_dots_below": [
832             "\u069D"
833           ],
834           "three_dots_above": [
835             "\u069E"
836           ],
837           "three_dots_below": [
838             "\u08AF"
839           ],
840           "isolated": "\uFEB9",
841           "final": "\uFEBA",
842           "initial": "\uFEBB",
843           "medial": "\uFEBC"
844         },
845         "dad": {
846           "normal": [
847             "\u0636"
848           ],
849           "dot_below": [
850             "\u06FB"
851           ],
852           "isolated": "\uFEBD",
853           "final": "\uFEBE",
854           "initial": "\uFEBF",
855           "medial": "\uFEC0"
856         },
857         "tah": {
858           "normal": [
859             "\u0637"
860           ],
861           "three_dots_above": [
862             "\u069F"
863           ],
864           "two_dots_above": [
865             "\u08A3"
866           ],
867           "isolated": "\uFEC1",
868           "final": "\uFEC2",
869           "initial": "\uFEC3",
870           "medial": "\uFEC4"
871         },
872         "zah": {
873           "normal": [
874             "\u0638"
875           ],
876           "isolated": "\uFEC5",
877           "final": "\uFEC6",
878           "initial": "\uFEC7",
879           "medial": "\uFEC8"
880         },
881         "ain": {
882           "normal": [
883             "\u0639"
884           ],
885           "three_dots_above": [
886             "\u06A0"
887           ],
888           "two_dots_above": [
889             "\u075D"
890           ],
891           "three_dots_pointing_downwards_above": [
892             "\u075E"
893           ],
894           "two_dots_vertically_above": [
895             "\u075F"
896           ],
897           "three_dots_below": [
898             "\u08B3"
899           ],
900           "isolated": "\uFEC9",
901           "final": "\uFECA",
902           "initial": "\uFECB",
903           "medial": "\uFECC"
904         },
905         "ghain": {
906           "normal": [
907             "\u063A"
908           ],
909           "dot_below": [
910             "\u06FC"
911           ],
912           "isolated": "\uFECD",
913           "final": "\uFECE",
914           "initial": "\uFECF",
915           "medial": "\uFED0"
916         },
917         "feh": {
918           "normal": [
919             "\u0641"
920           ],
921           "dotless": [
922             "\u06A1"
923           ],
924           "dot_moved_below": [
925             "\u06A2"
926           ],
927           "dot_below": [
928             "\u06A3"
929           ],
930           "three_dots_below": [
931             "\u06A5"
932           ],
933           "two_dots_below": [
934             "\u0760"
935           ],
936           "three_dots_pointing_upwards_below": [
937             "\u0761"
938           ],
939           "dot_below_three_dots_above": [
940             "\u08A4"
941           ],
942           "isolated": "\uFED1",
943           "final": "\uFED2",
944           "initial": "\uFED3",
945           "medial": "\uFED4"
946         },
947         "qaf": {
948           "normal": [
949             "\u0642"
950           ],
951           "dotless": [
952             "\u066F"
953           ],
954           "dot_above": [
955             "\u06A7"
956           ],
957           "three_dots_above": [
958             "\u06A8"
959           ],
960           "dot_below": [
961             "\u08A5"
962           ],
963           "isolated": "\uFED5",
964           "final": "\uFED6",
965           "initial": "\uFED7",
966           "medial": "\uFED8"
967         },
968         "kaf": {
969           "normal": [
970             "\u0643"
971           ],
972           "swash": [
973             "\u06AA"
974           ],
975           "ring": [
976             "\u06AB"
977           ],
978           "dot_above": [
979             "\u06AC"
980           ],
981           "three_dots_below": [
982             "\u06AE"
983           ],
984           "two_dots_above": [
985             "\u077F"
986           ],
987           "dot_below": [
988             "\u08B4"
989           ],
990           "isolated": "\uFED9",
991           "final": "\uFEDA",
992           "initial": "\uFEDB",
993           "medial": "\uFEDC"
994         },
995         "lam": {
996           "normal": [
997             "\u0644"
998           ],
999           "small_v": [
1000             "\u06B5"
1001           ],
1002           "dot_above": [
1003             "\u06B6"
1004           ],
1005           "three_dots_above": [
1006             "\u06B7"
1007           ],
1008           "three_dots_below": [
1009             "\u06B8"
1010           ],
1011           "bar": [
1012             "\u076A"
1013           ],
1014           "double_bar": [
1015             "\u08A6"
1016           ],
1017           "isolated": "\uFEDD",
1018           "final": "\uFEDE",
1019           "initial": "\uFEDF",
1020           "medial": "\uFEE0"
1021         },
1022         "meem": {
1023           "normal": [
1024             "\u0645"
1025           ],
1026           "dot_above": [
1027             "\u0765"
1028           ],
1029           "dot_below": [
1030             "\u0766"
1031           ],
1032           "three_dots_above": [
1033             "\u08A7"
1034           ],
1035           "isolated": "\uFEE1",
1036           "final": "\uFEE2",
1037           "initial": "\uFEE3",
1038           "medial": "\uFEE4"
1039         },
1040         "noon": {
1041           "normal": [
1042             "\u0646"
1043           ],
1044           "dot_below": [
1045             "\u06B9"
1046           ],
1047           "ring": [
1048             "\u06BC"
1049           ],
1050           "three_dots_above": [
1051             "\u06BD"
1052           ],
1053           "two_dots_below": [
1054             "\u0767"
1055           ],
1056           "small_tah": [
1057             "\u0768"
1058           ],
1059           "small_v": [
1060             "\u0769"
1061           ],
1062           "isolated": "\uFEE5",
1063           "final": "\uFEE6",
1064           "initial": "\uFEE7",
1065           "medial": "\uFEE8"
1066         },
1067         "heh": {
1068           "normal": [
1069             "\u0647"
1070           ],
1071           "isolated": "\uFEE9",
1072           "final": "\uFEEA",
1073           "initial": "\uFEEB",
1074           "medial": "\uFEEC"
1075         },
1076         "waw": {
1077           "normal": [
1078             "\u0648"
1079           ],
1080           "hamza_above": {
1081             "normal": [
1082               "\u0624",
1083               "\u0648\u0654"
1084             ],
1085             "isolated": "\uFE85",
1086             "final": "\uFE86"
1087           },
1088           "high_hamza": [
1089             "\u0676",
1090             "\u0648\u0674"
1091           ],
1092           "ring": [
1093             "\u06C4"
1094           ],
1095           "two_dots_above": [
1096             "\u06CA"
1097           ],
1098           "dot_above": [
1099             "\u06CF"
1100           ],
1101           "indic_two_above": [
1102             "\u0778"
1103           ],
1104           "indic_three_above": [
1105             "\u0779"
1106           ],
1107           "dot_within": [
1108             "\u08AB"
1109           ],
1110           "isolated": "\uFEED",
1111           "final": "\uFEEE"
1112         },
1113         "alef_maksura": {
1114           "normal": [
1115             "\u0649"
1116           ],
1117           "hamza_above": [
1118             "\u0626",
1119             "\u064A\u0654"
1120           ],
1121           "initial": "\uFBE8",
1122           "medial": "\uFBE9",
1123           "isolated": "\uFEEF",
1124           "final": "\uFEF0"
1125         },
1126         "yeh": {
1127           "normal": [
1128             "\u064A"
1129           ],
1130           "hamza_above": {
1131             "normal": [
1132               "\u0626",
1133               "\u0649\u0654"
1134             ],
1135             "isolated": "\uFE89",
1136             "final": "\uFE8A",
1137             "initial": "\uFE8B",
1138             "medial": "\uFE8C"
1139           },
1140           "two_dots_below_hamza_above": [
1141             "\u08A8"
1142           ],
1143           "high_hamza": [
1144             "\u0678",
1145             "\u064A\u0674"
1146           ],
1147           "tail": [
1148             "\u06CD"
1149           ],
1150           "small_v": [
1151             "\u06CE"
1152           ],
1153           "three_dots_below": [
1154             "\u06D1"
1155           ],
1156           "two_dots_below_dot_above": [
1157             "\u08A9"
1158           ],
1159           "two_dots_below_small_noon_above": [
1160             "\u08BA"
1161           ],
1162           "isolated": "\uFEF1",
1163           "final": "\uFEF2",
1164           "initial": "\uFEF3",
1165           "medial": "\uFEF4"
1166         },
1167         "tteh": {
1168           "normal": [
1169             "\u0679"
1170           ],
1171           "isolated": "\uFB66",
1172           "final": "\uFB67",
1173           "initial": "\uFB68",
1174           "medial": "\uFB69"
1175         },
1176         "tteheh": {
1177           "normal": [
1178             "\u067A"
1179           ],
1180           "isolated": "\uFB5E",
1181           "final": "\uFB5F",
1182           "initial": "\uFB60",
1183           "medial": "\uFB61"
1184         },
1185         "beeh": {
1186           "normal": [
1187             "\u067B"
1188           ],
1189           "isolated": "\uFB52",
1190           "final": "\uFB53",
1191           "initial": "\uFB54",
1192           "medial": "\uFB55"
1193         },
1194         "peh": {
1195           "normal": [
1196             "\u067E"
1197           ],
1198           "small_meem_above": [
1199             "\u08B7"
1200           ],
1201           "isolated": "\uFB56",
1202           "final": "\uFB57",
1203           "initial": "\uFB58",
1204           "medial": "\uFB59"
1205         },
1206         "teheh": {
1207           "normal": [
1208             "\u067F"
1209           ],
1210           "isolated": "\uFB62",
1211           "final": "\uFB63",
1212           "initial": "\uFB64",
1213           "medial": "\uFB65"
1214         },
1215         "beheh": {
1216           "normal": [
1217             "\u0680"
1218           ],
1219           "isolated": "\uFB5A",
1220           "final": "\uFB5B",
1221           "initial": "\uFB5C",
1222           "medial": "\uFB5D"
1223         },
1224         "nyeh": {
1225           "normal": [
1226             "\u0683"
1227           ],
1228           "isolated": "\uFB76",
1229           "final": "\uFB77",
1230           "initial": "\uFB78",
1231           "medial": "\uFB79"
1232         },
1233         "dyeh": {
1234           "normal": [
1235             "\u0684"
1236           ],
1237           "isolated": "\uFB72",
1238           "final": "\uFB73",
1239           "initial": "\uFB74",
1240           "medial": "\uFB75"
1241         },
1242         "tcheh": {
1243           "normal": [
1244             "\u0686"
1245           ],
1246           "dot_above": [
1247             "\u06BF"
1248           ],
1249           "isolated": "\uFB7A",
1250           "final": "\uFB7B",
1251           "initial": "\uFB7C",
1252           "medial": "\uFB7D"
1253         },
1254         "tcheheh": {
1255           "normal": [
1256             "\u0687"
1257           ],
1258           "isolated": "\uFB7E",
1259           "final": "\uFB7F",
1260           "initial": "\uFB80",
1261           "medial": "\uFB81"
1262         },
1263         "ddal": {
1264           "normal": [
1265             "\u0688"
1266           ],
1267           "isolated": "\uFB88",
1268           "final": "\uFB89"
1269         },
1270         "dahal": {
1271           "normal": [
1272             "\u068C"
1273           ],
1274           "isolated": "\uFB84",
1275           "final": "\uFB85"
1276         },
1277         "ddahal": {
1278           "normal": [
1279             "\u068D"
1280           ],
1281           "isolated": "\uFB82",
1282           "final": "\uFB83"
1283         },
1284         "dul": {
1285           "normal": [
1286             "\u068F",
1287             "\u068E"
1288           ],
1289           "isolated": "\uFB86",
1290           "final": "\uFB87"
1291         },
1292         "rreh": {
1293           "normal": [
1294             "\u0691"
1295           ],
1296           "isolated": "\uFB8C",
1297           "final": "\uFB8D"
1298         },
1299         "jeh": {
1300           "normal": [
1301             "\u0698"
1302           ],
1303           "isolated": "\uFB8A",
1304           "final": "\uFB8B"
1305         },
1306         "veh": {
1307           "normal": [
1308             "\u06A4"
1309           ],
1310           "isolated": "\uFB6A",
1311           "final": "\uFB6B",
1312           "initial": "\uFB6C",
1313           "medial": "\uFB6D"
1314         },
1315         "peheh": {
1316           "normal": [
1317             "\u06A6"
1318           ],
1319           "isolated": "\uFB6E",
1320           "final": "\uFB6F",
1321           "initial": "\uFB70",
1322           "medial": "\uFB71"
1323         },
1324         "keheh": {
1325           "normal": [
1326             "\u06A9"
1327           ],
1328           "dot_above": [
1329             "\u0762"
1330           ],
1331           "three_dots_above": [
1332             "\u0763"
1333           ],
1334           "three_dots_pointing_upwards_below": [
1335             "\u0764"
1336           ],
1337           "isolated": "\uFB8E",
1338           "final": "\uFB8F",
1339           "initial": "\uFB90",
1340           "medial": "\uFB91"
1341         },
1342         "ng": {
1343           "normal": [
1344             "\u06AD"
1345           ],
1346           "isolated": "\uFBD3",
1347           "final": "\uFBD4",
1348           "initial": "\uFBD5",
1349           "medial": "\uFBD6"
1350         },
1351         "gaf": {
1352           "normal": [
1353             "\u06AF"
1354           ],
1355           "ring": [
1356             "\u06B0"
1357           ],
1358           "two_dots_below": [
1359             "\u06B2"
1360           ],
1361           "three_dots_above": [
1362             "\u06B4"
1363           ],
1364           "inverted_stroke": [
1365             "\u08B0"
1366           ],
1367           "isolated": "\uFB92",
1368           "final": "\uFB93",
1369           "initial": "\uFB94",
1370           "medial": "\uFB95"
1371         },
1372         "ngoeh": {
1373           "normal": [
1374             "\u06B1"
1375           ],
1376           "isolated": "\uFB9A",
1377           "final": "\uFB9B",
1378           "initial": "\uFB9C",
1379           "medial": "\uFB9D"
1380         },
1381         "gueh": {
1382           "normal": [
1383             "\u06B3"
1384           ],
1385           "isolated": "\uFB96",
1386           "final": "\uFB97",
1387           "initial": "\uFB98",
1388           "medial": "\uFB99"
1389         },
1390         "noon ghunna": {
1391           "normal": [
1392             "\u06BA"
1393           ],
1394           "isolated": "\uFB9E",
1395           "final": "\uFB9F"
1396         },
1397         "rnoon": {
1398           "normal": [
1399             "\u06BB"
1400           ],
1401           "isolated": "\uFBA0",
1402           "final": "\uFBA1",
1403           "initial": "\uFBA2",
1404           "medial": "\uFBA3"
1405         },
1406         "heh doachashmee": {
1407           "normal": [
1408             "\u06BE"
1409           ],
1410           "isolated": "\uFBAA",
1411           "final": "\uFBAB",
1412           "initial": "\uFBAC",
1413           "medial": "\uFBAD"
1414         },
1415         "heh goal": {
1416           "normal": [
1417             "\u06C1"
1418           ],
1419           "hamza_above": [
1420             "\u06C1\u0654",
1421             "\u06C2"
1422           ],
1423           "isolated": "\uFBA6",
1424           "final": "\uFBA7",
1425           "initial": "\uFBA8",
1426           "medial": "\uFBA9"
1427         },
1428         "teh marbuta goal": {
1429           "normal": [
1430             "\u06C3"
1431           ]
1432         },
1433         "kirghiz oe": {
1434           "normal": [
1435             "\u06C5"
1436           ],
1437           "isolated": "\uFBE0",
1438           "final": "\uFBE1"
1439         },
1440         "oe": {
1441           "normal": [
1442             "\u06C6"
1443           ],
1444           "isolated": "\uFBD9",
1445           "final": "\uFBDA"
1446         },
1447         "u": {
1448           "normal": [
1449             "\u06C7"
1450           ],
1451           "hamza_above": {
1452             "normal": [
1453               "\u0677",
1454               "\u06C7\u0674"
1455             ],
1456             "isolated": "\uFBDD"
1457           },
1458           "isolated": "\uFBD7",
1459           "final": "\uFBD8"
1460         },
1461         "yu": {
1462           "normal": [
1463             "\u06C8"
1464           ],
1465           "isolated": "\uFBDB",
1466           "final": "\uFBDC"
1467         },
1468         "kirghiz yu": {
1469           "normal": [
1470             "\u06C9"
1471           ],
1472           "isolated": "\uFBE2",
1473           "final": "\uFBE3"
1474         },
1475         "ve": {
1476           "normal": [
1477             "\u06CB"
1478           ],
1479           "isolated": "\uFBDE",
1480           "final": "\uFBDF"
1481         },
1482         "farsi yeh": {
1483           "normal": [
1484             "\u06CC"
1485           ],
1486           "indic_two_above": [
1487             "\u0775"
1488           ],
1489           "indic_three_above": [
1490             "\u0776"
1491           ],
1492           "indic_four_above": [
1493             "\u0777"
1494           ],
1495           "isolated": "\uFBFC",
1496           "final": "\uFBFD",
1497           "initial": "\uFBFE",
1498           "medial": "\uFBFF"
1499         },
1500         "e": {
1501           "normal": [
1502             "\u06D0"
1503           ],
1504           "isolated": "\uFBE4",
1505           "final": "\uFBE5",
1506           "initial": "\uFBE6",
1507           "medial": "\uFBE7"
1508         },
1509         "yeh barree": {
1510           "normal": [
1511             "\u06D2"
1512           ],
1513           "hamza_above": {
1514             "normal": [
1515               "\u06D2\u0654",
1516               "\u06D3"
1517             ],
1518             "isolated": "\uFBB0",
1519             "final": "\uFBB1"
1520           },
1521           "indic_two_above": [
1522             "\u077A"
1523           ],
1524           "indic_three_above": [
1525             "\u077B"
1526           ],
1527           "isolated": "\uFBAE",
1528           "final": "\uFBAF"
1529         },
1530         "ae": {
1531           "normal": [
1532             "\u06D5"
1533           ],
1534           "isolated": "\u06D5",
1535           "final": "\uFEEA",
1536           "yeh_above": {
1537             "normal": [
1538               "\u06C0",
1539               "\u06D5\u0654"
1540             ],
1541             "isolated": "\uFBA4",
1542             "final": "\uFBA5"
1543           }
1544         },
1545         "rohingya yeh": {
1546           "normal": [
1547             "\u08AC"
1548           ]
1549         },
1550         "low alef": {
1551           "normal": [
1552             "\u08AD"
1553           ]
1554         },
1555         "straight waw": {
1556           "normal": [
1557             "\u08B1"
1558           ]
1559         },
1560         "african feh": {
1561           "normal": [
1562             "\u08BB"
1563           ]
1564         },
1565         "african qaf": {
1566           "normal": [
1567             "\u08BC"
1568           ]
1569         },
1570         "african noon": {
1571           "normal": [
1572             "\u08BD"
1573           ]
1574         }
1575       };
1576       exports2.default = arabicReference;
1577     }
1578   });
1579
1580   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1581   var require_unicode_ligatures = __commonJS({
1582     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1583       "use strict";
1584       Object.defineProperty(exports2, "__esModule", { value: true });
1585       var ligatureReference = {
1586         "\u0626\u0627": {
1587           "isolated": "\uFBEA",
1588           "final": "\uFBEB"
1589         },
1590         "\u0626\u06D5": {
1591           "isolated": "\uFBEC",
1592           "final": "\uFBED"
1593         },
1594         "\u0626\u0648": {
1595           "isolated": "\uFBEE",
1596           "final": "\uFBEF"
1597         },
1598         "\u0626\u06C7": {
1599           "isolated": "\uFBF0",
1600           "final": "\uFBF1"
1601         },
1602         "\u0626\u06C6": {
1603           "isolated": "\uFBF2",
1604           "final": "\uFBF3"
1605         },
1606         "\u0626\u06C8": {
1607           "isolated": "\uFBF4",
1608           "final": "\uFBF5"
1609         },
1610         "\u0626\u06D0": {
1611           "isolated": "\uFBF6",
1612           "final": "\uFBF7",
1613           "initial": "\uFBF8"
1614         },
1615         "\u0626\u0649": {
1616           "uighur_kirghiz": {
1617             "isolated": "\uFBF9",
1618             "final": "\uFBFA",
1619             "initial": "\uFBFB"
1620           },
1621           "isolated": "\uFC03",
1622           "final": "\uFC68"
1623         },
1624         "\u0626\u062C": {
1625           "isolated": "\uFC00",
1626           "initial": "\uFC97"
1627         },
1628         "\u0626\u062D": {
1629           "isolated": "\uFC01",
1630           "initial": "\uFC98"
1631         },
1632         "\u0626\u0645": {
1633           "isolated": "\uFC02",
1634           "final": "\uFC66",
1635           "initial": "\uFC9A",
1636           "medial": "\uFCDF"
1637         },
1638         "\u0626\u064A": {
1639           "isolated": "\uFC04",
1640           "final": "\uFC69"
1641         },
1642         "\u0628\u062C": {
1643           "isolated": "\uFC05",
1644           "initial": "\uFC9C"
1645         },
1646         "\u0628\u062D": {
1647           "isolated": "\uFC06",
1648           "initial": "\uFC9D"
1649         },
1650         "\u0628\u062E": {
1651           "isolated": "\uFC07",
1652           "initial": "\uFC9E"
1653         },
1654         "\u0628\u0645": {
1655           "isolated": "\uFC08",
1656           "final": "\uFC6C",
1657           "initial": "\uFC9F",
1658           "medial": "\uFCE1"
1659         },
1660         "\u0628\u0649": {
1661           "isolated": "\uFC09",
1662           "final": "\uFC6E"
1663         },
1664         "\u0628\u064A": {
1665           "isolated": "\uFC0A",
1666           "final": "\uFC6F"
1667         },
1668         "\u062A\u062C": {
1669           "isolated": "\uFC0B",
1670           "initial": "\uFCA1"
1671         },
1672         "\u062A\u062D": {
1673           "isolated": "\uFC0C",
1674           "initial": "\uFCA2"
1675         },
1676         "\u062A\u062E": {
1677           "isolated": "\uFC0D",
1678           "initial": "\uFCA3"
1679         },
1680         "\u062A\u0645": {
1681           "isolated": "\uFC0E",
1682           "final": "\uFC72",
1683           "initial": "\uFCA4",
1684           "medial": "\uFCE3"
1685         },
1686         "\u062A\u0649": {
1687           "isolated": "\uFC0F",
1688           "final": "\uFC74"
1689         },
1690         "\u062A\u064A": {
1691           "isolated": "\uFC10",
1692           "final": "\uFC75"
1693         },
1694         "\u062B\u062C": {
1695           "isolated": "\uFC11"
1696         },
1697         "\u062B\u0645": {
1698           "isolated": "\uFC12",
1699           "final": "\uFC78",
1700           "initial": "\uFCA6",
1701           "medial": "\uFCE5"
1702         },
1703         "\u062B\u0649": {
1704           "isolated": "\uFC13",
1705           "final": "\uFC7A"
1706         },
1707         "\u062B\u0648": {
1708           "isolated": "\uFC14"
1709         },
1710         "\u062C\u062D": {
1711           "isolated": "\uFC15",
1712           "initial": "\uFCA7"
1713         },
1714         "\u062C\u0645": {
1715           "isolated": "\uFC16",
1716           "initial": "\uFCA8"
1717         },
1718         "\u062D\u062C": {
1719           "isolated": "\uFC17",
1720           "initial": "\uFCA9"
1721         },
1722         "\u062D\u0645": {
1723           "isolated": "\uFC18",
1724           "initial": "\uFCAA"
1725         },
1726         "\u062E\u062C": {
1727           "isolated": "\uFC19",
1728           "initial": "\uFCAB"
1729         },
1730         "\u062E\u062D": {
1731           "isolated": "\uFC1A"
1732         },
1733         "\u062E\u0645": {
1734           "isolated": "\uFC1B",
1735           "initial": "\uFCAC"
1736         },
1737         "\u0633\u062C": {
1738           "isolated": "\uFC1C",
1739           "initial": "\uFCAD",
1740           "medial": "\uFD34"
1741         },
1742         "\u0633\u062D": {
1743           "isolated": "\uFC1D",
1744           "initial": "\uFCAE",
1745           "medial": "\uFD35"
1746         },
1747         "\u0633\u062E": {
1748           "isolated": "\uFC1E",
1749           "initial": "\uFCAF",
1750           "medial": "\uFD36"
1751         },
1752         "\u0633\u0645": {
1753           "isolated": "\uFC1F",
1754           "initial": "\uFCB0",
1755           "medial": "\uFCE7"
1756         },
1757         "\u0635\u062D": {
1758           "isolated": "\uFC20",
1759           "initial": "\uFCB1"
1760         },
1761         "\u0635\u0645": {
1762           "isolated": "\uFC21",
1763           "initial": "\uFCB3"
1764         },
1765         "\u0636\u062C": {
1766           "isolated": "\uFC22",
1767           "initial": "\uFCB4"
1768         },
1769         "\u0636\u062D": {
1770           "isolated": "\uFC23",
1771           "initial": "\uFCB5"
1772         },
1773         "\u0636\u062E": {
1774           "isolated": "\uFC24",
1775           "initial": "\uFCB6"
1776         },
1777         "\u0636\u0645": {
1778           "isolated": "\uFC25",
1779           "initial": "\uFCB7"
1780         },
1781         "\u0637\u062D": {
1782           "isolated": "\uFC26",
1783           "initial": "\uFCB8"
1784         },
1785         "\u0637\u0645": {
1786           "isolated": "\uFC27",
1787           "initial": "\uFD33",
1788           "medial": "\uFD3A"
1789         },
1790         "\u0638\u0645": {
1791           "isolated": "\uFC28",
1792           "initial": "\uFCB9",
1793           "medial": "\uFD3B"
1794         },
1795         "\u0639\u062C": {
1796           "isolated": "\uFC29",
1797           "initial": "\uFCBA"
1798         },
1799         "\u0639\u0645": {
1800           "isolated": "\uFC2A",
1801           "initial": "\uFCBB"
1802         },
1803         "\u063A\u062C": {
1804           "isolated": "\uFC2B",
1805           "initial": "\uFCBC"
1806         },
1807         "\u063A\u0645": {
1808           "isolated": "\uFC2C",
1809           "initial": "\uFCBD"
1810         },
1811         "\u0641\u062C": {
1812           "isolated": "\uFC2D",
1813           "initial": "\uFCBE"
1814         },
1815         "\u0641\u062D": {
1816           "isolated": "\uFC2E",
1817           "initial": "\uFCBF"
1818         },
1819         "\u0641\u062E": {
1820           "isolated": "\uFC2F",
1821           "initial": "\uFCC0"
1822         },
1823         "\u0641\u0645": {
1824           "isolated": "\uFC30",
1825           "initial": "\uFCC1"
1826         },
1827         "\u0641\u0649": {
1828           "isolated": "\uFC31",
1829           "final": "\uFC7C"
1830         },
1831         "\u0641\u064A": {
1832           "isolated": "\uFC32",
1833           "final": "\uFC7D"
1834         },
1835         "\u0642\u062D": {
1836           "isolated": "\uFC33",
1837           "initial": "\uFCC2"
1838         },
1839         "\u0642\u0645": {
1840           "isolated": "\uFC34",
1841           "initial": "\uFCC3"
1842         },
1843         "\u0642\u0649": {
1844           "isolated": "\uFC35",
1845           "final": "\uFC7E"
1846         },
1847         "\u0642\u064A": {
1848           "isolated": "\uFC36",
1849           "final": "\uFC7F"
1850         },
1851         "\u0643\u0627": {
1852           "isolated": "\uFC37",
1853           "final": "\uFC80"
1854         },
1855         "\u0643\u062C": {
1856           "isolated": "\uFC38",
1857           "initial": "\uFCC4"
1858         },
1859         "\u0643\u062D": {
1860           "isolated": "\uFC39",
1861           "initial": "\uFCC5"
1862         },
1863         "\u0643\u062E": {
1864           "isolated": "\uFC3A",
1865           "initial": "\uFCC6"
1866         },
1867         "\u0643\u0644": {
1868           "isolated": "\uFC3B",
1869           "final": "\uFC81",
1870           "initial": "\uFCC7",
1871           "medial": "\uFCEB"
1872         },
1873         "\u0643\u0645": {
1874           "isolated": "\uFC3C",
1875           "final": "\uFC82",
1876           "initial": "\uFCC8",
1877           "medial": "\uFCEC"
1878         },
1879         "\u0643\u0649": {
1880           "isolated": "\uFC3D",
1881           "final": "\uFC83"
1882         },
1883         "\u0643\u064A": {
1884           "isolated": "\uFC3E",
1885           "final": "\uFC84"
1886         },
1887         "\u0644\u062C": {
1888           "isolated": "\uFC3F",
1889           "initial": "\uFCC9"
1890         },
1891         "\u0644\u062D": {
1892           "isolated": "\uFC40",
1893           "initial": "\uFCCA"
1894         },
1895         "\u0644\u062E": {
1896           "isolated": "\uFC41",
1897           "initial": "\uFCCB"
1898         },
1899         "\u0644\u0645": {
1900           "isolated": "\uFC42",
1901           "final": "\uFC85",
1902           "initial": "\uFCCC",
1903           "medial": "\uFCED"
1904         },
1905         "\u0644\u0649": {
1906           "isolated": "\uFC43",
1907           "final": "\uFC86"
1908         },
1909         "\u0644\u064A": {
1910           "isolated": "\uFC44",
1911           "final": "\uFC87"
1912         },
1913         "\u0645\u062C": {
1914           "isolated": "\uFC45",
1915           "initial": "\uFCCE"
1916         },
1917         "\u0645\u062D": {
1918           "isolated": "\uFC46",
1919           "initial": "\uFCCF"
1920         },
1921         "\u0645\u062E": {
1922           "isolated": "\uFC47",
1923           "initial": "\uFCD0"
1924         },
1925         "\u0645\u0645": {
1926           "isolated": "\uFC48",
1927           "final": "\uFC89",
1928           "initial": "\uFCD1"
1929         },
1930         "\u0645\u0649": {
1931           "isolated": "\uFC49"
1932         },
1933         "\u0645\u064A": {
1934           "isolated": "\uFC4A"
1935         },
1936         "\u0646\u062C": {
1937           "isolated": "\uFC4B",
1938           "initial": "\uFCD2"
1939         },
1940         "\u0646\u062D": {
1941           "isolated": "\uFC4C",
1942           "initial": "\uFCD3"
1943         },
1944         "\u0646\u062E": {
1945           "isolated": "\uFC4D",
1946           "initial": "\uFCD4"
1947         },
1948         "\u0646\u0645": {
1949           "isolated": "\uFC4E",
1950           "final": "\uFC8C",
1951           "initial": "\uFCD5",
1952           "medial": "\uFCEE"
1953         },
1954         "\u0646\u0649": {
1955           "isolated": "\uFC4F",
1956           "final": "\uFC8E"
1957         },
1958         "\u0646\u064A": {
1959           "isolated": "\uFC50",
1960           "final": "\uFC8F"
1961         },
1962         "\u0647\u062C": {
1963           "isolated": "\uFC51",
1964           "initial": "\uFCD7"
1965         },
1966         "\u0647\u0645": {
1967           "isolated": "\uFC52",
1968           "initial": "\uFCD8"
1969         },
1970         "\u0647\u0649": {
1971           "isolated": "\uFC53"
1972         },
1973         "\u0647\u064A": {
1974           "isolated": "\uFC54"
1975         },
1976         "\u064A\u062C": {
1977           "isolated": "\uFC55",
1978           "initial": "\uFCDA"
1979         },
1980         "\u064A\u062D": {
1981           "isolated": "\uFC56",
1982           "initial": "\uFCDB"
1983         },
1984         "\u064A\u062E": {
1985           "isolated": "\uFC57",
1986           "initial": "\uFCDC"
1987         },
1988         "\u064A\u0645": {
1989           "isolated": "\uFC58",
1990           "final": "\uFC93",
1991           "initial": "\uFCDD",
1992           "medial": "\uFCF0"
1993         },
1994         "\u064A\u0649": {
1995           "isolated": "\uFC59",
1996           "final": "\uFC95"
1997         },
1998         "\u064A\u064A": {
1999           "isolated": "\uFC5A",
2000           "final": "\uFC96"
2001         },
2002         "\u0630\u0670": {
2003           "isolated": "\uFC5B"
2004         },
2005         "\u0631\u0670": {
2006           "isolated": "\uFC5C"
2007         },
2008         "\u0649\u0670": {
2009           "isolated": "\uFC5D",
2010           "final": "\uFC90"
2011         },
2012         "\u064C\u0651": {
2013           "isolated": "\uFC5E"
2014         },
2015         "\u064D\u0651": {
2016           "isolated": "\uFC5F"
2017         },
2018         "\u064E\u0651": {
2019           "isolated": "\uFC60"
2020         },
2021         "\u064F\u0651": {
2022           "isolated": "\uFC61"
2023         },
2024         "\u0650\u0651": {
2025           "isolated": "\uFC62"
2026         },
2027         "\u0651\u0670": {
2028           "isolated": "\uFC63"
2029         },
2030         "\u0626\u0631": {
2031           "final": "\uFC64"
2032         },
2033         "\u0626\u0632": {
2034           "final": "\uFC65"
2035         },
2036         "\u0626\u0646": {
2037           "final": "\uFC67"
2038         },
2039         "\u0628\u0631": {
2040           "final": "\uFC6A"
2041         },
2042         "\u0628\u0632": {
2043           "final": "\uFC6B"
2044         },
2045         "\u0628\u0646": {
2046           "final": "\uFC6D"
2047         },
2048         "\u062A\u0631": {
2049           "final": "\uFC70"
2050         },
2051         "\u062A\u0632": {
2052           "final": "\uFC71"
2053         },
2054         "\u062A\u0646": {
2055           "final": "\uFC73"
2056         },
2057         "\u062B\u0631": {
2058           "final": "\uFC76"
2059         },
2060         "\u062B\u0632": {
2061           "final": "\uFC77"
2062         },
2063         "\u062B\u0646": {
2064           "final": "\uFC79"
2065         },
2066         "\u062B\u064A": {
2067           "final": "\uFC7B"
2068         },
2069         "\u0645\u0627": {
2070           "final": "\uFC88"
2071         },
2072         "\u0646\u0631": {
2073           "final": "\uFC8A"
2074         },
2075         "\u0646\u0632": {
2076           "final": "\uFC8B"
2077         },
2078         "\u0646\u0646": {
2079           "final": "\uFC8D"
2080         },
2081         "\u064A\u0631": {
2082           "final": "\uFC91"
2083         },
2084         "\u064A\u0632": {
2085           "final": "\uFC92"
2086         },
2087         "\u064A\u0646": {
2088           "final": "\uFC94"
2089         },
2090         "\u0626\u062E": {
2091           "initial": "\uFC99"
2092         },
2093         "\u0626\u0647": {
2094           "initial": "\uFC9B",
2095           "medial": "\uFCE0"
2096         },
2097         "\u0628\u0647": {
2098           "initial": "\uFCA0",
2099           "medial": "\uFCE2"
2100         },
2101         "\u062A\u0647": {
2102           "initial": "\uFCA5",
2103           "medial": "\uFCE4"
2104         },
2105         "\u0635\u062E": {
2106           "initial": "\uFCB2"
2107         },
2108         "\u0644\u0647": {
2109           "initial": "\uFCCD"
2110         },
2111         "\u0646\u0647": {
2112           "initial": "\uFCD6",
2113           "medial": "\uFCEF"
2114         },
2115         "\u0647\u0670": {
2116           "initial": "\uFCD9"
2117         },
2118         "\u064A\u0647": {
2119           "initial": "\uFCDE",
2120           "medial": "\uFCF1"
2121         },
2122         "\u062B\u0647": {
2123           "medial": "\uFCE6"
2124         },
2125         "\u0633\u0647": {
2126           "medial": "\uFCE8",
2127           "initial": "\uFD31"
2128         },
2129         "\u0634\u0645": {
2130           "medial": "\uFCE9",
2131           "isolated": "\uFD0C",
2132           "final": "\uFD28",
2133           "initial": "\uFD30"
2134         },
2135         "\u0634\u0647": {
2136           "medial": "\uFCEA",
2137           "initial": "\uFD32"
2138         },
2139         "\u0640\u064E\u0651": {
2140           "medial": "\uFCF2"
2141         },
2142         "\u0640\u064F\u0651": {
2143           "medial": "\uFCF3"
2144         },
2145         "\u0640\u0650\u0651": {
2146           "medial": "\uFCF4"
2147         },
2148         "\u0637\u0649": {
2149           "isolated": "\uFCF5",
2150           "final": "\uFD11"
2151         },
2152         "\u0637\u064A": {
2153           "isolated": "\uFCF6",
2154           "final": "\uFD12"
2155         },
2156         "\u0639\u0649": {
2157           "isolated": "\uFCF7",
2158           "final": "\uFD13"
2159         },
2160         "\u0639\u064A": {
2161           "isolated": "\uFCF8",
2162           "final": "\uFD14"
2163         },
2164         "\u063A\u0649": {
2165           "isolated": "\uFCF9",
2166           "final": "\uFD15"
2167         },
2168         "\u063A\u064A": {
2169           "isolated": "\uFCFA",
2170           "final": "\uFD16"
2171         },
2172         "\u0633\u0649": {
2173           "isolated": "\uFCFB"
2174         },
2175         "\u0633\u064A": {
2176           "isolated": "\uFCFC",
2177           "final": "\uFD18"
2178         },
2179         "\u0634\u0649": {
2180           "isolated": "\uFCFD",
2181           "final": "\uFD19"
2182         },
2183         "\u0634\u064A": {
2184           "isolated": "\uFCFE",
2185           "final": "\uFD1A"
2186         },
2187         "\u062D\u0649": {
2188           "isolated": "\uFCFF",
2189           "final": "\uFD1B"
2190         },
2191         "\u062D\u064A": {
2192           "isolated": "\uFD00",
2193           "final": "\uFD1C"
2194         },
2195         "\u062C\u0649": {
2196           "isolated": "\uFD01",
2197           "final": "\uFD1D"
2198         },
2199         "\u062C\u064A": {
2200           "isolated": "\uFD02",
2201           "final": "\uFD1E"
2202         },
2203         "\u062E\u0649": {
2204           "isolated": "\uFD03",
2205           "final": "\uFD1F"
2206         },
2207         "\u062E\u064A": {
2208           "isolated": "\uFD04",
2209           "final": "\uFD20"
2210         },
2211         "\u0635\u0649": {
2212           "isolated": "\uFD05",
2213           "final": "\uFD21"
2214         },
2215         "\u0635\u064A": {
2216           "isolated": "\uFD06",
2217           "final": "\uFD22"
2218         },
2219         "\u0636\u0649": {
2220           "isolated": "\uFD07",
2221           "final": "\uFD23"
2222         },
2223         "\u0636\u064A": {
2224           "isolated": "\uFD08",
2225           "final": "\uFD24"
2226         },
2227         "\u0634\u062C": {
2228           "isolated": "\uFD09",
2229           "final": "\uFD25",
2230           "initial": "\uFD2D",
2231           "medial": "\uFD37"
2232         },
2233         "\u0634\u062D": {
2234           "isolated": "\uFD0A",
2235           "final": "\uFD26",
2236           "initial": "\uFD2E",
2237           "medial": "\uFD38"
2238         },
2239         "\u0634\u062E": {
2240           "isolated": "\uFD0B",
2241           "final": "\uFD27",
2242           "initial": "\uFD2F",
2243           "medial": "\uFD39"
2244         },
2245         "\u0634\u0631": {
2246           "isolated": "\uFD0D",
2247           "final": "\uFD29"
2248         },
2249         "\u0633\u0631": {
2250           "isolated": "\uFD0E",
2251           "final": "\uFD2A"
2252         },
2253         "\u0635\u0631": {
2254           "isolated": "\uFD0F",
2255           "final": "\uFD2B"
2256         },
2257         "\u0636\u0631": {
2258           "isolated": "\uFD10",
2259           "final": "\uFD2C"
2260         },
2261         "\u0633\u0639": {
2262           "final": "\uFD17"
2263         },
2264         "\u062A\u062C\u0645": {
2265           "initial": "\uFD50"
2266         },
2267         "\u062A\u062D\u062C": {
2268           "final": "\uFD51",
2269           "initial": "\uFD52"
2270         },
2271         "\u062A\u062D\u0645": {
2272           "initial": "\uFD53"
2273         },
2274         "\u062A\u062E\u0645": {
2275           "initial": "\uFD54"
2276         },
2277         "\u062A\u0645\u062C": {
2278           "initial": "\uFD55"
2279         },
2280         "\u062A\u0645\u062D": {
2281           "initial": "\uFD56"
2282         },
2283         "\u062A\u0645\u062E": {
2284           "initial": "\uFD57"
2285         },
2286         "\u062C\u0645\u062D": {
2287           "final": "\uFD58",
2288           "initial": "\uFD59"
2289         },
2290         "\u062D\u0645\u064A": {
2291           "final": "\uFD5A"
2292         },
2293         "\u062D\u0645\u0649": {
2294           "final": "\uFD5B"
2295         },
2296         "\u0633\u062D\u062C": {
2297           "initial": "\uFD5C"
2298         },
2299         "\u0633\u062C\u062D": {
2300           "initial": "\uFD5D"
2301         },
2302         "\u0633\u062C\u0649": {
2303           "final": "\uFD5E"
2304         },
2305         "\u0633\u0645\u062D": {
2306           "final": "\uFD5F",
2307           "initial": "\uFD60"
2308         },
2309         "\u0633\u0645\u062C": {
2310           "initial": "\uFD61"
2311         },
2312         "\u0633\u0645\u0645": {
2313           "final": "\uFD62",
2314           "initial": "\uFD63"
2315         },
2316         "\u0635\u062D\u062D": {
2317           "final": "\uFD64",
2318           "initial": "\uFD65"
2319         },
2320         "\u0635\u0645\u0645": {
2321           "final": "\uFD66",
2322           "initial": "\uFDC5"
2323         },
2324         "\u0634\u062D\u0645": {
2325           "final": "\uFD67",
2326           "initial": "\uFD68"
2327         },
2328         "\u0634\u062C\u064A": {
2329           "final": "\uFD69"
2330         },
2331         "\u0634\u0645\u062E": {
2332           "final": "\uFD6A",
2333           "initial": "\uFD6B"
2334         },
2335         "\u0634\u0645\u0645": {
2336           "final": "\uFD6C",
2337           "initial": "\uFD6D"
2338         },
2339         "\u0636\u062D\u0649": {
2340           "final": "\uFD6E"
2341         },
2342         "\u0636\u062E\u0645": {
2343           "final": "\uFD6F",
2344           "initial": "\uFD70"
2345         },
2346         "\u0636\u0645\u062D": {
2347           "final": "\uFD71"
2348         },
2349         "\u0637\u0645\u062D": {
2350           "initial": "\uFD72"
2351         },
2352         "\u0637\u0645\u0645": {
2353           "initial": "\uFD73"
2354         },
2355         "\u0637\u0645\u064A": {
2356           "final": "\uFD74"
2357         },
2358         "\u0639\u062C\u0645": {
2359           "final": "\uFD75",
2360           "initial": "\uFDC4"
2361         },
2362         "\u0639\u0645\u0645": {
2363           "final": "\uFD76",
2364           "initial": "\uFD77"
2365         },
2366         "\u0639\u0645\u0649": {
2367           "final": "\uFD78"
2368         },
2369         "\u063A\u0645\u0645": {
2370           "final": "\uFD79"
2371         },
2372         "\u063A\u0645\u064A": {
2373           "final": "\uFD7A"
2374         },
2375         "\u063A\u0645\u0649": {
2376           "final": "\uFD7B"
2377         },
2378         "\u0641\u062E\u0645": {
2379           "final": "\uFD7C",
2380           "initial": "\uFD7D"
2381         },
2382         "\u0642\u0645\u062D": {
2383           "final": "\uFD7E",
2384           "initial": "\uFDB4"
2385         },
2386         "\u0642\u0645\u0645": {
2387           "final": "\uFD7F"
2388         },
2389         "\u0644\u062D\u0645": {
2390           "final": "\uFD80",
2391           "initial": "\uFDB5"
2392         },
2393         "\u0644\u062D\u064A": {
2394           "final": "\uFD81"
2395         },
2396         "\u0644\u062D\u0649": {
2397           "final": "\uFD82"
2398         },
2399         "\u0644\u062C\u062C": {
2400           "initial": "\uFD83",
2401           "final": "\uFD84"
2402         },
2403         "\u0644\u062E\u0645": {
2404           "final": "\uFD85",
2405           "initial": "\uFD86"
2406         },
2407         "\u0644\u0645\u062D": {
2408           "final": "\uFD87",
2409           "initial": "\uFD88"
2410         },
2411         "\u0645\u062D\u062C": {
2412           "initial": "\uFD89"
2413         },
2414         "\u0645\u062D\u0645": {
2415           "initial": "\uFD8A"
2416         },
2417         "\u0645\u062D\u064A": {
2418           "final": "\uFD8B"
2419         },
2420         "\u0645\u062C\u062D": {
2421           "initial": "\uFD8C"
2422         },
2423         "\u0645\u062C\u0645": {
2424           "initial": "\uFD8D"
2425         },
2426         "\u0645\u062E\u062C": {
2427           "initial": "\uFD8E"
2428         },
2429         "\u0645\u062E\u0645": {
2430           "initial": "\uFD8F"
2431         },
2432         "\u0645\u062C\u062E": {
2433           "initial": "\uFD92"
2434         },
2435         "\u0647\u0645\u062C": {
2436           "initial": "\uFD93"
2437         },
2438         "\u0647\u0645\u0645": {
2439           "initial": "\uFD94"
2440         },
2441         "\u0646\u062D\u0645": {
2442           "initial": "\uFD95"
2443         },
2444         "\u0646\u062D\u0649": {
2445           "final": "\uFD96"
2446         },
2447         "\u0646\u062C\u0645": {
2448           "final": "\uFD97",
2449           "initial": "\uFD98"
2450         },
2451         "\u0646\u062C\u0649": {
2452           "final": "\uFD99"
2453         },
2454         "\u0646\u0645\u064A": {
2455           "final": "\uFD9A"
2456         },
2457         "\u0646\u0645\u0649": {
2458           "final": "\uFD9B"
2459         },
2460         "\u064A\u0645\u0645": {
2461           "final": "\uFD9C",
2462           "initial": "\uFD9D"
2463         },
2464         "\u0628\u062E\u064A": {
2465           "final": "\uFD9E"
2466         },
2467         "\u062A\u062C\u064A": {
2468           "final": "\uFD9F"
2469         },
2470         "\u062A\u062C\u0649": {
2471           "final": "\uFDA0"
2472         },
2473         "\u062A\u062E\u064A": {
2474           "final": "\uFDA1"
2475         },
2476         "\u062A\u062E\u0649": {
2477           "final": "\uFDA2"
2478         },
2479         "\u062A\u0645\u064A": {
2480           "final": "\uFDA3"
2481         },
2482         "\u062A\u0645\u0649": {
2483           "final": "\uFDA4"
2484         },
2485         "\u062C\u0645\u064A": {
2486           "final": "\uFDA5"
2487         },
2488         "\u062C\u062D\u0649": {
2489           "final": "\uFDA6"
2490         },
2491         "\u062C\u0645\u0649": {
2492           "final": "\uFDA7"
2493         },
2494         "\u0633\u062E\u0649": {
2495           "final": "\uFDA8"
2496         },
2497         "\u0635\u062D\u064A": {
2498           "final": "\uFDA9"
2499         },
2500         "\u0634\u062D\u064A": {
2501           "final": "\uFDAA"
2502         },
2503         "\u0636\u062D\u064A": {
2504           "final": "\uFDAB"
2505         },
2506         "\u0644\u062C\u064A": {
2507           "final": "\uFDAC"
2508         },
2509         "\u0644\u0645\u064A": {
2510           "final": "\uFDAD"
2511         },
2512         "\u064A\u062D\u064A": {
2513           "final": "\uFDAE"
2514         },
2515         "\u064A\u062C\u064A": {
2516           "final": "\uFDAF"
2517         },
2518         "\u064A\u0645\u064A": {
2519           "final": "\uFDB0"
2520         },
2521         "\u0645\u0645\u064A": {
2522           "final": "\uFDB1"
2523         },
2524         "\u0642\u0645\u064A": {
2525           "final": "\uFDB2"
2526         },
2527         "\u0646\u062D\u064A": {
2528           "final": "\uFDB3"
2529         },
2530         "\u0639\u0645\u064A": {
2531           "final": "\uFDB6"
2532         },
2533         "\u0643\u0645\u064A": {
2534           "final": "\uFDB7"
2535         },
2536         "\u0646\u062C\u062D": {
2537           "initial": "\uFDB8",
2538           "final": "\uFDBD"
2539         },
2540         "\u0645\u062E\u064A": {
2541           "final": "\uFDB9"
2542         },
2543         "\u0644\u062C\u0645": {
2544           "initial": "\uFDBA",
2545           "final": "\uFDBC"
2546         },
2547         "\u0643\u0645\u0645": {
2548           "final": "\uFDBB",
2549           "initial": "\uFDC3"
2550         },
2551         "\u062C\u062D\u064A": {
2552           "final": "\uFDBE"
2553         },
2554         "\u062D\u062C\u064A": {
2555           "final": "\uFDBF"
2556         },
2557         "\u0645\u062C\u064A": {
2558           "final": "\uFDC0"
2559         },
2560         "\u0641\u0645\u064A": {
2561           "final": "\uFDC1"
2562         },
2563         "\u0628\u062D\u064A": {
2564           "final": "\uFDC2"
2565         },
2566         "\u0633\u062E\u064A": {
2567           "final": "\uFDC6"
2568         },
2569         "\u0646\u062C\u064A": {
2570           "final": "\uFDC7"
2571         },
2572         "\u0644\u0622": {
2573           "isolated": "\uFEF5",
2574           "final": "\uFEF6"
2575         },
2576         "\u0644\u0623": {
2577           "isolated": "\uFEF7",
2578           "final": "\uFEF8"
2579         },
2580         "\u0644\u0625": {
2581           "isolated": "\uFEF9",
2582           "final": "\uFEFA"
2583         },
2584         "\u0644\u0627": {
2585           "isolated": "\uFEFB",
2586           "final": "\uFEFC"
2587         },
2588         "words": {
2589           "\u0635\u0644\u06D2": "\uFDF0",
2590           "\u0642\u0644\u06D2": "\uFDF1",
2591           "\u0627\u0644\u0644\u0647": "\uFDF2",
2592           "\u0627\u0643\u0628\u0631": "\uFDF3",
2593           "\u0645\u062D\u0645\u062F": "\uFDF4",
2594           "\u0635\u0644\u0639\u0645": "\uFDF5",
2595           "\u0631\u0633\u0648\u0644": "\uFDF6",
2596           "\u0639\u0644\u064A\u0647": "\uFDF7",
2597           "\u0648\u0633\u0644\u0645": "\uFDF8",
2598           "\u0635\u0644\u0649": "\uFDF9",
2599           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2600           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2601           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2602         }
2603       };
2604       exports2.default = ligatureReference;
2605     }
2606   });
2607
2608   // node_modules/alif-toolkit/lib/reference.js
2609   var require_reference = __commonJS({
2610     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2611       "use strict";
2612       Object.defineProperty(exports2, "__esModule", { value: true });
2613       var unicode_arabic_1 = require_unicode_arabic();
2614       var unicode_ligatures_1 = require_unicode_ligatures();
2615       var letterList = Object.keys(unicode_arabic_1.default);
2616       exports2.letterList = letterList;
2617       var ligatureList = Object.keys(unicode_ligatures_1.default);
2618       exports2.ligatureList = ligatureList;
2619       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2620       exports2.ligatureWordList = ligatureWordList;
2621       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2622       exports2.lams = lams;
2623       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2624       exports2.alefs = alefs;
2625       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2626       exports2.tashkeel = tashkeel;
2627       function addToTashkeel(start2, finish) {
2628         for (var i2 = start2; i2 <= finish; i2++) {
2629           exports2.tashkeel = tashkeel += String.fromCharCode(i2);
2630         }
2631       }
2632       addToTashkeel(1552, 1562);
2633       addToTashkeel(1611, 1631);
2634       addToTashkeel(1750, 1756);
2635       addToTashkeel(1760, 1764);
2636       addToTashkeel(1770, 1773);
2637       addToTashkeel(2259, 2273);
2638       addToTashkeel(2275, 2303);
2639       addToTashkeel(65136, 65151);
2640       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2641       exports2.lineBreakers = lineBreakers;
2642       function addToLineBreakers(start2, finish) {
2643         for (var i2 = start2; i2 <= finish; i2++) {
2644           exports2.lineBreakers = lineBreakers += String.fromCharCode(i2);
2645         }
2646       }
2647       addToLineBreakers(1536, 1567);
2648       addToLineBreakers(1569, 1573);
2649       addToLineBreakers(1583, 1586);
2650       addToLineBreakers(1632, 1645);
2651       addToLineBreakers(1649, 1655);
2652       addToLineBreakers(1672, 1689);
2653       addToLineBreakers(1731, 1739);
2654       addToLineBreakers(1746, 1785);
2655       addToLineBreakers(1881, 1883);
2656       addToLineBreakers(2218, 2222);
2657       addToLineBreakers(64336, 65021);
2658       addToLineBreakers(65152, 65276);
2659       addToLineBreakers(69216, 69247);
2660       addToLineBreakers(126064, 126143);
2661       addToLineBreakers(126464, 126719);
2662     }
2663   });
2664
2665   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2666   var require_GlyphSplitter = __commonJS({
2667     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2668       "use strict";
2669       Object.defineProperty(exports2, "__esModule", { value: true });
2670       var isArabic_1 = require_isArabic();
2671       var reference_1 = require_reference();
2672       function GlyphSplitter(word) {
2673         let letters = [];
2674         let lastLetter = "";
2675         word.split("").forEach((letter) => {
2676           if (isArabic_1.isArabic(letter)) {
2677             if (reference_1.tashkeel.indexOf(letter) > -1) {
2678               letters[letters.length - 1] += letter;
2679             } else if (lastLetter.length && (reference_1.lams.indexOf(lastLetter) === 0 && reference_1.alefs.indexOf(letter) > -1 || reference_1.lams.indexOf(lastLetter) > 0 && reference_1.alefs.indexOf(letter) === 0)) {
2680               letters[letters.length - 1] += letter;
2681             } else {
2682               letters.push(letter);
2683             }
2684           } else {
2685             letters.push(letter);
2686           }
2687           if (reference_1.tashkeel.indexOf(letter) === -1) {
2688             lastLetter = letter;
2689           }
2690         });
2691         return letters;
2692       }
2693       exports2.GlyphSplitter = GlyphSplitter;
2694     }
2695   });
2696
2697   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2698   var require_BaselineSplitter = __commonJS({
2699     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2700       "use strict";
2701       Object.defineProperty(exports2, "__esModule", { value: true });
2702       var isArabic_1 = require_isArabic();
2703       var reference_1 = require_reference();
2704       function BaselineSplitter(word) {
2705         let letters = [];
2706         let lastLetter = "";
2707         word.split("").forEach((letter) => {
2708           if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2709             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2710               letters[letters.length - 1] += letter;
2711             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2712               letters.push(letter);
2713             } else {
2714               letters[letters.length - 1] += letter;
2715             }
2716           } else {
2717             letters.push(letter);
2718           }
2719           if (reference_1.tashkeel.indexOf(letter) === -1) {
2720             lastLetter = letter;
2721           }
2722         });
2723         return letters;
2724       }
2725       exports2.BaselineSplitter = BaselineSplitter;
2726     }
2727   });
2728
2729   // node_modules/alif-toolkit/lib/Normalization.js
2730   var require_Normalization = __commonJS({
2731     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2732       "use strict";
2733       Object.defineProperty(exports2, "__esModule", { value: true });
2734       var unicode_arabic_1 = require_unicode_arabic();
2735       var unicode_ligatures_1 = require_unicode_ligatures();
2736       var isArabic_1 = require_isArabic();
2737       var reference_1 = require_reference();
2738       function Normal(word, breakPresentationForm) {
2739         if (typeof breakPresentationForm === "undefined") {
2740           breakPresentationForm = true;
2741         }
2742         let returnable = "";
2743         word.split("").forEach((letter) => {
2744           if (!isArabic_1.isArabic(letter)) {
2745             returnable += letter;
2746             return;
2747           }
2748           for (let w = 0; w < reference_1.letterList.length; w++) {
2749             let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2750             let versions = Object.keys(letterForms);
2751             for (let v = 0; v < versions.length; v++) {
2752               let localVersion = letterForms[versions[v]];
2753               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2754                 let embeddedForms = Object.keys(localVersion);
2755                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2756                   let form = localVersion[embeddedForms[ef]];
2757                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2758                     if (form === letter) {
2759                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2760                         if (typeof localVersion["normal"] === "object") {
2761                           returnable += localVersion["normal"][0];
2762                         } else {
2763                           returnable += localVersion["normal"];
2764                         }
2765                         return;
2766                       }
2767                       returnable += letter;
2768                       return;
2769                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2770                       returnable += form[0];
2771                       return;
2772                     }
2773                   }
2774                 }
2775               } else if (localVersion === letter) {
2776                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v]) > -1) {
2777                   if (typeof letterForms["normal"] === "object") {
2778                     returnable += letterForms["normal"][0];
2779                   } else {
2780                     returnable += letterForms["normal"];
2781                   }
2782                   return;
2783                 }
2784                 returnable += letter;
2785                 return;
2786               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2787                 returnable += localVersion[0];
2788                 return;
2789               }
2790             }
2791           }
2792           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2793             let normalForm = reference_1.ligatureList[v2];
2794             if (normalForm !== "words") {
2795               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2796               for (let f2 = 0; f2 < ligForms.length; f2++) {
2797                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2798                   returnable += normalForm;
2799                   return;
2800                 }
2801               }
2802             }
2803           }
2804           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2805             let normalForm = reference_1.ligatureWordList[v3];
2806             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2807               returnable += normalForm;
2808               return;
2809             }
2810           }
2811           returnable += letter;
2812         });
2813         return returnable;
2814       }
2815       exports2.Normal = Normal;
2816     }
2817   });
2818
2819   // node_modules/alif-toolkit/lib/CharShaper.js
2820   var require_CharShaper = __commonJS({
2821     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2822       "use strict";
2823       Object.defineProperty(exports2, "__esModule", { value: true });
2824       var unicode_arabic_1 = require_unicode_arabic();
2825       var isArabic_1 = require_isArabic();
2826       var reference_1 = require_reference();
2827       function CharShaper(letter, form) {
2828         if (!isArabic_1.isArabic(letter)) {
2829           throw new Error("Not Arabic");
2830         }
2831         if (letter === "\u0621") {
2832           return "\u0621";
2833         }
2834         for (let w = 0; w < reference_1.letterList.length; w++) {
2835           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2836           let versions = Object.keys(letterForms);
2837           for (let v = 0; v < versions.length; v++) {
2838             let localVersion = letterForms[versions[v]];
2839             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2840               if (versions.indexOf(form) > -1) {
2841                 return letterForms[form];
2842               }
2843             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2844               let embeddedVersions = Object.keys(localVersion);
2845               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2846                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2847                   if (embeddedVersions.indexOf(form) > -1) {
2848                     return localVersion[form];
2849                   }
2850                 }
2851               }
2852             }
2853           }
2854         }
2855       }
2856       exports2.CharShaper = CharShaper;
2857     }
2858   });
2859
2860   // node_modules/alif-toolkit/lib/WordShaper.js
2861   var require_WordShaper = __commonJS({
2862     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2863       "use strict";
2864       Object.defineProperty(exports2, "__esModule", { value: true });
2865       var isArabic_1 = require_isArabic();
2866       var reference_1 = require_reference();
2867       var CharShaper_1 = require_CharShaper();
2868       var unicode_ligatures_1 = require_unicode_ligatures();
2869       function WordShaper2(word) {
2870         let state = "initial";
2871         let output = "";
2872         for (let w = 0; w < word.length; w++) {
2873           let nextLetter = " ";
2874           for (let nxw = w + 1; nxw < word.length; nxw++) {
2875             if (!isArabic_1.isArabic(word[nxw])) {
2876               break;
2877             }
2878             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2879               nextLetter = word[nxw];
2880               break;
2881             }
2882           }
2883           if (!isArabic_1.isArabic(word[w]) || isArabic_1.isMath(word[w])) {
2884             output += word[w];
2885             state = "initial";
2886           } else if (reference_1.tashkeel.indexOf(word[w]) > -1) {
2887             output += word[w];
2888           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w]) > -1) {
2889             output += CharShaper_1.CharShaper(word[w], state === "initial" ? "isolated" : "final");
2890             state = "initial";
2891           } else if (reference_1.lams.indexOf(word[w]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2892             output += unicode_ligatures_1.default[word[w] + nextLetter][state === "initial" ? "isolated" : "final"];
2893             while (word[w] !== nextLetter) {
2894               w++;
2895             }
2896             state = "initial";
2897           } else {
2898             output += CharShaper_1.CharShaper(word[w], state);
2899             state = "medial";
2900           }
2901         }
2902         return output;
2903       }
2904       exports2.WordShaper = WordShaper2;
2905     }
2906   });
2907
2908   // node_modules/alif-toolkit/lib/ParentLetter.js
2909   var require_ParentLetter = __commonJS({
2910     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2911       "use strict";
2912       Object.defineProperty(exports2, "__esModule", { value: true });
2913       var unicode_arabic_1 = require_unicode_arabic();
2914       var isArabic_1 = require_isArabic();
2915       var reference_1 = require_reference();
2916       function ParentLetter(letter) {
2917         if (!isArabic_1.isArabic(letter)) {
2918           throw new Error("Not an Arabic letter");
2919         }
2920         for (let w = 0; w < reference_1.letterList.length; w++) {
2921           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2922           let versions = Object.keys(letterForms);
2923           for (let v = 0; v < versions.length; v++) {
2924             let localVersion = letterForms[versions[v]];
2925             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2926               let embeddedForms = Object.keys(localVersion);
2927               for (let ef = 0; ef < embeddedForms.length; ef++) {
2928                 let form = localVersion[embeddedForms[ef]];
2929                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2930                   return localVersion;
2931                 }
2932               }
2933             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2934               return letterForms;
2935             }
2936           }
2937           return null;
2938         }
2939       }
2940       exports2.ParentLetter = ParentLetter;
2941       function GrandparentLetter(letter) {
2942         if (!isArabic_1.isArabic(letter)) {
2943           throw new Error("Not an Arabic letter");
2944         }
2945         for (let w = 0; w < reference_1.letterList.length; w++) {
2946           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2947           let versions = Object.keys(letterForms);
2948           for (let v = 0; v < versions.length; v++) {
2949             let localVersion = letterForms[versions[v]];
2950             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2951               let embeddedForms = Object.keys(localVersion);
2952               for (let ef = 0; ef < embeddedForms.length; ef++) {
2953                 let form = localVersion[embeddedForms[ef]];
2954                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2955                   return letterForms;
2956                 }
2957               }
2958             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2959               return letterForms;
2960             }
2961           }
2962           return null;
2963         }
2964       }
2965       exports2.GrandparentLetter = GrandparentLetter;
2966     }
2967   });
2968
2969   // node_modules/alif-toolkit/lib/index.js
2970   var require_lib = __commonJS({
2971     "node_modules/alif-toolkit/lib/index.js"(exports2) {
2972       "use strict";
2973       Object.defineProperty(exports2, "__esModule", { value: true });
2974       var isArabic_1 = require_isArabic();
2975       exports2.isArabic = isArabic_1.isArabic;
2976       var GlyphSplitter_1 = require_GlyphSplitter();
2977       exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
2978       var BaselineSplitter_1 = require_BaselineSplitter();
2979       exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
2980       var Normalization_1 = require_Normalization();
2981       exports2.Normal = Normalization_1.Normal;
2982       var CharShaper_1 = require_CharShaper();
2983       exports2.CharShaper = CharShaper_1.CharShaper;
2984       var WordShaper_1 = require_WordShaper();
2985       exports2.WordShaper = WordShaper_1.WordShaper;
2986       var ParentLetter_1 = require_ParentLetter();
2987       exports2.ParentLetter = ParentLetter_1.ParentLetter;
2988       exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
2989     }
2990   });
2991
2992   // node_modules/vparse/index.js
2993   var require_vparse = __commonJS({
2994     "node_modules/vparse/index.js"(exports2, module2) {
2995       (function(window2) {
2996         "use strict";
2997         function parseVersion3(v) {
2998           var m = v.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
2999           v = {
3000             major: +m[0] || 0,
3001             minor: +m[1] || 0,
3002             patch: +m[2] || 0,
3003             build: +m[3] || 0
3004           };
3005           v.isEmpty = !v.major && !v.minor && !v.patch && !v.build;
3006           v.parsed = [v.major, v.minor, v.patch, v.build];
3007           v.text = v.parsed.join(".");
3008           v.compare = compare;
3009           return v;
3010         }
3011         function compare(v) {
3012           if (typeof v === "string") {
3013             v = parseVersion3(v);
3014           }
3015           for (var i2 = 0; i2 < 4; i2++) {
3016             if (this.parsed[i2] !== v.parsed[i2]) {
3017               return this.parsed[i2] > v.parsed[i2] ? 1 : -1;
3018             }
3019           }
3020           return 0;
3021         }
3022         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3023           module2.exports = parseVersion3;
3024         } else {
3025           window2.parseVersion = parseVersion3;
3026         }
3027       })(exports2);
3028     }
3029   });
3030
3031   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3032   var require_quickselect = __commonJS({
3033     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3034       (function(global3, factory) {
3035         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global3.quickselect = factory();
3036       })(exports2, function() {
3037         "use strict";
3038         function quickselect2(arr, k, left, right, compare) {
3039           quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
3040         }
3041         function quickselectStep(arr, k, left, right, compare) {
3042           while (right > left) {
3043             if (right - left > 600) {
3044               var n2 = right - left + 1;
3045               var m = k - left + 1;
3046               var z = Math.log(n2);
3047               var s = 0.5 * Math.exp(2 * z / 3);
3048               var sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
3049               var newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
3050               var newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
3051               quickselectStep(arr, k, newLeft, newRight, compare);
3052             }
3053             var t = arr[k];
3054             var i2 = left;
3055             var j2 = right;
3056             swap2(arr, left, k);
3057             if (compare(arr[right], t) > 0)
3058               swap2(arr, left, right);
3059             while (i2 < j2) {
3060               swap2(arr, i2, j2);
3061               i2++;
3062               j2--;
3063               while (compare(arr[i2], t) < 0)
3064                 i2++;
3065               while (compare(arr[j2], t) > 0)
3066                 j2--;
3067             }
3068             if (compare(arr[left], t) === 0)
3069               swap2(arr, left, j2);
3070             else {
3071               j2++;
3072               swap2(arr, j2, right);
3073             }
3074             if (j2 <= k)
3075               left = j2 + 1;
3076             if (k <= j2)
3077               right = j2 - 1;
3078           }
3079         }
3080         function swap2(arr, i2, j2) {
3081           var tmp = arr[i2];
3082           arr[i2] = arr[j2];
3083           arr[j2] = tmp;
3084         }
3085         function defaultCompare(a, b) {
3086           return a < b ? -1 : a > b ? 1 : 0;
3087         }
3088         return quickselect2;
3089       });
3090     }
3091   });
3092
3093   // node_modules/which-polygon/node_modules/rbush/index.js
3094   var require_rbush = __commonJS({
3095     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3096       "use strict";
3097       module2.exports = rbush;
3098       module2.exports.default = rbush;
3099       var quickselect2 = require_quickselect();
3100       function rbush(maxEntries, format2) {
3101         if (!(this instanceof rbush))
3102           return new rbush(maxEntries, format2);
3103         this._maxEntries = Math.max(4, maxEntries || 9);
3104         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3105         if (format2) {
3106           this._initFormat(format2);
3107         }
3108         this.clear();
3109       }
3110       rbush.prototype = {
3111         all: function() {
3112           return this._all(this.data, []);
3113         },
3114         search: function(bbox) {
3115           var node = this.data, result = [], toBBox = this.toBBox;
3116           if (!intersects(bbox, node))
3117             return result;
3118           var nodesToSearch = [], i2, len, child, childBBox;
3119           while (node) {
3120             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3121               child = node.children[i2];
3122               childBBox = node.leaf ? toBBox(child) : child;
3123               if (intersects(bbox, childBBox)) {
3124                 if (node.leaf)
3125                   result.push(child);
3126                 else if (contains(bbox, childBBox))
3127                   this._all(child, result);
3128                 else
3129                   nodesToSearch.push(child);
3130               }
3131             }
3132             node = nodesToSearch.pop();
3133           }
3134           return result;
3135         },
3136         collides: function(bbox) {
3137           var node = this.data, toBBox = this.toBBox;
3138           if (!intersects(bbox, node))
3139             return false;
3140           var nodesToSearch = [], i2, len, child, childBBox;
3141           while (node) {
3142             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3143               child = node.children[i2];
3144               childBBox = node.leaf ? toBBox(child) : child;
3145               if (intersects(bbox, childBBox)) {
3146                 if (node.leaf || contains(bbox, childBBox))
3147                   return true;
3148                 nodesToSearch.push(child);
3149               }
3150             }
3151             node = nodesToSearch.pop();
3152           }
3153           return false;
3154         },
3155         load: function(data) {
3156           if (!(data && data.length))
3157             return this;
3158           if (data.length < this._minEntries) {
3159             for (var i2 = 0, len = data.length; i2 < len; i2++) {
3160               this.insert(data[i2]);
3161             }
3162             return this;
3163           }
3164           var node = this._build(data.slice(), 0, data.length - 1, 0);
3165           if (!this.data.children.length) {
3166             this.data = node;
3167           } else if (this.data.height === node.height) {
3168             this._splitRoot(this.data, node);
3169           } else {
3170             if (this.data.height < node.height) {
3171               var tmpNode = this.data;
3172               this.data = node;
3173               node = tmpNode;
3174             }
3175             this._insert(node, this.data.height - node.height - 1, true);
3176           }
3177           return this;
3178         },
3179         insert: function(item) {
3180           if (item)
3181             this._insert(item, this.data.height - 1);
3182           return this;
3183         },
3184         clear: function() {
3185           this.data = createNode([]);
3186           return this;
3187         },
3188         remove: function(item, equalsFn) {
3189           if (!item)
3190             return this;
3191           var node = this.data, bbox = this.toBBox(item), path = [], indexes = [], i2, parent, index, goingUp;
3192           while (node || path.length) {
3193             if (!node) {
3194               node = path.pop();
3195               parent = path[path.length - 1];
3196               i2 = indexes.pop();
3197               goingUp = true;
3198             }
3199             if (node.leaf) {
3200               index = findItem(item, node.children, equalsFn);
3201               if (index !== -1) {
3202                 node.children.splice(index, 1);
3203                 path.push(node);
3204                 this._condense(path);
3205                 return this;
3206               }
3207             }
3208             if (!goingUp && !node.leaf && contains(node, bbox)) {
3209               path.push(node);
3210               indexes.push(i2);
3211               i2 = 0;
3212               parent = node;
3213               node = node.children[0];
3214             } else if (parent) {
3215               i2++;
3216               node = parent.children[i2];
3217               goingUp = false;
3218             } else
3219               node = null;
3220           }
3221           return this;
3222         },
3223         toBBox: function(item) {
3224           return item;
3225         },
3226         compareMinX: compareNodeMinX,
3227         compareMinY: compareNodeMinY,
3228         toJSON: function() {
3229           return this.data;
3230         },
3231         fromJSON: function(data) {
3232           this.data = data;
3233           return this;
3234         },
3235         _all: function(node, result) {
3236           var nodesToSearch = [];
3237           while (node) {
3238             if (node.leaf)
3239               result.push.apply(result, node.children);
3240             else
3241               nodesToSearch.push.apply(nodesToSearch, node.children);
3242             node = nodesToSearch.pop();
3243           }
3244           return result;
3245         },
3246         _build: function(items, left, right, height) {
3247           var N = right - left + 1, M = this._maxEntries, node;
3248           if (N <= M) {
3249             node = createNode(items.slice(left, right + 1));
3250             calcBBox(node, this.toBBox);
3251             return node;
3252           }
3253           if (!height) {
3254             height = Math.ceil(Math.log(N) / Math.log(M));
3255             M = Math.ceil(N / Math.pow(M, height - 1));
3256           }
3257           node = createNode([]);
3258           node.leaf = false;
3259           node.height = height;
3260           var N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M)), i2, j2, right2, right3;
3261           multiSelect(items, left, right, N1, this.compareMinX);
3262           for (i2 = left; i2 <= right; i2 += N1) {
3263             right2 = Math.min(i2 + N1 - 1, right);
3264             multiSelect(items, i2, right2, N2, this.compareMinY);
3265             for (j2 = i2; j2 <= right2; j2 += N2) {
3266               right3 = Math.min(j2 + N2 - 1, right2);
3267               node.children.push(this._build(items, j2, right3, height - 1));
3268             }
3269           }
3270           calcBBox(node, this.toBBox);
3271           return node;
3272         },
3273         _chooseSubtree: function(bbox, node, level, path) {
3274           var i2, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3275           while (true) {
3276             path.push(node);
3277             if (node.leaf || path.length - 1 === level)
3278               break;
3279             minArea = minEnlargement = Infinity;
3280             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3281               child = node.children[i2];
3282               area = bboxArea(child);
3283               enlargement = enlargedArea(bbox, child) - area;
3284               if (enlargement < minEnlargement) {
3285                 minEnlargement = enlargement;
3286                 minArea = area < minArea ? area : minArea;
3287                 targetNode = child;
3288               } else if (enlargement === minEnlargement) {
3289                 if (area < minArea) {
3290                   minArea = area;
3291                   targetNode = child;
3292                 }
3293               }
3294             }
3295             node = targetNode || node.children[0];
3296           }
3297           return node;
3298         },
3299         _insert: function(item, level, isNode) {
3300           var toBBox = this.toBBox, bbox = isNode ? item : toBBox(item), insertPath = [];
3301           var node = this._chooseSubtree(bbox, this.data, level, insertPath);
3302           node.children.push(item);
3303           extend2(node, bbox);
3304           while (level >= 0) {
3305             if (insertPath[level].children.length > this._maxEntries) {
3306               this._split(insertPath, level);
3307               level--;
3308             } else
3309               break;
3310           }
3311           this._adjustParentBBoxes(bbox, insertPath, level);
3312         },
3313         _split: function(insertPath, level) {
3314           var node = insertPath[level], M = node.children.length, m = this._minEntries;
3315           this._chooseSplitAxis(node, m, M);
3316           var splitIndex = this._chooseSplitIndex(node, m, M);
3317           var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3318           newNode.height = node.height;
3319           newNode.leaf = node.leaf;
3320           calcBBox(node, this.toBBox);
3321           calcBBox(newNode, this.toBBox);
3322           if (level)
3323             insertPath[level - 1].children.push(newNode);
3324           else
3325             this._splitRoot(node, newNode);
3326         },
3327         _splitRoot: function(node, newNode) {
3328           this.data = createNode([node, newNode]);
3329           this.data.height = node.height + 1;
3330           this.data.leaf = false;
3331           calcBBox(this.data, this.toBBox);
3332         },
3333         _chooseSplitIndex: function(node, m, M) {
3334           var i2, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3335           minOverlap = minArea = Infinity;
3336           for (i2 = m; i2 <= M - m; i2++) {
3337             bbox1 = distBBox(node, 0, i2, this.toBBox);
3338             bbox2 = distBBox(node, i2, M, this.toBBox);
3339             overlap = intersectionArea(bbox1, bbox2);
3340             area = bboxArea(bbox1) + bboxArea(bbox2);
3341             if (overlap < minOverlap) {
3342               minOverlap = overlap;
3343               index = i2;
3344               minArea = area < minArea ? area : minArea;
3345             } else if (overlap === minOverlap) {
3346               if (area < minArea) {
3347                 minArea = area;
3348                 index = i2;
3349               }
3350             }
3351           }
3352           return index;
3353         },
3354         _chooseSplitAxis: function(node, m, M) {
3355           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY);
3356           if (xMargin < yMargin)
3357             node.children.sort(compareMinX);
3358         },
3359         _allDistMargin: function(node, m, M, compare) {
3360           node.children.sort(compare);
3361           var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i2, child;
3362           for (i2 = m; i2 < M - m; i2++) {
3363             child = node.children[i2];
3364             extend2(leftBBox, node.leaf ? toBBox(child) : child);
3365             margin += bboxMargin(leftBBox);
3366           }
3367           for (i2 = M - m - 1; i2 >= m; i2--) {
3368             child = node.children[i2];
3369             extend2(rightBBox, node.leaf ? toBBox(child) : child);
3370             margin += bboxMargin(rightBBox);
3371           }
3372           return margin;
3373         },
3374         _adjustParentBBoxes: function(bbox, path, level) {
3375           for (var i2 = level; i2 >= 0; i2--) {
3376             extend2(path[i2], bbox);
3377           }
3378         },
3379         _condense: function(path) {
3380           for (var i2 = path.length - 1, siblings; i2 >= 0; i2--) {
3381             if (path[i2].children.length === 0) {
3382               if (i2 > 0) {
3383                 siblings = path[i2 - 1].children;
3384                 siblings.splice(siblings.indexOf(path[i2]), 1);
3385               } else
3386                 this.clear();
3387             } else
3388               calcBBox(path[i2], this.toBBox);
3389           }
3390         },
3391         _initFormat: function(format2) {
3392           var compareArr = ["return a", " - b", ";"];
3393           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3394           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3395           this.toBBox = new Function("a", "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};");
3396         }
3397       };
3398       function findItem(item, items, equalsFn) {
3399         if (!equalsFn)
3400           return items.indexOf(item);
3401         for (var i2 = 0; i2 < items.length; i2++) {
3402           if (equalsFn(item, items[i2]))
3403             return i2;
3404         }
3405         return -1;
3406       }
3407       function calcBBox(node, toBBox) {
3408         distBBox(node, 0, node.children.length, toBBox, node);
3409       }
3410       function distBBox(node, k, p, toBBox, destNode) {
3411         if (!destNode)
3412           destNode = createNode(null);
3413         destNode.minX = Infinity;
3414         destNode.minY = Infinity;
3415         destNode.maxX = -Infinity;
3416         destNode.maxY = -Infinity;
3417         for (var i2 = k, child; i2 < p; i2++) {
3418           child = node.children[i2];
3419           extend2(destNode, node.leaf ? toBBox(child) : child);
3420         }
3421         return destNode;
3422       }
3423       function extend2(a, b) {
3424         a.minX = Math.min(a.minX, b.minX);
3425         a.minY = Math.min(a.minY, b.minY);
3426         a.maxX = Math.max(a.maxX, b.maxX);
3427         a.maxY = Math.max(a.maxY, b.maxY);
3428         return a;
3429       }
3430       function compareNodeMinX(a, b) {
3431         return a.minX - b.minX;
3432       }
3433       function compareNodeMinY(a, b) {
3434         return a.minY - b.minY;
3435       }
3436       function bboxArea(a) {
3437         return (a.maxX - a.minX) * (a.maxY - a.minY);
3438       }
3439       function bboxMargin(a) {
3440         return a.maxX - a.minX + (a.maxY - a.minY);
3441       }
3442       function enlargedArea(a, b) {
3443         return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
3444       }
3445       function intersectionArea(a, b) {
3446         var minX = Math.max(a.minX, b.minX), minY = Math.max(a.minY, b.minY), maxX = Math.min(a.maxX, b.maxX), maxY = Math.min(a.maxY, b.maxY);
3447         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3448       }
3449       function contains(a, b) {
3450         return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
3451       }
3452       function intersects(a, b) {
3453         return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
3454       }
3455       function createNode(children2) {
3456         return {
3457           children: children2,
3458           height: 1,
3459           leaf: true,
3460           minX: Infinity,
3461           minY: Infinity,
3462           maxX: -Infinity,
3463           maxY: -Infinity
3464         };
3465       }
3466       function multiSelect(arr, left, right, n2, compare) {
3467         var stack = [left, right], mid;
3468         while (stack.length) {
3469           right = stack.pop();
3470           left = stack.pop();
3471           if (right - left <= n2)
3472             continue;
3473           mid = left + Math.ceil((right - left) / n2 / 2) * n2;
3474           quickselect2(arr, mid, left, right, compare);
3475           stack.push(left, mid, mid, right);
3476         }
3477       }
3478     }
3479   });
3480
3481   // node_modules/lineclip/index.js
3482   var require_lineclip = __commonJS({
3483     "node_modules/lineclip/index.js"(exports2, module2) {
3484       "use strict";
3485       module2.exports = lineclip2;
3486       lineclip2.polyline = lineclip2;
3487       lineclip2.polygon = polygonclip2;
3488       function lineclip2(points, bbox, result) {
3489         var len = points.length, codeA = bitCode2(points[0], bbox), part = [], i2, a, b, codeB, lastCode;
3490         if (!result)
3491           result = [];
3492         for (i2 = 1; i2 < len; i2++) {
3493           a = points[i2 - 1];
3494           b = points[i2];
3495           codeB = lastCode = bitCode2(b, bbox);
3496           while (true) {
3497             if (!(codeA | codeB)) {
3498               part.push(a);
3499               if (codeB !== lastCode) {
3500                 part.push(b);
3501                 if (i2 < len - 1) {
3502                   result.push(part);
3503                   part = [];
3504                 }
3505               } else if (i2 === len - 1) {
3506                 part.push(b);
3507               }
3508               break;
3509             } else if (codeA & codeB) {
3510               break;
3511             } else if (codeA) {
3512               a = intersect2(a, b, codeA, bbox);
3513               codeA = bitCode2(a, bbox);
3514             } else {
3515               b = intersect2(a, b, codeB, bbox);
3516               codeB = bitCode2(b, bbox);
3517             }
3518           }
3519           codeA = lastCode;
3520         }
3521         if (part.length)
3522           result.push(part);
3523         return result;
3524       }
3525       function polygonclip2(points, bbox) {
3526         var result, edge, prev, prevInside, i2, p, inside;
3527         for (edge = 1; edge <= 8; edge *= 2) {
3528           result = [];
3529           prev = points[points.length - 1];
3530           prevInside = !(bitCode2(prev, bbox) & edge);
3531           for (i2 = 0; i2 < points.length; i2++) {
3532             p = points[i2];
3533             inside = !(bitCode2(p, bbox) & edge);
3534             if (inside !== prevInside)
3535               result.push(intersect2(prev, p, edge, bbox));
3536             if (inside)
3537               result.push(p);
3538             prev = p;
3539             prevInside = inside;
3540           }
3541           points = result;
3542           if (!points.length)
3543             break;
3544         }
3545         return result;
3546       }
3547       function intersect2(a, b, edge, bbox) {
3548         return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
3549       }
3550       function bitCode2(p, bbox) {
3551         var code = 0;
3552         if (p[0] < bbox[0])
3553           code |= 1;
3554         else if (p[0] > bbox[2])
3555           code |= 2;
3556         if (p[1] < bbox[1])
3557           code |= 4;
3558         else if (p[1] > bbox[3])
3559           code |= 8;
3560         return code;
3561       }
3562     }
3563   });
3564
3565   // node_modules/which-polygon/index.js
3566   var require_which_polygon = __commonJS({
3567     "node_modules/which-polygon/index.js"(exports2, module2) {
3568       "use strict";
3569       var rbush = require_rbush();
3570       var lineclip2 = require_lineclip();
3571       module2.exports = whichPolygon5;
3572       function whichPolygon5(data) {
3573         var bboxes = [];
3574         for (var i2 = 0; i2 < data.features.length; i2++) {
3575           var feature3 = data.features[i2];
3576           var coords = feature3.geometry.coordinates;
3577           if (feature3.geometry.type === "Polygon") {
3578             bboxes.push(treeItem(coords, feature3.properties));
3579           } else if (feature3.geometry.type === "MultiPolygon") {
3580             for (var j2 = 0; j2 < coords.length; j2++) {
3581               bboxes.push(treeItem(coords[j2], feature3.properties));
3582             }
3583           }
3584         }
3585         var tree = rbush().load(bboxes);
3586         function query(p, multi) {
3587           var output = [], result = tree.search({
3588             minX: p[0],
3589             minY: p[1],
3590             maxX: p[0],
3591             maxY: p[1]
3592           });
3593           for (var i3 = 0; i3 < result.length; i3++) {
3594             if (insidePolygon(result[i3].coords, p)) {
3595               if (multi)
3596                 output.push(result[i3].props);
3597               else
3598                 return result[i3].props;
3599             }
3600           }
3601           return multi && output.length ? output : null;
3602         }
3603         query.tree = tree;
3604         query.bbox = function queryBBox(bbox) {
3605           var output = [];
3606           var result = tree.search({
3607             minX: bbox[0],
3608             minY: bbox[1],
3609             maxX: bbox[2],
3610             maxY: bbox[3]
3611           });
3612           for (var i3 = 0; i3 < result.length; i3++) {
3613             if (polygonIntersectsBBox(result[i3].coords, bbox)) {
3614               output.push(result[i3].props);
3615             }
3616           }
3617           return output;
3618         };
3619         return query;
3620       }
3621       function polygonIntersectsBBox(polygon2, bbox) {
3622         var bboxCenter = [
3623           (bbox[0] + bbox[2]) / 2,
3624           (bbox[1] + bbox[3]) / 2
3625         ];
3626         if (insidePolygon(polygon2, bboxCenter))
3627           return true;
3628         for (var i2 = 0; i2 < polygon2.length; i2++) {
3629           if (lineclip2(polygon2[i2], bbox).length > 0)
3630             return true;
3631         }
3632         return false;
3633       }
3634       function insidePolygon(rings, p) {
3635         var inside = false;
3636         for (var i2 = 0, len = rings.length; i2 < len; i2++) {
3637           var ring = rings[i2];
3638           for (var j2 = 0, len2 = ring.length, k = len2 - 1; j2 < len2; k = j2++) {
3639             if (rayIntersect(p, ring[j2], ring[k]))
3640               inside = !inside;
3641           }
3642         }
3643         return inside;
3644       }
3645       function rayIntersect(p, p1, p2) {
3646         return p1[1] > p[1] !== p2[1] > p[1] && p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0];
3647       }
3648       function treeItem(coords, props) {
3649         var item = {
3650           minX: Infinity,
3651           minY: Infinity,
3652           maxX: -Infinity,
3653           maxY: -Infinity,
3654           coords,
3655           props
3656         };
3657         for (var i2 = 0; i2 < coords[0].length; i2++) {
3658           var p = coords[0][i2];
3659           item.minX = Math.min(item.minX, p[0]);
3660           item.minY = Math.min(item.minY, p[1]);
3661           item.maxX = Math.max(item.maxX, p[0]);
3662           item.maxY = Math.max(item.maxY, p[1]);
3663         }
3664         return item;
3665       }
3666     }
3667   });
3668
3669   // node_modules/wgs84/index.js
3670   var require_wgs84 = __commonJS({
3671     "node_modules/wgs84/index.js"(exports2, module2) {
3672       module2.exports.RADIUS = 6378137;
3673       module2.exports.FLATTENING = 1 / 298.257223563;
3674       module2.exports.POLAR_RADIUS = 63567523142e-4;
3675     }
3676   });
3677
3678   // node_modules/@mapbox/geojson-area/index.js
3679   var require_geojson_area = __commonJS({
3680     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3681       var wgs84 = require_wgs84();
3682       module2.exports.geometry = geometry;
3683       module2.exports.ring = ringArea;
3684       function geometry(_) {
3685         var area = 0, i2;
3686         switch (_.type) {
3687           case "Polygon":
3688             return polygonArea(_.coordinates);
3689           case "MultiPolygon":
3690             for (i2 = 0; i2 < _.coordinates.length; i2++) {
3691               area += polygonArea(_.coordinates[i2]);
3692             }
3693             return area;
3694           case "Point":
3695           case "MultiPoint":
3696           case "LineString":
3697           case "MultiLineString":
3698             return 0;
3699           case "GeometryCollection":
3700             for (i2 = 0; i2 < _.geometries.length; i2++) {
3701               area += geometry(_.geometries[i2]);
3702             }
3703             return area;
3704         }
3705       }
3706       function polygonArea(coords) {
3707         var area = 0;
3708         if (coords && coords.length > 0) {
3709           area += Math.abs(ringArea(coords[0]));
3710           for (var i2 = 1; i2 < coords.length; i2++) {
3711             area -= Math.abs(ringArea(coords[i2]));
3712           }
3713         }
3714         return area;
3715       }
3716       function ringArea(coords) {
3717         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i2, area = 0, coordsLength = coords.length;
3718         if (coordsLength > 2) {
3719           for (i2 = 0; i2 < coordsLength; i2++) {
3720             if (i2 === coordsLength - 2) {
3721               lowerIndex = coordsLength - 2;
3722               middleIndex = coordsLength - 1;
3723               upperIndex = 0;
3724             } else if (i2 === coordsLength - 1) {
3725               lowerIndex = coordsLength - 1;
3726               middleIndex = 0;
3727               upperIndex = 1;
3728             } else {
3729               lowerIndex = i2;
3730               middleIndex = i2 + 1;
3731               upperIndex = i2 + 2;
3732             }
3733             p1 = coords[lowerIndex];
3734             p2 = coords[middleIndex];
3735             p3 = coords[upperIndex];
3736             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3737           }
3738           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3739         }
3740         return area;
3741       }
3742       function rad(_) {
3743         return _ * Math.PI / 180;
3744       }
3745     }
3746   });
3747
3748   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3749   var require_validateCenter = __commonJS({
3750     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3751       exports2.validateCenter = function validateCenter(center) {
3752         var validCenterLengths = [2, 3];
3753         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3754           throw new Error("ERROR! Center has to be an array of length two or three");
3755         }
3756         var [lng, lat] = center;
3757         if (typeof lng !== "number" || typeof lat !== "number") {
3758           throw new Error(`ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`);
3759         }
3760         if (lng > 180 || lng < -180) {
3761           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
3762         }
3763         if (lat > 90 || lat < -90) {
3764           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
3765         }
3766       };
3767     }
3768   });
3769
3770   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3771   var require_validateRadius = __commonJS({
3772     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3773       exports2.validateRadius = function validateRadius(radius) {
3774         if (typeof radius !== "number") {
3775           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
3776         }
3777         if (radius <= 0) {
3778           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
3779         }
3780       };
3781     }
3782   });
3783
3784   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3785   var require_validateNumberOfEdges = __commonJS({
3786     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3787       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3788         if (typeof numberOfEdges !== "number") {
3789           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3790           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
3791         }
3792         if (numberOfEdges < 3) {
3793           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
3794         }
3795       };
3796     }
3797   });
3798
3799   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3800   var require_validateEarthRadius = __commonJS({
3801     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3802       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3803         if (typeof earthRadius2 !== "number") {
3804           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3805           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
3806         }
3807         if (earthRadius2 <= 0) {
3808           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
3809         }
3810       };
3811     }
3812   });
3813
3814   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3815   var require_validateBearing = __commonJS({
3816     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3817       exports2.validateBearing = function validateBearing(bearing) {
3818         if (typeof bearing !== "number") {
3819           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3820           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
3821         }
3822       };
3823     }
3824   });
3825
3826   // node_modules/circle-to-polygon/input-validation/index.js
3827   var require_input_validation = __commonJS({
3828     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3829       var validateCenter = require_validateCenter().validateCenter;
3830       var validateRadius = require_validateRadius().validateRadius;
3831       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3832       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3833       var validateBearing = require_validateBearing().validateBearing;
3834       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3835         validateCenter(center);
3836         validateRadius(radius);
3837         validateNumberOfEdges(numberOfEdges);
3838         validateEarthRadius(earthRadius2);
3839         validateBearing(bearing);
3840       }
3841       exports2.validateCenter = validateCenter;
3842       exports2.validateRadius = validateRadius;
3843       exports2.validateNumberOfEdges = validateNumberOfEdges;
3844       exports2.validateEarthRadius = validateEarthRadius;
3845       exports2.validateBearing = validateBearing;
3846       exports2.validateInput = validateInput;
3847     }
3848   });
3849
3850   // node_modules/circle-to-polygon/index.js
3851   var require_circle_to_polygon = __commonJS({
3852     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3853       "use strict";
3854       var { validateInput } = require_input_validation();
3855       var defaultEarthRadius = 6378137;
3856       function toRadians(angleInDegrees) {
3857         return angleInDegrees * Math.PI / 180;
3858       }
3859       function toDegrees(angleInRadians) {
3860         return angleInRadians * 180 / Math.PI;
3861       }
3862       function offset(c1, distance, earthRadius2, bearing) {
3863         var lat1 = toRadians(c1[1]);
3864         var lon1 = toRadians(c1[0]);
3865         var dByR = distance / earthRadius2;
3866         var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing));
3867         var lon = lon1 + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));
3868         return [toDegrees(lon), toDegrees(lat)];
3869       }
3870       module2.exports = function circleToPolygon2(center, radius, options2) {
3871         var n2 = getNumberOfEdges(options2);
3872         var earthRadius2 = getEarthRadius(options2);
3873         var bearing = getBearing(options2);
3874         var direction = getDirection(options2);
3875         validateInput({ center, radius, numberOfEdges: n2, earthRadius: earthRadius2, bearing });
3876         var start2 = toRadians(bearing);
3877         var coordinates = [];
3878         for (var i2 = 0; i2 < n2; ++i2) {
3879           coordinates.push(offset(center, radius, earthRadius2, start2 + direction * 2 * Math.PI * -i2 / n2));
3880         }
3881         coordinates.push(coordinates[0]);
3882         return {
3883           type: "Polygon",
3884           coordinates: [coordinates]
3885         };
3886       };
3887       function getNumberOfEdges(options2) {
3888         if (isUndefinedOrNull(options2)) {
3889           return 32;
3890         } else if (isObjectNotArray(options2)) {
3891           var numberOfEdges = options2.numberOfEdges;
3892           return numberOfEdges === void 0 ? 32 : numberOfEdges;
3893         }
3894         return options2;
3895       }
3896       function getEarthRadius(options2) {
3897         if (isUndefinedOrNull(options2)) {
3898           return defaultEarthRadius;
3899         } else if (isObjectNotArray(options2)) {
3900           var earthRadius2 = options2.earthRadius;
3901           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3902         }
3903         return defaultEarthRadius;
3904       }
3905       function getDirection(options2) {
3906         if (isObjectNotArray(options2) && options2.rightHandRule) {
3907           return -1;
3908         }
3909         return 1;
3910       }
3911       function getBearing(options2) {
3912         if (isUndefinedOrNull(options2)) {
3913           return 0;
3914         } else if (isObjectNotArray(options2)) {
3915           var bearing = options2.bearing;
3916           return bearing === void 0 ? 0 : bearing;
3917         }
3918         return 0;
3919       }
3920       function isObjectNotArray(argument) {
3921         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3922       }
3923       function isUndefinedOrNull(argument) {
3924         return argument === null || argument === void 0;
3925       }
3926     }
3927   });
3928
3929   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
3930   var require_polygon_clipping_umd = __commonJS({
3931     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
3932       (function(global3, factory) {
3933         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global3 = typeof globalThis !== "undefined" ? globalThis : global3 || self, global3.polygonClipping = factory());
3934       })(exports2, function() {
3935         "use strict";
3936         function _classCallCheck(instance, Constructor) {
3937           if (!(instance instanceof Constructor)) {
3938             throw new TypeError("Cannot call a class as a function");
3939           }
3940         }
3941         function _defineProperties(target, props) {
3942           for (var i2 = 0; i2 < props.length; i2++) {
3943             var descriptor = props[i2];
3944             descriptor.enumerable = descriptor.enumerable || false;
3945             descriptor.configurable = true;
3946             if ("value" in descriptor)
3947               descriptor.writable = true;
3948             Object.defineProperty(target, descriptor.key, descriptor);
3949           }
3950         }
3951         function _createClass(Constructor, protoProps, staticProps) {
3952           if (protoProps)
3953             _defineProperties(Constructor.prototype, protoProps);
3954           if (staticProps)
3955             _defineProperties(Constructor, staticProps);
3956           return Constructor;
3957         }
3958         var Node = function() {
3959           function Node2(key, data) {
3960             this.next = null;
3961             this.key = key;
3962             this.data = data;
3963             this.left = null;
3964             this.right = null;
3965           }
3966           return Node2;
3967         }();
3968         function DEFAULT_COMPARE(a, b) {
3969           return a > b ? 1 : a < b ? -1 : 0;
3970         }
3971         function splay(i2, t, comparator) {
3972           var N = new Node(null, null);
3973           var l = N;
3974           var r = N;
3975           while (true) {
3976             var cmp2 = comparator(i2, t.key);
3977             if (cmp2 < 0) {
3978               if (t.left === null)
3979                 break;
3980               if (comparator(i2, t.left.key) < 0) {
3981                 var y = t.left;
3982                 t.left = y.right;
3983                 y.right = t;
3984                 t = y;
3985                 if (t.left === null)
3986                   break;
3987               }
3988               r.left = t;
3989               r = t;
3990               t = t.left;
3991             } else if (cmp2 > 0) {
3992               if (t.right === null)
3993                 break;
3994               if (comparator(i2, t.right.key) > 0) {
3995                 var y = t.right;
3996                 t.right = y.left;
3997                 y.left = t;
3998                 t = y;
3999                 if (t.right === null)
4000                   break;
4001               }
4002               l.right = t;
4003               l = t;
4004               t = t.right;
4005             } else
4006               break;
4007           }
4008           l.right = t.left;
4009           r.left = t.right;
4010           t.left = N.right;
4011           t.right = N.left;
4012           return t;
4013         }
4014         function insert(i2, data, t, comparator) {
4015           var node = new Node(i2, data);
4016           if (t === null) {
4017             node.left = node.right = null;
4018             return node;
4019           }
4020           t = splay(i2, t, comparator);
4021           var cmp2 = comparator(i2, t.key);
4022           if (cmp2 < 0) {
4023             node.left = t.left;
4024             node.right = t;
4025             t.left = null;
4026           } else if (cmp2 >= 0) {
4027             node.right = t.right;
4028             node.left = t;
4029             t.right = null;
4030           }
4031           return node;
4032         }
4033         function split(key, v, comparator) {
4034           var left = null;
4035           var right = null;
4036           if (v) {
4037             v = splay(key, v, comparator);
4038             var cmp2 = comparator(v.key, key);
4039             if (cmp2 === 0) {
4040               left = v.left;
4041               right = v.right;
4042             } else if (cmp2 < 0) {
4043               right = v.right;
4044               v.right = null;
4045               left = v;
4046             } else {
4047               left = v.left;
4048               v.left = null;
4049               right = v;
4050             }
4051           }
4052           return {
4053             left,
4054             right
4055           };
4056         }
4057         function merge3(left, right, comparator) {
4058           if (right === null)
4059             return left;
4060           if (left === null)
4061             return right;
4062           right = splay(left.key, right, comparator);
4063           right.left = left;
4064           return right;
4065         }
4066         function printRow(root3, prefix, isTail, out, printNode) {
4067           if (root3) {
4068             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4069             var indent2 = prefix + (isTail ? "    " : "\u2502   ");
4070             if (root3.left)
4071               printRow(root3.left, indent2, false, out, printNode);
4072             if (root3.right)
4073               printRow(root3.right, indent2, true, out, printNode);
4074           }
4075         }
4076         var Tree = function() {
4077           function Tree2(comparator) {
4078             if (comparator === void 0) {
4079               comparator = DEFAULT_COMPARE;
4080             }
4081             this._root = null;
4082             this._size = 0;
4083             this._comparator = comparator;
4084           }
4085           Tree2.prototype.insert = function(key, data) {
4086             this._size++;
4087             return this._root = insert(key, data, this._root, this._comparator);
4088           };
4089           Tree2.prototype.add = function(key, data) {
4090             var node = new Node(key, data);
4091             if (this._root === null) {
4092               node.left = node.right = null;
4093               this._size++;
4094               this._root = node;
4095             }
4096             var comparator = this._comparator;
4097             var t = splay(key, this._root, comparator);
4098             var cmp2 = comparator(key, t.key);
4099             if (cmp2 === 0)
4100               this._root = t;
4101             else {
4102               if (cmp2 < 0) {
4103                 node.left = t.left;
4104                 node.right = t;
4105                 t.left = null;
4106               } else if (cmp2 > 0) {
4107                 node.right = t.right;
4108                 node.left = t;
4109                 t.right = null;
4110               }
4111               this._size++;
4112               this._root = node;
4113             }
4114             return this._root;
4115           };
4116           Tree2.prototype.remove = function(key) {
4117             this._root = this._remove(key, this._root, this._comparator);
4118           };
4119           Tree2.prototype._remove = function(i2, t, comparator) {
4120             var x;
4121             if (t === null)
4122               return null;
4123             t = splay(i2, t, comparator);
4124             var cmp2 = comparator(i2, t.key);
4125             if (cmp2 === 0) {
4126               if (t.left === null) {
4127                 x = t.right;
4128               } else {
4129                 x = splay(i2, t.left, comparator);
4130                 x.right = t.right;
4131               }
4132               this._size--;
4133               return x;
4134             }
4135             return t;
4136           };
4137           Tree2.prototype.pop = function() {
4138             var node = this._root;
4139             if (node) {
4140               while (node.left) {
4141                 node = node.left;
4142               }
4143               this._root = splay(node.key, this._root, this._comparator);
4144               this._root = this._remove(node.key, this._root, this._comparator);
4145               return {
4146                 key: node.key,
4147                 data: node.data
4148               };
4149             }
4150             return null;
4151           };
4152           Tree2.prototype.findStatic = function(key) {
4153             var current = this._root;
4154             var compare = this._comparator;
4155             while (current) {
4156               var cmp2 = compare(key, current.key);
4157               if (cmp2 === 0)
4158                 return current;
4159               else if (cmp2 < 0)
4160                 current = current.left;
4161               else
4162                 current = current.right;
4163             }
4164             return null;
4165           };
4166           Tree2.prototype.find = function(key) {
4167             if (this._root) {
4168               this._root = splay(key, this._root, this._comparator);
4169               if (this._comparator(key, this._root.key) !== 0)
4170                 return null;
4171             }
4172             return this._root;
4173           };
4174           Tree2.prototype.contains = function(key) {
4175             var current = this._root;
4176             var compare = this._comparator;
4177             while (current) {
4178               var cmp2 = compare(key, current.key);
4179               if (cmp2 === 0)
4180                 return true;
4181               else if (cmp2 < 0)
4182                 current = current.left;
4183               else
4184                 current = current.right;
4185             }
4186             return false;
4187           };
4188           Tree2.prototype.forEach = function(visitor, ctx) {
4189             var current = this._root;
4190             var Q = [];
4191             var done = false;
4192             while (!done) {
4193               if (current !== null) {
4194                 Q.push(current);
4195                 current = current.left;
4196               } else {
4197                 if (Q.length !== 0) {
4198                   current = Q.pop();
4199                   visitor.call(ctx, current);
4200                   current = current.right;
4201                 } else
4202                   done = true;
4203               }
4204             }
4205             return this;
4206           };
4207           Tree2.prototype.range = function(low, high, fn, ctx) {
4208             var Q = [];
4209             var compare = this._comparator;
4210             var node = this._root;
4211             var cmp2;
4212             while (Q.length !== 0 || node) {
4213               if (node) {
4214                 Q.push(node);
4215                 node = node.left;
4216               } else {
4217                 node = Q.pop();
4218                 cmp2 = compare(node.key, high);
4219                 if (cmp2 > 0) {
4220                   break;
4221                 } else if (compare(node.key, low) >= 0) {
4222                   if (fn.call(ctx, node))
4223                     return this;
4224                 }
4225                 node = node.right;
4226               }
4227             }
4228             return this;
4229           };
4230           Tree2.prototype.keys = function() {
4231             var keys = [];
4232             this.forEach(function(_a) {
4233               var key = _a.key;
4234               return keys.push(key);
4235             });
4236             return keys;
4237           };
4238           Tree2.prototype.values = function() {
4239             var values = [];
4240             this.forEach(function(_a) {
4241               var data = _a.data;
4242               return values.push(data);
4243             });
4244             return values;
4245           };
4246           Tree2.prototype.min = function() {
4247             if (this._root)
4248               return this.minNode(this._root).key;
4249             return null;
4250           };
4251           Tree2.prototype.max = function() {
4252             if (this._root)
4253               return this.maxNode(this._root).key;
4254             return null;
4255           };
4256           Tree2.prototype.minNode = function(t) {
4257             if (t === void 0) {
4258               t = this._root;
4259             }
4260             if (t)
4261               while (t.left) {
4262                 t = t.left;
4263               }
4264             return t;
4265           };
4266           Tree2.prototype.maxNode = function(t) {
4267             if (t === void 0) {
4268               t = this._root;
4269             }
4270             if (t)
4271               while (t.right) {
4272                 t = t.right;
4273               }
4274             return t;
4275           };
4276           Tree2.prototype.at = function(index2) {
4277             var current = this._root;
4278             var done = false;
4279             var i2 = 0;
4280             var Q = [];
4281             while (!done) {
4282               if (current) {
4283                 Q.push(current);
4284                 current = current.left;
4285               } else {
4286                 if (Q.length > 0) {
4287                   current = Q.pop();
4288                   if (i2 === index2)
4289                     return current;
4290                   i2++;
4291                   current = current.right;
4292                 } else
4293                   done = true;
4294               }
4295             }
4296             return null;
4297           };
4298           Tree2.prototype.next = function(d) {
4299             var root3 = this._root;
4300             var successor = null;
4301             if (d.right) {
4302               successor = d.right;
4303               while (successor.left) {
4304                 successor = successor.left;
4305               }
4306               return successor;
4307             }
4308             var comparator = this._comparator;
4309             while (root3) {
4310               var cmp2 = comparator(d.key, root3.key);
4311               if (cmp2 === 0)
4312                 break;
4313               else if (cmp2 < 0) {
4314                 successor = root3;
4315                 root3 = root3.left;
4316               } else
4317                 root3 = root3.right;
4318             }
4319             return successor;
4320           };
4321           Tree2.prototype.prev = function(d) {
4322             var root3 = this._root;
4323             var predecessor = null;
4324             if (d.left !== null) {
4325               predecessor = d.left;
4326               while (predecessor.right) {
4327                 predecessor = predecessor.right;
4328               }
4329               return predecessor;
4330             }
4331             var comparator = this._comparator;
4332             while (root3) {
4333               var cmp2 = comparator(d.key, root3.key);
4334               if (cmp2 === 0)
4335                 break;
4336               else if (cmp2 < 0)
4337                 root3 = root3.left;
4338               else {
4339                 predecessor = root3;
4340                 root3 = root3.right;
4341               }
4342             }
4343             return predecessor;
4344           };
4345           Tree2.prototype.clear = function() {
4346             this._root = null;
4347             this._size = 0;
4348             return this;
4349           };
4350           Tree2.prototype.toList = function() {
4351             return toList(this._root);
4352           };
4353           Tree2.prototype.load = function(keys, values, presort) {
4354             if (values === void 0) {
4355               values = [];
4356             }
4357             if (presort === void 0) {
4358               presort = false;
4359             }
4360             var size = keys.length;
4361             var comparator = this._comparator;
4362             if (presort)
4363               sort(keys, values, 0, size - 1, comparator);
4364             if (this._root === null) {
4365               this._root = loadRecursive(keys, values, 0, size);
4366               this._size = size;
4367             } else {
4368               var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);
4369               size = this._size + size;
4370               this._root = sortedListToBST({
4371                 head: mergedList
4372               }, 0, size);
4373             }
4374             return this;
4375           };
4376           Tree2.prototype.isEmpty = function() {
4377             return this._root === null;
4378           };
4379           Object.defineProperty(Tree2.prototype, "size", {
4380             get: function get3() {
4381               return this._size;
4382             },
4383             enumerable: true,
4384             configurable: true
4385           });
4386           Object.defineProperty(Tree2.prototype, "root", {
4387             get: function get3() {
4388               return this._root;
4389             },
4390             enumerable: true,
4391             configurable: true
4392           });
4393           Tree2.prototype.toString = function(printNode) {
4394             if (printNode === void 0) {
4395               printNode = function printNode2(n2) {
4396                 return String(n2.key);
4397               };
4398             }
4399             var out = [];
4400             printRow(this._root, "", true, function(v) {
4401               return out.push(v);
4402             }, printNode);
4403             return out.join("");
4404           };
4405           Tree2.prototype.update = function(key, newKey, newData) {
4406             var comparator = this._comparator;
4407             var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4408             if (comparator(key, newKey) < 0) {
4409               right = insert(newKey, newData, right, comparator);
4410             } else {
4411               left = insert(newKey, newData, left, comparator);
4412             }
4413             this._root = merge3(left, right, comparator);
4414           };
4415           Tree2.prototype.split = function(key) {
4416             return split(key, this._root, this._comparator);
4417           };
4418           return Tree2;
4419         }();
4420         function loadRecursive(keys, values, start2, end) {
4421           var size = end - start2;
4422           if (size > 0) {
4423             var middle = start2 + Math.floor(size / 2);
4424             var key = keys[middle];
4425             var data = values[middle];
4426             var node = new Node(key, data);
4427             node.left = loadRecursive(keys, values, start2, middle);
4428             node.right = loadRecursive(keys, values, middle + 1, end);
4429             return node;
4430           }
4431           return null;
4432         }
4433         function createList(keys, values) {
4434           var head = new Node(null, null);
4435           var p = head;
4436           for (var i2 = 0; i2 < keys.length; i2++) {
4437             p = p.next = new Node(keys[i2], values[i2]);
4438           }
4439           p.next = null;
4440           return head.next;
4441         }
4442         function toList(root3) {
4443           var current = root3;
4444           var Q = [];
4445           var done = false;
4446           var head = new Node(null, null);
4447           var p = head;
4448           while (!done) {
4449             if (current) {
4450               Q.push(current);
4451               current = current.left;
4452             } else {
4453               if (Q.length > 0) {
4454                 current = p = p.next = Q.pop();
4455                 current = current.right;
4456               } else
4457                 done = true;
4458             }
4459           }
4460           p.next = null;
4461           return head.next;
4462         }
4463         function sortedListToBST(list, start2, end) {
4464           var size = end - start2;
4465           if (size > 0) {
4466             var middle = start2 + Math.floor(size / 2);
4467             var left = sortedListToBST(list, start2, middle);
4468             var root3 = list.head;
4469             root3.left = left;
4470             list.head = list.head.next;
4471             root3.right = sortedListToBST(list, middle + 1, end);
4472             return root3;
4473           }
4474           return null;
4475         }
4476         function mergeLists(l1, l2, compare) {
4477           var head = new Node(null, null);
4478           var p = head;
4479           var p1 = l1;
4480           var p2 = l2;
4481           while (p1 !== null && p2 !== null) {
4482             if (compare(p1.key, p2.key) < 0) {
4483               p.next = p1;
4484               p1 = p1.next;
4485             } else {
4486               p.next = p2;
4487               p2 = p2.next;
4488             }
4489             p = p.next;
4490           }
4491           if (p1 !== null) {
4492             p.next = p1;
4493           } else if (p2 !== null) {
4494             p.next = p2;
4495           }
4496           return head.next;
4497         }
4498         function sort(keys, values, left, right, compare) {
4499           if (left >= right)
4500             return;
4501           var pivot = keys[left + right >> 1];
4502           var i2 = left - 1;
4503           var j2 = right + 1;
4504           while (true) {
4505             do {
4506               i2++;
4507             } while (compare(keys[i2], pivot) < 0);
4508             do {
4509               j2--;
4510             } while (compare(keys[j2], pivot) > 0);
4511             if (i2 >= j2)
4512               break;
4513             var tmp = keys[i2];
4514             keys[i2] = keys[j2];
4515             keys[j2] = tmp;
4516             tmp = values[i2];
4517             values[i2] = values[j2];
4518             values[j2] = tmp;
4519           }
4520           sort(keys, values, left, j2, compare);
4521           sort(keys, values, j2 + 1, right, compare);
4522         }
4523         var isInBbox = function isInBbox2(bbox, point) {
4524           return bbox.ll.x <= point.x && point.x <= bbox.ur.x && bbox.ll.y <= point.y && point.y <= bbox.ur.y;
4525         };
4526         var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4527           if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y)
4528             return null;
4529           var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4530           var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4531           var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4532           var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4533           return {
4534             ll: {
4535               x: lowerX,
4536               y: lowerY
4537             },
4538             ur: {
4539               x: upperX,
4540               y: upperY
4541             }
4542           };
4543         };
4544         var epsilon3 = Number.EPSILON;
4545         if (epsilon3 === void 0)
4546           epsilon3 = Math.pow(2, -52);
4547         var EPSILON_SQ = epsilon3 * epsilon3;
4548         var cmp = function cmp2(a, b) {
4549           if (-epsilon3 < a && a < epsilon3) {
4550             if (-epsilon3 < b && b < epsilon3) {
4551               return 0;
4552             }
4553           }
4554           var ab = a - b;
4555           if (ab * ab < EPSILON_SQ * a * b) {
4556             return 0;
4557           }
4558           return a < b ? -1 : 1;
4559         };
4560         var PtRounder = /* @__PURE__ */ function() {
4561           function PtRounder2() {
4562             _classCallCheck(this, PtRounder2);
4563             this.reset();
4564           }
4565           _createClass(PtRounder2, [{
4566             key: "reset",
4567             value: function reset() {
4568               this.xRounder = new CoordRounder();
4569               this.yRounder = new CoordRounder();
4570             }
4571           }, {
4572             key: "round",
4573             value: function round(x, y) {
4574               return {
4575                 x: this.xRounder.round(x),
4576                 y: this.yRounder.round(y)
4577               };
4578             }
4579           }]);
4580           return PtRounder2;
4581         }();
4582         var CoordRounder = /* @__PURE__ */ function() {
4583           function CoordRounder2() {
4584             _classCallCheck(this, CoordRounder2);
4585             this.tree = new Tree();
4586             this.round(0);
4587           }
4588           _createClass(CoordRounder2, [{
4589             key: "round",
4590             value: function round(coord2) {
4591               var node = this.tree.add(coord2);
4592               var prevNode = this.tree.prev(node);
4593               if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4594                 this.tree.remove(coord2);
4595                 return prevNode.key;
4596               }
4597               var nextNode = this.tree.next(node);
4598               if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4599                 this.tree.remove(coord2);
4600                 return nextNode.key;
4601               }
4602               return coord2;
4603             }
4604           }]);
4605           return CoordRounder2;
4606         }();
4607         var rounder = new PtRounder();
4608         var crossProduct = function crossProduct2(a, b) {
4609           return a.x * b.y - a.y * b.x;
4610         };
4611         var dotProduct = function dotProduct2(a, b) {
4612           return a.x * b.x + a.y * b.y;
4613         };
4614         var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4615           var v1 = {
4616             x: endPt1.x - basePt.x,
4617             y: endPt1.y - basePt.y
4618           };
4619           var v2 = {
4620             x: endPt2.x - basePt.x,
4621             y: endPt2.y - basePt.y
4622           };
4623           var kross = crossProduct(v1, v2);
4624           return cmp(kross, 0);
4625         };
4626         var length = function length2(v) {
4627           return Math.sqrt(dotProduct(v, v));
4628         };
4629         var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4630           var vBase = {
4631             x: pBase.x - pShared.x,
4632             y: pBase.y - pShared.y
4633           };
4634           var vAngle = {
4635             x: pAngle.x - pShared.x,
4636             y: pAngle.y - pShared.y
4637           };
4638           return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4639         };
4640         var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4641           var vBase = {
4642             x: pBase.x - pShared.x,
4643             y: pBase.y - pShared.y
4644           };
4645           var vAngle = {
4646             x: pAngle.x - pShared.x,
4647             y: pAngle.y - pShared.y
4648           };
4649           return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4650         };
4651         var horizontalIntersection = function horizontalIntersection2(pt, v, y) {
4652           if (v.y === 0)
4653             return null;
4654           return {
4655             x: pt.x + v.x / v.y * (y - pt.y),
4656             y
4657           };
4658         };
4659         var verticalIntersection = function verticalIntersection2(pt, v, x) {
4660           if (v.x === 0)
4661             return null;
4662           return {
4663             x,
4664             y: pt.y + v.y / v.x * (x - pt.x)
4665           };
4666         };
4667         var intersection = function intersection2(pt1, v1, pt2, v2) {
4668           if (v1.x === 0)
4669             return verticalIntersection(pt2, v2, pt1.x);
4670           if (v2.x === 0)
4671             return verticalIntersection(pt1, v1, pt2.x);
4672           if (v1.y === 0)
4673             return horizontalIntersection(pt2, v2, pt1.y);
4674           if (v2.y === 0)
4675             return horizontalIntersection(pt1, v1, pt2.y);
4676           var kross = crossProduct(v1, v2);
4677           if (kross == 0)
4678             return null;
4679           var ve = {
4680             x: pt2.x - pt1.x,
4681             y: pt2.y - pt1.y
4682           };
4683           var d1 = crossProduct(ve, v1) / kross;
4684           var d2 = crossProduct(ve, v2) / kross;
4685           var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4686           var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4687           var x = (x12 + x2) / 2;
4688           var y = (y12 + y2) / 2;
4689           return {
4690             x,
4691             y
4692           };
4693         };
4694         var SweepEvent = /* @__PURE__ */ function() {
4695           _createClass(SweepEvent2, null, [{
4696             key: "compare",
4697             value: function compare(a, b) {
4698               var ptCmp = SweepEvent2.comparePoints(a.point, b.point);
4699               if (ptCmp !== 0)
4700                 return ptCmp;
4701               if (a.point !== b.point)
4702                 a.link(b);
4703               if (a.isLeft !== b.isLeft)
4704                 return a.isLeft ? 1 : -1;
4705               return Segment.compare(a.segment, b.segment);
4706             }
4707           }, {
4708             key: "comparePoints",
4709             value: function comparePoints(aPt, bPt) {
4710               if (aPt.x < bPt.x)
4711                 return -1;
4712               if (aPt.x > bPt.x)
4713                 return 1;
4714               if (aPt.y < bPt.y)
4715                 return -1;
4716               if (aPt.y > bPt.y)
4717                 return 1;
4718               return 0;
4719             }
4720           }]);
4721           function SweepEvent2(point, isLeft) {
4722             _classCallCheck(this, SweepEvent2);
4723             if (point.events === void 0)
4724               point.events = [this];
4725             else
4726               point.events.push(this);
4727             this.point = point;
4728             this.isLeft = isLeft;
4729           }
4730           _createClass(SweepEvent2, [{
4731             key: "link",
4732             value: function link2(other) {
4733               if (other.point === this.point) {
4734                 throw new Error("Tried to link already linked events");
4735               }
4736               var otherEvents = other.point.events;
4737               for (var i2 = 0, iMax = otherEvents.length; i2 < iMax; i2++) {
4738                 var evt = otherEvents[i2];
4739                 this.point.events.push(evt);
4740                 evt.point = this.point;
4741               }
4742               this.checkForConsuming();
4743             }
4744           }, {
4745             key: "checkForConsuming",
4746             value: function checkForConsuming() {
4747               var numEvents = this.point.events.length;
4748               for (var i2 = 0; i2 < numEvents; i2++) {
4749                 var evt1 = this.point.events[i2];
4750                 if (evt1.segment.consumedBy !== void 0)
4751                   continue;
4752                 for (var j2 = i2 + 1; j2 < numEvents; j2++) {
4753                   var evt2 = this.point.events[j2];
4754                   if (evt2.consumedBy !== void 0)
4755                     continue;
4756                   if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4757                     continue;
4758                   evt1.segment.consume(evt2.segment);
4759                 }
4760               }
4761             }
4762           }, {
4763             key: "getAvailableLinkedEvents",
4764             value: function getAvailableLinkedEvents() {
4765               var events = [];
4766               for (var i2 = 0, iMax = this.point.events.length; i2 < iMax; i2++) {
4767                 var evt = this.point.events[i2];
4768                 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4769                   events.push(evt);
4770                 }
4771               }
4772               return events;
4773             }
4774           }, {
4775             key: "getLeftmostComparator",
4776             value: function getLeftmostComparator(baseEvent) {
4777               var _this = this;
4778               var cache = /* @__PURE__ */ new Map();
4779               var fillCache = function fillCache2(linkedEvent) {
4780                 var nextEvent = linkedEvent.otherSE;
4781                 cache.set(linkedEvent, {
4782                   sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4783                   cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4784                 });
4785               };
4786               return function(a, b) {
4787                 if (!cache.has(a))
4788                   fillCache(a);
4789                 if (!cache.has(b))
4790                   fillCache(b);
4791                 var _cache$get = cache.get(a), asine = _cache$get.sine, acosine = _cache$get.cosine;
4792                 var _cache$get2 = cache.get(b), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4793                 if (asine >= 0 && bsine >= 0) {
4794                   if (acosine < bcosine)
4795                     return 1;
4796                   if (acosine > bcosine)
4797                     return -1;
4798                   return 0;
4799                 }
4800                 if (asine < 0 && bsine < 0) {
4801                   if (acosine < bcosine)
4802                     return -1;
4803                   if (acosine > bcosine)
4804                     return 1;
4805                   return 0;
4806                 }
4807                 if (bsine < asine)
4808                   return -1;
4809                 if (bsine > asine)
4810                   return 1;
4811                 return 0;
4812               };
4813             }
4814           }]);
4815           return SweepEvent2;
4816         }();
4817         var segmentId = 0;
4818         var Segment = /* @__PURE__ */ function() {
4819           _createClass(Segment2, null, [{
4820             key: "compare",
4821             value: function compare(a, b) {
4822               var alx = a.leftSE.point.x;
4823               var blx = b.leftSE.point.x;
4824               var arx = a.rightSE.point.x;
4825               var brx = b.rightSE.point.x;
4826               if (brx < alx)
4827                 return 1;
4828               if (arx < blx)
4829                 return -1;
4830               var aly = a.leftSE.point.y;
4831               var bly = b.leftSE.point.y;
4832               var ary = a.rightSE.point.y;
4833               var bry = b.rightSE.point.y;
4834               if (alx < blx) {
4835                 if (bly < aly && bly < ary)
4836                   return 1;
4837                 if (bly > aly && bly > ary)
4838                   return -1;
4839                 var aCmpBLeft = a.comparePoint(b.leftSE.point);
4840                 if (aCmpBLeft < 0)
4841                   return 1;
4842                 if (aCmpBLeft > 0)
4843                   return -1;
4844                 var bCmpARight = b.comparePoint(a.rightSE.point);
4845                 if (bCmpARight !== 0)
4846                   return bCmpARight;
4847                 return -1;
4848               }
4849               if (alx > blx) {
4850                 if (aly < bly && aly < bry)
4851                   return -1;
4852                 if (aly > bly && aly > bry)
4853                   return 1;
4854                 var bCmpALeft = b.comparePoint(a.leftSE.point);
4855                 if (bCmpALeft !== 0)
4856                   return bCmpALeft;
4857                 var aCmpBRight = a.comparePoint(b.rightSE.point);
4858                 if (aCmpBRight < 0)
4859                   return 1;
4860                 if (aCmpBRight > 0)
4861                   return -1;
4862                 return 1;
4863               }
4864               if (aly < bly)
4865                 return -1;
4866               if (aly > bly)
4867                 return 1;
4868               if (arx < brx) {
4869                 var _bCmpARight = b.comparePoint(a.rightSE.point);
4870                 if (_bCmpARight !== 0)
4871                   return _bCmpARight;
4872               }
4873               if (arx > brx) {
4874                 var _aCmpBRight = a.comparePoint(b.rightSE.point);
4875                 if (_aCmpBRight < 0)
4876                   return 1;
4877                 if (_aCmpBRight > 0)
4878                   return -1;
4879               }
4880               if (arx !== brx) {
4881                 var ay = ary - aly;
4882                 var ax = arx - alx;
4883                 var by = bry - bly;
4884                 var bx = brx - blx;
4885                 if (ay > ax && by < bx)
4886                   return 1;
4887                 if (ay < ax && by > bx)
4888                   return -1;
4889               }
4890               if (arx > brx)
4891                 return 1;
4892               if (arx < brx)
4893                 return -1;
4894               if (ary < bry)
4895                 return -1;
4896               if (ary > bry)
4897                 return 1;
4898               if (a.id < b.id)
4899                 return -1;
4900               if (a.id > b.id)
4901                 return 1;
4902               return 0;
4903             }
4904           }]);
4905           function Segment2(leftSE, rightSE, rings, windings) {
4906             _classCallCheck(this, Segment2);
4907             this.id = ++segmentId;
4908             this.leftSE = leftSE;
4909             leftSE.segment = this;
4910             leftSE.otherSE = rightSE;
4911             this.rightSE = rightSE;
4912             rightSE.segment = this;
4913             rightSE.otherSE = leftSE;
4914             this.rings = rings;
4915             this.windings = windings;
4916           }
4917           _createClass(Segment2, [{
4918             key: "replaceRightSE",
4919             value: function replaceRightSE(newRightSE) {
4920               this.rightSE = newRightSE;
4921               this.rightSE.segment = this;
4922               this.rightSE.otherSE = this.leftSE;
4923               this.leftSE.otherSE = this.rightSE;
4924             }
4925           }, {
4926             key: "bbox",
4927             value: function bbox() {
4928               var y12 = this.leftSE.point.y;
4929               var y2 = this.rightSE.point.y;
4930               return {
4931                 ll: {
4932                   x: this.leftSE.point.x,
4933                   y: y12 < y2 ? y12 : y2
4934                 },
4935                 ur: {
4936                   x: this.rightSE.point.x,
4937                   y: y12 > y2 ? y12 : y2
4938                 }
4939               };
4940             }
4941           }, {
4942             key: "vector",
4943             value: function vector() {
4944               return {
4945                 x: this.rightSE.point.x - this.leftSE.point.x,
4946                 y: this.rightSE.point.y - this.leftSE.point.y
4947               };
4948             }
4949           }, {
4950             key: "isAnEndpoint",
4951             value: function isAnEndpoint(pt) {
4952               return pt.x === this.leftSE.point.x && pt.y === this.leftSE.point.y || pt.x === this.rightSE.point.x && pt.y === this.rightSE.point.y;
4953             }
4954           }, {
4955             key: "comparePoint",
4956             value: function comparePoint(point) {
4957               if (this.isAnEndpoint(point))
4958                 return 0;
4959               var lPt = this.leftSE.point;
4960               var rPt = this.rightSE.point;
4961               var v = this.vector();
4962               if (lPt.x === rPt.x) {
4963                 if (point.x === lPt.x)
4964                   return 0;
4965                 return point.x < lPt.x ? 1 : -1;
4966               }
4967               var yDist = (point.y - lPt.y) / v.y;
4968               var xFromYDist = lPt.x + yDist * v.x;
4969               if (point.x === xFromYDist)
4970                 return 0;
4971               var xDist = (point.x - lPt.x) / v.x;
4972               var yFromXDist = lPt.y + xDist * v.y;
4973               if (point.y === yFromXDist)
4974                 return 0;
4975               return point.y < yFromXDist ? -1 : 1;
4976             }
4977           }, {
4978             key: "getIntersection",
4979             value: function getIntersection(other) {
4980               var tBbox = this.bbox();
4981               var oBbox = other.bbox();
4982               var bboxOverlap = getBboxOverlap(tBbox, oBbox);
4983               if (bboxOverlap === null)
4984                 return null;
4985               var tlp = this.leftSE.point;
4986               var trp = this.rightSE.point;
4987               var olp = other.leftSE.point;
4988               var orp = other.rightSE.point;
4989               var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
4990               var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
4991               var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
4992               var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
4993               if (touchesThisLSE && touchesOtherLSE) {
4994                 if (touchesThisRSE && !touchesOtherRSE)
4995                   return trp;
4996                 if (!touchesThisRSE && touchesOtherRSE)
4997                   return orp;
4998                 return null;
4999               }
5000               if (touchesThisLSE) {
5001                 if (touchesOtherRSE) {
5002                   if (tlp.x === orp.x && tlp.y === orp.y)
5003                     return null;
5004                 }
5005                 return tlp;
5006               }
5007               if (touchesOtherLSE) {
5008                 if (touchesThisRSE) {
5009                   if (trp.x === olp.x && trp.y === olp.y)
5010                     return null;
5011                 }
5012                 return olp;
5013               }
5014               if (touchesThisRSE && touchesOtherRSE)
5015                 return null;
5016               if (touchesThisRSE)
5017                 return trp;
5018               if (touchesOtherRSE)
5019                 return orp;
5020               var pt = intersection(tlp, this.vector(), olp, other.vector());
5021               if (pt === null)
5022                 return null;
5023               if (!isInBbox(bboxOverlap, pt))
5024                 return null;
5025               return rounder.round(pt.x, pt.y);
5026             }
5027           }, {
5028             key: "split",
5029             value: function split2(point) {
5030               var newEvents = [];
5031               var alreadyLinked = point.events !== void 0;
5032               var newLeftSE = new SweepEvent(point, true);
5033               var newRightSE = new SweepEvent(point, false);
5034               var oldRightSE = this.rightSE;
5035               this.replaceRightSE(newRightSE);
5036               newEvents.push(newRightSE);
5037               newEvents.push(newLeftSE);
5038               var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5039               if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5040                 newSeg.swapEvents();
5041               }
5042               if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5043                 this.swapEvents();
5044               }
5045               if (alreadyLinked) {
5046                 newLeftSE.checkForConsuming();
5047                 newRightSE.checkForConsuming();
5048               }
5049               return newEvents;
5050             }
5051           }, {
5052             key: "swapEvents",
5053             value: function swapEvents() {
5054               var tmpEvt = this.rightSE;
5055               this.rightSE = this.leftSE;
5056               this.leftSE = tmpEvt;
5057               this.leftSE.isLeft = true;
5058               this.rightSE.isLeft = false;
5059               for (var i2 = 0, iMax = this.windings.length; i2 < iMax; i2++) {
5060                 this.windings[i2] *= -1;
5061               }
5062             }
5063           }, {
5064             key: "consume",
5065             value: function consume(other) {
5066               var consumer = this;
5067               var consumee = other;
5068               while (consumer.consumedBy) {
5069                 consumer = consumer.consumedBy;
5070               }
5071               while (consumee.consumedBy) {
5072                 consumee = consumee.consumedBy;
5073               }
5074               var cmp2 = Segment2.compare(consumer, consumee);
5075               if (cmp2 === 0)
5076                 return;
5077               if (cmp2 > 0) {
5078                 var tmp = consumer;
5079                 consumer = consumee;
5080                 consumee = tmp;
5081               }
5082               if (consumer.prev === consumee) {
5083                 var _tmp = consumer;
5084                 consumer = consumee;
5085                 consumee = _tmp;
5086               }
5087               for (var i2 = 0, iMax = consumee.rings.length; i2 < iMax; i2++) {
5088                 var ring = consumee.rings[i2];
5089                 var winding = consumee.windings[i2];
5090                 var index2 = consumer.rings.indexOf(ring);
5091                 if (index2 === -1) {
5092                   consumer.rings.push(ring);
5093                   consumer.windings.push(winding);
5094                 } else
5095                   consumer.windings[index2] += winding;
5096               }
5097               consumee.rings = null;
5098               consumee.windings = null;
5099               consumee.consumedBy = consumer;
5100               consumee.leftSE.consumedBy = consumer.leftSE;
5101               consumee.rightSE.consumedBy = consumer.rightSE;
5102             }
5103           }, {
5104             key: "prevInResult",
5105             value: function prevInResult() {
5106               if (this._prevInResult !== void 0)
5107                 return this._prevInResult;
5108               if (!this.prev)
5109                 this._prevInResult = null;
5110               else if (this.prev.isInResult())
5111                 this._prevInResult = this.prev;
5112               else
5113                 this._prevInResult = this.prev.prevInResult();
5114               return this._prevInResult;
5115             }
5116           }, {
5117             key: "beforeState",
5118             value: function beforeState() {
5119               if (this._beforeState !== void 0)
5120                 return this._beforeState;
5121               if (!this.prev)
5122                 this._beforeState = {
5123                   rings: [],
5124                   windings: [],
5125                   multiPolys: []
5126                 };
5127               else {
5128                 var seg = this.prev.consumedBy || this.prev;
5129                 this._beforeState = seg.afterState();
5130               }
5131               return this._beforeState;
5132             }
5133           }, {
5134             key: "afterState",
5135             value: function afterState() {
5136               if (this._afterState !== void 0)
5137                 return this._afterState;
5138               var beforeState = this.beforeState();
5139               this._afterState = {
5140                 rings: beforeState.rings.slice(0),
5141                 windings: beforeState.windings.slice(0),
5142                 multiPolys: []
5143               };
5144               var ringsAfter = this._afterState.rings;
5145               var windingsAfter = this._afterState.windings;
5146               var mpsAfter = this._afterState.multiPolys;
5147               for (var i2 = 0, iMax = this.rings.length; i2 < iMax; i2++) {
5148                 var ring = this.rings[i2];
5149                 var winding = this.windings[i2];
5150                 var index2 = ringsAfter.indexOf(ring);
5151                 if (index2 === -1) {
5152                   ringsAfter.push(ring);
5153                   windingsAfter.push(winding);
5154                 } else
5155                   windingsAfter[index2] += winding;
5156               }
5157               var polysAfter = [];
5158               var polysExclude = [];
5159               for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5160                 if (windingsAfter[_i] === 0)
5161                   continue;
5162                 var _ring = ringsAfter[_i];
5163                 var poly = _ring.poly;
5164                 if (polysExclude.indexOf(poly) !== -1)
5165                   continue;
5166                 if (_ring.isExterior)
5167                   polysAfter.push(poly);
5168                 else {
5169                   if (polysExclude.indexOf(poly) === -1)
5170                     polysExclude.push(poly);
5171                   var _index = polysAfter.indexOf(_ring.poly);
5172                   if (_index !== -1)
5173                     polysAfter.splice(_index, 1);
5174                 }
5175               }
5176               for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5177                 var mp = polysAfter[_i2].multiPoly;
5178                 if (mpsAfter.indexOf(mp) === -1)
5179                   mpsAfter.push(mp);
5180               }
5181               return this._afterState;
5182             }
5183           }, {
5184             key: "isInResult",
5185             value: function isInResult() {
5186               if (this.consumedBy)
5187                 return false;
5188               if (this._isInResult !== void 0)
5189                 return this._isInResult;
5190               var mpsBefore = this.beforeState().multiPolys;
5191               var mpsAfter = this.afterState().multiPolys;
5192               switch (operation.type) {
5193                 case "union": {
5194                   var noBefores = mpsBefore.length === 0;
5195                   var noAfters = mpsAfter.length === 0;
5196                   this._isInResult = noBefores !== noAfters;
5197                   break;
5198                 }
5199                 case "intersection": {
5200                   var least;
5201                   var most;
5202                   if (mpsBefore.length < mpsAfter.length) {
5203                     least = mpsBefore.length;
5204                     most = mpsAfter.length;
5205                   } else {
5206                     least = mpsAfter.length;
5207                     most = mpsBefore.length;
5208                   }
5209                   this._isInResult = most === operation.numMultiPolys && least < most;
5210                   break;
5211                 }
5212                 case "xor": {
5213                   var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5214                   this._isInResult = diff % 2 === 1;
5215                   break;
5216                 }
5217                 case "difference": {
5218                   var isJustSubject = function isJustSubject2(mps) {
5219                     return mps.length === 1 && mps[0].isSubject;
5220                   };
5221                   this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5222                   break;
5223                 }
5224                 default:
5225                   throw new Error("Unrecognized operation type found ".concat(operation.type));
5226               }
5227               return this._isInResult;
5228             }
5229           }], [{
5230             key: "fromRing",
5231             value: function fromRing(pt1, pt2, ring) {
5232               var leftPt, rightPt, winding;
5233               var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5234               if (cmpPts < 0) {
5235                 leftPt = pt1;
5236                 rightPt = pt2;
5237                 winding = 1;
5238               } else if (cmpPts > 0) {
5239                 leftPt = pt2;
5240                 rightPt = pt1;
5241                 winding = -1;
5242               } else
5243                 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5244               var leftSE = new SweepEvent(leftPt, true);
5245               var rightSE = new SweepEvent(rightPt, false);
5246               return new Segment2(leftSE, rightSE, [ring], [winding]);
5247             }
5248           }]);
5249           return Segment2;
5250         }();
5251         var RingIn = /* @__PURE__ */ function() {
5252           function RingIn2(geomRing, poly, isExterior) {
5253             _classCallCheck(this, RingIn2);
5254             if (!Array.isArray(geomRing) || geomRing.length === 0) {
5255               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5256             }
5257             this.poly = poly;
5258             this.isExterior = isExterior;
5259             this.segments = [];
5260             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5261               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5262             }
5263             var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5264             this.bbox = {
5265               ll: {
5266                 x: firstPoint.x,
5267                 y: firstPoint.y
5268               },
5269               ur: {
5270                 x: firstPoint.x,
5271                 y: firstPoint.y
5272               }
5273             };
5274             var prevPoint = firstPoint;
5275             for (var i2 = 1, iMax = geomRing.length; i2 < iMax; i2++) {
5276               if (typeof geomRing[i2][0] !== "number" || typeof geomRing[i2][1] !== "number") {
5277                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5278               }
5279               var point = rounder.round(geomRing[i2][0], geomRing[i2][1]);
5280               if (point.x === prevPoint.x && point.y === prevPoint.y)
5281                 continue;
5282               this.segments.push(Segment.fromRing(prevPoint, point, this));
5283               if (point.x < this.bbox.ll.x)
5284                 this.bbox.ll.x = point.x;
5285               if (point.y < this.bbox.ll.y)
5286                 this.bbox.ll.y = point.y;
5287               if (point.x > this.bbox.ur.x)
5288                 this.bbox.ur.x = point.x;
5289               if (point.y > this.bbox.ur.y)
5290                 this.bbox.ur.y = point.y;
5291               prevPoint = point;
5292             }
5293             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5294               this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5295             }
5296           }
5297           _createClass(RingIn2, [{
5298             key: "getSweepEvents",
5299             value: function getSweepEvents() {
5300               var sweepEvents = [];
5301               for (var i2 = 0, iMax = this.segments.length; i2 < iMax; i2++) {
5302                 var segment = this.segments[i2];
5303                 sweepEvents.push(segment.leftSE);
5304                 sweepEvents.push(segment.rightSE);
5305               }
5306               return sweepEvents;
5307             }
5308           }]);
5309           return RingIn2;
5310         }();
5311         var PolyIn = /* @__PURE__ */ function() {
5312           function PolyIn2(geomPoly, multiPoly) {
5313             _classCallCheck(this, PolyIn2);
5314             if (!Array.isArray(geomPoly)) {
5315               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5316             }
5317             this.exteriorRing = new RingIn(geomPoly[0], this, true);
5318             this.bbox = {
5319               ll: {
5320                 x: this.exteriorRing.bbox.ll.x,
5321                 y: this.exteriorRing.bbox.ll.y
5322               },
5323               ur: {
5324                 x: this.exteriorRing.bbox.ur.x,
5325                 y: this.exteriorRing.bbox.ur.y
5326               }
5327             };
5328             this.interiorRings = [];
5329             for (var i2 = 1, iMax = geomPoly.length; i2 < iMax; i2++) {
5330               var ring = new RingIn(geomPoly[i2], this, false);
5331               if (ring.bbox.ll.x < this.bbox.ll.x)
5332                 this.bbox.ll.x = ring.bbox.ll.x;
5333               if (ring.bbox.ll.y < this.bbox.ll.y)
5334                 this.bbox.ll.y = ring.bbox.ll.y;
5335               if (ring.bbox.ur.x > this.bbox.ur.x)
5336                 this.bbox.ur.x = ring.bbox.ur.x;
5337               if (ring.bbox.ur.y > this.bbox.ur.y)
5338                 this.bbox.ur.y = ring.bbox.ur.y;
5339               this.interiorRings.push(ring);
5340             }
5341             this.multiPoly = multiPoly;
5342           }
5343           _createClass(PolyIn2, [{
5344             key: "getSweepEvents",
5345             value: function getSweepEvents() {
5346               var sweepEvents = this.exteriorRing.getSweepEvents();
5347               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5348                 var ringSweepEvents = this.interiorRings[i2].getSweepEvents();
5349                 for (var j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
5350                   sweepEvents.push(ringSweepEvents[j2]);
5351                 }
5352               }
5353               return sweepEvents;
5354             }
5355           }]);
5356           return PolyIn2;
5357         }();
5358         var MultiPolyIn = /* @__PURE__ */ function() {
5359           function MultiPolyIn2(geom, isSubject) {
5360             _classCallCheck(this, MultiPolyIn2);
5361             if (!Array.isArray(geom)) {
5362               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5363             }
5364             try {
5365               if (typeof geom[0][0][0] === "number")
5366                 geom = [geom];
5367             } catch (ex) {
5368             }
5369             this.polys = [];
5370             this.bbox = {
5371               ll: {
5372                 x: Number.POSITIVE_INFINITY,
5373                 y: Number.POSITIVE_INFINITY
5374               },
5375               ur: {
5376                 x: Number.NEGATIVE_INFINITY,
5377                 y: Number.NEGATIVE_INFINITY
5378               }
5379             };
5380             for (var i2 = 0, iMax = geom.length; i2 < iMax; i2++) {
5381               var poly = new PolyIn(geom[i2], this);
5382               if (poly.bbox.ll.x < this.bbox.ll.x)
5383                 this.bbox.ll.x = poly.bbox.ll.x;
5384               if (poly.bbox.ll.y < this.bbox.ll.y)
5385                 this.bbox.ll.y = poly.bbox.ll.y;
5386               if (poly.bbox.ur.x > this.bbox.ur.x)
5387                 this.bbox.ur.x = poly.bbox.ur.x;
5388               if (poly.bbox.ur.y > this.bbox.ur.y)
5389                 this.bbox.ur.y = poly.bbox.ur.y;
5390               this.polys.push(poly);
5391             }
5392             this.isSubject = isSubject;
5393           }
5394           _createClass(MultiPolyIn2, [{
5395             key: "getSweepEvents",
5396             value: function getSweepEvents() {
5397               var sweepEvents = [];
5398               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5399                 var polySweepEvents = this.polys[i2].getSweepEvents();
5400                 for (var j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
5401                   sweepEvents.push(polySweepEvents[j2]);
5402                 }
5403               }
5404               return sweepEvents;
5405             }
5406           }]);
5407           return MultiPolyIn2;
5408         }();
5409         var RingOut = /* @__PURE__ */ function() {
5410           _createClass(RingOut2, null, [{
5411             key: "factory",
5412             value: function factory(allSegments) {
5413               var ringsOut = [];
5414               for (var i2 = 0, iMax = allSegments.length; i2 < iMax; i2++) {
5415                 var segment = allSegments[i2];
5416                 if (!segment.isInResult() || segment.ringOut)
5417                   continue;
5418                 var prevEvent = null;
5419                 var event = segment.leftSE;
5420                 var nextEvent = segment.rightSE;
5421                 var events = [event];
5422                 var startingPoint = event.point;
5423                 var intersectionLEs = [];
5424                 while (true) {
5425                   prevEvent = event;
5426                   event = nextEvent;
5427                   events.push(event);
5428                   if (event.point === startingPoint)
5429                     break;
5430                   while (true) {
5431                     var availableLEs = event.getAvailableLinkedEvents();
5432                     if (availableLEs.length === 0) {
5433                       var firstPt = events[0].point;
5434                       var lastPt = events[events.length - 1].point;
5435                       throw new Error("Unable to complete output ring starting at [".concat(firstPt.x, ",") + " ".concat(firstPt.y, "]. Last matching segment found ends at") + " [".concat(lastPt.x, ", ").concat(lastPt.y, "]."));
5436                     }
5437                     if (availableLEs.length === 1) {
5438                       nextEvent = availableLEs[0].otherSE;
5439                       break;
5440                     }
5441                     var indexLE = null;
5442                     for (var j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
5443                       if (intersectionLEs[j2].point === event.point) {
5444                         indexLE = j2;
5445                         break;
5446                       }
5447                     }
5448                     if (indexLE !== null) {
5449                       var intersectionLE = intersectionLEs.splice(indexLE)[0];
5450                       var ringEvents = events.splice(intersectionLE.index);
5451                       ringEvents.unshift(ringEvents[0].otherSE);
5452                       ringsOut.push(new RingOut2(ringEvents.reverse()));
5453                       continue;
5454                     }
5455                     intersectionLEs.push({
5456                       index: events.length,
5457                       point: event.point
5458                     });
5459                     var comparator = event.getLeftmostComparator(prevEvent);
5460                     nextEvent = availableLEs.sort(comparator)[0].otherSE;
5461                     break;
5462                   }
5463                 }
5464                 ringsOut.push(new RingOut2(events));
5465               }
5466               return ringsOut;
5467             }
5468           }]);
5469           function RingOut2(events) {
5470             _classCallCheck(this, RingOut2);
5471             this.events = events;
5472             for (var i2 = 0, iMax = events.length; i2 < iMax; i2++) {
5473               events[i2].segment.ringOut = this;
5474             }
5475             this.poly = null;
5476           }
5477           _createClass(RingOut2, [{
5478             key: "getGeom",
5479             value: function getGeom2() {
5480               var prevPt = this.events[0].point;
5481               var points = [prevPt];
5482               for (var i2 = 1, iMax = this.events.length - 1; i2 < iMax; i2++) {
5483                 var _pt = this.events[i2].point;
5484                 var _nextPt = this.events[i2 + 1].point;
5485                 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5486                   continue;
5487                 points.push(_pt);
5488                 prevPt = _pt;
5489               }
5490               if (points.length === 1)
5491                 return null;
5492               var pt = points[0];
5493               var nextPt = points[1];
5494               if (compareVectorAngles(pt, prevPt, nextPt) === 0)
5495                 points.shift();
5496               points.push(points[0]);
5497               var step = this.isExteriorRing() ? 1 : -1;
5498               var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5499               var iEnd = this.isExteriorRing() ? points.length : -1;
5500               var orderedPoints = [];
5501               for (var _i = iStart; _i != iEnd; _i += step) {
5502                 orderedPoints.push([points[_i].x, points[_i].y]);
5503               }
5504               return orderedPoints;
5505             }
5506           }, {
5507             key: "isExteriorRing",
5508             value: function isExteriorRing() {
5509               if (this._isExteriorRing === void 0) {
5510                 var enclosing = this.enclosingRing();
5511                 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5512               }
5513               return this._isExteriorRing;
5514             }
5515           }, {
5516             key: "enclosingRing",
5517             value: function enclosingRing() {
5518               if (this._enclosingRing === void 0) {
5519                 this._enclosingRing = this._calcEnclosingRing();
5520               }
5521               return this._enclosingRing;
5522             }
5523           }, {
5524             key: "_calcEnclosingRing",
5525             value: function _calcEnclosingRing() {
5526               var leftMostEvt = this.events[0];
5527               for (var i2 = 1, iMax = this.events.length; i2 < iMax; i2++) {
5528                 var evt = this.events[i2];
5529                 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5530                   leftMostEvt = evt;
5531               }
5532               var prevSeg = leftMostEvt.segment.prevInResult();
5533               var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5534               while (true) {
5535                 if (!prevSeg)
5536                   return null;
5537                 if (!prevPrevSeg)
5538                   return prevSeg.ringOut;
5539                 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5540                   if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5541                     return prevSeg.ringOut;
5542                   } else
5543                     return prevSeg.ringOut.enclosingRing();
5544                 }
5545                 prevSeg = prevPrevSeg.prevInResult();
5546                 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5547               }
5548             }
5549           }]);
5550           return RingOut2;
5551         }();
5552         var PolyOut = /* @__PURE__ */ function() {
5553           function PolyOut2(exteriorRing) {
5554             _classCallCheck(this, PolyOut2);
5555             this.exteriorRing = exteriorRing;
5556             exteriorRing.poly = this;
5557             this.interiorRings = [];
5558           }
5559           _createClass(PolyOut2, [{
5560             key: "addInterior",
5561             value: function addInterior(ring) {
5562               this.interiorRings.push(ring);
5563               ring.poly = this;
5564             }
5565           }, {
5566             key: "getGeom",
5567             value: function getGeom2() {
5568               var geom = [this.exteriorRing.getGeom()];
5569               if (geom[0] === null)
5570                 return null;
5571               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5572                 var ringGeom = this.interiorRings[i2].getGeom();
5573                 if (ringGeom === null)
5574                   continue;
5575                 geom.push(ringGeom);
5576               }
5577               return geom;
5578             }
5579           }]);
5580           return PolyOut2;
5581         }();
5582         var MultiPolyOut = /* @__PURE__ */ function() {
5583           function MultiPolyOut2(rings) {
5584             _classCallCheck(this, MultiPolyOut2);
5585             this.rings = rings;
5586             this.polys = this._composePolys(rings);
5587           }
5588           _createClass(MultiPolyOut2, [{
5589             key: "getGeom",
5590             value: function getGeom2() {
5591               var geom = [];
5592               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5593                 var polyGeom = this.polys[i2].getGeom();
5594                 if (polyGeom === null)
5595                   continue;
5596                 geom.push(polyGeom);
5597               }
5598               return geom;
5599             }
5600           }, {
5601             key: "_composePolys",
5602             value: function _composePolys(rings) {
5603               var polys = [];
5604               for (var i2 = 0, iMax = rings.length; i2 < iMax; i2++) {
5605                 var ring = rings[i2];
5606                 if (ring.poly)
5607                   continue;
5608                 if (ring.isExteriorRing())
5609                   polys.push(new PolyOut(ring));
5610                 else {
5611                   var enclosingRing = ring.enclosingRing();
5612                   if (!enclosingRing.poly)
5613                     polys.push(new PolyOut(enclosingRing));
5614                   enclosingRing.poly.addInterior(ring);
5615                 }
5616               }
5617               return polys;
5618             }
5619           }]);
5620           return MultiPolyOut2;
5621         }();
5622         var SweepLine = /* @__PURE__ */ function() {
5623           function SweepLine2(queue) {
5624             var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5625             _classCallCheck(this, SweepLine2);
5626             this.queue = queue;
5627             this.tree = new Tree(comparator);
5628             this.segments = [];
5629           }
5630           _createClass(SweepLine2, [{
5631             key: "process",
5632             value: function process2(event) {
5633               var segment = event.segment;
5634               var newEvents = [];
5635               if (event.consumedBy) {
5636                 if (event.isLeft)
5637                   this.queue.remove(event.otherSE);
5638                 else
5639                   this.tree.remove(segment);
5640                 return newEvents;
5641               }
5642               var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5643               if (!node)
5644                 throw new Error("Unable to find segment #".concat(segment.id, " ") + "[".concat(segment.leftSE.point.x, ", ").concat(segment.leftSE.point.y, "] -> ") + "[".concat(segment.rightSE.point.x, ", ").concat(segment.rightSE.point.y, "] ") + "in SweepLine tree. Please submit a bug report.");
5645               var prevNode = node;
5646               var nextNode = node;
5647               var prevSeg = void 0;
5648               var nextSeg = void 0;
5649               while (prevSeg === void 0) {
5650                 prevNode = this.tree.prev(prevNode);
5651                 if (prevNode === null)
5652                   prevSeg = null;
5653                 else if (prevNode.key.consumedBy === void 0)
5654                   prevSeg = prevNode.key;
5655               }
5656               while (nextSeg === void 0) {
5657                 nextNode = this.tree.next(nextNode);
5658                 if (nextNode === null)
5659                   nextSeg = null;
5660                 else if (nextNode.key.consumedBy === void 0)
5661                   nextSeg = nextNode.key;
5662               }
5663               if (event.isLeft) {
5664                 var prevMySplitter = null;
5665                 if (prevSeg) {
5666                   var prevInter = prevSeg.getIntersection(segment);
5667                   if (prevInter !== null) {
5668                     if (!segment.isAnEndpoint(prevInter))
5669                       prevMySplitter = prevInter;
5670                     if (!prevSeg.isAnEndpoint(prevInter)) {
5671                       var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5672                       for (var i2 = 0, iMax = newEventsFromSplit.length; i2 < iMax; i2++) {
5673                         newEvents.push(newEventsFromSplit[i2]);
5674                       }
5675                     }
5676                   }
5677                 }
5678                 var nextMySplitter = null;
5679                 if (nextSeg) {
5680                   var nextInter = nextSeg.getIntersection(segment);
5681                   if (nextInter !== null) {
5682                     if (!segment.isAnEndpoint(nextInter))
5683                       nextMySplitter = nextInter;
5684                     if (!nextSeg.isAnEndpoint(nextInter)) {
5685                       var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5686                       for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5687                         newEvents.push(_newEventsFromSplit[_i]);
5688                       }
5689                     }
5690                   }
5691                 }
5692                 if (prevMySplitter !== null || nextMySplitter !== null) {
5693                   var mySplitter = null;
5694                   if (prevMySplitter === null)
5695                     mySplitter = nextMySplitter;
5696                   else if (nextMySplitter === null)
5697                     mySplitter = prevMySplitter;
5698                   else {
5699                     var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5700                     mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5701                   }
5702                   this.queue.remove(segment.rightSE);
5703                   newEvents.push(segment.rightSE);
5704                   var _newEventsFromSplit2 = segment.split(mySplitter);
5705                   for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5706                     newEvents.push(_newEventsFromSplit2[_i2]);
5707                   }
5708                 }
5709                 if (newEvents.length > 0) {
5710                   this.tree.remove(segment);
5711                   newEvents.push(event);
5712                 } else {
5713                   this.segments.push(segment);
5714                   segment.prev = prevSeg;
5715                 }
5716               } else {
5717                 if (prevSeg && nextSeg) {
5718                   var inter = prevSeg.getIntersection(nextSeg);
5719                   if (inter !== null) {
5720                     if (!prevSeg.isAnEndpoint(inter)) {
5721                       var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5722                       for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5723                         newEvents.push(_newEventsFromSplit3[_i3]);
5724                       }
5725                     }
5726                     if (!nextSeg.isAnEndpoint(inter)) {
5727                       var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5728                       for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5729                         newEvents.push(_newEventsFromSplit4[_i4]);
5730                       }
5731                     }
5732                   }
5733                 }
5734                 this.tree.remove(segment);
5735               }
5736               return newEvents;
5737             }
5738           }, {
5739             key: "_splitSafely",
5740             value: function _splitSafely(seg, pt) {
5741               this.tree.remove(seg);
5742               var rightSE = seg.rightSE;
5743               this.queue.remove(rightSE);
5744               var newEvents = seg.split(pt);
5745               newEvents.push(rightSE);
5746               if (seg.consumedBy === void 0)
5747                 this.tree.insert(seg);
5748               return newEvents;
5749             }
5750           }]);
5751           return SweepLine2;
5752         }();
5753         var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5754         var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5755         var Operation = /* @__PURE__ */ function() {
5756           function Operation2() {
5757             _classCallCheck(this, Operation2);
5758           }
5759           _createClass(Operation2, [{
5760             key: "run",
5761             value: function run(type3, geom, moreGeoms) {
5762               operation.type = type3;
5763               rounder.reset();
5764               var multipolys = [new MultiPolyIn(geom, true)];
5765               for (var i2 = 0, iMax = moreGeoms.length; i2 < iMax; i2++) {
5766                 multipolys.push(new MultiPolyIn(moreGeoms[i2], false));
5767               }
5768               operation.numMultiPolys = multipolys.length;
5769               if (operation.type === "difference") {
5770                 var subject = multipolys[0];
5771                 var _i = 1;
5772                 while (_i < multipolys.length) {
5773                   if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5774                     _i++;
5775                   else
5776                     multipolys.splice(_i, 1);
5777                 }
5778               }
5779               if (operation.type === "intersection") {
5780                 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5781                   var mpA = multipolys[_i2];
5782                   for (var j2 = _i2 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
5783                     if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
5784                       return [];
5785                   }
5786                 }
5787               }
5788               var queue = new Tree(SweepEvent.compare);
5789               for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
5790                 var sweepEvents = multipolys[_i3].getSweepEvents();
5791                 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
5792                   queue.insert(sweepEvents[_j]);
5793                   if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5794                     throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
5795                   }
5796                 }
5797               }
5798               var sweepLine = new SweepLine(queue);
5799               var prevQueueSize = queue.size;
5800               var node = queue.pop();
5801               while (node) {
5802                 var evt = node.key;
5803                 if (queue.size === prevQueueSize) {
5804                   var seg = evt.segment;
5805                   throw new Error("Unable to pop() ".concat(evt.isLeft ? "left" : "right", " SweepEvent ") + "[".concat(evt.point.x, ", ").concat(evt.point.y, "] from segment #").concat(seg.id, " ") + "[".concat(seg.leftSE.point.x, ", ").concat(seg.leftSE.point.y, "] -> ") + "[".concat(seg.rightSE.point.x, ", ").concat(seg.rightSE.point.y, "] from queue. ") + "Please file a bug report.");
5806                 }
5807                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5808                   throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
5809                 }
5810                 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
5811                   throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
5812                 }
5813                 var newEvents = sweepLine.process(evt);
5814                 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
5815                   var _evt = newEvents[_i4];
5816                   if (_evt.consumedBy === void 0)
5817                     queue.insert(_evt);
5818                 }
5819                 prevQueueSize = queue.size;
5820                 node = queue.pop();
5821               }
5822               rounder.reset();
5823               var ringsOut = RingOut.factory(sweepLine.segments);
5824               var result = new MultiPolyOut(ringsOut);
5825               return result.getGeom();
5826             }
5827           }]);
5828           return Operation2;
5829         }();
5830         var operation = new Operation();
5831         var union = function union2(geom) {
5832           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5833             moreGeoms[_key - 1] = arguments[_key];
5834           }
5835           return operation.run("union", geom, moreGeoms);
5836         };
5837         var intersection$1 = function intersection2(geom) {
5838           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
5839             moreGeoms[_key2 - 1] = arguments[_key2];
5840           }
5841           return operation.run("intersection", geom, moreGeoms);
5842         };
5843         var xor = function xor2(geom) {
5844           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5845             moreGeoms[_key3 - 1] = arguments[_key3];
5846           }
5847           return operation.run("xor", geom, moreGeoms);
5848         };
5849         var difference = function difference2(subjectGeom) {
5850           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5851             clippingGeoms[_key4 - 1] = arguments[_key4];
5852           }
5853           return operation.run("difference", subjectGeom, clippingGeoms);
5854         };
5855         var index = {
5856           union,
5857           intersection: intersection$1,
5858           xor,
5859           difference
5860         };
5861         return index;
5862       });
5863     }
5864   });
5865
5866   // node_modules/geojson-precision/index.js
5867   var require_geojson_precision = __commonJS({
5868     "node_modules/geojson-precision/index.js"(exports2, module2) {
5869       (function() {
5870         function parse(t, coordinatePrecision, extrasPrecision) {
5871           function point(p) {
5872             return p.map(function(e, index) {
5873               if (index < 2) {
5874                 return 1 * e.toFixed(coordinatePrecision);
5875               } else {
5876                 return 1 * e.toFixed(extrasPrecision);
5877               }
5878             });
5879           }
5880           function multi(l) {
5881             return l.map(point);
5882           }
5883           function poly(p) {
5884             return p.map(multi);
5885           }
5886           function multiPoly(m) {
5887             return m.map(poly);
5888           }
5889           function geometry(obj) {
5890             if (!obj) {
5891               return {};
5892             }
5893             switch (obj.type) {
5894               case "Point":
5895                 obj.coordinates = point(obj.coordinates);
5896                 return obj;
5897               case "LineString":
5898               case "MultiPoint":
5899                 obj.coordinates = multi(obj.coordinates);
5900                 return obj;
5901               case "Polygon":
5902               case "MultiLineString":
5903                 obj.coordinates = poly(obj.coordinates);
5904                 return obj;
5905               case "MultiPolygon":
5906                 obj.coordinates = multiPoly(obj.coordinates);
5907                 return obj;
5908               case "GeometryCollection":
5909                 obj.geometries = obj.geometries.map(geometry);
5910                 return obj;
5911               default:
5912                 return {};
5913             }
5914           }
5915           function feature3(obj) {
5916             obj.geometry = geometry(obj.geometry);
5917             return obj;
5918           }
5919           function featureCollection(f2) {
5920             f2.features = f2.features.map(feature3);
5921             return f2;
5922           }
5923           function geometryCollection(g) {
5924             g.geometries = g.geometries.map(geometry);
5925             return g;
5926           }
5927           if (!t) {
5928             return t;
5929           }
5930           switch (t.type) {
5931             case "Feature":
5932               return feature3(t);
5933             case "GeometryCollection":
5934               return geometryCollection(t);
5935             case "FeatureCollection":
5936               return featureCollection(t);
5937             case "Point":
5938             case "LineString":
5939             case "Polygon":
5940             case "MultiPoint":
5941             case "MultiPolygon":
5942             case "MultiLineString":
5943               return geometry(t);
5944             default:
5945               return t;
5946           }
5947         }
5948         module2.exports = parse;
5949         module2.exports.parse = parse;
5950       })();
5951     }
5952   });
5953
5954   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
5955   var require_json_stringify_pretty_compact = __commonJS({
5956     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
5957       function isObject2(obj) {
5958         return typeof obj === "object" && obj !== null;
5959       }
5960       function forEach(obj, cb) {
5961         if (Array.isArray(obj)) {
5962           obj.forEach(cb);
5963         } else if (isObject2(obj)) {
5964           Object.keys(obj).forEach(function(key) {
5965             var val = obj[key];
5966             cb(val, key);
5967           });
5968         }
5969       }
5970       function getTreeDepth(obj) {
5971         var depth = 0;
5972         if (Array.isArray(obj) || isObject2(obj)) {
5973           forEach(obj, function(val) {
5974             if (Array.isArray(val) || isObject2(val)) {
5975               var tmpDepth = getTreeDepth(val);
5976               if (tmpDepth > depth) {
5977                 depth = tmpDepth;
5978               }
5979             }
5980           });
5981           return depth + 1;
5982         }
5983         return depth;
5984       }
5985       function stringify3(obj, options2) {
5986         options2 = options2 || {};
5987         var indent2 = JSON.stringify([1], null, get3(options2, "indent", 2)).slice(2, -3);
5988         var addMargin = get3(options2, "margins", false);
5989         var addArrayMargin = get3(options2, "arrayMargins", false);
5990         var addObjectMargin = get3(options2, "objectMargins", false);
5991         var maxLength = indent2 === "" ? Infinity : get3(options2, "maxLength", 80);
5992         var maxNesting = get3(options2, "maxNesting", Infinity);
5993         return function _stringify(obj2, currentIndent, reserved) {
5994           if (obj2 && typeof obj2.toJSON === "function") {
5995             obj2 = obj2.toJSON();
5996           }
5997           var string = JSON.stringify(obj2);
5998           if (string === void 0) {
5999             return string;
6000           }
6001           var length = maxLength - currentIndent.length - reserved;
6002           var treeDepth = getTreeDepth(obj2);
6003           if (treeDepth <= maxNesting && string.length <= length) {
6004             var prettified = prettify(string, {
6005               addMargin,
6006               addArrayMargin,
6007               addObjectMargin
6008             });
6009             if (prettified.length <= length) {
6010               return prettified;
6011             }
6012           }
6013           if (isObject2(obj2)) {
6014             var nextIndent = currentIndent + indent2;
6015             var items = [];
6016             var delimiters;
6017             var comma = function(array2, index2) {
6018               return index2 === array2.length - 1 ? 0 : 1;
6019             };
6020             if (Array.isArray(obj2)) {
6021               for (var index = 0; index < obj2.length; index++) {
6022                 items.push(_stringify(obj2[index], nextIndent, comma(obj2, index)) || "null");
6023               }
6024               delimiters = "[]";
6025             } else {
6026               Object.keys(obj2).forEach(function(key, index2, array2) {
6027                 var keyPart = JSON.stringify(key) + ": ";
6028                 var value = _stringify(obj2[key], nextIndent, keyPart.length + comma(array2, index2));
6029                 if (value !== void 0) {
6030                   items.push(keyPart + value);
6031                 }
6032               });
6033               delimiters = "{}";
6034             }
6035             if (items.length > 0) {
6036               return [
6037                 delimiters[0],
6038                 indent2 + items.join(",\n" + nextIndent),
6039                 delimiters[1]
6040               ].join("\n" + currentIndent);
6041             }
6042           }
6043           return string;
6044         }(obj, "", 0);
6045       }
6046       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6047       function prettify(string, options2) {
6048         options2 = options2 || {};
6049         var tokens = {
6050           "{": "{",
6051           "}": "}",
6052           "[": "[",
6053           "]": "]",
6054           ",": ", ",
6055           ":": ": "
6056         };
6057         if (options2.addMargin || options2.addObjectMargin) {
6058           tokens["{"] = "{ ";
6059           tokens["}"] = " }";
6060         }
6061         if (options2.addMargin || options2.addArrayMargin) {
6062           tokens["["] = "[ ";
6063           tokens["]"] = " ]";
6064         }
6065         return string.replace(stringOrChar, function(match, string2) {
6066           return string2 ? match : tokens[match];
6067         });
6068       }
6069       function get3(options2, name2, defaultValue) {
6070         return name2 in options2 ? options2[name2] : defaultValue;
6071       }
6072       module2.exports = stringify3;
6073     }
6074   });
6075
6076   // node_modules/aes-js/index.js
6077   var require_aes_js = __commonJS({
6078     "node_modules/aes-js/index.js"(exports2, module2) {
6079       (function(root3) {
6080         "use strict";
6081         function checkInt(value) {
6082           return parseInt(value) === value;
6083         }
6084         function checkInts(arrayish) {
6085           if (!checkInt(arrayish.length)) {
6086             return false;
6087           }
6088           for (var i2 = 0; i2 < arrayish.length; i2++) {
6089             if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) {
6090               return false;
6091             }
6092           }
6093           return true;
6094         }
6095         function coerceArray(arg, copy2) {
6096           if (arg.buffer && arg.name === "Uint8Array") {
6097             if (copy2) {
6098               if (arg.slice) {
6099                 arg = arg.slice();
6100               } else {
6101                 arg = Array.prototype.slice.call(arg);
6102               }
6103             }
6104             return arg;
6105           }
6106           if (Array.isArray(arg)) {
6107             if (!checkInts(arg)) {
6108               throw new Error("Array contains invalid value: " + arg);
6109             }
6110             return new Uint8Array(arg);
6111           }
6112           if (checkInt(arg.length) && checkInts(arg)) {
6113             return new Uint8Array(arg);
6114           }
6115           throw new Error("unsupported array-like object");
6116         }
6117         function createArray(length) {
6118           return new Uint8Array(length);
6119         }
6120         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6121           if (sourceStart != null || sourceEnd != null) {
6122             if (sourceArray.slice) {
6123               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6124             } else {
6125               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6126             }
6127           }
6128           targetArray.set(sourceArray, targetStart);
6129         }
6130         var convertUtf8 = function() {
6131           function toBytes(text2) {
6132             var result = [], i2 = 0;
6133             text2 = encodeURI(text2);
6134             while (i2 < text2.length) {
6135               var c = text2.charCodeAt(i2++);
6136               if (c === 37) {
6137                 result.push(parseInt(text2.substr(i2, 2), 16));
6138                 i2 += 2;
6139               } else {
6140                 result.push(c);
6141               }
6142             }
6143             return coerceArray(result);
6144           }
6145           function fromBytes(bytes) {
6146             var result = [], i2 = 0;
6147             while (i2 < bytes.length) {
6148               var c = bytes[i2];
6149               if (c < 128) {
6150                 result.push(String.fromCharCode(c));
6151                 i2++;
6152               } else if (c > 191 && c < 224) {
6153                 result.push(String.fromCharCode((c & 31) << 6 | bytes[i2 + 1] & 63));
6154                 i2 += 2;
6155               } else {
6156                 result.push(String.fromCharCode((c & 15) << 12 | (bytes[i2 + 1] & 63) << 6 | bytes[i2 + 2] & 63));
6157                 i2 += 3;
6158               }
6159             }
6160             return result.join("");
6161           }
6162           return {
6163             toBytes,
6164             fromBytes
6165           };
6166         }();
6167         var convertHex = function() {
6168           function toBytes(text2) {
6169             var result = [];
6170             for (var i2 = 0; i2 < text2.length; i2 += 2) {
6171               result.push(parseInt(text2.substr(i2, 2), 16));
6172             }
6173             return result;
6174           }
6175           var Hex = "0123456789abcdef";
6176           function fromBytes(bytes) {
6177             var result = [];
6178             for (var i2 = 0; i2 < bytes.length; i2++) {
6179               var v = bytes[i2];
6180               result.push(Hex[(v & 240) >> 4] + Hex[v & 15]);
6181             }
6182             return result.join("");
6183           }
6184           return {
6185             toBytes,
6186             fromBytes
6187           };
6188         }();
6189         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6190         var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145];
6191         var S = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
6192         var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125];
6193         var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986];
6194         var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766];
6195         var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126];
6196         var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436];
6197         var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890];
6198         var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935];
6199         var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600];
6200         var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480];
6201         var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795];
6202         var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855];
6203         var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150];
6204         var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
6205         function convertToInt32(bytes) {
6206           var result = [];
6207           for (var i2 = 0; i2 < bytes.length; i2 += 4) {
6208             result.push(bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]);
6209           }
6210           return result;
6211         }
6212         var AES = function(key) {
6213           if (!(this instanceof AES)) {
6214             throw Error("AES must be instanitated with `new`");
6215           }
6216           Object.defineProperty(this, "key", {
6217             value: coerceArray(key, true)
6218           });
6219           this._prepare();
6220         };
6221         AES.prototype._prepare = function() {
6222           var rounds = numberOfRounds[this.key.length];
6223           if (rounds == null) {
6224             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6225           }
6226           this._Ke = [];
6227           this._Kd = [];
6228           for (var i2 = 0; i2 <= rounds; i2++) {
6229             this._Ke.push([0, 0, 0, 0]);
6230             this._Kd.push([0, 0, 0, 0]);
6231           }
6232           var roundKeyCount = (rounds + 1) * 4;
6233           var KC = this.key.length / 4;
6234           var tk = convertToInt32(this.key);
6235           var index;
6236           for (var i2 = 0; i2 < KC; i2++) {
6237             index = i2 >> 2;
6238             this._Ke[index][i2 % 4] = tk[i2];
6239             this._Kd[rounds - index][i2 % 4] = tk[i2];
6240           }
6241           var rconpointer = 0;
6242           var t = KC, tt;
6243           while (t < roundKeyCount) {
6244             tt = tk[KC - 1];
6245             tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24;
6246             rconpointer += 1;
6247             if (KC != 8) {
6248               for (var i2 = 1; i2 < KC; i2++) {
6249                 tk[i2] ^= tk[i2 - 1];
6250               }
6251             } else {
6252               for (var i2 = 1; i2 < KC / 2; i2++) {
6253                 tk[i2] ^= tk[i2 - 1];
6254               }
6255               tt = tk[KC / 2 - 1];
6256               tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24;
6257               for (var i2 = KC / 2 + 1; i2 < KC; i2++) {
6258                 tk[i2] ^= tk[i2 - 1];
6259               }
6260             }
6261             var i2 = 0, r, c;
6262             while (i2 < KC && t < roundKeyCount) {
6263               r = t >> 2;
6264               c = t % 4;
6265               this._Ke[r][c] = tk[i2];
6266               this._Kd[rounds - r][c] = tk[i2++];
6267               t++;
6268             }
6269           }
6270           for (var r = 1; r < rounds; r++) {
6271             for (var c = 0; c < 4; c++) {
6272               tt = this._Kd[r][c];
6273               this._Kd[r][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255];
6274             }
6275           }
6276         };
6277         AES.prototype.encrypt = function(plaintext) {
6278           if (plaintext.length != 16) {
6279             throw new Error("invalid plaintext size (must be 16 bytes)");
6280           }
6281           var rounds = this._Ke.length - 1;
6282           var a = [0, 0, 0, 0];
6283           var t = convertToInt32(plaintext);
6284           for (var i2 = 0; i2 < 4; i2++) {
6285             t[i2] ^= this._Ke[0][i2];
6286           }
6287           for (var r = 1; r < rounds; r++) {
6288             for (var i2 = 0; i2 < 4; i2++) {
6289               a[i2] = T1[t[i2] >> 24 & 255] ^ T2[t[(i2 + 1) % 4] >> 16 & 255] ^ T3[t[(i2 + 2) % 4] >> 8 & 255] ^ T4[t[(i2 + 3) % 4] & 255] ^ this._Ke[r][i2];
6290             }
6291             t = a.slice();
6292           }
6293           var result = createArray(16), tt;
6294           for (var i2 = 0; i2 < 4; i2++) {
6295             tt = this._Ke[rounds][i2];
6296             result[4 * i2] = (S[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6297             result[4 * i2 + 1] = (S[t[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6298             result[4 * i2 + 2] = (S[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6299             result[4 * i2 + 3] = (S[t[(i2 + 3) % 4] & 255] ^ tt) & 255;
6300           }
6301           return result;
6302         };
6303         AES.prototype.decrypt = function(ciphertext) {
6304           if (ciphertext.length != 16) {
6305             throw new Error("invalid ciphertext size (must be 16 bytes)");
6306           }
6307           var rounds = this._Kd.length - 1;
6308           var a = [0, 0, 0, 0];
6309           var t = convertToInt32(ciphertext);
6310           for (var i2 = 0; i2 < 4; i2++) {
6311             t[i2] ^= this._Kd[0][i2];
6312           }
6313           for (var r = 1; r < rounds; r++) {
6314             for (var i2 = 0; i2 < 4; i2++) {
6315               a[i2] = T5[t[i2] >> 24 & 255] ^ T6[t[(i2 + 3) % 4] >> 16 & 255] ^ T7[t[(i2 + 2) % 4] >> 8 & 255] ^ T8[t[(i2 + 1) % 4] & 255] ^ this._Kd[r][i2];
6316             }
6317             t = a.slice();
6318           }
6319           var result = createArray(16), tt;
6320           for (var i2 = 0; i2 < 4; i2++) {
6321             tt = this._Kd[rounds][i2];
6322             result[4 * i2] = (Si[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6323             result[4 * i2 + 1] = (Si[t[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6324             result[4 * i2 + 2] = (Si[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6325             result[4 * i2 + 3] = (Si[t[(i2 + 1) % 4] & 255] ^ tt) & 255;
6326           }
6327           return result;
6328         };
6329         var ModeOfOperationECB = function(key) {
6330           if (!(this instanceof ModeOfOperationECB)) {
6331             throw Error("AES must be instanitated with `new`");
6332           }
6333           this.description = "Electronic Code Block";
6334           this.name = "ecb";
6335           this._aes = new AES(key);
6336         };
6337         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6338           plaintext = coerceArray(plaintext);
6339           if (plaintext.length % 16 !== 0) {
6340             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6341           }
6342           var ciphertext = createArray(plaintext.length);
6343           var block2 = createArray(16);
6344           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6345             copyArray(plaintext, block2, 0, i2, i2 + 16);
6346             block2 = this._aes.encrypt(block2);
6347             copyArray(block2, ciphertext, i2);
6348           }
6349           return ciphertext;
6350         };
6351         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6352           ciphertext = coerceArray(ciphertext);
6353           if (ciphertext.length % 16 !== 0) {
6354             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6355           }
6356           var plaintext = createArray(ciphertext.length);
6357           var block2 = createArray(16);
6358           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6359             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6360             block2 = this._aes.decrypt(block2);
6361             copyArray(block2, plaintext, i2);
6362           }
6363           return plaintext;
6364         };
6365         var ModeOfOperationCBC = function(key, iv) {
6366           if (!(this instanceof ModeOfOperationCBC)) {
6367             throw Error("AES must be instanitated with `new`");
6368           }
6369           this.description = "Cipher Block Chaining";
6370           this.name = "cbc";
6371           if (!iv) {
6372             iv = createArray(16);
6373           } else if (iv.length != 16) {
6374             throw new Error("invalid initialation vector size (must be 16 bytes)");
6375           }
6376           this._lastCipherblock = coerceArray(iv, true);
6377           this._aes = new AES(key);
6378         };
6379         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6380           plaintext = coerceArray(plaintext);
6381           if (plaintext.length % 16 !== 0) {
6382             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6383           }
6384           var ciphertext = createArray(plaintext.length);
6385           var block2 = createArray(16);
6386           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6387             copyArray(plaintext, block2, 0, i2, i2 + 16);
6388             for (var j2 = 0; j2 < 16; j2++) {
6389               block2[j2] ^= this._lastCipherblock[j2];
6390             }
6391             this._lastCipherblock = this._aes.encrypt(block2);
6392             copyArray(this._lastCipherblock, ciphertext, i2);
6393           }
6394           return ciphertext;
6395         };
6396         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6397           ciphertext = coerceArray(ciphertext);
6398           if (ciphertext.length % 16 !== 0) {
6399             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6400           }
6401           var plaintext = createArray(ciphertext.length);
6402           var block2 = createArray(16);
6403           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6404             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6405             block2 = this._aes.decrypt(block2);
6406             for (var j2 = 0; j2 < 16; j2++) {
6407               plaintext[i2 + j2] = block2[j2] ^ this._lastCipherblock[j2];
6408             }
6409             copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16);
6410           }
6411           return plaintext;
6412         };
6413         var ModeOfOperationCFB = function(key, iv, segmentSize) {
6414           if (!(this instanceof ModeOfOperationCFB)) {
6415             throw Error("AES must be instanitated with `new`");
6416           }
6417           this.description = "Cipher Feedback";
6418           this.name = "cfb";
6419           if (!iv) {
6420             iv = createArray(16);
6421           } else if (iv.length != 16) {
6422             throw new Error("invalid initialation vector size (must be 16 size)");
6423           }
6424           if (!segmentSize) {
6425             segmentSize = 1;
6426           }
6427           this.segmentSize = segmentSize;
6428           this._shiftRegister = coerceArray(iv, true);
6429           this._aes = new AES(key);
6430         };
6431         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6432           if (plaintext.length % this.segmentSize != 0) {
6433             throw new Error("invalid plaintext size (must be segmentSize bytes)");
6434           }
6435           var encrypted = coerceArray(plaintext, true);
6436           var xorSegment;
6437           for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) {
6438             xorSegment = this._aes.encrypt(this._shiftRegister);
6439             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6440               encrypted[i2 + j2] ^= xorSegment[j2];
6441             }
6442             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6443             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6444           }
6445           return encrypted;
6446         };
6447         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6448           if (ciphertext.length % this.segmentSize != 0) {
6449             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6450           }
6451           var plaintext = coerceArray(ciphertext, true);
6452           var xorSegment;
6453           for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) {
6454             xorSegment = this._aes.encrypt(this._shiftRegister);
6455             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6456               plaintext[i2 + j2] ^= xorSegment[j2];
6457             }
6458             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6459             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6460           }
6461           return plaintext;
6462         };
6463         var ModeOfOperationOFB = function(key, iv) {
6464           if (!(this instanceof ModeOfOperationOFB)) {
6465             throw Error("AES must be instanitated with `new`");
6466           }
6467           this.description = "Output Feedback";
6468           this.name = "ofb";
6469           if (!iv) {
6470             iv = createArray(16);
6471           } else if (iv.length != 16) {
6472             throw new Error("invalid initialation vector size (must be 16 bytes)");
6473           }
6474           this._lastPrecipher = coerceArray(iv, true);
6475           this._lastPrecipherIndex = 16;
6476           this._aes = new AES(key);
6477         };
6478         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6479           var encrypted = coerceArray(plaintext, true);
6480           for (var i2 = 0; i2 < encrypted.length; i2++) {
6481             if (this._lastPrecipherIndex === 16) {
6482               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6483               this._lastPrecipherIndex = 0;
6484             }
6485             encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6486           }
6487           return encrypted;
6488         };
6489         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6490         var Counter = function(initialValue) {
6491           if (!(this instanceof Counter)) {
6492             throw Error("Counter must be instanitated with `new`");
6493           }
6494           if (initialValue !== 0 && !initialValue) {
6495             initialValue = 1;
6496           }
6497           if (typeof initialValue === "number") {
6498             this._counter = createArray(16);
6499             this.setValue(initialValue);
6500           } else {
6501             this.setBytes(initialValue);
6502           }
6503         };
6504         Counter.prototype.setValue = function(value) {
6505           if (typeof value !== "number" || parseInt(value) != value) {
6506             throw new Error("invalid counter value (must be an integer)");
6507           }
6508           if (value > Number.MAX_SAFE_INTEGER) {
6509             throw new Error("integer value out of safe range");
6510           }
6511           for (var index = 15; index >= 0; --index) {
6512             this._counter[index] = value % 256;
6513             value = parseInt(value / 256);
6514           }
6515         };
6516         Counter.prototype.setBytes = function(bytes) {
6517           bytes = coerceArray(bytes, true);
6518           if (bytes.length != 16) {
6519             throw new Error("invalid counter bytes size (must be 16 bytes)");
6520           }
6521           this._counter = bytes;
6522         };
6523         Counter.prototype.increment = function() {
6524           for (var i2 = 15; i2 >= 0; i2--) {
6525             if (this._counter[i2] === 255) {
6526               this._counter[i2] = 0;
6527             } else {
6528               this._counter[i2]++;
6529               break;
6530             }
6531           }
6532         };
6533         var ModeOfOperationCTR = function(key, counter) {
6534           if (!(this instanceof ModeOfOperationCTR)) {
6535             throw Error("AES must be instanitated with `new`");
6536           }
6537           this.description = "Counter";
6538           this.name = "ctr";
6539           if (!(counter instanceof Counter)) {
6540             counter = new Counter(counter);
6541           }
6542           this._counter = counter;
6543           this._remainingCounter = null;
6544           this._remainingCounterIndex = 16;
6545           this._aes = new AES(key);
6546         };
6547         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6548           var encrypted = coerceArray(plaintext, true);
6549           for (var i2 = 0; i2 < encrypted.length; i2++) {
6550             if (this._remainingCounterIndex === 16) {
6551               this._remainingCounter = this._aes.encrypt(this._counter._counter);
6552               this._remainingCounterIndex = 0;
6553               this._counter.increment();
6554             }
6555             encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++];
6556           }
6557           return encrypted;
6558         };
6559         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6560         function pkcs7pad(data) {
6561           data = coerceArray(data, true);
6562           var padder = 16 - data.length % 16;
6563           var result = createArray(data.length + padder);
6564           copyArray(data, result);
6565           for (var i2 = data.length; i2 < result.length; i2++) {
6566             result[i2] = padder;
6567           }
6568           return result;
6569         }
6570         function pkcs7strip(data) {
6571           data = coerceArray(data, true);
6572           if (data.length < 16) {
6573             throw new Error("PKCS#7 invalid length");
6574           }
6575           var padder = data[data.length - 1];
6576           if (padder > 16) {
6577             throw new Error("PKCS#7 padding byte out of range");
6578           }
6579           var length = data.length - padder;
6580           for (var i2 = 0; i2 < padder; i2++) {
6581             if (data[length + i2] !== padder) {
6582               throw new Error("PKCS#7 invalid padding byte");
6583             }
6584           }
6585           var result = createArray(length);
6586           copyArray(data, result, 0, 0, length);
6587           return result;
6588         }
6589         var aesjs2 = {
6590           AES,
6591           Counter,
6592           ModeOfOperation: {
6593             ecb: ModeOfOperationECB,
6594             cbc: ModeOfOperationCBC,
6595             cfb: ModeOfOperationCFB,
6596             ofb: ModeOfOperationOFB,
6597             ctr: ModeOfOperationCTR
6598           },
6599           utils: {
6600             hex: convertHex,
6601             utf8: convertUtf8
6602           },
6603           padding: {
6604             pkcs7: {
6605               pad: pkcs7pad,
6606               strip: pkcs7strip
6607             }
6608           },
6609           _arrayTest: {
6610             coerceArray,
6611             createArray,
6612             copyArray
6613           }
6614         };
6615         if (typeof exports2 !== "undefined") {
6616           module2.exports = aesjs2;
6617         } else if (typeof define === "function" && define.amd) {
6618           define([], function() {
6619             return aesjs2;
6620           });
6621         } else {
6622           if (root3.aesjs) {
6623             aesjs2._aesjs = root3.aesjs;
6624           }
6625           root3.aesjs = aesjs2;
6626         }
6627       })(exports2);
6628     }
6629   });
6630
6631   // node_modules/fast-deep-equal/index.js
6632   var require_fast_deep_equal = __commonJS({
6633     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
6634       "use strict";
6635       module2.exports = function equal(a, b) {
6636         if (a === b)
6637           return true;
6638         if (a && b && typeof a == "object" && typeof b == "object") {
6639           if (a.constructor !== b.constructor)
6640             return false;
6641           var length, i2, keys;
6642           if (Array.isArray(a)) {
6643             length = a.length;
6644             if (length != b.length)
6645               return false;
6646             for (i2 = length; i2-- !== 0; )
6647               if (!equal(a[i2], b[i2]))
6648                 return false;
6649             return true;
6650           }
6651           if (a.constructor === RegExp)
6652             return a.source === b.source && a.flags === b.flags;
6653           if (a.valueOf !== Object.prototype.valueOf)
6654             return a.valueOf() === b.valueOf();
6655           if (a.toString !== Object.prototype.toString)
6656             return a.toString() === b.toString();
6657           keys = Object.keys(a);
6658           length = keys.length;
6659           if (length !== Object.keys(b).length)
6660             return false;
6661           for (i2 = length; i2-- !== 0; )
6662             if (!Object.prototype.hasOwnProperty.call(b, keys[i2]))
6663               return false;
6664           for (i2 = length; i2-- !== 0; ) {
6665             var key = keys[i2];
6666             if (!equal(a[key], b[key]))
6667               return false;
6668           }
6669           return true;
6670         }
6671         return a !== a && b !== b;
6672       };
6673     }
6674   });
6675
6676   // node_modules/lodash/lodash.js
6677   var require_lodash = __commonJS({
6678     "node_modules/lodash/lodash.js"(exports2, module2) {
6679       (function() {
6680         var undefined2;
6681         var VERSION = "4.17.21";
6682         var LARGE_ARRAY_SIZE = 200;
6683         var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT3 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
6684         var HASH_UNDEFINED = "__lodash_hash_undefined__";
6685         var MAX_MEMOIZE_SIZE = 500;
6686         var PLACEHOLDER = "__lodash_placeholder__";
6687         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6688         var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
6689         var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
6690         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6691         var HOT_COUNT = 800, HOT_SPAN = 16;
6692         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6693         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6694         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6695         var wrapFlags = [
6696           ["ary", WRAP_ARY_FLAG],
6697           ["bind", WRAP_BIND_FLAG],
6698           ["bindKey", WRAP_BIND_KEY_FLAG],
6699           ["curry", WRAP_CURRY_FLAG],
6700           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6701           ["flip", WRAP_FLIP_FLAG],
6702           ["partial", WRAP_PARTIAL_FLAG],
6703           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6704           ["rearg", WRAP_REARG_FLAG]
6705         ];
6706         var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
6707         var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
6708         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6709         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6710         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6711         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6712         var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
6713         var reTrimStart2 = /^\s+/;
6714         var reWhitespace2 = /\s/;
6715         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6716         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6717         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6718         var reEscapeChar = /\\(\\)?/g;
6719         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6720         var reFlags = /\w*$/;
6721         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6722         var reIsBinary2 = /^0b[01]+$/i;
6723         var reIsHostCtor = /^\[object .+?Constructor\]$/;
6724         var reIsOctal2 = /^0o[0-7]+$/i;
6725         var reIsUint = /^(?:0|[1-9]\d*)$/;
6726         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6727         var reNoMatch = /($^)/;
6728         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6729         var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
6730         var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
6731         var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
6732         var reApos = RegExp(rsApos, "g");
6733         var reComboMark = RegExp(rsCombo, "g");
6734         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6735         var reUnicodeWord = RegExp([
6736           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6737           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6738           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6739           rsUpper + "+" + rsOptContrUpper,
6740           rsOrdUpper,
6741           rsOrdLower,
6742           rsDigits,
6743           rsEmoji
6744         ].join("|"), "g");
6745         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6746         var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
6747         var contextProps = [
6748           "Array",
6749           "Buffer",
6750           "DataView",
6751           "Date",
6752           "Error",
6753           "Float32Array",
6754           "Float64Array",
6755           "Function",
6756           "Int8Array",
6757           "Int16Array",
6758           "Int32Array",
6759           "Map",
6760           "Math",
6761           "Object",
6762           "Promise",
6763           "RegExp",
6764           "Set",
6765           "String",
6766           "Symbol",
6767           "TypeError",
6768           "Uint8Array",
6769           "Uint8ClampedArray",
6770           "Uint16Array",
6771           "Uint32Array",
6772           "WeakMap",
6773           "_",
6774           "clearTimeout",
6775           "isFinite",
6776           "parseInt",
6777           "setTimeout"
6778         ];
6779         var templateCounter = -1;
6780         var typedArrayTags = {};
6781         typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
6782         typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
6783         var cloneableTags = {};
6784         cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag2] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
6785         cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
6786         var deburredLetters = {
6787           "\xC0": "A",
6788           "\xC1": "A",
6789           "\xC2": "A",
6790           "\xC3": "A",
6791           "\xC4": "A",
6792           "\xC5": "A",
6793           "\xE0": "a",
6794           "\xE1": "a",
6795           "\xE2": "a",
6796           "\xE3": "a",
6797           "\xE4": "a",
6798           "\xE5": "a",
6799           "\xC7": "C",
6800           "\xE7": "c",
6801           "\xD0": "D",
6802           "\xF0": "d",
6803           "\xC8": "E",
6804           "\xC9": "E",
6805           "\xCA": "E",
6806           "\xCB": "E",
6807           "\xE8": "e",
6808           "\xE9": "e",
6809           "\xEA": "e",
6810           "\xEB": "e",
6811           "\xCC": "I",
6812           "\xCD": "I",
6813           "\xCE": "I",
6814           "\xCF": "I",
6815           "\xEC": "i",
6816           "\xED": "i",
6817           "\xEE": "i",
6818           "\xEF": "i",
6819           "\xD1": "N",
6820           "\xF1": "n",
6821           "\xD2": "O",
6822           "\xD3": "O",
6823           "\xD4": "O",
6824           "\xD5": "O",
6825           "\xD6": "O",
6826           "\xD8": "O",
6827           "\xF2": "o",
6828           "\xF3": "o",
6829           "\xF4": "o",
6830           "\xF5": "o",
6831           "\xF6": "o",
6832           "\xF8": "o",
6833           "\xD9": "U",
6834           "\xDA": "U",
6835           "\xDB": "U",
6836           "\xDC": "U",
6837           "\xF9": "u",
6838           "\xFA": "u",
6839           "\xFB": "u",
6840           "\xFC": "u",
6841           "\xDD": "Y",
6842           "\xFD": "y",
6843           "\xFF": "y",
6844           "\xC6": "Ae",
6845           "\xE6": "ae",
6846           "\xDE": "Th",
6847           "\xFE": "th",
6848           "\xDF": "ss",
6849           "\u0100": "A",
6850           "\u0102": "A",
6851           "\u0104": "A",
6852           "\u0101": "a",
6853           "\u0103": "a",
6854           "\u0105": "a",
6855           "\u0106": "C",
6856           "\u0108": "C",
6857           "\u010A": "C",
6858           "\u010C": "C",
6859           "\u0107": "c",
6860           "\u0109": "c",
6861           "\u010B": "c",
6862           "\u010D": "c",
6863           "\u010E": "D",
6864           "\u0110": "D",
6865           "\u010F": "d",
6866           "\u0111": "d",
6867           "\u0112": "E",
6868           "\u0114": "E",
6869           "\u0116": "E",
6870           "\u0118": "E",
6871           "\u011A": "E",
6872           "\u0113": "e",
6873           "\u0115": "e",
6874           "\u0117": "e",
6875           "\u0119": "e",
6876           "\u011B": "e",
6877           "\u011C": "G",
6878           "\u011E": "G",
6879           "\u0120": "G",
6880           "\u0122": "G",
6881           "\u011D": "g",
6882           "\u011F": "g",
6883           "\u0121": "g",
6884           "\u0123": "g",
6885           "\u0124": "H",
6886           "\u0126": "H",
6887           "\u0125": "h",
6888           "\u0127": "h",
6889           "\u0128": "I",
6890           "\u012A": "I",
6891           "\u012C": "I",
6892           "\u012E": "I",
6893           "\u0130": "I",
6894           "\u0129": "i",
6895           "\u012B": "i",
6896           "\u012D": "i",
6897           "\u012F": "i",
6898           "\u0131": "i",
6899           "\u0134": "J",
6900           "\u0135": "j",
6901           "\u0136": "K",
6902           "\u0137": "k",
6903           "\u0138": "k",
6904           "\u0139": "L",
6905           "\u013B": "L",
6906           "\u013D": "L",
6907           "\u013F": "L",
6908           "\u0141": "L",
6909           "\u013A": "l",
6910           "\u013C": "l",
6911           "\u013E": "l",
6912           "\u0140": "l",
6913           "\u0142": "l",
6914           "\u0143": "N",
6915           "\u0145": "N",
6916           "\u0147": "N",
6917           "\u014A": "N",
6918           "\u0144": "n",
6919           "\u0146": "n",
6920           "\u0148": "n",
6921           "\u014B": "n",
6922           "\u014C": "O",
6923           "\u014E": "O",
6924           "\u0150": "O",
6925           "\u014D": "o",
6926           "\u014F": "o",
6927           "\u0151": "o",
6928           "\u0154": "R",
6929           "\u0156": "R",
6930           "\u0158": "R",
6931           "\u0155": "r",
6932           "\u0157": "r",
6933           "\u0159": "r",
6934           "\u015A": "S",
6935           "\u015C": "S",
6936           "\u015E": "S",
6937           "\u0160": "S",
6938           "\u015B": "s",
6939           "\u015D": "s",
6940           "\u015F": "s",
6941           "\u0161": "s",
6942           "\u0162": "T",
6943           "\u0164": "T",
6944           "\u0166": "T",
6945           "\u0163": "t",
6946           "\u0165": "t",
6947           "\u0167": "t",
6948           "\u0168": "U",
6949           "\u016A": "U",
6950           "\u016C": "U",
6951           "\u016E": "U",
6952           "\u0170": "U",
6953           "\u0172": "U",
6954           "\u0169": "u",
6955           "\u016B": "u",
6956           "\u016D": "u",
6957           "\u016F": "u",
6958           "\u0171": "u",
6959           "\u0173": "u",
6960           "\u0174": "W",
6961           "\u0175": "w",
6962           "\u0176": "Y",
6963           "\u0177": "y",
6964           "\u0178": "Y",
6965           "\u0179": "Z",
6966           "\u017B": "Z",
6967           "\u017D": "Z",
6968           "\u017A": "z",
6969           "\u017C": "z",
6970           "\u017E": "z",
6971           "\u0132": "IJ",
6972           "\u0133": "ij",
6973           "\u0152": "Oe",
6974           "\u0153": "oe",
6975           "\u0149": "'n",
6976           "\u017F": "s"
6977         };
6978         var htmlEscapes2 = {
6979           "&": "&amp;",
6980           "<": "&lt;",
6981           ">": "&gt;",
6982           '"': "&quot;",
6983           "'": "&#39;"
6984         };
6985         var htmlUnescapes2 = {
6986           "&amp;": "&",
6987           "&lt;": "<",
6988           "&gt;": ">",
6989           "&quot;": '"',
6990           "&#39;": "'"
6991         };
6992         var stringEscapes = {
6993           "\\": "\\",
6994           "'": "'",
6995           "\n": "n",
6996           "\r": "r",
6997           "\u2028": "u2028",
6998           "\u2029": "u2029"
6999         };
7000         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7001         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7002         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7003         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7004         var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7005         var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7006         var moduleExports = freeModule && freeModule.exports === freeExports;
7007         var freeProcess = moduleExports && freeGlobal2.process;
7008         var nodeUtil = function() {
7009           try {
7010             var types = freeModule && freeModule.require && freeModule.require("util").types;
7011             if (types) {
7012               return types;
7013             }
7014             return freeProcess && freeProcess.binding && freeProcess.binding("util");
7015           } catch (e) {
7016           }
7017         }();
7018         var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
7019         function apply(func, thisArg, args) {
7020           switch (args.length) {
7021             case 0:
7022               return func.call(thisArg);
7023             case 1:
7024               return func.call(thisArg, args[0]);
7025             case 2:
7026               return func.call(thisArg, args[0], args[1]);
7027             case 3:
7028               return func.call(thisArg, args[0], args[1], args[2]);
7029           }
7030           return func.apply(thisArg, args);
7031         }
7032         function arrayAggregator(array2, setter, iteratee, accumulator) {
7033           var index = -1, length = array2 == null ? 0 : array2.length;
7034           while (++index < length) {
7035             var value = array2[index];
7036             setter(accumulator, value, iteratee(value), array2);
7037           }
7038           return accumulator;
7039         }
7040         function arrayEach(array2, iteratee) {
7041           var index = -1, length = array2 == null ? 0 : array2.length;
7042           while (++index < length) {
7043             if (iteratee(array2[index], index, array2) === false) {
7044               break;
7045             }
7046           }
7047           return array2;
7048         }
7049         function arrayEachRight(array2, iteratee) {
7050           var length = array2 == null ? 0 : array2.length;
7051           while (length--) {
7052             if (iteratee(array2[length], length, array2) === false) {
7053               break;
7054             }
7055           }
7056           return array2;
7057         }
7058         function arrayEvery(array2, predicate) {
7059           var index = -1, length = array2 == null ? 0 : array2.length;
7060           while (++index < length) {
7061             if (!predicate(array2[index], index, array2)) {
7062               return false;
7063             }
7064           }
7065           return true;
7066         }
7067         function arrayFilter(array2, predicate) {
7068           var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7069           while (++index < length) {
7070             var value = array2[index];
7071             if (predicate(value, index, array2)) {
7072               result[resIndex++] = value;
7073             }
7074           }
7075           return result;
7076         }
7077         function arrayIncludes(array2, value) {
7078           var length = array2 == null ? 0 : array2.length;
7079           return !!length && baseIndexOf(array2, value, 0) > -1;
7080         }
7081         function arrayIncludesWith(array2, value, comparator) {
7082           var index = -1, length = array2 == null ? 0 : array2.length;
7083           while (++index < length) {
7084             if (comparator(value, array2[index])) {
7085               return true;
7086             }
7087           }
7088           return false;
7089         }
7090         function arrayMap2(array2, iteratee) {
7091           var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7092           while (++index < length) {
7093             result[index] = iteratee(array2[index], index, array2);
7094           }
7095           return result;
7096         }
7097         function arrayPush(array2, values) {
7098           var index = -1, length = values.length, offset = array2.length;
7099           while (++index < length) {
7100             array2[offset + index] = values[index];
7101           }
7102           return array2;
7103         }
7104         function arrayReduce(array2, iteratee, accumulator, initAccum) {
7105           var index = -1, length = array2 == null ? 0 : array2.length;
7106           if (initAccum && length) {
7107             accumulator = array2[++index];
7108           }
7109           while (++index < length) {
7110             accumulator = iteratee(accumulator, array2[index], index, array2);
7111           }
7112           return accumulator;
7113         }
7114         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7115           var length = array2 == null ? 0 : array2.length;
7116           if (initAccum && length) {
7117             accumulator = array2[--length];
7118           }
7119           while (length--) {
7120             accumulator = iteratee(accumulator, array2[length], length, array2);
7121           }
7122           return accumulator;
7123         }
7124         function arraySome(array2, predicate) {
7125           var index = -1, length = array2 == null ? 0 : array2.length;
7126           while (++index < length) {
7127             if (predicate(array2[index], index, array2)) {
7128               return true;
7129             }
7130           }
7131           return false;
7132         }
7133         var asciiSize = baseProperty("length");
7134         function asciiToArray(string) {
7135           return string.split("");
7136         }
7137         function asciiWords(string) {
7138           return string.match(reAsciiWord) || [];
7139         }
7140         function baseFindKey(collection, predicate, eachFunc) {
7141           var result;
7142           eachFunc(collection, function(value, key, collection2) {
7143             if (predicate(value, key, collection2)) {
7144               result = key;
7145               return false;
7146             }
7147           });
7148           return result;
7149         }
7150         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7151           var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7152           while (fromRight ? index-- : ++index < length) {
7153             if (predicate(array2[index], index, array2)) {
7154               return index;
7155             }
7156           }
7157           return -1;
7158         }
7159         function baseIndexOf(array2, value, fromIndex) {
7160           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7161         }
7162         function baseIndexOfWith(array2, value, fromIndex, comparator) {
7163           var index = fromIndex - 1, length = array2.length;
7164           while (++index < length) {
7165             if (comparator(array2[index], value)) {
7166               return index;
7167             }
7168           }
7169           return -1;
7170         }
7171         function baseIsNaN(value) {
7172           return value !== value;
7173         }
7174         function baseMean(array2, iteratee) {
7175           var length = array2 == null ? 0 : array2.length;
7176           return length ? baseSum(array2, iteratee) / length : NAN2;
7177         }
7178         function baseProperty(key) {
7179           return function(object) {
7180             return object == null ? undefined2 : object[key];
7181           };
7182         }
7183         function basePropertyOf2(object) {
7184           return function(key) {
7185             return object == null ? undefined2 : object[key];
7186           };
7187         }
7188         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7189           eachFunc(collection, function(value, index, collection2) {
7190             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7191           });
7192           return accumulator;
7193         }
7194         function baseSortBy(array2, comparer) {
7195           var length = array2.length;
7196           array2.sort(comparer);
7197           while (length--) {
7198             array2[length] = array2[length].value;
7199           }
7200           return array2;
7201         }
7202         function baseSum(array2, iteratee) {
7203           var result, index = -1, length = array2.length;
7204           while (++index < length) {
7205             var current = iteratee(array2[index]);
7206             if (current !== undefined2) {
7207               result = result === undefined2 ? current : result + current;
7208             }
7209           }
7210           return result;
7211         }
7212         function baseTimes(n2, iteratee) {
7213           var index = -1, result = Array(n2);
7214           while (++index < n2) {
7215             result[index] = iteratee(index);
7216           }
7217           return result;
7218         }
7219         function baseToPairs(object, props) {
7220           return arrayMap2(props, function(key) {
7221             return [key, object[key]];
7222           });
7223         }
7224         function baseTrim2(string) {
7225           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7226         }
7227         function baseUnary(func) {
7228           return function(value) {
7229             return func(value);
7230           };
7231         }
7232         function baseValues(object, props) {
7233           return arrayMap2(props, function(key) {
7234             return object[key];
7235           });
7236         }
7237         function cacheHas(cache, key) {
7238           return cache.has(key);
7239         }
7240         function charsStartIndex(strSymbols, chrSymbols) {
7241           var index = -1, length = strSymbols.length;
7242           while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7243           }
7244           return index;
7245         }
7246         function charsEndIndex(strSymbols, chrSymbols) {
7247           var index = strSymbols.length;
7248           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7249           }
7250           return index;
7251         }
7252         function countHolders(array2, placeholder) {
7253           var length = array2.length, result = 0;
7254           while (length--) {
7255             if (array2[length] === placeholder) {
7256               ++result;
7257             }
7258           }
7259           return result;
7260         }
7261         var deburrLetter = basePropertyOf2(deburredLetters);
7262         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7263         function escapeStringChar(chr) {
7264           return "\\" + stringEscapes[chr];
7265         }
7266         function getValue(object, key) {
7267           return object == null ? undefined2 : object[key];
7268         }
7269         function hasUnicode(string) {
7270           return reHasUnicode.test(string);
7271         }
7272         function hasUnicodeWord(string) {
7273           return reHasUnicodeWord.test(string);
7274         }
7275         function iteratorToArray(iterator) {
7276           var data, result = [];
7277           while (!(data = iterator.next()).done) {
7278             result.push(data.value);
7279           }
7280           return result;
7281         }
7282         function mapToArray(map2) {
7283           var index = -1, result = Array(map2.size);
7284           map2.forEach(function(value, key) {
7285             result[++index] = [key, value];
7286           });
7287           return result;
7288         }
7289         function overArg(func, transform2) {
7290           return function(arg) {
7291             return func(transform2(arg));
7292           };
7293         }
7294         function replaceHolders(array2, placeholder) {
7295           var index = -1, length = array2.length, resIndex = 0, result = [];
7296           while (++index < length) {
7297             var value = array2[index];
7298             if (value === placeholder || value === PLACEHOLDER) {
7299               array2[index] = PLACEHOLDER;
7300               result[resIndex++] = index;
7301             }
7302           }
7303           return result;
7304         }
7305         function setToArray(set3) {
7306           var index = -1, result = Array(set3.size);
7307           set3.forEach(function(value) {
7308             result[++index] = value;
7309           });
7310           return result;
7311         }
7312         function setToPairs(set3) {
7313           var index = -1, result = Array(set3.size);
7314           set3.forEach(function(value) {
7315             result[++index] = [value, value];
7316           });
7317           return result;
7318         }
7319         function strictIndexOf(array2, value, fromIndex) {
7320           var index = fromIndex - 1, length = array2.length;
7321           while (++index < length) {
7322             if (array2[index] === value) {
7323               return index;
7324             }
7325           }
7326           return -1;
7327         }
7328         function strictLastIndexOf(array2, value, fromIndex) {
7329           var index = fromIndex + 1;
7330           while (index--) {
7331             if (array2[index] === value) {
7332               return index;
7333             }
7334           }
7335           return index;
7336         }
7337         function stringSize(string) {
7338           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7339         }
7340         function stringToArray(string) {
7341           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7342         }
7343         function trimmedEndIndex2(string) {
7344           var index = string.length;
7345           while (index-- && reWhitespace2.test(string.charAt(index))) {
7346           }
7347           return index;
7348         }
7349         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7350         function unicodeSize(string) {
7351           var result = reUnicode.lastIndex = 0;
7352           while (reUnicode.test(string)) {
7353             ++result;
7354           }
7355           return result;
7356         }
7357         function unicodeToArray(string) {
7358           return string.match(reUnicode) || [];
7359         }
7360         function unicodeWords(string) {
7361           return string.match(reUnicodeWord) || [];
7362         }
7363         var runInContext = function runInContext2(context) {
7364           context = context == null ? root3 : _.defaults(root3.Object(), context, _.pick(root3, contextProps));
7365           var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
7366           var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto3 = Object2.prototype;
7367           var coreJsData = context["__core-js_shared__"];
7368           var funcToString = funcProto.toString;
7369           var hasOwnProperty2 = objectProto3.hasOwnProperty;
7370           var idCounter = 0;
7371           var maskSrcKey = function() {
7372             var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
7373             return uid ? "Symbol(src)_1." + uid : "";
7374           }();
7375           var nativeObjectToString3 = objectProto3.toString;
7376           var objectCtorString = funcToString.call(Object2);
7377           var oldDash = root3._;
7378           var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
7379           var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto3.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
7380           var defineProperty = function() {
7381             try {
7382               var func = getNative(Object2, "defineProperty");
7383               func({}, "", {});
7384               return func;
7385             } catch (e) {
7386             }
7387           }();
7388           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7389           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
7390           var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
7391           var metaMap = WeakMap && new WeakMap();
7392           var realNames = {};
7393           var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
7394           var symbolProto2 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined2, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined2;
7395           function lodash(value) {
7396             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7397               if (value instanceof LodashWrapper) {
7398                 return value;
7399               }
7400               if (hasOwnProperty2.call(value, "__wrapped__")) {
7401                 return wrapperClone(value);
7402               }
7403             }
7404             return new LodashWrapper(value);
7405           }
7406           var baseCreate = function() {
7407             function object() {
7408             }
7409             return function(proto) {
7410               if (!isObject2(proto)) {
7411                 return {};
7412               }
7413               if (objectCreate) {
7414                 return objectCreate(proto);
7415               }
7416               object.prototype = proto;
7417               var result2 = new object();
7418               object.prototype = undefined2;
7419               return result2;
7420             };
7421           }();
7422           function baseLodash() {
7423           }
7424           function LodashWrapper(value, chainAll) {
7425             this.__wrapped__ = value;
7426             this.__actions__ = [];
7427             this.__chain__ = !!chainAll;
7428             this.__index__ = 0;
7429             this.__values__ = undefined2;
7430           }
7431           lodash.templateSettings = {
7432             "escape": reEscape,
7433             "evaluate": reEvaluate,
7434             "interpolate": reInterpolate,
7435             "variable": "",
7436             "imports": {
7437               "_": lodash
7438             }
7439           };
7440           lodash.prototype = baseLodash.prototype;
7441           lodash.prototype.constructor = lodash;
7442           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7443           LodashWrapper.prototype.constructor = LodashWrapper;
7444           function LazyWrapper(value) {
7445             this.__wrapped__ = value;
7446             this.__actions__ = [];
7447             this.__dir__ = 1;
7448             this.__filtered__ = false;
7449             this.__iteratees__ = [];
7450             this.__takeCount__ = MAX_ARRAY_LENGTH;
7451             this.__views__ = [];
7452           }
7453           function lazyClone() {
7454             var result2 = new LazyWrapper(this.__wrapped__);
7455             result2.__actions__ = copyArray(this.__actions__);
7456             result2.__dir__ = this.__dir__;
7457             result2.__filtered__ = this.__filtered__;
7458             result2.__iteratees__ = copyArray(this.__iteratees__);
7459             result2.__takeCount__ = this.__takeCount__;
7460             result2.__views__ = copyArray(this.__views__);
7461             return result2;
7462           }
7463           function lazyReverse() {
7464             if (this.__filtered__) {
7465               var result2 = new LazyWrapper(this);
7466               result2.__dir__ = -1;
7467               result2.__filtered__ = true;
7468             } else {
7469               result2 = this.clone();
7470               result2.__dir__ *= -1;
7471             }
7472             return result2;
7473           }
7474           function lazyValue() {
7475             var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length, this.__takeCount__);
7476             if (!isArr || !isRight && arrLength == length && takeCount == length) {
7477               return baseWrapperValue(array2, this.__actions__);
7478             }
7479             var result2 = [];
7480             outer:
7481               while (length-- && resIndex < takeCount) {
7482                 index += dir;
7483                 var iterIndex = -1, value = array2[index];
7484                 while (++iterIndex < iterLength) {
7485                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type3 = data.type, computed = iteratee2(value);
7486                   if (type3 == LAZY_MAP_FLAG) {
7487                     value = computed;
7488                   } else if (!computed) {
7489                     if (type3 == LAZY_FILTER_FLAG) {
7490                       continue outer;
7491                     } else {
7492                       break outer;
7493                     }
7494                   }
7495                 }
7496                 result2[resIndex++] = value;
7497               }
7498             return result2;
7499           }
7500           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7501           LazyWrapper.prototype.constructor = LazyWrapper;
7502           function Hash(entries) {
7503             var index = -1, length = entries == null ? 0 : entries.length;
7504             this.clear();
7505             while (++index < length) {
7506               var entry = entries[index];
7507               this.set(entry[0], entry[1]);
7508             }
7509           }
7510           function hashClear() {
7511             this.__data__ = nativeCreate ? nativeCreate(null) : {};
7512             this.size = 0;
7513           }
7514           function hashDelete(key) {
7515             var result2 = this.has(key) && delete this.__data__[key];
7516             this.size -= result2 ? 1 : 0;
7517             return result2;
7518           }
7519           function hashGet(key) {
7520             var data = this.__data__;
7521             if (nativeCreate) {
7522               var result2 = data[key];
7523               return result2 === HASH_UNDEFINED ? undefined2 : result2;
7524             }
7525             return hasOwnProperty2.call(data, key) ? data[key] : undefined2;
7526           }
7527           function hashHas(key) {
7528             var data = this.__data__;
7529             return nativeCreate ? data[key] !== undefined2 : hasOwnProperty2.call(data, key);
7530           }
7531           function hashSet(key, value) {
7532             var data = this.__data__;
7533             this.size += this.has(key) ? 0 : 1;
7534             data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
7535             return this;
7536           }
7537           Hash.prototype.clear = hashClear;
7538           Hash.prototype["delete"] = hashDelete;
7539           Hash.prototype.get = hashGet;
7540           Hash.prototype.has = hashHas;
7541           Hash.prototype.set = hashSet;
7542           function ListCache(entries) {
7543             var index = -1, length = entries == null ? 0 : entries.length;
7544             this.clear();
7545             while (++index < length) {
7546               var entry = entries[index];
7547               this.set(entry[0], entry[1]);
7548             }
7549           }
7550           function listCacheClear() {
7551             this.__data__ = [];
7552             this.size = 0;
7553           }
7554           function listCacheDelete(key) {
7555             var data = this.__data__, index = assocIndexOf(data, key);
7556             if (index < 0) {
7557               return false;
7558             }
7559             var lastIndex = data.length - 1;
7560             if (index == lastIndex) {
7561               data.pop();
7562             } else {
7563               splice.call(data, index, 1);
7564             }
7565             --this.size;
7566             return true;
7567           }
7568           function listCacheGet(key) {
7569             var data = this.__data__, index = assocIndexOf(data, key);
7570             return index < 0 ? undefined2 : data[index][1];
7571           }
7572           function listCacheHas(key) {
7573             return assocIndexOf(this.__data__, key) > -1;
7574           }
7575           function listCacheSet(key, value) {
7576             var data = this.__data__, index = assocIndexOf(data, key);
7577             if (index < 0) {
7578               ++this.size;
7579               data.push([key, value]);
7580             } else {
7581               data[index][1] = value;
7582             }
7583             return this;
7584           }
7585           ListCache.prototype.clear = listCacheClear;
7586           ListCache.prototype["delete"] = listCacheDelete;
7587           ListCache.prototype.get = listCacheGet;
7588           ListCache.prototype.has = listCacheHas;
7589           ListCache.prototype.set = listCacheSet;
7590           function MapCache(entries) {
7591             var index = -1, length = entries == null ? 0 : entries.length;
7592             this.clear();
7593             while (++index < length) {
7594               var entry = entries[index];
7595               this.set(entry[0], entry[1]);
7596             }
7597           }
7598           function mapCacheClear() {
7599             this.size = 0;
7600             this.__data__ = {
7601               "hash": new Hash(),
7602               "map": new (Map2 || ListCache)(),
7603               "string": new Hash()
7604             };
7605           }
7606           function mapCacheDelete(key) {
7607             var result2 = getMapData(this, key)["delete"](key);
7608             this.size -= result2 ? 1 : 0;
7609             return result2;
7610           }
7611           function mapCacheGet(key) {
7612             return getMapData(this, key).get(key);
7613           }
7614           function mapCacheHas(key) {
7615             return getMapData(this, key).has(key);
7616           }
7617           function mapCacheSet(key, value) {
7618             var data = getMapData(this, key), size2 = data.size;
7619             data.set(key, value);
7620             this.size += data.size == size2 ? 0 : 1;
7621             return this;
7622           }
7623           MapCache.prototype.clear = mapCacheClear;
7624           MapCache.prototype["delete"] = mapCacheDelete;
7625           MapCache.prototype.get = mapCacheGet;
7626           MapCache.prototype.has = mapCacheHas;
7627           MapCache.prototype.set = mapCacheSet;
7628           function SetCache(values2) {
7629             var index = -1, length = values2 == null ? 0 : values2.length;
7630             this.__data__ = new MapCache();
7631             while (++index < length) {
7632               this.add(values2[index]);
7633             }
7634           }
7635           function setCacheAdd(value) {
7636             this.__data__.set(value, HASH_UNDEFINED);
7637             return this;
7638           }
7639           function setCacheHas(value) {
7640             return this.__data__.has(value);
7641           }
7642           SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
7643           SetCache.prototype.has = setCacheHas;
7644           function Stack(entries) {
7645             var data = this.__data__ = new ListCache(entries);
7646             this.size = data.size;
7647           }
7648           function stackClear() {
7649             this.__data__ = new ListCache();
7650             this.size = 0;
7651           }
7652           function stackDelete(key) {
7653             var data = this.__data__, result2 = data["delete"](key);
7654             this.size = data.size;
7655             return result2;
7656           }
7657           function stackGet(key) {
7658             return this.__data__.get(key);
7659           }
7660           function stackHas(key) {
7661             return this.__data__.has(key);
7662           }
7663           function stackSet(key, value) {
7664             var data = this.__data__;
7665             if (data instanceof ListCache) {
7666               var pairs = data.__data__;
7667               if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
7668                 pairs.push([key, value]);
7669                 this.size = ++data.size;
7670                 return this;
7671               }
7672               data = this.__data__ = new MapCache(pairs);
7673             }
7674             data.set(key, value);
7675             this.size = data.size;
7676             return this;
7677           }
7678           Stack.prototype.clear = stackClear;
7679           Stack.prototype["delete"] = stackDelete;
7680           Stack.prototype.get = stackGet;
7681           Stack.prototype.has = stackHas;
7682           Stack.prototype.set = stackSet;
7683           function arrayLikeKeys(value, inherited) {
7684             var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
7685             for (var key in value) {
7686               if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
7687                 result2.push(key);
7688               }
7689             }
7690             return result2;
7691           }
7692           function arraySample(array2) {
7693             var length = array2.length;
7694             return length ? array2[baseRandom(0, length - 1)] : undefined2;
7695           }
7696           function arraySampleSize(array2, n2) {
7697             return shuffleSelf(copyArray(array2), baseClamp(n2, 0, array2.length));
7698           }
7699           function arrayShuffle(array2) {
7700             return shuffleSelf(copyArray(array2));
7701           }
7702           function assignMergeValue(object, key, value) {
7703             if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
7704               baseAssignValue(object, key, value);
7705             }
7706           }
7707           function assignValue(object, key, value) {
7708             var objValue = object[key];
7709             if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
7710               baseAssignValue(object, key, value);
7711             }
7712           }
7713           function assocIndexOf(array2, key) {
7714             var length = array2.length;
7715             while (length--) {
7716               if (eq(array2[length][0], key)) {
7717                 return length;
7718               }
7719             }
7720             return -1;
7721           }
7722           function baseAggregator(collection, setter, iteratee2, accumulator) {
7723             baseEach(collection, function(value, key, collection2) {
7724               setter(accumulator, value, iteratee2(value), collection2);
7725             });
7726             return accumulator;
7727           }
7728           function baseAssign(object, source) {
7729             return object && copyObject(source, keys(source), object);
7730           }
7731           function baseAssignIn(object, source) {
7732             return object && copyObject(source, keysIn(source), object);
7733           }
7734           function baseAssignValue(object, key, value) {
7735             if (key == "__proto__" && defineProperty) {
7736               defineProperty(object, key, {
7737                 "configurable": true,
7738                 "enumerable": true,
7739                 "value": value,
7740                 "writable": true
7741               });
7742             } else {
7743               object[key] = value;
7744             }
7745           }
7746           function baseAt(object, paths) {
7747             var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7748             while (++index < length) {
7749               result2[index] = skip ? undefined2 : get3(object, paths[index]);
7750             }
7751             return result2;
7752           }
7753           function baseClamp(number3, lower2, upper) {
7754             if (number3 === number3) {
7755               if (upper !== undefined2) {
7756                 number3 = number3 <= upper ? number3 : upper;
7757               }
7758               if (lower2 !== undefined2) {
7759                 number3 = number3 >= lower2 ? number3 : lower2;
7760               }
7761             }
7762             return number3;
7763           }
7764           function baseClone(value, bitmask, customizer, key, object, stack) {
7765             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7766             if (customizer) {
7767               result2 = object ? customizer(value, key, object, stack) : customizer(value);
7768             }
7769             if (result2 !== undefined2) {
7770               return result2;
7771             }
7772             if (!isObject2(value)) {
7773               return value;
7774             }
7775             var isArr = isArray2(value);
7776             if (isArr) {
7777               result2 = initCloneArray(value);
7778               if (!isDeep) {
7779                 return copyArray(value, result2);
7780               }
7781             } else {
7782               var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
7783               if (isBuffer(value)) {
7784                 return cloneBuffer(value, isDeep);
7785               }
7786               if (tag == objectTag || tag == argsTag || isFunc && !object) {
7787                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
7788                 if (!isDeep) {
7789                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
7790                 }
7791               } else {
7792                 if (!cloneableTags[tag]) {
7793                   return object ? value : {};
7794                 }
7795                 result2 = initCloneByTag(value, tag, isDeep);
7796               }
7797             }
7798             stack || (stack = new Stack());
7799             var stacked = stack.get(value);
7800             if (stacked) {
7801               return stacked;
7802             }
7803             stack.set(value, result2);
7804             if (isSet(value)) {
7805               value.forEach(function(subValue) {
7806                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
7807               });
7808             } else if (isMap(value)) {
7809               value.forEach(function(subValue, key2) {
7810                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7811               });
7812             }
7813             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
7814             var props = isArr ? undefined2 : keysFunc(value);
7815             arrayEach(props || value, function(subValue, key2) {
7816               if (props) {
7817                 key2 = subValue;
7818                 subValue = value[key2];
7819               }
7820               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7821             });
7822             return result2;
7823           }
7824           function baseConforms(source) {
7825             var props = keys(source);
7826             return function(object) {
7827               return baseConformsTo(object, source, props);
7828             };
7829           }
7830           function baseConformsTo(object, source, props) {
7831             var length = props.length;
7832             if (object == null) {
7833               return !length;
7834             }
7835             object = Object2(object);
7836             while (length--) {
7837               var key = props[length], predicate = source[key], value = object[key];
7838               if (value === undefined2 && !(key in object) || !predicate(value)) {
7839                 return false;
7840               }
7841             }
7842             return true;
7843           }
7844           function baseDelay(func, wait, args) {
7845             if (typeof func != "function") {
7846               throw new TypeError2(FUNC_ERROR_TEXT3);
7847             }
7848             return setTimeout2(function() {
7849               func.apply(undefined2, args);
7850             }, wait);
7851           }
7852           function baseDifference(array2, values2, iteratee2, comparator) {
7853             var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
7854             if (!length) {
7855               return result2;
7856             }
7857             if (iteratee2) {
7858               values2 = arrayMap2(values2, baseUnary(iteratee2));
7859             }
7860             if (comparator) {
7861               includes2 = arrayIncludesWith;
7862               isCommon = false;
7863             } else if (values2.length >= LARGE_ARRAY_SIZE) {
7864               includes2 = cacheHas;
7865               isCommon = false;
7866               values2 = new SetCache(values2);
7867             }
7868             outer:
7869               while (++index < length) {
7870                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
7871                 value = comparator || value !== 0 ? value : 0;
7872                 if (isCommon && computed === computed) {
7873                   var valuesIndex = valuesLength;
7874                   while (valuesIndex--) {
7875                     if (values2[valuesIndex] === computed) {
7876                       continue outer;
7877                     }
7878                   }
7879                   result2.push(value);
7880                 } else if (!includes2(values2, computed, comparator)) {
7881                   result2.push(value);
7882                 }
7883               }
7884             return result2;
7885           }
7886           var baseEach = createBaseEach(baseForOwn);
7887           var baseEachRight = createBaseEach(baseForOwnRight, true);
7888           function baseEvery(collection, predicate) {
7889             var result2 = true;
7890             baseEach(collection, function(value, index, collection2) {
7891               result2 = !!predicate(value, index, collection2);
7892               return result2;
7893             });
7894             return result2;
7895           }
7896           function baseExtremum(array2, iteratee2, comparator) {
7897             var index = -1, length = array2.length;
7898             while (++index < length) {
7899               var value = array2[index], current = iteratee2(value);
7900               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
7901                 var computed = current, result2 = value;
7902               }
7903             }
7904             return result2;
7905           }
7906           function baseFill(array2, value, start2, end) {
7907             var length = array2.length;
7908             start2 = toInteger(start2);
7909             if (start2 < 0) {
7910               start2 = -start2 > length ? 0 : length + start2;
7911             }
7912             end = end === undefined2 || end > length ? length : toInteger(end);
7913             if (end < 0) {
7914               end += length;
7915             }
7916             end = start2 > end ? 0 : toLength(end);
7917             while (start2 < end) {
7918               array2[start2++] = value;
7919             }
7920             return array2;
7921           }
7922           function baseFilter(collection, predicate) {
7923             var result2 = [];
7924             baseEach(collection, function(value, index, collection2) {
7925               if (predicate(value, index, collection2)) {
7926                 result2.push(value);
7927               }
7928             });
7929             return result2;
7930           }
7931           function baseFlatten(array2, depth, predicate, isStrict, result2) {
7932             var index = -1, length = array2.length;
7933             predicate || (predicate = isFlattenable);
7934             result2 || (result2 = []);
7935             while (++index < length) {
7936               var value = array2[index];
7937               if (depth > 0 && predicate(value)) {
7938                 if (depth > 1) {
7939                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
7940                 } else {
7941                   arrayPush(result2, value);
7942                 }
7943               } else if (!isStrict) {
7944                 result2[result2.length] = value;
7945               }
7946             }
7947             return result2;
7948           }
7949           var baseFor = createBaseFor();
7950           var baseForRight = createBaseFor(true);
7951           function baseForOwn(object, iteratee2) {
7952             return object && baseFor(object, iteratee2, keys);
7953           }
7954           function baseForOwnRight(object, iteratee2) {
7955             return object && baseForRight(object, iteratee2, keys);
7956           }
7957           function baseFunctions(object, props) {
7958             return arrayFilter(props, function(key) {
7959               return isFunction(object[key]);
7960             });
7961           }
7962           function baseGet(object, path) {
7963             path = castPath(path, object);
7964             var index = 0, length = path.length;
7965             while (object != null && index < length) {
7966               object = object[toKey(path[index++])];
7967             }
7968             return index && index == length ? object : undefined2;
7969           }
7970           function baseGetAllKeys(object, keysFunc, symbolsFunc) {
7971             var result2 = keysFunc(object);
7972             return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object));
7973           }
7974           function baseGetTag2(value) {
7975             if (value == null) {
7976               return value === undefined2 ? undefinedTag2 : nullTag2;
7977             }
7978             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
7979           }
7980           function baseGt(value, other) {
7981             return value > other;
7982           }
7983           function baseHas(object, key) {
7984             return object != null && hasOwnProperty2.call(object, key);
7985           }
7986           function baseHasIn(object, key) {
7987             return object != null && key in Object2(object);
7988           }
7989           function baseInRange(number3, start2, end) {
7990             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
7991           }
7992           function baseIntersection(arrays, iteratee2, comparator) {
7993             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
7994             while (othIndex--) {
7995               var array2 = arrays[othIndex];
7996               if (othIndex && iteratee2) {
7997                 array2 = arrayMap2(array2, baseUnary(iteratee2));
7998               }
7999               maxLength = nativeMin2(array2.length, maxLength);
8000               caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache(othIndex && array2) : undefined2;
8001             }
8002             array2 = arrays[0];
8003             var index = -1, seen = caches[0];
8004             outer:
8005               while (++index < length && result2.length < maxLength) {
8006                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8007                 value = comparator || value !== 0 ? value : 0;
8008                 if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
8009                   othIndex = othLength;
8010                   while (--othIndex) {
8011                     var cache = caches[othIndex];
8012                     if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8013                       continue outer;
8014                     }
8015                   }
8016                   if (seen) {
8017                     seen.push(computed);
8018                   }
8019                   result2.push(value);
8020                 }
8021               }
8022             return result2;
8023           }
8024           function baseInverter(object, setter, iteratee2, accumulator) {
8025             baseForOwn(object, function(value, key, object2) {
8026               setter(accumulator, iteratee2(value), key, object2);
8027             });
8028             return accumulator;
8029           }
8030           function baseInvoke(object, path, args) {
8031             path = castPath(path, object);
8032             object = parent(object, path);
8033             var func = object == null ? object : object[toKey(last(path))];
8034             return func == null ? undefined2 : apply(func, object, args);
8035           }
8036           function baseIsArguments(value) {
8037             return isObjectLike2(value) && baseGetTag2(value) == argsTag;
8038           }
8039           function baseIsArrayBuffer(value) {
8040             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag;
8041           }
8042           function baseIsDate(value) {
8043             return isObjectLike2(value) && baseGetTag2(value) == dateTag;
8044           }
8045           function baseIsEqual(value, other, bitmask, customizer, stack) {
8046             if (value === other) {
8047               return true;
8048             }
8049             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8050               return value !== value && other !== other;
8051             }
8052             return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
8053           }
8054           function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
8055             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
8056             objTag = objTag == argsTag ? objectTag : objTag;
8057             othTag = othTag == argsTag ? objectTag : othTag;
8058             var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
8059             if (isSameTag && isBuffer(object)) {
8060               if (!isBuffer(other)) {
8061                 return false;
8062               }
8063               objIsArr = true;
8064               objIsObj = false;
8065             }
8066             if (isSameTag && !objIsObj) {
8067               stack || (stack = new Stack());
8068               return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
8069             }
8070             if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
8071               var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
8072               if (objIsWrapped || othIsWrapped) {
8073                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8074                 stack || (stack = new Stack());
8075                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8076               }
8077             }
8078             if (!isSameTag) {
8079               return false;
8080             }
8081             stack || (stack = new Stack());
8082             return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
8083           }
8084           function baseIsMap(value) {
8085             return isObjectLike2(value) && getTag(value) == mapTag;
8086           }
8087           function baseIsMatch(object, source, matchData, customizer) {
8088             var index = matchData.length, length = index, noCustomizer = !customizer;
8089             if (object == null) {
8090               return !length;
8091             }
8092             object = Object2(object);
8093             while (index--) {
8094               var data = matchData[index];
8095               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8096                 return false;
8097               }
8098             }
8099             while (++index < length) {
8100               data = matchData[index];
8101               var key = data[0], objValue = object[key], srcValue = data[1];
8102               if (noCustomizer && data[2]) {
8103                 if (objValue === undefined2 && !(key in object)) {
8104                   return false;
8105                 }
8106               } else {
8107                 var stack = new Stack();
8108                 if (customizer) {
8109                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
8110                 }
8111                 if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
8112                   return false;
8113                 }
8114               }
8115             }
8116             return true;
8117           }
8118           function baseIsNative(value) {
8119             if (!isObject2(value) || isMasked(value)) {
8120               return false;
8121             }
8122             var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
8123             return pattern.test(toSource(value));
8124           }
8125           function baseIsRegExp(value) {
8126             return isObjectLike2(value) && baseGetTag2(value) == regexpTag;
8127           }
8128           function baseIsSet(value) {
8129             return isObjectLike2(value) && getTag(value) == setTag;
8130           }
8131           function baseIsTypedArray(value) {
8132             return isObjectLike2(value) && isLength(value.length) && !!typedArrayTags[baseGetTag2(value)];
8133           }
8134           function baseIteratee(value) {
8135             if (typeof value == "function") {
8136               return value;
8137             }
8138             if (value == null) {
8139               return identity4;
8140             }
8141             if (typeof value == "object") {
8142               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8143             }
8144             return property(value);
8145           }
8146           function baseKeys(object) {
8147             if (!isPrototype(object)) {
8148               return nativeKeys(object);
8149             }
8150             var result2 = [];
8151             for (var key in Object2(object)) {
8152               if (hasOwnProperty2.call(object, key) && key != "constructor") {
8153                 result2.push(key);
8154               }
8155             }
8156             return result2;
8157           }
8158           function baseKeysIn(object) {
8159             if (!isObject2(object)) {
8160               return nativeKeysIn(object);
8161             }
8162             var isProto = isPrototype(object), result2 = [];
8163             for (var key in object) {
8164               if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) {
8165                 result2.push(key);
8166               }
8167             }
8168             return result2;
8169           }
8170           function baseLt(value, other) {
8171             return value < other;
8172           }
8173           function baseMap(collection, iteratee2) {
8174             var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
8175             baseEach(collection, function(value, key, collection2) {
8176               result2[++index] = iteratee2(value, key, collection2);
8177             });
8178             return result2;
8179           }
8180           function baseMatches(source) {
8181             var matchData = getMatchData(source);
8182             if (matchData.length == 1 && matchData[0][2]) {
8183               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8184             }
8185             return function(object) {
8186               return object === source || baseIsMatch(object, source, matchData);
8187             };
8188           }
8189           function baseMatchesProperty(path, srcValue) {
8190             if (isKey(path) && isStrictComparable(srcValue)) {
8191               return matchesStrictComparable(toKey(path), srcValue);
8192             }
8193             return function(object) {
8194               var objValue = get3(object, path);
8195               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
8196             };
8197           }
8198           function baseMerge(object, source, srcIndex, customizer, stack) {
8199             if (object === source) {
8200               return;
8201             }
8202             baseFor(source, function(srcValue, key) {
8203               stack || (stack = new Stack());
8204               if (isObject2(srcValue)) {
8205                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8206               } else {
8207                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8208                 if (newValue === undefined2) {
8209                   newValue = srcValue;
8210                 }
8211                 assignMergeValue(object, key, newValue);
8212               }
8213             }, keysIn);
8214           }
8215           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8216             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8217             if (stacked) {
8218               assignMergeValue(object, key, stacked);
8219               return;
8220             }
8221             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8222             var isCommon = newValue === undefined2;
8223             if (isCommon) {
8224               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
8225               newValue = srcValue;
8226               if (isArr || isBuff || isTyped) {
8227                 if (isArray2(objValue)) {
8228                   newValue = objValue;
8229                 } else if (isArrayLikeObject(objValue)) {
8230                   newValue = copyArray(objValue);
8231                 } else if (isBuff) {
8232                   isCommon = false;
8233                   newValue = cloneBuffer(srcValue, true);
8234                 } else if (isTyped) {
8235                   isCommon = false;
8236                   newValue = cloneTypedArray(srcValue, true);
8237                 } else {
8238                   newValue = [];
8239                 }
8240               } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
8241                 newValue = objValue;
8242                 if (isArguments(objValue)) {
8243                   newValue = toPlainObject(objValue);
8244                 } else if (!isObject2(objValue) || isFunction(objValue)) {
8245                   newValue = initCloneObject(srcValue);
8246                 }
8247               } else {
8248                 isCommon = false;
8249               }
8250             }
8251             if (isCommon) {
8252               stack.set(srcValue, newValue);
8253               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8254               stack["delete"](srcValue);
8255             }
8256             assignMergeValue(object, key, newValue);
8257           }
8258           function baseNth(array2, n2) {
8259             var length = array2.length;
8260             if (!length) {
8261               return;
8262             }
8263             n2 += n2 < 0 ? length : 0;
8264             return isIndex(n2, length) ? array2[n2] : undefined2;
8265           }
8266           function baseOrderBy(collection, iteratees, orders) {
8267             if (iteratees.length) {
8268               iteratees = arrayMap2(iteratees, function(iteratee2) {
8269                 if (isArray2(iteratee2)) {
8270                   return function(value) {
8271                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8272                   };
8273                 }
8274                 return iteratee2;
8275               });
8276             } else {
8277               iteratees = [identity4];
8278             }
8279             var index = -1;
8280             iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
8281             var result2 = baseMap(collection, function(value, key, collection2) {
8282               var criteria = arrayMap2(iteratees, function(iteratee2) {
8283                 return iteratee2(value);
8284               });
8285               return { "criteria": criteria, "index": ++index, "value": value };
8286             });
8287             return baseSortBy(result2, function(object, other) {
8288               return compareMultiple(object, other, orders);
8289             });
8290           }
8291           function basePick(object, paths) {
8292             return basePickBy(object, paths, function(value, path) {
8293               return hasIn(object, path);
8294             });
8295           }
8296           function basePickBy(object, paths, predicate) {
8297             var index = -1, length = paths.length, result2 = {};
8298             while (++index < length) {
8299               var path = paths[index], value = baseGet(object, path);
8300               if (predicate(value, path)) {
8301                 baseSet(result2, castPath(path, object), value);
8302               }
8303             }
8304             return result2;
8305           }
8306           function basePropertyDeep(path) {
8307             return function(object) {
8308               return baseGet(object, path);
8309             };
8310           }
8311           function basePullAll(array2, values2, iteratee2, comparator) {
8312             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8313             if (array2 === values2) {
8314               values2 = copyArray(values2);
8315             }
8316             if (iteratee2) {
8317               seen = arrayMap2(array2, baseUnary(iteratee2));
8318             }
8319             while (++index < length) {
8320               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8321               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8322                 if (seen !== array2) {
8323                   splice.call(seen, fromIndex, 1);
8324                 }
8325                 splice.call(array2, fromIndex, 1);
8326               }
8327             }
8328             return array2;
8329           }
8330           function basePullAt(array2, indexes) {
8331             var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8332             while (length--) {
8333               var index = indexes[length];
8334               if (length == lastIndex || index !== previous) {
8335                 var previous = index;
8336                 if (isIndex(index)) {
8337                   splice.call(array2, index, 1);
8338                 } else {
8339                   baseUnset(array2, index);
8340                 }
8341               }
8342             }
8343             return array2;
8344           }
8345           function baseRandom(lower2, upper) {
8346             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8347           }
8348           function baseRange(start2, end, step, fromRight) {
8349             var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8350             while (length--) {
8351               result2[fromRight ? length : ++index] = start2;
8352               start2 += step;
8353             }
8354             return result2;
8355           }
8356           function baseRepeat(string, n2) {
8357             var result2 = "";
8358             if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER) {
8359               return result2;
8360             }
8361             do {
8362               if (n2 % 2) {
8363                 result2 += string;
8364               }
8365               n2 = nativeFloor(n2 / 2);
8366               if (n2) {
8367                 string += string;
8368               }
8369             } while (n2);
8370             return result2;
8371           }
8372           function baseRest(func, start2) {
8373             return setToString(overRest(func, start2, identity4), func + "");
8374           }
8375           function baseSample(collection) {
8376             return arraySample(values(collection));
8377           }
8378           function baseSampleSize(collection, n2) {
8379             var array2 = values(collection);
8380             return shuffleSelf(array2, baseClamp(n2, 0, array2.length));
8381           }
8382           function baseSet(object, path, value, customizer) {
8383             if (!isObject2(object)) {
8384               return object;
8385             }
8386             path = castPath(path, object);
8387             var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8388             while (nested != null && ++index < length) {
8389               var key = toKey(path[index]), newValue = value;
8390               if (key === "__proto__" || key === "constructor" || key === "prototype") {
8391                 return object;
8392               }
8393               if (index != lastIndex) {
8394                 var objValue = nested[key];
8395                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8396                 if (newValue === undefined2) {
8397                   newValue = isObject2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
8398                 }
8399               }
8400               assignValue(nested, key, newValue);
8401               nested = nested[key];
8402             }
8403             return object;
8404           }
8405           var baseSetData = !metaMap ? identity4 : function(func, data) {
8406             metaMap.set(func, data);
8407             return func;
8408           };
8409           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8410             return defineProperty(func, "toString", {
8411               "configurable": true,
8412               "enumerable": false,
8413               "value": constant(string),
8414               "writable": true
8415             });
8416           };
8417           function baseShuffle(collection) {
8418             return shuffleSelf(values(collection));
8419           }
8420           function baseSlice(array2, start2, end) {
8421             var index = -1, length = array2.length;
8422             if (start2 < 0) {
8423               start2 = -start2 > length ? 0 : length + start2;
8424             }
8425             end = end > length ? length : end;
8426             if (end < 0) {
8427               end += length;
8428             }
8429             length = start2 > end ? 0 : end - start2 >>> 0;
8430             start2 >>>= 0;
8431             var result2 = Array2(length);
8432             while (++index < length) {
8433               result2[index] = array2[index + start2];
8434             }
8435             return result2;
8436           }
8437           function baseSome(collection, predicate) {
8438             var result2;
8439             baseEach(collection, function(value, index, collection2) {
8440               result2 = predicate(value, index, collection2);
8441               return !result2;
8442             });
8443             return !!result2;
8444           }
8445           function baseSortedIndex(array2, value, retHighest) {
8446             var low = 0, high = array2 == null ? low : array2.length;
8447             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8448               while (low < high) {
8449                 var mid = low + high >>> 1, computed = array2[mid];
8450                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8451                   low = mid + 1;
8452                 } else {
8453                   high = mid;
8454                 }
8455               }
8456               return high;
8457             }
8458             return baseSortedIndexBy(array2, value, identity4, retHighest);
8459           }
8460           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8461             var low = 0, high = array2 == null ? 0 : array2.length;
8462             if (high === 0) {
8463               return 0;
8464             }
8465             value = iteratee2(value);
8466             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8467             while (low < high) {
8468               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8469               if (valIsNaN) {
8470                 var setLow = retHighest || othIsReflexive;
8471               } else if (valIsUndefined) {
8472                 setLow = othIsReflexive && (retHighest || othIsDefined);
8473               } else if (valIsNull) {
8474                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8475               } else if (valIsSymbol) {
8476                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8477               } else if (othIsNull || othIsSymbol) {
8478                 setLow = false;
8479               } else {
8480                 setLow = retHighest ? computed <= value : computed < value;
8481               }
8482               if (setLow) {
8483                 low = mid + 1;
8484               } else {
8485                 high = mid;
8486               }
8487             }
8488             return nativeMin2(high, MAX_ARRAY_INDEX);
8489           }
8490           function baseSortedUniq(array2, iteratee2) {
8491             var index = -1, length = array2.length, resIndex = 0, result2 = [];
8492             while (++index < length) {
8493               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8494               if (!index || !eq(computed, seen)) {
8495                 var seen = computed;
8496                 result2[resIndex++] = value === 0 ? 0 : value;
8497               }
8498             }
8499             return result2;
8500           }
8501           function baseToNumber(value) {
8502             if (typeof value == "number") {
8503               return value;
8504             }
8505             if (isSymbol2(value)) {
8506               return NAN2;
8507             }
8508             return +value;
8509           }
8510           function baseToString2(value) {
8511             if (typeof value == "string") {
8512               return value;
8513             }
8514             if (isArray2(value)) {
8515               return arrayMap2(value, baseToString2) + "";
8516             }
8517             if (isSymbol2(value)) {
8518               return symbolToString2 ? symbolToString2.call(value) : "";
8519             }
8520             var result2 = value + "";
8521             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8522           }
8523           function baseUniq(array2, iteratee2, comparator) {
8524             var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8525             if (comparator) {
8526               isCommon = false;
8527               includes2 = arrayIncludesWith;
8528             } else if (length >= LARGE_ARRAY_SIZE) {
8529               var set4 = iteratee2 ? null : createSet(array2);
8530               if (set4) {
8531                 return setToArray(set4);
8532               }
8533               isCommon = false;
8534               includes2 = cacheHas;
8535               seen = new SetCache();
8536             } else {
8537               seen = iteratee2 ? [] : result2;
8538             }
8539             outer:
8540               while (++index < length) {
8541                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8542                 value = comparator || value !== 0 ? value : 0;
8543                 if (isCommon && computed === computed) {
8544                   var seenIndex = seen.length;
8545                   while (seenIndex--) {
8546                     if (seen[seenIndex] === computed) {
8547                       continue outer;
8548                     }
8549                   }
8550                   if (iteratee2) {
8551                     seen.push(computed);
8552                   }
8553                   result2.push(value);
8554                 } else if (!includes2(seen, computed, comparator)) {
8555                   if (seen !== result2) {
8556                     seen.push(computed);
8557                   }
8558                   result2.push(value);
8559                 }
8560               }
8561             return result2;
8562           }
8563           function baseUnset(object, path) {
8564             path = castPath(path, object);
8565             object = parent(object, path);
8566             return object == null || delete object[toKey(last(path))];
8567           }
8568           function baseUpdate(object, path, updater, customizer) {
8569             return baseSet(object, path, updater(baseGet(object, path)), customizer);
8570           }
8571           function baseWhile(array2, predicate, isDrop, fromRight) {
8572             var length = array2.length, index = fromRight ? length : -1;
8573             while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8574             }
8575             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8576           }
8577           function baseWrapperValue(value, actions) {
8578             var result2 = value;
8579             if (result2 instanceof LazyWrapper) {
8580               result2 = result2.value();
8581             }
8582             return arrayReduce(actions, function(result3, action) {
8583               return action.func.apply(action.thisArg, arrayPush([result3], action.args));
8584             }, result2);
8585           }
8586           function baseXor(arrays, iteratee2, comparator) {
8587             var length = arrays.length;
8588             if (length < 2) {
8589               return length ? baseUniq(arrays[0]) : [];
8590             }
8591             var index = -1, result2 = Array2(length);
8592             while (++index < length) {
8593               var array2 = arrays[index], othIndex = -1;
8594               while (++othIndex < length) {
8595                 if (othIndex != index) {
8596                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8597                 }
8598               }
8599             }
8600             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8601           }
8602           function baseZipObject(props, values2, assignFunc) {
8603             var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8604             while (++index < length) {
8605               var value = index < valsLength ? values2[index] : undefined2;
8606               assignFunc(result2, props[index], value);
8607             }
8608             return result2;
8609           }
8610           function castArrayLikeObject(value) {
8611             return isArrayLikeObject(value) ? value : [];
8612           }
8613           function castFunction(value) {
8614             return typeof value == "function" ? value : identity4;
8615           }
8616           function castPath(value, object) {
8617             if (isArray2(value)) {
8618               return value;
8619             }
8620             return isKey(value, object) ? [value] : stringToPath(toString2(value));
8621           }
8622           var castRest = baseRest;
8623           function castSlice(array2, start2, end) {
8624             var length = array2.length;
8625             end = end === undefined2 ? length : end;
8626             return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8627           }
8628           var clearTimeout2 = ctxClearTimeout || function(id2) {
8629             return root3.clearTimeout(id2);
8630           };
8631           function cloneBuffer(buffer, isDeep) {
8632             if (isDeep) {
8633               return buffer.slice();
8634             }
8635             var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8636             buffer.copy(result2);
8637             return result2;
8638           }
8639           function cloneArrayBuffer(arrayBuffer) {
8640             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8641             new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
8642             return result2;
8643           }
8644           function cloneDataView(dataView, isDeep) {
8645             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8646             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8647           }
8648           function cloneRegExp(regexp) {
8649             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8650             result2.lastIndex = regexp.lastIndex;
8651             return result2;
8652           }
8653           function cloneSymbol(symbol) {
8654             return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
8655           }
8656           function cloneTypedArray(typedArray, isDeep) {
8657             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8658             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8659           }
8660           function compareAscending(value, other) {
8661             if (value !== other) {
8662               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8663               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8664               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8665                 return 1;
8666               }
8667               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8668                 return -1;
8669               }
8670             }
8671             return 0;
8672           }
8673           function compareMultiple(object, other, orders) {
8674             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8675             while (++index < length) {
8676               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8677               if (result2) {
8678                 if (index >= ordersLength) {
8679                   return result2;
8680                 }
8681                 var order = orders[index];
8682                 return result2 * (order == "desc" ? -1 : 1);
8683               }
8684             }
8685             return object.index - other.index;
8686           }
8687           function composeArgs(args, partials, holders, isCurried) {
8688             var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
8689             while (++leftIndex < leftLength) {
8690               result2[leftIndex] = partials[leftIndex];
8691             }
8692             while (++argsIndex < holdersLength) {
8693               if (isUncurried || argsIndex < argsLength) {
8694                 result2[holders[argsIndex]] = args[argsIndex];
8695               }
8696             }
8697             while (rangeLength--) {
8698               result2[leftIndex++] = args[argsIndex++];
8699             }
8700             return result2;
8701           }
8702           function composeArgsRight(args, partials, holders, isCurried) {
8703             var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
8704             while (++argsIndex < rangeLength) {
8705               result2[argsIndex] = args[argsIndex];
8706             }
8707             var offset = argsIndex;
8708             while (++rightIndex < rightLength) {
8709               result2[offset + rightIndex] = partials[rightIndex];
8710             }
8711             while (++holdersIndex < holdersLength) {
8712               if (isUncurried || argsIndex < argsLength) {
8713                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8714               }
8715             }
8716             return result2;
8717           }
8718           function copyArray(source, array2) {
8719             var index = -1, length = source.length;
8720             array2 || (array2 = Array2(length));
8721             while (++index < length) {
8722               array2[index] = source[index];
8723             }
8724             return array2;
8725           }
8726           function copyObject(source, props, object, customizer) {
8727             var isNew = !object;
8728             object || (object = {});
8729             var index = -1, length = props.length;
8730             while (++index < length) {
8731               var key = props[index];
8732               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8733               if (newValue === undefined2) {
8734                 newValue = source[key];
8735               }
8736               if (isNew) {
8737                 baseAssignValue(object, key, newValue);
8738               } else {
8739                 assignValue(object, key, newValue);
8740               }
8741             }
8742             return object;
8743           }
8744           function copySymbols(source, object) {
8745             return copyObject(source, getSymbols(source), object);
8746           }
8747           function copySymbolsIn(source, object) {
8748             return copyObject(source, getSymbolsIn(source), object);
8749           }
8750           function createAggregator(setter, initializer) {
8751             return function(collection, iteratee2) {
8752               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8753               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8754             };
8755           }
8756           function createAssigner(assigner) {
8757             return baseRest(function(object, sources) {
8758               var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8759               customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8760               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8761                 customizer = length < 3 ? undefined2 : customizer;
8762                 length = 1;
8763               }
8764               object = Object2(object);
8765               while (++index < length) {
8766                 var source = sources[index];
8767                 if (source) {
8768                   assigner(object, source, index, customizer);
8769                 }
8770               }
8771               return object;
8772             });
8773           }
8774           function createBaseEach(eachFunc, fromRight) {
8775             return function(collection, iteratee2) {
8776               if (collection == null) {
8777                 return collection;
8778               }
8779               if (!isArrayLike(collection)) {
8780                 return eachFunc(collection, iteratee2);
8781               }
8782               var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
8783               while (fromRight ? index-- : ++index < length) {
8784                 if (iteratee2(iterable[index], index, iterable) === false) {
8785                   break;
8786                 }
8787               }
8788               return collection;
8789             };
8790           }
8791           function createBaseFor(fromRight) {
8792             return function(object, iteratee2, keysFunc) {
8793               var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
8794               while (length--) {
8795                 var key = props[fromRight ? length : ++index];
8796                 if (iteratee2(iterable[key], key, iterable) === false) {
8797                   break;
8798                 }
8799               }
8800               return object;
8801             };
8802           }
8803           function createBind(func, bitmask, thisArg) {
8804             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
8805             function wrapper() {
8806               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8807               return fn.apply(isBind ? thisArg : this, arguments);
8808             }
8809             return wrapper;
8810           }
8811           function createCaseFirst(methodName) {
8812             return function(string) {
8813               string = toString2(string);
8814               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
8815               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
8816               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
8817               return chr[methodName]() + trailing;
8818             };
8819           }
8820           function createCompounder(callback) {
8821             return function(string) {
8822               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
8823             };
8824           }
8825           function createCtor(Ctor) {
8826             return function() {
8827               var args = arguments;
8828               switch (args.length) {
8829                 case 0:
8830                   return new Ctor();
8831                 case 1:
8832                   return new Ctor(args[0]);
8833                 case 2:
8834                   return new Ctor(args[0], args[1]);
8835                 case 3:
8836                   return new Ctor(args[0], args[1], args[2]);
8837                 case 4:
8838                   return new Ctor(args[0], args[1], args[2], args[3]);
8839                 case 5:
8840                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8841                 case 6:
8842                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8843                 case 7:
8844                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8845               }
8846               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
8847               return isObject2(result2) ? result2 : thisBinding;
8848             };
8849           }
8850           function createCurry(func, bitmask, arity) {
8851             var Ctor = createCtor(func);
8852             function wrapper() {
8853               var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
8854               while (index--) {
8855                 args[index] = arguments[index];
8856               }
8857               var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
8858               length -= holders.length;
8859               if (length < arity) {
8860                 return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length);
8861               }
8862               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8863               return apply(fn, this, args);
8864             }
8865             return wrapper;
8866           }
8867           function createFind(findIndexFunc) {
8868             return function(collection, predicate, fromIndex) {
8869               var iterable = Object2(collection);
8870               if (!isArrayLike(collection)) {
8871                 var iteratee2 = getIteratee(predicate, 3);
8872                 collection = keys(collection);
8873                 predicate = function(key) {
8874                   return iteratee2(iterable[key], key, iterable);
8875                 };
8876               }
8877               var index = findIndexFunc(collection, predicate, fromIndex);
8878               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
8879             };
8880           }
8881           function createFlow(fromRight) {
8882             return flatRest(function(funcs) {
8883               var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
8884               if (fromRight) {
8885                 funcs.reverse();
8886               }
8887               while (index--) {
8888                 var func = funcs[index];
8889                 if (typeof func != "function") {
8890                   throw new TypeError2(FUNC_ERROR_TEXT3);
8891                 }
8892                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
8893                   var wrapper = new LodashWrapper([], true);
8894                 }
8895               }
8896               index = wrapper ? index : length;
8897               while (++index < length) {
8898                 func = funcs[index];
8899                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
8900                 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
8901                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
8902                 } else {
8903                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
8904                 }
8905               }
8906               return function() {
8907                 var args = arguments, value = args[0];
8908                 if (wrapper && args.length == 1 && isArray2(value)) {
8909                   return wrapper.plant(value).value();
8910                 }
8911                 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
8912                 while (++index2 < length) {
8913                   result2 = funcs[index2].call(this, result2);
8914                 }
8915                 return result2;
8916               };
8917             });
8918           }
8919           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
8920             var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
8921             function wrapper() {
8922               var length = arguments.length, args = Array2(length), index = length;
8923               while (index--) {
8924                 args[index] = arguments[index];
8925               }
8926               if (isCurried) {
8927                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
8928               }
8929               if (partials) {
8930                 args = composeArgs(args, partials, holders, isCurried);
8931               }
8932               if (partialsRight) {
8933                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
8934               }
8935               length -= holdersCount;
8936               if (isCurried && length < arity) {
8937                 var newHolders = replaceHolders(args, placeholder);
8938                 return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length);
8939               }
8940               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
8941               length = args.length;
8942               if (argPos) {
8943                 args = reorder(args, argPos);
8944               } else if (isFlip && length > 1) {
8945                 args.reverse();
8946               }
8947               if (isAry && ary2 < length) {
8948                 args.length = ary2;
8949               }
8950               if (this && this !== root3 && this instanceof wrapper) {
8951                 fn = Ctor || createCtor(fn);
8952               }
8953               return fn.apply(thisBinding, args);
8954             }
8955             return wrapper;
8956           }
8957           function createInverter(setter, toIteratee) {
8958             return function(object, iteratee2) {
8959               return baseInverter(object, setter, toIteratee(iteratee2), {});
8960             };
8961           }
8962           function createMathOperation(operator, defaultValue) {
8963             return function(value, other) {
8964               var result2;
8965               if (value === undefined2 && other === undefined2) {
8966                 return defaultValue;
8967               }
8968               if (value !== undefined2) {
8969                 result2 = value;
8970               }
8971               if (other !== undefined2) {
8972                 if (result2 === undefined2) {
8973                   return other;
8974                 }
8975                 if (typeof value == "string" || typeof other == "string") {
8976                   value = baseToString2(value);
8977                   other = baseToString2(other);
8978                 } else {
8979                   value = baseToNumber(value);
8980                   other = baseToNumber(other);
8981                 }
8982                 result2 = operator(value, other);
8983               }
8984               return result2;
8985             };
8986           }
8987           function createOver(arrayFunc) {
8988             return flatRest(function(iteratees) {
8989               iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
8990               return baseRest(function(args) {
8991                 var thisArg = this;
8992                 return arrayFunc(iteratees, function(iteratee2) {
8993                   return apply(iteratee2, thisArg, args);
8994                 });
8995               });
8996             });
8997           }
8998           function createPadding(length, chars) {
8999             chars = chars === undefined2 ? " " : baseToString2(chars);
9000             var charsLength = chars.length;
9001             if (charsLength < 2) {
9002               return charsLength ? baseRepeat(chars, length) : chars;
9003             }
9004             var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9005             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9006           }
9007           function createPartial(func, bitmask, thisArg, partials) {
9008             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9009             function wrapper() {
9010               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9011               while (++leftIndex < leftLength) {
9012                 args[leftIndex] = partials[leftIndex];
9013               }
9014               while (argsLength--) {
9015                 args[leftIndex++] = arguments[++argsIndex];
9016               }
9017               return apply(fn, isBind ? thisArg : this, args);
9018             }
9019             return wrapper;
9020           }
9021           function createRange(fromRight) {
9022             return function(start2, end, step) {
9023               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9024                 end = step = undefined2;
9025               }
9026               start2 = toFinite(start2);
9027               if (end === undefined2) {
9028                 end = start2;
9029                 start2 = 0;
9030               } else {
9031                 end = toFinite(end);
9032               }
9033               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9034               return baseRange(start2, end, step, fromRight);
9035             };
9036           }
9037           function createRelationalOperation(operator) {
9038             return function(value, other) {
9039               if (!(typeof value == "string" && typeof other == "string")) {
9040                 value = toNumber2(value);
9041                 other = toNumber2(other);
9042               }
9043               return operator(value, other);
9044             };
9045           }
9046           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9047             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9048             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9049             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9050             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9051               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9052             }
9053             var newData = [
9054               func,
9055               bitmask,
9056               thisArg,
9057               newPartials,
9058               newHolders,
9059               newPartialsRight,
9060               newHoldersRight,
9061               argPos,
9062               ary2,
9063               arity
9064             ];
9065             var result2 = wrapFunc.apply(undefined2, newData);
9066             if (isLaziable(func)) {
9067               setData(result2, newData);
9068             }
9069             result2.placeholder = placeholder;
9070             return setWrapToString(result2, func, bitmask);
9071           }
9072           function createRound(methodName) {
9073             var func = Math2[methodName];
9074             return function(number3, precision2) {
9075               number3 = toNumber2(number3);
9076               precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9077               if (precision2 && nativeIsFinite(number3)) {
9078                 var pair2 = (toString2(number3) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision2));
9079                 pair2 = (toString2(value) + "e").split("e");
9080                 return +(pair2[0] + "e" + (+pair2[1] - precision2));
9081               }
9082               return func(number3);
9083             };
9084           }
9085           var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9086             return new Set2(values2);
9087           };
9088           function createToPairs(keysFunc) {
9089             return function(object) {
9090               var tag = getTag(object);
9091               if (tag == mapTag) {
9092                 return mapToArray(object);
9093               }
9094               if (tag == setTag) {
9095                 return setToPairs(object);
9096               }
9097               return baseToPairs(object, keysFunc(object));
9098             };
9099           }
9100           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9101             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9102             if (!isBindKey && typeof func != "function") {
9103               throw new TypeError2(FUNC_ERROR_TEXT3);
9104             }
9105             var length = partials ? partials.length : 0;
9106             if (!length) {
9107               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9108               partials = holders = undefined2;
9109             }
9110             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9111             arity = arity === undefined2 ? arity : toInteger(arity);
9112             length -= holders ? holders.length : 0;
9113             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9114               var partialsRight = partials, holdersRight = holders;
9115               partials = holders = undefined2;
9116             }
9117             var data = isBindKey ? undefined2 : getData(func);
9118             var newData = [
9119               func,
9120               bitmask,
9121               thisArg,
9122               partials,
9123               holders,
9124               partialsRight,
9125               holdersRight,
9126               argPos,
9127               ary2,
9128               arity
9129             ];
9130             if (data) {
9131               mergeData(newData, data);
9132             }
9133             func = newData[0];
9134             bitmask = newData[1];
9135             thisArg = newData[2];
9136             partials = newData[3];
9137             holders = newData[4];
9138             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9139             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9140               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9141             }
9142             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9143               var result2 = createBind(func, bitmask, thisArg);
9144             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9145               result2 = createCurry(func, bitmask, arity);
9146             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9147               result2 = createPartial(func, bitmask, thisArg, partials);
9148             } else {
9149               result2 = createHybrid.apply(undefined2, newData);
9150             }
9151             var setter = data ? baseSetData : setData;
9152             return setWrapToString(setter(result2, newData), func, bitmask);
9153           }
9154           function customDefaultsAssignIn(objValue, srcValue, key, object) {
9155             if (objValue === undefined2 || eq(objValue, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
9156               return srcValue;
9157             }
9158             return objValue;
9159           }
9160           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9161             if (isObject2(objValue) && isObject2(srcValue)) {
9162               stack.set(srcValue, objValue);
9163               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9164               stack["delete"](srcValue);
9165             }
9166             return objValue;
9167           }
9168           function customOmitClone(value) {
9169             return isPlainObject(value) ? undefined2 : value;
9170           }
9171           function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
9172             var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
9173             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9174               return false;
9175             }
9176             var arrStacked = stack.get(array2);
9177             var othStacked = stack.get(other);
9178             if (arrStacked && othStacked) {
9179               return arrStacked == other && othStacked == array2;
9180             }
9181             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
9182             stack.set(array2, other);
9183             stack.set(other, array2);
9184             while (++index < arrLength) {
9185               var arrValue = array2[index], othValue = other[index];
9186               if (customizer) {
9187                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9188               }
9189               if (compared !== undefined2) {
9190                 if (compared) {
9191                   continue;
9192                 }
9193                 result2 = false;
9194                 break;
9195               }
9196               if (seen) {
9197                 if (!arraySome(other, function(othValue2, othIndex) {
9198                   if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9199                     return seen.push(othIndex);
9200                   }
9201                 })) {
9202                   result2 = false;
9203                   break;
9204                 }
9205               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9206                 result2 = false;
9207                 break;
9208               }
9209             }
9210             stack["delete"](array2);
9211             stack["delete"](other);
9212             return result2;
9213           }
9214           function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
9215             switch (tag) {
9216               case dataViewTag:
9217                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9218                   return false;
9219                 }
9220                 object = object.buffer;
9221                 other = other.buffer;
9222               case arrayBufferTag:
9223                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
9224                   return false;
9225                 }
9226                 return true;
9227               case boolTag:
9228               case dateTag:
9229               case numberTag:
9230                 return eq(+object, +other);
9231               case errorTag:
9232                 return object.name == other.name && object.message == other.message;
9233               case regexpTag:
9234               case stringTag:
9235                 return object == other + "";
9236               case mapTag:
9237                 var convert = mapToArray;
9238               case setTag:
9239                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
9240                 convert || (convert = setToArray);
9241                 if (object.size != other.size && !isPartial) {
9242                   return false;
9243                 }
9244                 var stacked = stack.get(object);
9245                 if (stacked) {
9246                   return stacked == other;
9247                 }
9248                 bitmask |= COMPARE_UNORDERED_FLAG;
9249                 stack.set(object, other);
9250                 var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9251                 stack["delete"](object);
9252                 return result2;
9253               case symbolTag2:
9254                 if (symbolValueOf) {
9255                   return symbolValueOf.call(object) == symbolValueOf.call(other);
9256                 }
9257             }
9258             return false;
9259           }
9260           function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
9261             var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
9262             if (objLength != othLength && !isPartial) {
9263               return false;
9264             }
9265             var index = objLength;
9266             while (index--) {
9267               var key = objProps[index];
9268               if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
9269                 return false;
9270               }
9271             }
9272             var objStacked = stack.get(object);
9273             var othStacked = stack.get(other);
9274             if (objStacked && othStacked) {
9275               return objStacked == other && othStacked == object;
9276             }
9277             var result2 = true;
9278             stack.set(object, other);
9279             stack.set(other, object);
9280             var skipCtor = isPartial;
9281             while (++index < objLength) {
9282               key = objProps[index];
9283               var objValue = object[key], othValue = other[key];
9284               if (customizer) {
9285                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9286               }
9287               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9288                 result2 = false;
9289                 break;
9290               }
9291               skipCtor || (skipCtor = key == "constructor");
9292             }
9293             if (result2 && !skipCtor) {
9294               var objCtor = object.constructor, othCtor = other.constructor;
9295               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9296                 result2 = false;
9297               }
9298             }
9299             stack["delete"](object);
9300             stack["delete"](other);
9301             return result2;
9302           }
9303           function flatRest(func) {
9304             return setToString(overRest(func, undefined2, flatten2), func + "");
9305           }
9306           function getAllKeys(object) {
9307             return baseGetAllKeys(object, keys, getSymbols);
9308           }
9309           function getAllKeysIn(object) {
9310             return baseGetAllKeys(object, keysIn, getSymbolsIn);
9311           }
9312           var getData = !metaMap ? noop3 : function(func) {
9313             return metaMap.get(func);
9314           };
9315           function getFuncName(func) {
9316             var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array2.length : 0;
9317             while (length--) {
9318               var data = array2[length], otherFunc = data.func;
9319               if (otherFunc == null || otherFunc == func) {
9320                 return data.name;
9321               }
9322             }
9323             return result2;
9324           }
9325           function getHolder(func) {
9326             var object = hasOwnProperty2.call(lodash, "placeholder") ? lodash : func;
9327             return object.placeholder;
9328           }
9329           function getIteratee() {
9330             var result2 = lodash.iteratee || iteratee;
9331             result2 = result2 === iteratee ? baseIteratee : result2;
9332             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9333           }
9334           function getMapData(map3, key) {
9335             var data = map3.__data__;
9336             return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9337           }
9338           function getMatchData(object) {
9339             var result2 = keys(object), length = result2.length;
9340             while (length--) {
9341               var key = result2[length], value = object[key];
9342               result2[length] = [key, value, isStrictComparable(value)];
9343             }
9344             return result2;
9345           }
9346           function getNative(object, key) {
9347             var value = getValue(object, key);
9348             return baseIsNative(value) ? value : undefined2;
9349           }
9350           function getRawTag2(value) {
9351             var isOwn = hasOwnProperty2.call(value, symToStringTag3), tag = value[symToStringTag3];
9352             try {
9353               value[symToStringTag3] = undefined2;
9354               var unmasked = true;
9355             } catch (e) {
9356             }
9357             var result2 = nativeObjectToString3.call(value);
9358             if (unmasked) {
9359               if (isOwn) {
9360                 value[symToStringTag3] = tag;
9361               } else {
9362                 delete value[symToStringTag3];
9363               }
9364             }
9365             return result2;
9366           }
9367           var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
9368             if (object == null) {
9369               return [];
9370             }
9371             object = Object2(object);
9372             return arrayFilter(nativeGetSymbols(object), function(symbol) {
9373               return propertyIsEnumerable.call(object, symbol);
9374             });
9375           };
9376           var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
9377             var result2 = [];
9378             while (object) {
9379               arrayPush(result2, getSymbols(object));
9380               object = getPrototype(object);
9381             }
9382             return result2;
9383           };
9384           var getTag = baseGetTag2;
9385           if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
9386             getTag = function(value) {
9387               var result2 = baseGetTag2(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
9388               if (ctorString) {
9389                 switch (ctorString) {
9390                   case dataViewCtorString:
9391                     return dataViewTag;
9392                   case mapCtorString:
9393                     return mapTag;
9394                   case promiseCtorString:
9395                     return promiseTag;
9396                   case setCtorString:
9397                     return setTag;
9398                   case weakMapCtorString:
9399                     return weakMapTag;
9400                 }
9401               }
9402               return result2;
9403             };
9404           }
9405           function getView(start2, end, transforms) {
9406             var index = -1, length = transforms.length;
9407             while (++index < length) {
9408               var data = transforms[index], size2 = data.size;
9409               switch (data.type) {
9410                 case "drop":
9411                   start2 += size2;
9412                   break;
9413                 case "dropRight":
9414                   end -= size2;
9415                   break;
9416                 case "take":
9417                   end = nativeMin2(end, start2 + size2);
9418                   break;
9419                 case "takeRight":
9420                   start2 = nativeMax2(start2, end - size2);
9421                   break;
9422               }
9423             }
9424             return { "start": start2, "end": end };
9425           }
9426           function getWrapDetails(source) {
9427             var match = source.match(reWrapDetails);
9428             return match ? match[1].split(reSplitDetails) : [];
9429           }
9430           function hasPath(object, path, hasFunc) {
9431             path = castPath(path, object);
9432             var index = -1, length = path.length, result2 = false;
9433             while (++index < length) {
9434               var key = toKey(path[index]);
9435               if (!(result2 = object != null && hasFunc(object, key))) {
9436                 break;
9437               }
9438               object = object[key];
9439             }
9440             if (result2 || ++index != length) {
9441               return result2;
9442             }
9443             length = object == null ? 0 : object.length;
9444             return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
9445           }
9446           function initCloneArray(array2) {
9447             var length = array2.length, result2 = new array2.constructor(length);
9448             if (length && typeof array2[0] == "string" && hasOwnProperty2.call(array2, "index")) {
9449               result2.index = array2.index;
9450               result2.input = array2.input;
9451             }
9452             return result2;
9453           }
9454           function initCloneObject(object) {
9455             return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
9456           }
9457           function initCloneByTag(object, tag, isDeep) {
9458             var Ctor = object.constructor;
9459             switch (tag) {
9460               case arrayBufferTag:
9461                 return cloneArrayBuffer(object);
9462               case boolTag:
9463               case dateTag:
9464                 return new Ctor(+object);
9465               case dataViewTag:
9466                 return cloneDataView(object, isDeep);
9467               case float32Tag:
9468               case float64Tag:
9469               case int8Tag:
9470               case int16Tag:
9471               case int32Tag:
9472               case uint8Tag:
9473               case uint8ClampedTag:
9474               case uint16Tag:
9475               case uint32Tag:
9476                 return cloneTypedArray(object, isDeep);
9477               case mapTag:
9478                 return new Ctor();
9479               case numberTag:
9480               case stringTag:
9481                 return new Ctor(object);
9482               case regexpTag:
9483                 return cloneRegExp(object);
9484               case setTag:
9485                 return new Ctor();
9486               case symbolTag2:
9487                 return cloneSymbol(object);
9488             }
9489           }
9490           function insertWrapDetails(source, details) {
9491             var length = details.length;
9492             if (!length) {
9493               return source;
9494             }
9495             var lastIndex = length - 1;
9496             details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9497             details = details.join(length > 2 ? ", " : " ");
9498             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9499           }
9500           function isFlattenable(value) {
9501             return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9502           }
9503           function isIndex(value, length) {
9504             var type3 = typeof value;
9505             length = length == null ? MAX_SAFE_INTEGER : length;
9506             return !!length && (type3 == "number" || type3 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9507           }
9508           function isIterateeCall(value, index, object) {
9509             if (!isObject2(object)) {
9510               return false;
9511             }
9512             var type3 = typeof index;
9513             if (type3 == "number" ? isArrayLike(object) && isIndex(index, object.length) : type3 == "string" && index in object) {
9514               return eq(object[index], value);
9515             }
9516             return false;
9517           }
9518           function isKey(value, object) {
9519             if (isArray2(value)) {
9520               return false;
9521             }
9522             var type3 = typeof value;
9523             if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value == null || isSymbol2(value)) {
9524               return true;
9525             }
9526             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9527           }
9528           function isKeyable(value) {
9529             var type3 = typeof value;
9530             return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value !== "__proto__" : value === null;
9531           }
9532           function isLaziable(func) {
9533             var funcName = getFuncName(func), other = lodash[funcName];
9534             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9535               return false;
9536             }
9537             if (func === other) {
9538               return true;
9539             }
9540             var data = getData(other);
9541             return !!data && func === data[0];
9542           }
9543           function isMasked(func) {
9544             return !!maskSrcKey && maskSrcKey in func;
9545           }
9546           var isMaskable = coreJsData ? isFunction : stubFalse;
9547           function isPrototype(value) {
9548             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto3;
9549             return value === proto;
9550           }
9551           function isStrictComparable(value) {
9552             return value === value && !isObject2(value);
9553           }
9554           function matchesStrictComparable(key, srcValue) {
9555             return function(object) {
9556               if (object == null) {
9557                 return false;
9558               }
9559               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9560             };
9561           }
9562           function memoizeCapped(func) {
9563             var result2 = memoize(func, function(key) {
9564               if (cache.size === MAX_MEMOIZE_SIZE) {
9565                 cache.clear();
9566               }
9567               return key;
9568             });
9569             var cache = result2.cache;
9570             return result2;
9571           }
9572           function mergeData(data, source) {
9573             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9574             var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
9575             if (!(isCommon || isCombo)) {
9576               return data;
9577             }
9578             if (srcBitmask & WRAP_BIND_FLAG) {
9579               data[2] = source[2];
9580               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9581             }
9582             var value = source[3];
9583             if (value) {
9584               var partials = data[3];
9585               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9586               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9587             }
9588             value = source[5];
9589             if (value) {
9590               partials = data[5];
9591               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9592               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9593             }
9594             value = source[7];
9595             if (value) {
9596               data[7] = value;
9597             }
9598             if (srcBitmask & WRAP_ARY_FLAG) {
9599               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9600             }
9601             if (data[9] == null) {
9602               data[9] = source[9];
9603             }
9604             data[0] = source[0];
9605             data[1] = newBitmask;
9606             return data;
9607           }
9608           function nativeKeysIn(object) {
9609             var result2 = [];
9610             if (object != null) {
9611               for (var key in Object2(object)) {
9612                 result2.push(key);
9613               }
9614             }
9615             return result2;
9616           }
9617           function objectToString2(value) {
9618             return nativeObjectToString3.call(value);
9619           }
9620           function overRest(func, start2, transform3) {
9621             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9622             return function() {
9623               var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9624               while (++index < length) {
9625                 array2[index] = args[start2 + index];
9626               }
9627               index = -1;
9628               var otherArgs = Array2(start2 + 1);
9629               while (++index < start2) {
9630                 otherArgs[index] = args[index];
9631               }
9632               otherArgs[start2] = transform3(array2);
9633               return apply(func, this, otherArgs);
9634             };
9635           }
9636           function parent(object, path) {
9637             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9638           }
9639           function reorder(array2, indexes) {
9640             var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9641             while (length--) {
9642               var index = indexes[length];
9643               array2[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
9644             }
9645             return array2;
9646           }
9647           function safeGet(object, key) {
9648             if (key === "constructor" && typeof object[key] === "function") {
9649               return;
9650             }
9651             if (key == "__proto__") {
9652               return;
9653             }
9654             return object[key];
9655           }
9656           var setData = shortOut(baseSetData);
9657           var setTimeout2 = ctxSetTimeout || function(func, wait) {
9658             return root3.setTimeout(func, wait);
9659           };
9660           var setToString = shortOut(baseSetToString);
9661           function setWrapToString(wrapper, reference, bitmask) {
9662             var source = reference + "";
9663             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9664           }
9665           function shortOut(func) {
9666             var count = 0, lastCalled = 0;
9667             return function() {
9668               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9669               lastCalled = stamp;
9670               if (remaining > 0) {
9671                 if (++count >= HOT_COUNT) {
9672                   return arguments[0];
9673                 }
9674               } else {
9675                 count = 0;
9676               }
9677               return func.apply(undefined2, arguments);
9678             };
9679           }
9680           function shuffleSelf(array2, size2) {
9681             var index = -1, length = array2.length, lastIndex = length - 1;
9682             size2 = size2 === undefined2 ? length : size2;
9683             while (++index < size2) {
9684               var rand = baseRandom(index, lastIndex), value = array2[rand];
9685               array2[rand] = array2[index];
9686               array2[index] = value;
9687             }
9688             array2.length = size2;
9689             return array2;
9690           }
9691           var stringToPath = memoizeCapped(function(string) {
9692             var result2 = [];
9693             if (string.charCodeAt(0) === 46) {
9694               result2.push("");
9695             }
9696             string.replace(rePropName, function(match, number3, quote2, subString) {
9697               result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9698             });
9699             return result2;
9700           });
9701           function toKey(value) {
9702             if (typeof value == "string" || isSymbol2(value)) {
9703               return value;
9704             }
9705             var result2 = value + "";
9706             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9707           }
9708           function toSource(func) {
9709             if (func != null) {
9710               try {
9711                 return funcToString.call(func);
9712               } catch (e) {
9713               }
9714               try {
9715                 return func + "";
9716               } catch (e) {
9717               }
9718             }
9719             return "";
9720           }
9721           function updateWrapDetails(details, bitmask) {
9722             arrayEach(wrapFlags, function(pair2) {
9723               var value = "_." + pair2[0];
9724               if (bitmask & pair2[1] && !arrayIncludes(details, value)) {
9725                 details.push(value);
9726               }
9727             });
9728             return details.sort();
9729           }
9730           function wrapperClone(wrapper) {
9731             if (wrapper instanceof LazyWrapper) {
9732               return wrapper.clone();
9733             }
9734             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9735             result2.__actions__ = copyArray(wrapper.__actions__);
9736             result2.__index__ = wrapper.__index__;
9737             result2.__values__ = wrapper.__values__;
9738             return result2;
9739           }
9740           function chunk(array2, size2, guard) {
9741             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9742               size2 = 1;
9743             } else {
9744               size2 = nativeMax2(toInteger(size2), 0);
9745             }
9746             var length = array2 == null ? 0 : array2.length;
9747             if (!length || size2 < 1) {
9748               return [];
9749             }
9750             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9751             while (index < length) {
9752               result2[resIndex++] = baseSlice(array2, index, index += size2);
9753             }
9754             return result2;
9755           }
9756           function compact(array2) {
9757             var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
9758             while (++index < length) {
9759               var value = array2[index];
9760               if (value) {
9761                 result2[resIndex++] = value;
9762               }
9763             }
9764             return result2;
9765           }
9766           function concat() {
9767             var length = arguments.length;
9768             if (!length) {
9769               return [];
9770             }
9771             var args = Array2(length - 1), array2 = arguments[0], index = length;
9772             while (index--) {
9773               args[index - 1] = arguments[index];
9774             }
9775             return arrayPush(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
9776           }
9777           var difference = baseRest(function(array2, values2) {
9778             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
9779           });
9780           var differenceBy = baseRest(function(array2, values2) {
9781             var iteratee2 = last(values2);
9782             if (isArrayLikeObject(iteratee2)) {
9783               iteratee2 = undefined2;
9784             }
9785             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
9786           });
9787           var differenceWith = baseRest(function(array2, values2) {
9788             var comparator = last(values2);
9789             if (isArrayLikeObject(comparator)) {
9790               comparator = undefined2;
9791             }
9792             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
9793           });
9794           function drop(array2, n2, guard) {
9795             var length = array2 == null ? 0 : array2.length;
9796             if (!length) {
9797               return [];
9798             }
9799             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9800             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
9801           }
9802           function dropRight(array2, n2, guard) {
9803             var length = array2 == null ? 0 : array2.length;
9804             if (!length) {
9805               return [];
9806             }
9807             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9808             n2 = length - n2;
9809             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
9810           }
9811           function dropRightWhile(array2, predicate) {
9812             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
9813           }
9814           function dropWhile(array2, predicate) {
9815             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
9816           }
9817           function fill(array2, value, start2, end) {
9818             var length = array2 == null ? 0 : array2.length;
9819             if (!length) {
9820               return [];
9821             }
9822             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
9823               start2 = 0;
9824               end = length;
9825             }
9826             return baseFill(array2, value, start2, end);
9827           }
9828           function findIndex(array2, predicate, fromIndex) {
9829             var length = array2 == null ? 0 : array2.length;
9830             if (!length) {
9831               return -1;
9832             }
9833             var index = fromIndex == null ? 0 : toInteger(fromIndex);
9834             if (index < 0) {
9835               index = nativeMax2(length + index, 0);
9836             }
9837             return baseFindIndex(array2, getIteratee(predicate, 3), index);
9838           }
9839           function findLastIndex(array2, predicate, fromIndex) {
9840             var length = array2 == null ? 0 : array2.length;
9841             if (!length) {
9842               return -1;
9843             }
9844             var index = length - 1;
9845             if (fromIndex !== undefined2) {
9846               index = toInteger(fromIndex);
9847               index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9848             }
9849             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
9850           }
9851           function flatten2(array2) {
9852             var length = array2 == null ? 0 : array2.length;
9853             return length ? baseFlatten(array2, 1) : [];
9854           }
9855           function flattenDeep(array2) {
9856             var length = array2 == null ? 0 : array2.length;
9857             return length ? baseFlatten(array2, INFINITY2) : [];
9858           }
9859           function flattenDepth(array2, depth) {
9860             var length = array2 == null ? 0 : array2.length;
9861             if (!length) {
9862               return [];
9863             }
9864             depth = depth === undefined2 ? 1 : toInteger(depth);
9865             return baseFlatten(array2, depth);
9866           }
9867           function fromPairs(pairs) {
9868             var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
9869             while (++index < length) {
9870               var pair2 = pairs[index];
9871               result2[pair2[0]] = pair2[1];
9872             }
9873             return result2;
9874           }
9875           function head(array2) {
9876             return array2 && array2.length ? array2[0] : undefined2;
9877           }
9878           function indexOf(array2, value, fromIndex) {
9879             var length = array2 == null ? 0 : array2.length;
9880             if (!length) {
9881               return -1;
9882             }
9883             var index = fromIndex == null ? 0 : toInteger(fromIndex);
9884             if (index < 0) {
9885               index = nativeMax2(length + index, 0);
9886             }
9887             return baseIndexOf(array2, value, index);
9888           }
9889           function initial(array2) {
9890             var length = array2 == null ? 0 : array2.length;
9891             return length ? baseSlice(array2, 0, -1) : [];
9892           }
9893           var intersection = baseRest(function(arrays) {
9894             var mapped = arrayMap2(arrays, castArrayLikeObject);
9895             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
9896           });
9897           var intersectionBy = baseRest(function(arrays) {
9898             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9899             if (iteratee2 === last(mapped)) {
9900               iteratee2 = undefined2;
9901             } else {
9902               mapped.pop();
9903             }
9904             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
9905           });
9906           var intersectionWith = baseRest(function(arrays) {
9907             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9908             comparator = typeof comparator == "function" ? comparator : undefined2;
9909             if (comparator) {
9910               mapped.pop();
9911             }
9912             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
9913           });
9914           function join(array2, separator) {
9915             return array2 == null ? "" : nativeJoin.call(array2, separator);
9916           }
9917           function last(array2) {
9918             var length = array2 == null ? 0 : array2.length;
9919             return length ? array2[length - 1] : undefined2;
9920           }
9921           function lastIndexOf(array2, value, fromIndex) {
9922             var length = array2 == null ? 0 : array2.length;
9923             if (!length) {
9924               return -1;
9925             }
9926             var index = length;
9927             if (fromIndex !== undefined2) {
9928               index = toInteger(fromIndex);
9929               index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9930             }
9931             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
9932           }
9933           function nth(array2, n2) {
9934             return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
9935           }
9936           var pull = baseRest(pullAll);
9937           function pullAll(array2, values2) {
9938             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
9939           }
9940           function pullAllBy(array2, values2, iteratee2) {
9941             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
9942           }
9943           function pullAllWith(array2, values2, comparator) {
9944             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
9945           }
9946           var pullAt = flatRest(function(array2, indexes) {
9947             var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
9948             basePullAt(array2, arrayMap2(indexes, function(index) {
9949               return isIndex(index, length) ? +index : index;
9950             }).sort(compareAscending));
9951             return result2;
9952           });
9953           function remove2(array2, predicate) {
9954             var result2 = [];
9955             if (!(array2 && array2.length)) {
9956               return result2;
9957             }
9958             var index = -1, indexes = [], length = array2.length;
9959             predicate = getIteratee(predicate, 3);
9960             while (++index < length) {
9961               var value = array2[index];
9962               if (predicate(value, index, array2)) {
9963                 result2.push(value);
9964                 indexes.push(index);
9965               }
9966             }
9967             basePullAt(array2, indexes);
9968             return result2;
9969           }
9970           function reverse(array2) {
9971             return array2 == null ? array2 : nativeReverse.call(array2);
9972           }
9973           function slice(array2, start2, end) {
9974             var length = array2 == null ? 0 : array2.length;
9975             if (!length) {
9976               return [];
9977             }
9978             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
9979               start2 = 0;
9980               end = length;
9981             } else {
9982               start2 = start2 == null ? 0 : toInteger(start2);
9983               end = end === undefined2 ? length : toInteger(end);
9984             }
9985             return baseSlice(array2, start2, end);
9986           }
9987           function sortedIndex(array2, value) {
9988             return baseSortedIndex(array2, value);
9989           }
9990           function sortedIndexBy(array2, value, iteratee2) {
9991             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
9992           }
9993           function sortedIndexOf(array2, value) {
9994             var length = array2 == null ? 0 : array2.length;
9995             if (length) {
9996               var index = baseSortedIndex(array2, value);
9997               if (index < length && eq(array2[index], value)) {
9998                 return index;
9999               }
10000             }
10001             return -1;
10002           }
10003           function sortedLastIndex(array2, value) {
10004             return baseSortedIndex(array2, value, true);
10005           }
10006           function sortedLastIndexBy(array2, value, iteratee2) {
10007             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10008           }
10009           function sortedLastIndexOf(array2, value) {
10010             var length = array2 == null ? 0 : array2.length;
10011             if (length) {
10012               var index = baseSortedIndex(array2, value, true) - 1;
10013               if (eq(array2[index], value)) {
10014                 return index;
10015               }
10016             }
10017             return -1;
10018           }
10019           function sortedUniq(array2) {
10020             return array2 && array2.length ? baseSortedUniq(array2) : [];
10021           }
10022           function sortedUniqBy(array2, iteratee2) {
10023             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10024           }
10025           function tail(array2) {
10026             var length = array2 == null ? 0 : array2.length;
10027             return length ? baseSlice(array2, 1, length) : [];
10028           }
10029           function take(array2, n2, guard) {
10030             if (!(array2 && array2.length)) {
10031               return [];
10032             }
10033             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10034             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
10035           }
10036           function takeRight(array2, n2, guard) {
10037             var length = array2 == null ? 0 : array2.length;
10038             if (!length) {
10039               return [];
10040             }
10041             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10042             n2 = length - n2;
10043             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
10044           }
10045           function takeRightWhile(array2, predicate) {
10046             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10047           }
10048           function takeWhile(array2, predicate) {
10049             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10050           }
10051           var union = baseRest(function(arrays) {
10052             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10053           });
10054           var unionBy = baseRest(function(arrays) {
10055             var iteratee2 = last(arrays);
10056             if (isArrayLikeObject(iteratee2)) {
10057               iteratee2 = undefined2;
10058             }
10059             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10060           });
10061           var unionWith = baseRest(function(arrays) {
10062             var comparator = last(arrays);
10063             comparator = typeof comparator == "function" ? comparator : undefined2;
10064             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10065           });
10066           function uniq(array2) {
10067             return array2 && array2.length ? baseUniq(array2) : [];
10068           }
10069           function uniqBy(array2, iteratee2) {
10070             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10071           }
10072           function uniqWith(array2, comparator) {
10073             comparator = typeof comparator == "function" ? comparator : undefined2;
10074             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10075           }
10076           function unzip(array2) {
10077             if (!(array2 && array2.length)) {
10078               return [];
10079             }
10080             var length = 0;
10081             array2 = arrayFilter(array2, function(group) {
10082               if (isArrayLikeObject(group)) {
10083                 length = nativeMax2(group.length, length);
10084                 return true;
10085               }
10086             });
10087             return baseTimes(length, function(index) {
10088               return arrayMap2(array2, baseProperty(index));
10089             });
10090           }
10091           function unzipWith(array2, iteratee2) {
10092             if (!(array2 && array2.length)) {
10093               return [];
10094             }
10095             var result2 = unzip(array2);
10096             if (iteratee2 == null) {
10097               return result2;
10098             }
10099             return arrayMap2(result2, function(group) {
10100               return apply(iteratee2, undefined2, group);
10101             });
10102           }
10103           var without = baseRest(function(array2, values2) {
10104             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10105           });
10106           var xor = baseRest(function(arrays) {
10107             return baseXor(arrayFilter(arrays, isArrayLikeObject));
10108           });
10109           var xorBy = baseRest(function(arrays) {
10110             var iteratee2 = last(arrays);
10111             if (isArrayLikeObject(iteratee2)) {
10112               iteratee2 = undefined2;
10113             }
10114             return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10115           });
10116           var xorWith = baseRest(function(arrays) {
10117             var comparator = last(arrays);
10118             comparator = typeof comparator == "function" ? comparator : undefined2;
10119             return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
10120           });
10121           var zip = baseRest(unzip);
10122           function zipObject(props, values2) {
10123             return baseZipObject(props || [], values2 || [], assignValue);
10124           }
10125           function zipObjectDeep(props, values2) {
10126             return baseZipObject(props || [], values2 || [], baseSet);
10127           }
10128           var zipWith = baseRest(function(arrays) {
10129             var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10130             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10131             return unzipWith(arrays, iteratee2);
10132           });
10133           function chain(value) {
10134             var result2 = lodash(value);
10135             result2.__chain__ = true;
10136             return result2;
10137           }
10138           function tap(value, interceptor) {
10139             interceptor(value);
10140             return value;
10141           }
10142           function thru(value, interceptor) {
10143             return interceptor(value);
10144           }
10145           var wrapperAt = flatRest(function(paths) {
10146             var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10147               return baseAt(object, paths);
10148             };
10149             if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start2)) {
10150               return this.thru(interceptor);
10151             }
10152             value = value.slice(start2, +start2 + (length ? 1 : 0));
10153             value.__actions__.push({
10154               "func": thru,
10155               "args": [interceptor],
10156               "thisArg": undefined2
10157             });
10158             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10159               if (length && !array2.length) {
10160                 array2.push(undefined2);
10161               }
10162               return array2;
10163             });
10164           });
10165           function wrapperChain() {
10166             return chain(this);
10167           }
10168           function wrapperCommit() {
10169             return new LodashWrapper(this.value(), this.__chain__);
10170           }
10171           function wrapperNext() {
10172             if (this.__values__ === undefined2) {
10173               this.__values__ = toArray(this.value());
10174             }
10175             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10176             return { "done": done, "value": value };
10177           }
10178           function wrapperToIterator() {
10179             return this;
10180           }
10181           function wrapperPlant(value) {
10182             var result2, parent2 = this;
10183             while (parent2 instanceof baseLodash) {
10184               var clone2 = wrapperClone(parent2);
10185               clone2.__index__ = 0;
10186               clone2.__values__ = undefined2;
10187               if (result2) {
10188                 previous.__wrapped__ = clone2;
10189               } else {
10190                 result2 = clone2;
10191               }
10192               var previous = clone2;
10193               parent2 = parent2.__wrapped__;
10194             }
10195             previous.__wrapped__ = value;
10196             return result2;
10197           }
10198           function wrapperReverse() {
10199             var value = this.__wrapped__;
10200             if (value instanceof LazyWrapper) {
10201               var wrapped = value;
10202               if (this.__actions__.length) {
10203                 wrapped = new LazyWrapper(this);
10204               }
10205               wrapped = wrapped.reverse();
10206               wrapped.__actions__.push({
10207                 "func": thru,
10208                 "args": [reverse],
10209                 "thisArg": undefined2
10210               });
10211               return new LodashWrapper(wrapped, this.__chain__);
10212             }
10213             return this.thru(reverse);
10214           }
10215           function wrapperValue() {
10216             return baseWrapperValue(this.__wrapped__, this.__actions__);
10217           }
10218           var countBy = createAggregator(function(result2, value, key) {
10219             if (hasOwnProperty2.call(result2, key)) {
10220               ++result2[key];
10221             } else {
10222               baseAssignValue(result2, key, 1);
10223             }
10224           });
10225           function every(collection, predicate, guard) {
10226             var func = isArray2(collection) ? arrayEvery : baseEvery;
10227             if (guard && isIterateeCall(collection, predicate, guard)) {
10228               predicate = undefined2;
10229             }
10230             return func(collection, getIteratee(predicate, 3));
10231           }
10232           function filter2(collection, predicate) {
10233             var func = isArray2(collection) ? arrayFilter : baseFilter;
10234             return func(collection, getIteratee(predicate, 3));
10235           }
10236           var find2 = createFind(findIndex);
10237           var findLast = createFind(findLastIndex);
10238           function flatMap(collection, iteratee2) {
10239             return baseFlatten(map2(collection, iteratee2), 1);
10240           }
10241           function flatMapDeep(collection, iteratee2) {
10242             return baseFlatten(map2(collection, iteratee2), INFINITY2);
10243           }
10244           function flatMapDepth(collection, iteratee2, depth) {
10245             depth = depth === undefined2 ? 1 : toInteger(depth);
10246             return baseFlatten(map2(collection, iteratee2), depth);
10247           }
10248           function forEach(collection, iteratee2) {
10249             var func = isArray2(collection) ? arrayEach : baseEach;
10250             return func(collection, getIteratee(iteratee2, 3));
10251           }
10252           function forEachRight(collection, iteratee2) {
10253             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10254             return func(collection, getIteratee(iteratee2, 3));
10255           }
10256           var groupBy = createAggregator(function(result2, value, key) {
10257             if (hasOwnProperty2.call(result2, key)) {
10258               result2[key].push(value);
10259             } else {
10260               baseAssignValue(result2, key, [value]);
10261             }
10262           });
10263           function includes(collection, value, fromIndex, guard) {
10264             collection = isArrayLike(collection) ? collection : values(collection);
10265             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10266             var length = collection.length;
10267             if (fromIndex < 0) {
10268               fromIndex = nativeMax2(length + fromIndex, 0);
10269             }
10270             return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10271           }
10272           var invokeMap = baseRest(function(collection, path, args) {
10273             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
10274             baseEach(collection, function(value) {
10275               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10276             });
10277             return result2;
10278           });
10279           var keyBy = createAggregator(function(result2, value, key) {
10280             baseAssignValue(result2, key, value);
10281           });
10282           function map2(collection, iteratee2) {
10283             var func = isArray2(collection) ? arrayMap2 : baseMap;
10284             return func(collection, getIteratee(iteratee2, 3));
10285           }
10286           function orderBy(collection, iteratees, orders, guard) {
10287             if (collection == null) {
10288               return [];
10289             }
10290             if (!isArray2(iteratees)) {
10291               iteratees = iteratees == null ? [] : [iteratees];
10292             }
10293             orders = guard ? undefined2 : orders;
10294             if (!isArray2(orders)) {
10295               orders = orders == null ? [] : [orders];
10296             }
10297             return baseOrderBy(collection, iteratees, orders);
10298           }
10299           var partition = createAggregator(function(result2, value, key) {
10300             result2[key ? 0 : 1].push(value);
10301           }, function() {
10302             return [[], []];
10303           });
10304           function reduce(collection, iteratee2, accumulator) {
10305             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10306             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10307           }
10308           function reduceRight(collection, iteratee2, accumulator) {
10309             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10310             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10311           }
10312           function reject(collection, predicate) {
10313             var func = isArray2(collection) ? arrayFilter : baseFilter;
10314             return func(collection, negate(getIteratee(predicate, 3)));
10315           }
10316           function sample(collection) {
10317             var func = isArray2(collection) ? arraySample : baseSample;
10318             return func(collection);
10319           }
10320           function sampleSize(collection, n2, guard) {
10321             if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined2) {
10322               n2 = 1;
10323             } else {
10324               n2 = toInteger(n2);
10325             }
10326             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10327             return func(collection, n2);
10328           }
10329           function shuffle(collection) {
10330             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10331             return func(collection);
10332           }
10333           function size(collection) {
10334             if (collection == null) {
10335               return 0;
10336             }
10337             if (isArrayLike(collection)) {
10338               return isString(collection) ? stringSize(collection) : collection.length;
10339             }
10340             var tag = getTag(collection);
10341             if (tag == mapTag || tag == setTag) {
10342               return collection.size;
10343             }
10344             return baseKeys(collection).length;
10345           }
10346           function some(collection, predicate, guard) {
10347             var func = isArray2(collection) ? arraySome : baseSome;
10348             if (guard && isIterateeCall(collection, predicate, guard)) {
10349               predicate = undefined2;
10350             }
10351             return func(collection, getIteratee(predicate, 3));
10352           }
10353           var sortBy = baseRest(function(collection, iteratees) {
10354             if (collection == null) {
10355               return [];
10356             }
10357             var length = iteratees.length;
10358             if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10359               iteratees = [];
10360             } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10361               iteratees = [iteratees[0]];
10362             }
10363             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10364           });
10365           var now3 = ctxNow || function() {
10366             return root3.Date.now();
10367           };
10368           function after(n2, func) {
10369             if (typeof func != "function") {
10370               throw new TypeError2(FUNC_ERROR_TEXT3);
10371             }
10372             n2 = toInteger(n2);
10373             return function() {
10374               if (--n2 < 1) {
10375                 return func.apply(this, arguments);
10376               }
10377             };
10378           }
10379           function ary(func, n2, guard) {
10380             n2 = guard ? undefined2 : n2;
10381             n2 = func && n2 == null ? func.length : n2;
10382             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n2);
10383           }
10384           function before(n2, func) {
10385             var result2;
10386             if (typeof func != "function") {
10387               throw new TypeError2(FUNC_ERROR_TEXT3);
10388             }
10389             n2 = toInteger(n2);
10390             return function() {
10391               if (--n2 > 0) {
10392                 result2 = func.apply(this, arguments);
10393               }
10394               if (n2 <= 1) {
10395                 func = undefined2;
10396               }
10397               return result2;
10398             };
10399           }
10400           var bind = baseRest(function(func, thisArg, partials) {
10401             var bitmask = WRAP_BIND_FLAG;
10402             if (partials.length) {
10403               var holders = replaceHolders(partials, getHolder(bind));
10404               bitmask |= WRAP_PARTIAL_FLAG;
10405             }
10406             return createWrap(func, bitmask, thisArg, partials, holders);
10407           });
10408           var bindKey2 = baseRest(function(object, key, partials) {
10409             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10410             if (partials.length) {
10411               var holders = replaceHolders(partials, getHolder(bindKey2));
10412               bitmask |= WRAP_PARTIAL_FLAG;
10413             }
10414             return createWrap(key, bitmask, object, partials, holders);
10415           });
10416           function curry(func, arity, guard) {
10417             arity = guard ? undefined2 : arity;
10418             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10419             result2.placeholder = curry.placeholder;
10420             return result2;
10421           }
10422           function curryRight(func, arity, guard) {
10423             arity = guard ? undefined2 : arity;
10424             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10425             result2.placeholder = curryRight.placeholder;
10426             return result2;
10427           }
10428           function debounce2(func, wait, options2) {
10429             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10430             if (typeof func != "function") {
10431               throw new TypeError2(FUNC_ERROR_TEXT3);
10432             }
10433             wait = toNumber2(wait) || 0;
10434             if (isObject2(options2)) {
10435               leading = !!options2.leading;
10436               maxing = "maxWait" in options2;
10437               maxWait = maxing ? nativeMax2(toNumber2(options2.maxWait) || 0, wait) : maxWait;
10438               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10439             }
10440             function invokeFunc(time) {
10441               var args = lastArgs, thisArg = lastThis;
10442               lastArgs = lastThis = undefined2;
10443               lastInvokeTime = time;
10444               result2 = func.apply(thisArg, args);
10445               return result2;
10446             }
10447             function leadingEdge(time) {
10448               lastInvokeTime = time;
10449               timerId = setTimeout2(timerExpired, wait);
10450               return leading ? invokeFunc(time) : result2;
10451             }
10452             function remainingWait(time) {
10453               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10454               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10455             }
10456             function shouldInvoke(time) {
10457               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10458               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10459             }
10460             function timerExpired() {
10461               var time = now3();
10462               if (shouldInvoke(time)) {
10463                 return trailingEdge(time);
10464               }
10465               timerId = setTimeout2(timerExpired, remainingWait(time));
10466             }
10467             function trailingEdge(time) {
10468               timerId = undefined2;
10469               if (trailing && lastArgs) {
10470                 return invokeFunc(time);
10471               }
10472               lastArgs = lastThis = undefined2;
10473               return result2;
10474             }
10475             function cancel() {
10476               if (timerId !== undefined2) {
10477                 clearTimeout2(timerId);
10478               }
10479               lastInvokeTime = 0;
10480               lastArgs = lastCallTime = lastThis = timerId = undefined2;
10481             }
10482             function flush() {
10483               return timerId === undefined2 ? result2 : trailingEdge(now3());
10484             }
10485             function debounced() {
10486               var time = now3(), isInvoking = shouldInvoke(time);
10487               lastArgs = arguments;
10488               lastThis = this;
10489               lastCallTime = time;
10490               if (isInvoking) {
10491                 if (timerId === undefined2) {
10492                   return leadingEdge(lastCallTime);
10493                 }
10494                 if (maxing) {
10495                   clearTimeout2(timerId);
10496                   timerId = setTimeout2(timerExpired, wait);
10497                   return invokeFunc(lastCallTime);
10498                 }
10499               }
10500               if (timerId === undefined2) {
10501                 timerId = setTimeout2(timerExpired, wait);
10502               }
10503               return result2;
10504             }
10505             debounced.cancel = cancel;
10506             debounced.flush = flush;
10507             return debounced;
10508           }
10509           var defer = baseRest(function(func, args) {
10510             return baseDelay(func, 1, args);
10511           });
10512           var delay = baseRest(function(func, wait, args) {
10513             return baseDelay(func, toNumber2(wait) || 0, args);
10514           });
10515           function flip(func) {
10516             return createWrap(func, WRAP_FLIP_FLAG);
10517           }
10518           function memoize(func, resolver) {
10519             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10520               throw new TypeError2(FUNC_ERROR_TEXT3);
10521             }
10522             var memoized = function() {
10523               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10524               if (cache.has(key)) {
10525                 return cache.get(key);
10526               }
10527               var result2 = func.apply(this, args);
10528               memoized.cache = cache.set(key, result2) || cache;
10529               return result2;
10530             };
10531             memoized.cache = new (memoize.Cache || MapCache)();
10532             return memoized;
10533           }
10534           memoize.Cache = MapCache;
10535           function negate(predicate) {
10536             if (typeof predicate != "function") {
10537               throw new TypeError2(FUNC_ERROR_TEXT3);
10538             }
10539             return function() {
10540               var args = arguments;
10541               switch (args.length) {
10542                 case 0:
10543                   return !predicate.call(this);
10544                 case 1:
10545                   return !predicate.call(this, args[0]);
10546                 case 2:
10547                   return !predicate.call(this, args[0], args[1]);
10548                 case 3:
10549                   return !predicate.call(this, args[0], args[1], args[2]);
10550               }
10551               return !predicate.apply(this, args);
10552             };
10553           }
10554           function once(func) {
10555             return before(2, func);
10556           }
10557           var overArgs = castRest(function(func, transforms) {
10558             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary(getIteratee()));
10559             var funcsLength = transforms.length;
10560             return baseRest(function(args) {
10561               var index = -1, length = nativeMin2(args.length, funcsLength);
10562               while (++index < length) {
10563                 args[index] = transforms[index].call(this, args[index]);
10564               }
10565               return apply(func, this, args);
10566             });
10567           });
10568           var partial = baseRest(function(func, partials) {
10569             var holders = replaceHolders(partials, getHolder(partial));
10570             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10571           });
10572           var partialRight = baseRest(function(func, partials) {
10573             var holders = replaceHolders(partials, getHolder(partialRight));
10574             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10575           });
10576           var rearg = flatRest(function(func, indexes) {
10577             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10578           });
10579           function rest(func, start2) {
10580             if (typeof func != "function") {
10581               throw new TypeError2(FUNC_ERROR_TEXT3);
10582             }
10583             start2 = start2 === undefined2 ? start2 : toInteger(start2);
10584             return baseRest(func, start2);
10585           }
10586           function spread(func, start2) {
10587             if (typeof func != "function") {
10588               throw new TypeError2(FUNC_ERROR_TEXT3);
10589             }
10590             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10591             return baseRest(function(args) {
10592               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10593               if (array2) {
10594                 arrayPush(otherArgs, array2);
10595               }
10596               return apply(func, this, otherArgs);
10597             });
10598           }
10599           function throttle2(func, wait, options2) {
10600             var leading = true, trailing = true;
10601             if (typeof func != "function") {
10602               throw new TypeError2(FUNC_ERROR_TEXT3);
10603             }
10604             if (isObject2(options2)) {
10605               leading = "leading" in options2 ? !!options2.leading : leading;
10606               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10607             }
10608             return debounce2(func, wait, {
10609               "leading": leading,
10610               "maxWait": wait,
10611               "trailing": trailing
10612             });
10613           }
10614           function unary(func) {
10615             return ary(func, 1);
10616           }
10617           function wrap2(value, wrapper) {
10618             return partial(castFunction(wrapper), value);
10619           }
10620           function castArray() {
10621             if (!arguments.length) {
10622               return [];
10623             }
10624             var value = arguments[0];
10625             return isArray2(value) ? value : [value];
10626           }
10627           function clone(value) {
10628             return baseClone(value, CLONE_SYMBOLS_FLAG);
10629           }
10630           function cloneWith(value, customizer) {
10631             customizer = typeof customizer == "function" ? customizer : undefined2;
10632             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10633           }
10634           function cloneDeep(value) {
10635             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10636           }
10637           function cloneDeepWith(value, customizer) {
10638             customizer = typeof customizer == "function" ? customizer : undefined2;
10639             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10640           }
10641           function conformsTo(object, source) {
10642             return source == null || baseConformsTo(object, source, keys(source));
10643           }
10644           function eq(value, other) {
10645             return value === other || value !== value && other !== other;
10646           }
10647           var gt = createRelationalOperation(baseGt);
10648           var gte = createRelationalOperation(function(value, other) {
10649             return value >= other;
10650           });
10651           var isArguments = baseIsArguments(function() {
10652             return arguments;
10653           }()) ? baseIsArguments : function(value) {
10654             return isObjectLike2(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
10655           };
10656           var isArray2 = Array2.isArray;
10657           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
10658           function isArrayLike(value) {
10659             return value != null && isLength(value.length) && !isFunction(value);
10660           }
10661           function isArrayLikeObject(value) {
10662             return isObjectLike2(value) && isArrayLike(value);
10663           }
10664           function isBoolean(value) {
10665             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag;
10666           }
10667           var isBuffer = nativeIsBuffer || stubFalse;
10668           var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
10669           function isElement(value) {
10670             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10671           }
10672           function isEmpty(value) {
10673             if (value == null) {
10674               return true;
10675             }
10676             if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
10677               return !value.length;
10678             }
10679             var tag = getTag(value);
10680             if (tag == mapTag || tag == setTag) {
10681               return !value.size;
10682             }
10683             if (isPrototype(value)) {
10684               return !baseKeys(value).length;
10685             }
10686             for (var key in value) {
10687               if (hasOwnProperty2.call(value, key)) {
10688                 return false;
10689               }
10690             }
10691             return true;
10692           }
10693           function isEqual(value, other) {
10694             return baseIsEqual(value, other);
10695           }
10696           function isEqualWith(value, other, customizer) {
10697             customizer = typeof customizer == "function" ? customizer : undefined2;
10698             var result2 = customizer ? customizer(value, other) : undefined2;
10699             return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
10700           }
10701           function isError(value) {
10702             if (!isObjectLike2(value)) {
10703               return false;
10704             }
10705             var tag = baseGetTag2(value);
10706             return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10707           }
10708           function isFinite2(value) {
10709             return typeof value == "number" && nativeIsFinite(value);
10710           }
10711           function isFunction(value) {
10712             if (!isObject2(value)) {
10713               return false;
10714             }
10715             var tag = baseGetTag2(value);
10716             return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
10717           }
10718           function isInteger(value) {
10719             return typeof value == "number" && value == toInteger(value);
10720           }
10721           function isLength(value) {
10722             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
10723           }
10724           function isObject2(value) {
10725             var type3 = typeof value;
10726             return value != null && (type3 == "object" || type3 == "function");
10727           }
10728           function isObjectLike2(value) {
10729             return value != null && typeof value == "object";
10730           }
10731           var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
10732           function isMatch(object, source) {
10733             return object === source || baseIsMatch(object, source, getMatchData(source));
10734           }
10735           function isMatchWith(object, source, customizer) {
10736             customizer = typeof customizer == "function" ? customizer : undefined2;
10737             return baseIsMatch(object, source, getMatchData(source), customizer);
10738           }
10739           function isNaN2(value) {
10740             return isNumber2(value) && value != +value;
10741           }
10742           function isNative(value) {
10743             if (isMaskable(value)) {
10744               throw new Error2(CORE_ERROR_TEXT);
10745             }
10746             return baseIsNative(value);
10747           }
10748           function isNull(value) {
10749             return value === null;
10750           }
10751           function isNil(value) {
10752             return value == null;
10753           }
10754           function isNumber2(value) {
10755             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag;
10756           }
10757           function isPlainObject(value) {
10758             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag) {
10759               return false;
10760             }
10761             var proto = getPrototype(value);
10762             if (proto === null) {
10763               return true;
10764             }
10765             var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
10766             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
10767           }
10768           var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
10769           function isSafeInteger(value) {
10770             return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
10771           }
10772           var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
10773           function isString(value) {
10774             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag;
10775           }
10776           function isSymbol2(value) {
10777             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag2;
10778           }
10779           var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
10780           function isUndefined(value) {
10781             return value === undefined2;
10782           }
10783           function isWeakMap(value) {
10784             return isObjectLike2(value) && getTag(value) == weakMapTag;
10785           }
10786           function isWeakSet(value) {
10787             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
10788           }
10789           var lt = createRelationalOperation(baseLt);
10790           var lte = createRelationalOperation(function(value, other) {
10791             return value <= other;
10792           });
10793           function toArray(value) {
10794             if (!value) {
10795               return [];
10796             }
10797             if (isArrayLike(value)) {
10798               return isString(value) ? stringToArray(value) : copyArray(value);
10799             }
10800             if (symIterator && value[symIterator]) {
10801               return iteratorToArray(value[symIterator]());
10802             }
10803             var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
10804             return func(value);
10805           }
10806           function toFinite(value) {
10807             if (!value) {
10808               return value === 0 ? value : 0;
10809             }
10810             value = toNumber2(value);
10811             if (value === INFINITY2 || value === -INFINITY2) {
10812               var sign2 = value < 0 ? -1 : 1;
10813               return sign2 * MAX_INTEGER;
10814             }
10815             return value === value ? value : 0;
10816           }
10817           function toInteger(value) {
10818             var result2 = toFinite(value), remainder = result2 % 1;
10819             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
10820           }
10821           function toLength(value) {
10822             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
10823           }
10824           function toNumber2(value) {
10825             if (typeof value == "number") {
10826               return value;
10827             }
10828             if (isSymbol2(value)) {
10829               return NAN2;
10830             }
10831             if (isObject2(value)) {
10832               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
10833               value = isObject2(other) ? other + "" : other;
10834             }
10835             if (typeof value != "string") {
10836               return value === 0 ? value : +value;
10837             }
10838             value = baseTrim2(value);
10839             var isBinary = reIsBinary2.test(value);
10840             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
10841           }
10842           function toPlainObject(value) {
10843             return copyObject(value, keysIn(value));
10844           }
10845           function toSafeInteger(value) {
10846             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
10847           }
10848           function toString2(value) {
10849             return value == null ? "" : baseToString2(value);
10850           }
10851           var assign = createAssigner(function(object, source) {
10852             if (isPrototype(source) || isArrayLike(source)) {
10853               copyObject(source, keys(source), object);
10854               return;
10855             }
10856             for (var key in source) {
10857               if (hasOwnProperty2.call(source, key)) {
10858                 assignValue(object, key, source[key]);
10859               }
10860             }
10861           });
10862           var assignIn = createAssigner(function(object, source) {
10863             copyObject(source, keysIn(source), object);
10864           });
10865           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
10866             copyObject(source, keysIn(source), object, customizer);
10867           });
10868           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
10869             copyObject(source, keys(source), object, customizer);
10870           });
10871           var at = flatRest(baseAt);
10872           function create2(prototype, properties) {
10873             var result2 = baseCreate(prototype);
10874             return properties == null ? result2 : baseAssign(result2, properties);
10875           }
10876           var defaults2 = baseRest(function(object, sources) {
10877             object = Object2(object);
10878             var index = -1;
10879             var length = sources.length;
10880             var guard = length > 2 ? sources[2] : undefined2;
10881             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
10882               length = 1;
10883             }
10884             while (++index < length) {
10885               var source = sources[index];
10886               var props = keysIn(source);
10887               var propsIndex = -1;
10888               var propsLength = props.length;
10889               while (++propsIndex < propsLength) {
10890                 var key = props[propsIndex];
10891                 var value = object[key];
10892                 if (value === undefined2 || eq(value, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
10893                   object[key] = source[key];
10894                 }
10895               }
10896             }
10897             return object;
10898           });
10899           var defaultsDeep = baseRest(function(args) {
10900             args.push(undefined2, customDefaultsMerge);
10901             return apply(mergeWith, undefined2, args);
10902           });
10903           function findKey(object, predicate) {
10904             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
10905           }
10906           function findLastKey(object, predicate) {
10907             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
10908           }
10909           function forIn(object, iteratee2) {
10910             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
10911           }
10912           function forInRight(object, iteratee2) {
10913             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
10914           }
10915           function forOwn(object, iteratee2) {
10916             return object && baseForOwn(object, getIteratee(iteratee2, 3));
10917           }
10918           function forOwnRight(object, iteratee2) {
10919             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
10920           }
10921           function functions(object) {
10922             return object == null ? [] : baseFunctions(object, keys(object));
10923           }
10924           function functionsIn(object) {
10925             return object == null ? [] : baseFunctions(object, keysIn(object));
10926           }
10927           function get3(object, path, defaultValue) {
10928             var result2 = object == null ? undefined2 : baseGet(object, path);
10929             return result2 === undefined2 ? defaultValue : result2;
10930           }
10931           function has(object, path) {
10932             return object != null && hasPath(object, path, baseHas);
10933           }
10934           function hasIn(object, path) {
10935             return object != null && hasPath(object, path, baseHasIn);
10936           }
10937           var invert = createInverter(function(result2, value, key) {
10938             if (value != null && typeof value.toString != "function") {
10939               value = nativeObjectToString3.call(value);
10940             }
10941             result2[value] = key;
10942           }, constant(identity4));
10943           var invertBy = createInverter(function(result2, value, key) {
10944             if (value != null && typeof value.toString != "function") {
10945               value = nativeObjectToString3.call(value);
10946             }
10947             if (hasOwnProperty2.call(result2, value)) {
10948               result2[value].push(key);
10949             } else {
10950               result2[value] = [key];
10951             }
10952           }, getIteratee);
10953           var invoke = baseRest(baseInvoke);
10954           function keys(object) {
10955             return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
10956           }
10957           function keysIn(object) {
10958             return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
10959           }
10960           function mapKeys(object, iteratee2) {
10961             var result2 = {};
10962             iteratee2 = getIteratee(iteratee2, 3);
10963             baseForOwn(object, function(value, key, object2) {
10964               baseAssignValue(result2, iteratee2(value, key, object2), value);
10965             });
10966             return result2;
10967           }
10968           function mapValues(object, iteratee2) {
10969             var result2 = {};
10970             iteratee2 = getIteratee(iteratee2, 3);
10971             baseForOwn(object, function(value, key, object2) {
10972               baseAssignValue(result2, key, iteratee2(value, key, object2));
10973             });
10974             return result2;
10975           }
10976           var merge3 = createAssigner(function(object, source, srcIndex) {
10977             baseMerge(object, source, srcIndex);
10978           });
10979           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
10980             baseMerge(object, source, srcIndex, customizer);
10981           });
10982           var omit = flatRest(function(object, paths) {
10983             var result2 = {};
10984             if (object == null) {
10985               return result2;
10986             }
10987             var isDeep = false;
10988             paths = arrayMap2(paths, function(path) {
10989               path = castPath(path, object);
10990               isDeep || (isDeep = path.length > 1);
10991               return path;
10992             });
10993             copyObject(object, getAllKeysIn(object), result2);
10994             if (isDeep) {
10995               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
10996             }
10997             var length = paths.length;
10998             while (length--) {
10999               baseUnset(result2, paths[length]);
11000             }
11001             return result2;
11002           });
11003           function omitBy(object, predicate) {
11004             return pickBy(object, negate(getIteratee(predicate)));
11005           }
11006           var pick = flatRest(function(object, paths) {
11007             return object == null ? {} : basePick(object, paths);
11008           });
11009           function pickBy(object, predicate) {
11010             if (object == null) {
11011               return {};
11012             }
11013             var props = arrayMap2(getAllKeysIn(object), function(prop) {
11014               return [prop];
11015             });
11016             predicate = getIteratee(predicate);
11017             return basePickBy(object, props, function(value, path) {
11018               return predicate(value, path[0]);
11019             });
11020           }
11021           function result(object, path, defaultValue) {
11022             path = castPath(path, object);
11023             var index = -1, length = path.length;
11024             if (!length) {
11025               length = 1;
11026               object = undefined2;
11027             }
11028             while (++index < length) {
11029               var value = object == null ? undefined2 : object[toKey(path[index])];
11030               if (value === undefined2) {
11031                 index = length;
11032                 value = defaultValue;
11033               }
11034               object = isFunction(value) ? value.call(object) : value;
11035             }
11036             return object;
11037           }
11038           function set3(object, path, value) {
11039             return object == null ? object : baseSet(object, path, value);
11040           }
11041           function setWith(object, path, value, customizer) {
11042             customizer = typeof customizer == "function" ? customizer : undefined2;
11043             return object == null ? object : baseSet(object, path, value, customizer);
11044           }
11045           var toPairs = createToPairs(keys);
11046           var toPairsIn = createToPairs(keysIn);
11047           function transform2(object, iteratee2, accumulator) {
11048             var isArr = isArray2(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
11049             iteratee2 = getIteratee(iteratee2, 4);
11050             if (accumulator == null) {
11051               var Ctor = object && object.constructor;
11052               if (isArrLike) {
11053                 accumulator = isArr ? new Ctor() : [];
11054               } else if (isObject2(object)) {
11055                 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
11056               } else {
11057                 accumulator = {};
11058               }
11059             }
11060             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11061               return iteratee2(accumulator, value, index, object2);
11062             });
11063             return accumulator;
11064           }
11065           function unset(object, path) {
11066             return object == null ? true : baseUnset(object, path);
11067           }
11068           function update(object, path, updater) {
11069             return object == null ? object : baseUpdate(object, path, castFunction(updater));
11070           }
11071           function updateWith(object, path, updater, customizer) {
11072             customizer = typeof customizer == "function" ? customizer : undefined2;
11073             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11074           }
11075           function values(object) {
11076             return object == null ? [] : baseValues(object, keys(object));
11077           }
11078           function valuesIn(object) {
11079             return object == null ? [] : baseValues(object, keysIn(object));
11080           }
11081           function clamp3(number3, lower2, upper) {
11082             if (upper === undefined2) {
11083               upper = lower2;
11084               lower2 = undefined2;
11085             }
11086             if (upper !== undefined2) {
11087               upper = toNumber2(upper);
11088               upper = upper === upper ? upper : 0;
11089             }
11090             if (lower2 !== undefined2) {
11091               lower2 = toNumber2(lower2);
11092               lower2 = lower2 === lower2 ? lower2 : 0;
11093             }
11094             return baseClamp(toNumber2(number3), lower2, upper);
11095           }
11096           function inRange(number3, start2, end) {
11097             start2 = toFinite(start2);
11098             if (end === undefined2) {
11099               end = start2;
11100               start2 = 0;
11101             } else {
11102               end = toFinite(end);
11103             }
11104             number3 = toNumber2(number3);
11105             return baseInRange(number3, start2, end);
11106           }
11107           function random(lower2, upper, floating) {
11108             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11109               upper = floating = undefined2;
11110             }
11111             if (floating === undefined2) {
11112               if (typeof upper == "boolean") {
11113                 floating = upper;
11114                 upper = undefined2;
11115               } else if (typeof lower2 == "boolean") {
11116                 floating = lower2;
11117                 lower2 = undefined2;
11118               }
11119             }
11120             if (lower2 === undefined2 && upper === undefined2) {
11121               lower2 = 0;
11122               upper = 1;
11123             } else {
11124               lower2 = toFinite(lower2);
11125               if (upper === undefined2) {
11126                 upper = lower2;
11127                 lower2 = 0;
11128               } else {
11129                 upper = toFinite(upper);
11130               }
11131             }
11132             if (lower2 > upper) {
11133               var temp = lower2;
11134               lower2 = upper;
11135               upper = temp;
11136             }
11137             if (floating || lower2 % 1 || upper % 1) {
11138               var rand = nativeRandom();
11139               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11140             }
11141             return baseRandom(lower2, upper);
11142           }
11143           var camelCase = createCompounder(function(result2, word, index) {
11144             word = word.toLowerCase();
11145             return result2 + (index ? capitalize(word) : word);
11146           });
11147           function capitalize(string) {
11148             return upperFirst(toString2(string).toLowerCase());
11149           }
11150           function deburr(string) {
11151             string = toString2(string);
11152             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11153           }
11154           function endsWith(string, target, position) {
11155             string = toString2(string);
11156             target = baseToString2(target);
11157             var length = string.length;
11158             position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11159             var end = position;
11160             position -= target.length;
11161             return position >= 0 && string.slice(position, end) == target;
11162           }
11163           function escape6(string) {
11164             string = toString2(string);
11165             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11166           }
11167           function escapeRegExp(string) {
11168             string = toString2(string);
11169             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
11170           }
11171           var kebabCase = createCompounder(function(result2, word, index) {
11172             return result2 + (index ? "-" : "") + word.toLowerCase();
11173           });
11174           var lowerCase = createCompounder(function(result2, word, index) {
11175             return result2 + (index ? " " : "") + word.toLowerCase();
11176           });
11177           var lowerFirst = createCaseFirst("toLowerCase");
11178           function pad2(string, length, chars) {
11179             string = toString2(string);
11180             length = toInteger(length);
11181             var strLength = length ? stringSize(string) : 0;
11182             if (!length || strLength >= length) {
11183               return string;
11184             }
11185             var mid = (length - strLength) / 2;
11186             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11187           }
11188           function padEnd(string, length, chars) {
11189             string = toString2(string);
11190             length = toInteger(length);
11191             var strLength = length ? stringSize(string) : 0;
11192             return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11193           }
11194           function padStart(string, length, chars) {
11195             string = toString2(string);
11196             length = toInteger(length);
11197             var strLength = length ? stringSize(string) : 0;
11198             return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11199           }
11200           function parseInt2(string, radix, guard) {
11201             if (guard || radix == null) {
11202               radix = 0;
11203             } else if (radix) {
11204               radix = +radix;
11205             }
11206             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11207           }
11208           function repeat(string, n2, guard) {
11209             if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined2) {
11210               n2 = 1;
11211             } else {
11212               n2 = toInteger(n2);
11213             }
11214             return baseRepeat(toString2(string), n2);
11215           }
11216           function replace() {
11217             var args = arguments, string = toString2(args[0]);
11218             return args.length < 3 ? string : string.replace(args[1], args[2]);
11219           }
11220           var snakeCase = createCompounder(function(result2, word, index) {
11221             return result2 + (index ? "_" : "") + word.toLowerCase();
11222           });
11223           function split(string, separator, limit) {
11224             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11225               separator = limit = undefined2;
11226             }
11227             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11228             if (!limit) {
11229               return [];
11230             }
11231             string = toString2(string);
11232             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11233               separator = baseToString2(separator);
11234               if (!separator && hasUnicode(string)) {
11235                 return castSlice(stringToArray(string), 0, limit);
11236               }
11237             }
11238             return string.split(separator, limit);
11239           }
11240           var startCase = createCompounder(function(result2, word, index) {
11241             return result2 + (index ? " " : "") + upperFirst(word);
11242           });
11243           function startsWith(string, target, position) {
11244             string = toString2(string);
11245             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11246             target = baseToString2(target);
11247             return string.slice(position, position + target.length) == target;
11248           }
11249           function template(string, options2, guard) {
11250             var settings = lodash.templateSettings;
11251             if (guard && isIterateeCall(string, options2, guard)) {
11252               options2 = undefined2;
11253             }
11254             string = toString2(string);
11255             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11256             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
11257             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11258             var reDelimiters = RegExp2((options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$", "g");
11259             var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11260             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11261               interpolateValue || (interpolateValue = esTemplateValue);
11262               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11263               if (escapeValue) {
11264                 isEscaping = true;
11265                 source += "' +\n__e(" + escapeValue + ") +\n'";
11266               }
11267               if (evaluateValue) {
11268                 isEvaluating = true;
11269                 source += "';\n" + evaluateValue + ";\n__p += '";
11270               }
11271               if (interpolateValue) {
11272                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11273               }
11274               index = offset + match.length;
11275               return match;
11276             });
11277             source += "';\n";
11278             var variable = hasOwnProperty2.call(options2, "variable") && options2.variable;
11279             if (!variable) {
11280               source = "with (obj) {\n" + source + "\n}\n";
11281             } else if (reForbiddenIdentifierChars.test(variable)) {
11282               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11283             }
11284             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11285             source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
11286             var result2 = attempt(function() {
11287               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11288             });
11289             result2.source = source;
11290             if (isError(result2)) {
11291               throw result2;
11292             }
11293             return result2;
11294           }
11295           function toLower(value) {
11296             return toString2(value).toLowerCase();
11297           }
11298           function toUpper(value) {
11299             return toString2(value).toUpperCase();
11300           }
11301           function trim(string, chars, guard) {
11302             string = toString2(string);
11303             if (string && (guard || chars === undefined2)) {
11304               return baseTrim2(string);
11305             }
11306             if (!string || !(chars = baseToString2(chars))) {
11307               return string;
11308             }
11309             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11310             return castSlice(strSymbols, start2, end).join("");
11311           }
11312           function trimEnd(string, chars, guard) {
11313             string = toString2(string);
11314             if (string && (guard || chars === undefined2)) {
11315               return string.slice(0, trimmedEndIndex2(string) + 1);
11316             }
11317             if (!string || !(chars = baseToString2(chars))) {
11318               return string;
11319             }
11320             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11321             return castSlice(strSymbols, 0, end).join("");
11322           }
11323           function trimStart(string, chars, guard) {
11324             string = toString2(string);
11325             if (string && (guard || chars === undefined2)) {
11326               return string.replace(reTrimStart2, "");
11327             }
11328             if (!string || !(chars = baseToString2(chars))) {
11329               return string;
11330             }
11331             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11332             return castSlice(strSymbols, start2).join("");
11333           }
11334           function truncate(string, options2) {
11335             var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11336             if (isObject2(options2)) {
11337               var separator = "separator" in options2 ? options2.separator : separator;
11338               length = "length" in options2 ? toInteger(options2.length) : length;
11339               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11340             }
11341             string = toString2(string);
11342             var strLength = string.length;
11343             if (hasUnicode(string)) {
11344               var strSymbols = stringToArray(string);
11345               strLength = strSymbols.length;
11346             }
11347             if (length >= strLength) {
11348               return string;
11349             }
11350             var end = length - stringSize(omission);
11351             if (end < 1) {
11352               return omission;
11353             }
11354             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11355             if (separator === undefined2) {
11356               return result2 + omission;
11357             }
11358             if (strSymbols) {
11359               end += result2.length - end;
11360             }
11361             if (isRegExp(separator)) {
11362               if (string.slice(end).search(separator)) {
11363                 var match, substring = result2;
11364                 if (!separator.global) {
11365                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11366                 }
11367                 separator.lastIndex = 0;
11368                 while (match = separator.exec(substring)) {
11369                   var newEnd = match.index;
11370                 }
11371                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11372               }
11373             } else if (string.indexOf(baseToString2(separator), end) != end) {
11374               var index = result2.lastIndexOf(separator);
11375               if (index > -1) {
11376                 result2 = result2.slice(0, index);
11377               }
11378             }
11379             return result2 + omission;
11380           }
11381           function unescape4(string) {
11382             string = toString2(string);
11383             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11384           }
11385           var upperCase = createCompounder(function(result2, word, index) {
11386             return result2 + (index ? " " : "") + word.toUpperCase();
11387           });
11388           var upperFirst = createCaseFirst("toUpperCase");
11389           function words(string, pattern, guard) {
11390             string = toString2(string);
11391             pattern = guard ? undefined2 : pattern;
11392             if (pattern === undefined2) {
11393               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11394             }
11395             return string.match(pattern) || [];
11396           }
11397           var attempt = baseRest(function(func, args) {
11398             try {
11399               return apply(func, undefined2, args);
11400             } catch (e) {
11401               return isError(e) ? e : new Error2(e);
11402             }
11403           });
11404           var bindAll = flatRest(function(object, methodNames) {
11405             arrayEach(methodNames, function(key) {
11406               key = toKey(key);
11407               baseAssignValue(object, key, bind(object[key], object));
11408             });
11409             return object;
11410           });
11411           function cond(pairs) {
11412             var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
11413             pairs = !length ? [] : arrayMap2(pairs, function(pair2) {
11414               if (typeof pair2[1] != "function") {
11415                 throw new TypeError2(FUNC_ERROR_TEXT3);
11416               }
11417               return [toIteratee(pair2[0]), pair2[1]];
11418             });
11419             return baseRest(function(args) {
11420               var index = -1;
11421               while (++index < length) {
11422                 var pair2 = pairs[index];
11423                 if (apply(pair2[0], this, args)) {
11424                   return apply(pair2[1], this, args);
11425                 }
11426               }
11427             });
11428           }
11429           function conforms(source) {
11430             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11431           }
11432           function constant(value) {
11433             return function() {
11434               return value;
11435             };
11436           }
11437           function defaultTo(value, defaultValue) {
11438             return value == null || value !== value ? defaultValue : value;
11439           }
11440           var flow = createFlow();
11441           var flowRight = createFlow(true);
11442           function identity4(value) {
11443             return value;
11444           }
11445           function iteratee(func) {
11446             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11447           }
11448           function matches(source) {
11449             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11450           }
11451           function matchesProperty(path, srcValue) {
11452             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11453           }
11454           var method = baseRest(function(path, args) {
11455             return function(object) {
11456               return baseInvoke(object, path, args);
11457             };
11458           });
11459           var methodOf = baseRest(function(object, args) {
11460             return function(path) {
11461               return baseInvoke(object, path, args);
11462             };
11463           });
11464           function mixin(object, source, options2) {
11465             var props = keys(source), methodNames = baseFunctions(source, props);
11466             if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
11467               options2 = source;
11468               source = object;
11469               object = this;
11470               methodNames = baseFunctions(source, keys(source));
11471             }
11472             var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction(object);
11473             arrayEach(methodNames, function(methodName) {
11474               var func = source[methodName];
11475               object[methodName] = func;
11476               if (isFunc) {
11477                 object.prototype[methodName] = function() {
11478                   var chainAll = this.__chain__;
11479                   if (chain2 || chainAll) {
11480                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11481                     actions.push({ "func": func, "args": arguments, "thisArg": object });
11482                     result2.__chain__ = chainAll;
11483                     return result2;
11484                   }
11485                   return func.apply(object, arrayPush([this.value()], arguments));
11486                 };
11487               }
11488             });
11489             return object;
11490           }
11491           function noConflict() {
11492             if (root3._ === this) {
11493               root3._ = oldDash;
11494             }
11495             return this;
11496           }
11497           function noop3() {
11498           }
11499           function nthArg(n2) {
11500             n2 = toInteger(n2);
11501             return baseRest(function(args) {
11502               return baseNth(args, n2);
11503             });
11504           }
11505           var over = createOver(arrayMap2);
11506           var overEvery = createOver(arrayEvery);
11507           var overSome = createOver(arraySome);
11508           function property(path) {
11509             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11510           }
11511           function propertyOf(object) {
11512             return function(path) {
11513               return object == null ? undefined2 : baseGet(object, path);
11514             };
11515           }
11516           var range3 = createRange();
11517           var rangeRight = createRange(true);
11518           function stubArray() {
11519             return [];
11520           }
11521           function stubFalse() {
11522             return false;
11523           }
11524           function stubObject() {
11525             return {};
11526           }
11527           function stubString() {
11528             return "";
11529           }
11530           function stubTrue() {
11531             return true;
11532           }
11533           function times(n2, iteratee2) {
11534             n2 = toInteger(n2);
11535             if (n2 < 1 || n2 > MAX_SAFE_INTEGER) {
11536               return [];
11537             }
11538             var index = MAX_ARRAY_LENGTH, length = nativeMin2(n2, MAX_ARRAY_LENGTH);
11539             iteratee2 = getIteratee(iteratee2);
11540             n2 -= MAX_ARRAY_LENGTH;
11541             var result2 = baseTimes(length, iteratee2);
11542             while (++index < n2) {
11543               iteratee2(index);
11544             }
11545             return result2;
11546           }
11547           function toPath(value) {
11548             if (isArray2(value)) {
11549               return arrayMap2(value, toKey);
11550             }
11551             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11552           }
11553           function uniqueId(prefix) {
11554             var id2 = ++idCounter;
11555             return toString2(prefix) + id2;
11556           }
11557           var add = createMathOperation(function(augend, addend) {
11558             return augend + addend;
11559           }, 0);
11560           var ceil = createRound("ceil");
11561           var divide = createMathOperation(function(dividend, divisor) {
11562             return dividend / divisor;
11563           }, 1);
11564           var floor = createRound("floor");
11565           function max3(array2) {
11566             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11567           }
11568           function maxBy(array2, iteratee2) {
11569             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11570           }
11571           function mean(array2) {
11572             return baseMean(array2, identity4);
11573           }
11574           function meanBy(array2, iteratee2) {
11575             return baseMean(array2, getIteratee(iteratee2, 2));
11576           }
11577           function min3(array2) {
11578             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11579           }
11580           function minBy(array2, iteratee2) {
11581             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11582           }
11583           var multiply = createMathOperation(function(multiplier, multiplicand) {
11584             return multiplier * multiplicand;
11585           }, 1);
11586           var round = createRound("round");
11587           var subtract = createMathOperation(function(minuend, subtrahend) {
11588             return minuend - subtrahend;
11589           }, 0);
11590           function sum(array2) {
11591             return array2 && array2.length ? baseSum(array2, identity4) : 0;
11592           }
11593           function sumBy(array2, iteratee2) {
11594             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11595           }
11596           lodash.after = after;
11597           lodash.ary = ary;
11598           lodash.assign = assign;
11599           lodash.assignIn = assignIn;
11600           lodash.assignInWith = assignInWith;
11601           lodash.assignWith = assignWith;
11602           lodash.at = at;
11603           lodash.before = before;
11604           lodash.bind = bind;
11605           lodash.bindAll = bindAll;
11606           lodash.bindKey = bindKey2;
11607           lodash.castArray = castArray;
11608           lodash.chain = chain;
11609           lodash.chunk = chunk;
11610           lodash.compact = compact;
11611           lodash.concat = concat;
11612           lodash.cond = cond;
11613           lodash.conforms = conforms;
11614           lodash.constant = constant;
11615           lodash.countBy = countBy;
11616           lodash.create = create2;
11617           lodash.curry = curry;
11618           lodash.curryRight = curryRight;
11619           lodash.debounce = debounce2;
11620           lodash.defaults = defaults2;
11621           lodash.defaultsDeep = defaultsDeep;
11622           lodash.defer = defer;
11623           lodash.delay = delay;
11624           lodash.difference = difference;
11625           lodash.differenceBy = differenceBy;
11626           lodash.differenceWith = differenceWith;
11627           lodash.drop = drop;
11628           lodash.dropRight = dropRight;
11629           lodash.dropRightWhile = dropRightWhile;
11630           lodash.dropWhile = dropWhile;
11631           lodash.fill = fill;
11632           lodash.filter = filter2;
11633           lodash.flatMap = flatMap;
11634           lodash.flatMapDeep = flatMapDeep;
11635           lodash.flatMapDepth = flatMapDepth;
11636           lodash.flatten = flatten2;
11637           lodash.flattenDeep = flattenDeep;
11638           lodash.flattenDepth = flattenDepth;
11639           lodash.flip = flip;
11640           lodash.flow = flow;
11641           lodash.flowRight = flowRight;
11642           lodash.fromPairs = fromPairs;
11643           lodash.functions = functions;
11644           lodash.functionsIn = functionsIn;
11645           lodash.groupBy = groupBy;
11646           lodash.initial = initial;
11647           lodash.intersection = intersection;
11648           lodash.intersectionBy = intersectionBy;
11649           lodash.intersectionWith = intersectionWith;
11650           lodash.invert = invert;
11651           lodash.invertBy = invertBy;
11652           lodash.invokeMap = invokeMap;
11653           lodash.iteratee = iteratee;
11654           lodash.keyBy = keyBy;
11655           lodash.keys = keys;
11656           lodash.keysIn = keysIn;
11657           lodash.map = map2;
11658           lodash.mapKeys = mapKeys;
11659           lodash.mapValues = mapValues;
11660           lodash.matches = matches;
11661           lodash.matchesProperty = matchesProperty;
11662           lodash.memoize = memoize;
11663           lodash.merge = merge3;
11664           lodash.mergeWith = mergeWith;
11665           lodash.method = method;
11666           lodash.methodOf = methodOf;
11667           lodash.mixin = mixin;
11668           lodash.negate = negate;
11669           lodash.nthArg = nthArg;
11670           lodash.omit = omit;
11671           lodash.omitBy = omitBy;
11672           lodash.once = once;
11673           lodash.orderBy = orderBy;
11674           lodash.over = over;
11675           lodash.overArgs = overArgs;
11676           lodash.overEvery = overEvery;
11677           lodash.overSome = overSome;
11678           lodash.partial = partial;
11679           lodash.partialRight = partialRight;
11680           lodash.partition = partition;
11681           lodash.pick = pick;
11682           lodash.pickBy = pickBy;
11683           lodash.property = property;
11684           lodash.propertyOf = propertyOf;
11685           lodash.pull = pull;
11686           lodash.pullAll = pullAll;
11687           lodash.pullAllBy = pullAllBy;
11688           lodash.pullAllWith = pullAllWith;
11689           lodash.pullAt = pullAt;
11690           lodash.range = range3;
11691           lodash.rangeRight = rangeRight;
11692           lodash.rearg = rearg;
11693           lodash.reject = reject;
11694           lodash.remove = remove2;
11695           lodash.rest = rest;
11696           lodash.reverse = reverse;
11697           lodash.sampleSize = sampleSize;
11698           lodash.set = set3;
11699           lodash.setWith = setWith;
11700           lodash.shuffle = shuffle;
11701           lodash.slice = slice;
11702           lodash.sortBy = sortBy;
11703           lodash.sortedUniq = sortedUniq;
11704           lodash.sortedUniqBy = sortedUniqBy;
11705           lodash.split = split;
11706           lodash.spread = spread;
11707           lodash.tail = tail;
11708           lodash.take = take;
11709           lodash.takeRight = takeRight;
11710           lodash.takeRightWhile = takeRightWhile;
11711           lodash.takeWhile = takeWhile;
11712           lodash.tap = tap;
11713           lodash.throttle = throttle2;
11714           lodash.thru = thru;
11715           lodash.toArray = toArray;
11716           lodash.toPairs = toPairs;
11717           lodash.toPairsIn = toPairsIn;
11718           lodash.toPath = toPath;
11719           lodash.toPlainObject = toPlainObject;
11720           lodash.transform = transform2;
11721           lodash.unary = unary;
11722           lodash.union = union;
11723           lodash.unionBy = unionBy;
11724           lodash.unionWith = unionWith;
11725           lodash.uniq = uniq;
11726           lodash.uniqBy = uniqBy;
11727           lodash.uniqWith = uniqWith;
11728           lodash.unset = unset;
11729           lodash.unzip = unzip;
11730           lodash.unzipWith = unzipWith;
11731           lodash.update = update;
11732           lodash.updateWith = updateWith;
11733           lodash.values = values;
11734           lodash.valuesIn = valuesIn;
11735           lodash.without = without;
11736           lodash.words = words;
11737           lodash.wrap = wrap2;
11738           lodash.xor = xor;
11739           lodash.xorBy = xorBy;
11740           lodash.xorWith = xorWith;
11741           lodash.zip = zip;
11742           lodash.zipObject = zipObject;
11743           lodash.zipObjectDeep = zipObjectDeep;
11744           lodash.zipWith = zipWith;
11745           lodash.entries = toPairs;
11746           lodash.entriesIn = toPairsIn;
11747           lodash.extend = assignIn;
11748           lodash.extendWith = assignInWith;
11749           mixin(lodash, lodash);
11750           lodash.add = add;
11751           lodash.attempt = attempt;
11752           lodash.camelCase = camelCase;
11753           lodash.capitalize = capitalize;
11754           lodash.ceil = ceil;
11755           lodash.clamp = clamp3;
11756           lodash.clone = clone;
11757           lodash.cloneDeep = cloneDeep;
11758           lodash.cloneDeepWith = cloneDeepWith;
11759           lodash.cloneWith = cloneWith;
11760           lodash.conformsTo = conformsTo;
11761           lodash.deburr = deburr;
11762           lodash.defaultTo = defaultTo;
11763           lodash.divide = divide;
11764           lodash.endsWith = endsWith;
11765           lodash.eq = eq;
11766           lodash.escape = escape6;
11767           lodash.escapeRegExp = escapeRegExp;
11768           lodash.every = every;
11769           lodash.find = find2;
11770           lodash.findIndex = findIndex;
11771           lodash.findKey = findKey;
11772           lodash.findLast = findLast;
11773           lodash.findLastIndex = findLastIndex;
11774           lodash.findLastKey = findLastKey;
11775           lodash.floor = floor;
11776           lodash.forEach = forEach;
11777           lodash.forEachRight = forEachRight;
11778           lodash.forIn = forIn;
11779           lodash.forInRight = forInRight;
11780           lodash.forOwn = forOwn;
11781           lodash.forOwnRight = forOwnRight;
11782           lodash.get = get3;
11783           lodash.gt = gt;
11784           lodash.gte = gte;
11785           lodash.has = has;
11786           lodash.hasIn = hasIn;
11787           lodash.head = head;
11788           lodash.identity = identity4;
11789           lodash.includes = includes;
11790           lodash.indexOf = indexOf;
11791           lodash.inRange = inRange;
11792           lodash.invoke = invoke;
11793           lodash.isArguments = isArguments;
11794           lodash.isArray = isArray2;
11795           lodash.isArrayBuffer = isArrayBuffer;
11796           lodash.isArrayLike = isArrayLike;
11797           lodash.isArrayLikeObject = isArrayLikeObject;
11798           lodash.isBoolean = isBoolean;
11799           lodash.isBuffer = isBuffer;
11800           lodash.isDate = isDate;
11801           lodash.isElement = isElement;
11802           lodash.isEmpty = isEmpty;
11803           lodash.isEqual = isEqual;
11804           lodash.isEqualWith = isEqualWith;
11805           lodash.isError = isError;
11806           lodash.isFinite = isFinite2;
11807           lodash.isFunction = isFunction;
11808           lodash.isInteger = isInteger;
11809           lodash.isLength = isLength;
11810           lodash.isMap = isMap;
11811           lodash.isMatch = isMatch;
11812           lodash.isMatchWith = isMatchWith;
11813           lodash.isNaN = isNaN2;
11814           lodash.isNative = isNative;
11815           lodash.isNil = isNil;
11816           lodash.isNull = isNull;
11817           lodash.isNumber = isNumber2;
11818           lodash.isObject = isObject2;
11819           lodash.isObjectLike = isObjectLike2;
11820           lodash.isPlainObject = isPlainObject;
11821           lodash.isRegExp = isRegExp;
11822           lodash.isSafeInteger = isSafeInteger;
11823           lodash.isSet = isSet;
11824           lodash.isString = isString;
11825           lodash.isSymbol = isSymbol2;
11826           lodash.isTypedArray = isTypedArray;
11827           lodash.isUndefined = isUndefined;
11828           lodash.isWeakMap = isWeakMap;
11829           lodash.isWeakSet = isWeakSet;
11830           lodash.join = join;
11831           lodash.kebabCase = kebabCase;
11832           lodash.last = last;
11833           lodash.lastIndexOf = lastIndexOf;
11834           lodash.lowerCase = lowerCase;
11835           lodash.lowerFirst = lowerFirst;
11836           lodash.lt = lt;
11837           lodash.lte = lte;
11838           lodash.max = max3;
11839           lodash.maxBy = maxBy;
11840           lodash.mean = mean;
11841           lodash.meanBy = meanBy;
11842           lodash.min = min3;
11843           lodash.minBy = minBy;
11844           lodash.stubArray = stubArray;
11845           lodash.stubFalse = stubFalse;
11846           lodash.stubObject = stubObject;
11847           lodash.stubString = stubString;
11848           lodash.stubTrue = stubTrue;
11849           lodash.multiply = multiply;
11850           lodash.nth = nth;
11851           lodash.noConflict = noConflict;
11852           lodash.noop = noop3;
11853           lodash.now = now3;
11854           lodash.pad = pad2;
11855           lodash.padEnd = padEnd;
11856           lodash.padStart = padStart;
11857           lodash.parseInt = parseInt2;
11858           lodash.random = random;
11859           lodash.reduce = reduce;
11860           lodash.reduceRight = reduceRight;
11861           lodash.repeat = repeat;
11862           lodash.replace = replace;
11863           lodash.result = result;
11864           lodash.round = round;
11865           lodash.runInContext = runInContext2;
11866           lodash.sample = sample;
11867           lodash.size = size;
11868           lodash.snakeCase = snakeCase;
11869           lodash.some = some;
11870           lodash.sortedIndex = sortedIndex;
11871           lodash.sortedIndexBy = sortedIndexBy;
11872           lodash.sortedIndexOf = sortedIndexOf;
11873           lodash.sortedLastIndex = sortedLastIndex;
11874           lodash.sortedLastIndexBy = sortedLastIndexBy;
11875           lodash.sortedLastIndexOf = sortedLastIndexOf;
11876           lodash.startCase = startCase;
11877           lodash.startsWith = startsWith;
11878           lodash.subtract = subtract;
11879           lodash.sum = sum;
11880           lodash.sumBy = sumBy;
11881           lodash.template = template;
11882           lodash.times = times;
11883           lodash.toFinite = toFinite;
11884           lodash.toInteger = toInteger;
11885           lodash.toLength = toLength;
11886           lodash.toLower = toLower;
11887           lodash.toNumber = toNumber2;
11888           lodash.toSafeInteger = toSafeInteger;
11889           lodash.toString = toString2;
11890           lodash.toUpper = toUpper;
11891           lodash.trim = trim;
11892           lodash.trimEnd = trimEnd;
11893           lodash.trimStart = trimStart;
11894           lodash.truncate = truncate;
11895           lodash.unescape = unescape4;
11896           lodash.uniqueId = uniqueId;
11897           lodash.upperCase = upperCase;
11898           lodash.upperFirst = upperFirst;
11899           lodash.each = forEach;
11900           lodash.eachRight = forEachRight;
11901           lodash.first = head;
11902           mixin(lodash, function() {
11903             var source = {};
11904             baseForOwn(lodash, function(func, methodName) {
11905               if (!hasOwnProperty2.call(lodash.prototype, methodName)) {
11906                 source[methodName] = func;
11907               }
11908             });
11909             return source;
11910           }(), { "chain": false });
11911           lodash.VERSION = VERSION;
11912           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
11913             lodash[methodName].placeholder = lodash;
11914           });
11915           arrayEach(["drop", "take"], function(methodName, index) {
11916             LazyWrapper.prototype[methodName] = function(n2) {
11917               n2 = n2 === undefined2 ? 1 : nativeMax2(toInteger(n2), 0);
11918               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
11919               if (result2.__filtered__) {
11920                 result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
11921               } else {
11922                 result2.__views__.push({
11923                   "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
11924                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
11925                 });
11926               }
11927               return result2;
11928             };
11929             LazyWrapper.prototype[methodName + "Right"] = function(n2) {
11930               return this.reverse()[methodName](n2).reverse();
11931             };
11932           });
11933           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
11934             var type3 = index + 1, isFilter = type3 == LAZY_FILTER_FLAG || type3 == LAZY_WHILE_FLAG;
11935             LazyWrapper.prototype[methodName] = function(iteratee2) {
11936               var result2 = this.clone();
11937               result2.__iteratees__.push({
11938                 "iteratee": getIteratee(iteratee2, 3),
11939                 "type": type3
11940               });
11941               result2.__filtered__ = result2.__filtered__ || isFilter;
11942               return result2;
11943             };
11944           });
11945           arrayEach(["head", "last"], function(methodName, index) {
11946             var takeName = "take" + (index ? "Right" : "");
11947             LazyWrapper.prototype[methodName] = function() {
11948               return this[takeName](1).value()[0];
11949             };
11950           });
11951           arrayEach(["initial", "tail"], function(methodName, index) {
11952             var dropName = "drop" + (index ? "" : "Right");
11953             LazyWrapper.prototype[methodName] = function() {
11954               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
11955             };
11956           });
11957           LazyWrapper.prototype.compact = function() {
11958             return this.filter(identity4);
11959           };
11960           LazyWrapper.prototype.find = function(predicate) {
11961             return this.filter(predicate).head();
11962           };
11963           LazyWrapper.prototype.findLast = function(predicate) {
11964             return this.reverse().find(predicate);
11965           };
11966           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
11967             if (typeof path == "function") {
11968               return new LazyWrapper(this);
11969             }
11970             return this.map(function(value) {
11971               return baseInvoke(value, path, args);
11972             });
11973           });
11974           LazyWrapper.prototype.reject = function(predicate) {
11975             return this.filter(negate(getIteratee(predicate)));
11976           };
11977           LazyWrapper.prototype.slice = function(start2, end) {
11978             start2 = toInteger(start2);
11979             var result2 = this;
11980             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
11981               return new LazyWrapper(result2);
11982             }
11983             if (start2 < 0) {
11984               result2 = result2.takeRight(-start2);
11985             } else if (start2) {
11986               result2 = result2.drop(start2);
11987             }
11988             if (end !== undefined2) {
11989               end = toInteger(end);
11990               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
11991             }
11992             return result2;
11993           };
11994           LazyWrapper.prototype.takeRightWhile = function(predicate) {
11995             return this.reverse().takeWhile(predicate).reverse();
11996           };
11997           LazyWrapper.prototype.toArray = function() {
11998             return this.take(MAX_ARRAY_LENGTH);
11999           };
12000           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12001             var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
12002             if (!lodashFunc) {
12003               return;
12004             }
12005             lodash.prototype[methodName] = function() {
12006               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12007               var interceptor = function(value2) {
12008                 var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
12009                 return isTaker && chainAll ? result3[0] : result3;
12010               };
12011               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12012                 isLazy = useLazy = false;
12013               }
12014               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12015               if (!retUnwrapped && useLazy) {
12016                 value = onlyLazy ? value : new LazyWrapper(this);
12017                 var result2 = func.apply(value, args);
12018                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12019                 return new LodashWrapper(result2, chainAll);
12020               }
12021               if (isUnwrapped && onlyLazy) {
12022                 return func.apply(this, args);
12023               }
12024               result2 = this.thru(interceptor);
12025               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12026             };
12027           });
12028           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12029             var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12030             lodash.prototype[methodName] = function() {
12031               var args = arguments;
12032               if (retUnwrapped && !this.__chain__) {
12033                 var value = this.value();
12034                 return func.apply(isArray2(value) ? value : [], args);
12035               }
12036               return this[chainName](function(value2) {
12037                 return func.apply(isArray2(value2) ? value2 : [], args);
12038               });
12039             };
12040           });
12041           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12042             var lodashFunc = lodash[methodName];
12043             if (lodashFunc) {
12044               var key = lodashFunc.name + "";
12045               if (!hasOwnProperty2.call(realNames, key)) {
12046                 realNames[key] = [];
12047               }
12048               realNames[key].push({ "name": methodName, "func": lodashFunc });
12049             }
12050           });
12051           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12052             "name": "wrapper",
12053             "func": undefined2
12054           }];
12055           LazyWrapper.prototype.clone = lazyClone;
12056           LazyWrapper.prototype.reverse = lazyReverse;
12057           LazyWrapper.prototype.value = lazyValue;
12058           lodash.prototype.at = wrapperAt;
12059           lodash.prototype.chain = wrapperChain;
12060           lodash.prototype.commit = wrapperCommit;
12061           lodash.prototype.next = wrapperNext;
12062           lodash.prototype.plant = wrapperPlant;
12063           lodash.prototype.reverse = wrapperReverse;
12064           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12065           lodash.prototype.first = lodash.prototype.head;
12066           if (symIterator) {
12067             lodash.prototype[symIterator] = wrapperToIterator;
12068           }
12069           return lodash;
12070         };
12071         var _ = runInContext();
12072         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12073           root3._ = _;
12074           define(function() {
12075             return _;
12076           });
12077         } else if (freeModule) {
12078           (freeModule.exports = _)._ = _;
12079           freeExports._ = _;
12080         } else {
12081           root3._ = _;
12082         }
12083       }).call(exports2);
12084     }
12085   });
12086
12087   // node_modules/rbush/rbush.min.js
12088   var require_rbush_min = __commonJS({
12089     "node_modules/rbush/rbush.min.js"(exports2, module2) {
12090       !function(t, i2) {
12091         typeof exports2 == "object" && typeof module2 != "undefined" ? module2.exports = i2() : typeof define == "function" && define.amd ? define(i2) : (t = t || self).RBush = i2();
12092       }(exports2, function() {
12093         "use strict";
12094         function t(t2, r2, e3, a2, h2) {
12095           !function t3(n3, r3, e4, a3, h3) {
12096             for (; a3 > e4; ) {
12097               if (a3 - e4 > 600) {
12098                 var o2 = a3 - e4 + 1, s2 = r3 - e4 + 1, l2 = Math.log(o2), f3 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f3 * (o2 - f3) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e4, Math.floor(r3 - s2 * f3 / o2 + u2)), c2 = Math.min(a3, Math.floor(r3 + (o2 - s2) * f3 / o2 + u2));
12099                 t3(n3, r3, m2, c2, h3);
12100               }
12101               var p2 = n3[r3], d2 = e4, x = a3;
12102               for (i2(n3, e4, r3), h3(n3[a3], p2) > 0 && i2(n3, e4, a3); d2 < x; ) {
12103                 for (i2(n3, d2, x), d2++, x--; h3(n3[d2], p2) < 0; )
12104                   d2++;
12105                 for (; h3(n3[x], p2) > 0; )
12106                   x--;
12107               }
12108               h3(n3[e4], p2) === 0 ? i2(n3, e4, x) : i2(n3, ++x, a3), x <= r3 && (e4 = x + 1), r3 <= x && (a3 = x - 1);
12109             }
12110           }(t2, r2, e3 || 0, a2 || t2.length - 1, h2 || n2);
12111         }
12112         function i2(t2, i3, n3) {
12113           var r2 = t2[i3];
12114           t2[i3] = t2[n3], t2[n3] = r2;
12115         }
12116         function n2(t2, i3) {
12117           return t2 < i3 ? -1 : t2 > i3 ? 1 : 0;
12118         }
12119         var r = function(t2) {
12120           t2 === void 0 && (t2 = 9), this._maxEntries = Math.max(4, t2), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12121         };
12122         function e(t2, i3, n3) {
12123           if (!n3)
12124             return i3.indexOf(t2);
12125           for (var r2 = 0; r2 < i3.length; r2++)
12126             if (n3(t2, i3[r2]))
12127               return r2;
12128           return -1;
12129         }
12130         function a(t2, i3) {
12131           h(t2, 0, t2.children.length, i3, t2);
12132         }
12133         function h(t2, i3, n3, r2, e3) {
12134           e3 || (e3 = p(null)), e3.minX = 1 / 0, e3.minY = 1 / 0, e3.maxX = -1 / 0, e3.maxY = -1 / 0;
12135           for (var a2 = i3; a2 < n3; a2++) {
12136             var h2 = t2.children[a2];
12137             o(e3, t2.leaf ? r2(h2) : h2);
12138           }
12139           return e3;
12140         }
12141         function o(t2, i3) {
12142           return t2.minX = Math.min(t2.minX, i3.minX), t2.minY = Math.min(t2.minY, i3.minY), t2.maxX = Math.max(t2.maxX, i3.maxX), t2.maxY = Math.max(t2.maxY, i3.maxY), t2;
12143         }
12144         function s(t2, i3) {
12145           return t2.minX - i3.minX;
12146         }
12147         function l(t2, i3) {
12148           return t2.minY - i3.minY;
12149         }
12150         function f2(t2) {
12151           return (t2.maxX - t2.minX) * (t2.maxY - t2.minY);
12152         }
12153         function u(t2) {
12154           return t2.maxX - t2.minX + (t2.maxY - t2.minY);
12155         }
12156         function m(t2, i3) {
12157           return t2.minX <= i3.minX && t2.minY <= i3.minY && i3.maxX <= t2.maxX && i3.maxY <= t2.maxY;
12158         }
12159         function c(t2, i3) {
12160           return i3.minX <= t2.maxX && i3.minY <= t2.maxY && i3.maxX >= t2.minX && i3.maxY >= t2.minY;
12161         }
12162         function p(t2) {
12163           return { children: t2, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12164         }
12165         function d(i3, n3, r2, e3, a2) {
12166           for (var h2 = [n3, r2]; h2.length; )
12167             if (!((r2 = h2.pop()) - (n3 = h2.pop()) <= e3)) {
12168               var o2 = n3 + Math.ceil((r2 - n3) / e3 / 2) * e3;
12169               t(i3, o2, n3, r2, a2), h2.push(n3, o2, o2, r2);
12170             }
12171         }
12172         return r.prototype.all = function() {
12173           return this._all(this.data, []);
12174         }, r.prototype.search = function(t2) {
12175           var i3 = this.data, n3 = [];
12176           if (!c(t2, i3))
12177             return n3;
12178           for (var r2 = this.toBBox, e3 = []; i3; ) {
12179             for (var a2 = 0; a2 < i3.children.length; a2++) {
12180               var h2 = i3.children[a2], o2 = i3.leaf ? r2(h2) : h2;
12181               c(t2, o2) && (i3.leaf ? n3.push(h2) : m(t2, o2) ? this._all(h2, n3) : e3.push(h2));
12182             }
12183             i3 = e3.pop();
12184           }
12185           return n3;
12186         }, r.prototype.collides = function(t2) {
12187           var i3 = this.data;
12188           if (!c(t2, i3))
12189             return false;
12190           for (var n3 = []; i3; ) {
12191             for (var r2 = 0; r2 < i3.children.length; r2++) {
12192               var e3 = i3.children[r2], a2 = i3.leaf ? this.toBBox(e3) : e3;
12193               if (c(t2, a2)) {
12194                 if (i3.leaf || m(t2, a2))
12195                   return true;
12196                 n3.push(e3);
12197               }
12198             }
12199             i3 = n3.pop();
12200           }
12201           return false;
12202         }, r.prototype.load = function(t2) {
12203           if (!t2 || !t2.length)
12204             return this;
12205           if (t2.length < this._minEntries) {
12206             for (var i3 = 0; i3 < t2.length; i3++)
12207               this.insert(t2[i3]);
12208             return this;
12209           }
12210           var n3 = this._build(t2.slice(), 0, t2.length - 1, 0);
12211           if (this.data.children.length)
12212             if (this.data.height === n3.height)
12213               this._splitRoot(this.data, n3);
12214             else {
12215               if (this.data.height < n3.height) {
12216                 var r2 = this.data;
12217                 this.data = n3, n3 = r2;
12218               }
12219               this._insert(n3, this.data.height - n3.height - 1, true);
12220             }
12221           else
12222             this.data = n3;
12223           return this;
12224         }, r.prototype.insert = function(t2) {
12225           return t2 && this._insert(t2, this.data.height - 1), this;
12226         }, r.prototype.clear = function() {
12227           return this.data = p([]), this;
12228         }, r.prototype.remove = function(t2, i3) {
12229           if (!t2)
12230             return this;
12231           for (var n3, r2, a2, h2 = this.data, o2 = this.toBBox(t2), s2 = [], l2 = []; h2 || s2.length; ) {
12232             if (h2 || (h2 = s2.pop(), r2 = s2[s2.length - 1], n3 = l2.pop(), a2 = true), h2.leaf) {
12233               var f3 = e(t2, h2.children, i3);
12234               if (f3 !== -1)
12235                 return h2.children.splice(f3, 1), s2.push(h2), this._condense(s2), this;
12236             }
12237             a2 || h2.leaf || !m(h2, o2) ? r2 ? (n3++, h2 = r2.children[n3], a2 = false) : h2 = null : (s2.push(h2), l2.push(n3), n3 = 0, r2 = h2, h2 = h2.children[0]);
12238           }
12239           return this;
12240         }, r.prototype.toBBox = function(t2) {
12241           return t2;
12242         }, r.prototype.compareMinX = function(t2, i3) {
12243           return t2.minX - i3.minX;
12244         }, r.prototype.compareMinY = function(t2, i3) {
12245           return t2.minY - i3.minY;
12246         }, r.prototype.toJSON = function() {
12247           return this.data;
12248         }, r.prototype.fromJSON = function(t2) {
12249           return this.data = t2, this;
12250         }, r.prototype._all = function(t2, i3) {
12251           for (var n3 = []; t2; )
12252             t2.leaf ? i3.push.apply(i3, t2.children) : n3.push.apply(n3, t2.children), t2 = n3.pop();
12253           return i3;
12254         }, r.prototype._build = function(t2, i3, n3, r2) {
12255           var e3, h2 = n3 - i3 + 1, o2 = this._maxEntries;
12256           if (h2 <= o2)
12257             return a(e3 = p(t2.slice(i3, n3 + 1)), this.toBBox), e3;
12258           r2 || (r2 = Math.ceil(Math.log(h2) / Math.log(o2)), o2 = Math.ceil(h2 / Math.pow(o2, r2 - 1))), (e3 = p([])).leaf = false, e3.height = r2;
12259           var s2 = Math.ceil(h2 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
12260           d(t2, i3, n3, l2, this.compareMinX);
12261           for (var f3 = i3; f3 <= n3; f3 += l2) {
12262             var u2 = Math.min(f3 + l2 - 1, n3);
12263             d(t2, f3, u2, s2, this.compareMinY);
12264             for (var m2 = f3; m2 <= u2; m2 += s2) {
12265               var c2 = Math.min(m2 + s2 - 1, u2);
12266               e3.children.push(this._build(t2, m2, c2, r2 - 1));
12267             }
12268           }
12269           return a(e3, this.toBBox), e3;
12270         }, r.prototype._chooseSubtree = function(t2, i3, n3, r2) {
12271           for (; r2.push(i3), !i3.leaf && r2.length - 1 !== n3; ) {
12272             for (var e3 = 1 / 0, a2 = 1 / 0, h2 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
12273               var s2 = i3.children[o2], l2 = f2(s2), u2 = (m2 = t2, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
12274               u2 < a2 ? (a2 = u2, e3 = l2 < e3 ? l2 : e3, h2 = s2) : u2 === a2 && l2 < e3 && (e3 = l2, h2 = s2);
12275             }
12276             i3 = h2 || i3.children[0];
12277           }
12278           var m2, c2;
12279           return i3;
12280         }, r.prototype._insert = function(t2, i3, n3) {
12281           var r2 = n3 ? t2 : this.toBBox(t2), e3 = [], a2 = this._chooseSubtree(r2, this.data, i3, e3);
12282           for (a2.children.push(t2), o(a2, r2); i3 >= 0 && e3[i3].children.length > this._maxEntries; )
12283             this._split(e3, i3), i3--;
12284           this._adjustParentBBoxes(r2, e3, i3);
12285         }, r.prototype._split = function(t2, i3) {
12286           var n3 = t2[i3], r2 = n3.children.length, e3 = this._minEntries;
12287           this._chooseSplitAxis(n3, e3, r2);
12288           var h2 = this._chooseSplitIndex(n3, e3, r2), o2 = p(n3.children.splice(h2, n3.children.length - h2));
12289           o2.height = n3.height, o2.leaf = n3.leaf, a(n3, this.toBBox), a(o2, this.toBBox), i3 ? t2[i3 - 1].children.push(o2) : this._splitRoot(n3, o2);
12290         }, r.prototype._splitRoot = function(t2, i3) {
12291           this.data = p([t2, i3]), this.data.height = t2.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
12292         }, r.prototype._chooseSplitIndex = function(t2, i3, n3) {
12293           for (var r2, e3, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n3 - i3; p2++) {
12294             var d2 = h(t2, 0, p2, this.toBBox), x = h(t2, p2, n3, this.toBBox), v = (e3 = d2, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e3.minX, a2.minX), s2 = Math.max(e3.minY, a2.minY), l2 = Math.min(e3.maxX, a2.maxX), u2 = Math.min(e3.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f2(d2) + f2(x);
12295             v < m2 ? (m2 = v, r2 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r2 = p2);
12296           }
12297           return r2 || n3 - i3;
12298         }, r.prototype._chooseSplitAxis = function(t2, i3, n3) {
12299           var r2 = t2.leaf ? this.compareMinX : s, e3 = t2.leaf ? this.compareMinY : l;
12300           this._allDistMargin(t2, i3, n3, r2) < this._allDistMargin(t2, i3, n3, e3) && t2.children.sort(r2);
12301         }, r.prototype._allDistMargin = function(t2, i3, n3, r2) {
12302           t2.children.sort(r2);
12303           for (var e3 = this.toBBox, a2 = h(t2, 0, i3, e3), s2 = h(t2, n3 - i3, n3, e3), l2 = u(a2) + u(s2), f3 = i3; f3 < n3 - i3; f3++) {
12304             var m2 = t2.children[f3];
12305             o(a2, t2.leaf ? e3(m2) : m2), l2 += u(a2);
12306           }
12307           for (var c2 = n3 - i3 - 1; c2 >= i3; c2--) {
12308             var p2 = t2.children[c2];
12309             o(s2, t2.leaf ? e3(p2) : p2), l2 += u(s2);
12310           }
12311           return l2;
12312         }, r.prototype._adjustParentBBoxes = function(t2, i3, n3) {
12313           for (var r2 = n3; r2 >= 0; r2--)
12314             o(i3[r2], t2);
12315         }, r.prototype._condense = function(t2) {
12316           for (var i3 = t2.length - 1, n3 = void 0; i3 >= 0; i3--)
12317             t2[i3].children.length === 0 ? i3 > 0 ? (n3 = t2[i3 - 1].children).splice(n3.indexOf(t2[i3]), 1) : this.clear() : a(t2[i3], this.toBBox);
12318         }, r;
12319       });
12320     }
12321   });
12322
12323   // node_modules/ieee754/index.js
12324   var require_ieee754 = __commonJS({
12325     "node_modules/ieee754/index.js"(exports2) {
12326       exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12327         var e, m;
12328         var eLen = nBytes * 8 - mLen - 1;
12329         var eMax = (1 << eLen) - 1;
12330         var eBias = eMax >> 1;
12331         var nBits = -7;
12332         var i2 = isLE ? nBytes - 1 : 0;
12333         var d = isLE ? -1 : 1;
12334         var s = buffer[offset + i2];
12335         i2 += d;
12336         e = s & (1 << -nBits) - 1;
12337         s >>= -nBits;
12338         nBits += eLen;
12339         for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12340         }
12341         m = e & (1 << -nBits) - 1;
12342         e >>= -nBits;
12343         nBits += mLen;
12344         for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12345         }
12346         if (e === 0) {
12347           e = 1 - eBias;
12348         } else if (e === eMax) {
12349           return m ? NaN : (s ? -1 : 1) * Infinity;
12350         } else {
12351           m = m + Math.pow(2, mLen);
12352           e = e - eBias;
12353         }
12354         return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
12355       };
12356       exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12357         var e, m, c;
12358         var eLen = nBytes * 8 - mLen - 1;
12359         var eMax = (1 << eLen) - 1;
12360         var eBias = eMax >> 1;
12361         var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12362         var i2 = isLE ? 0 : nBytes - 1;
12363         var d = isLE ? 1 : -1;
12364         var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12365         value = Math.abs(value);
12366         if (isNaN(value) || value === Infinity) {
12367           m = isNaN(value) ? 1 : 0;
12368           e = eMax;
12369         } else {
12370           e = Math.floor(Math.log(value) / Math.LN2);
12371           if (value * (c = Math.pow(2, -e)) < 1) {
12372             e--;
12373             c *= 2;
12374           }
12375           if (e + eBias >= 1) {
12376             value += rt / c;
12377           } else {
12378             value += rt * Math.pow(2, 1 - eBias);
12379           }
12380           if (value * c >= 2) {
12381             e++;
12382             c /= 2;
12383           }
12384           if (e + eBias >= eMax) {
12385             m = 0;
12386             e = eMax;
12387           } else if (e + eBias >= 1) {
12388             m = (value * c - 1) * Math.pow(2, mLen);
12389             e = e + eBias;
12390           } else {
12391             m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12392             e = 0;
12393           }
12394         }
12395         for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
12396         }
12397         e = e << mLen | m;
12398         eLen += mLen;
12399         for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
12400         }
12401         buffer[offset + i2 - d] |= s * 128;
12402       };
12403     }
12404   });
12405
12406   // node_modules/pbf/index.js
12407   var require_pbf = __commonJS({
12408     "node_modules/pbf/index.js"(exports2, module2) {
12409       "use strict";
12410       module2.exports = Pbf;
12411       var ieee754 = require_ieee754();
12412       function Pbf(buf) {
12413         this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12414         this.pos = 0;
12415         this.type = 0;
12416         this.length = this.buf.length;
12417       }
12418       Pbf.Varint = 0;
12419       Pbf.Fixed64 = 1;
12420       Pbf.Bytes = 2;
12421       Pbf.Fixed32 = 5;
12422       var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12423       var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12424       var TEXT_DECODER_MIN_LENGTH = 12;
12425       var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12426       Pbf.prototype = {
12427         destroy: function() {
12428           this.buf = null;
12429         },
12430         readFields: function(readField, result, end) {
12431           end = end || this.length;
12432           while (this.pos < end) {
12433             var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12434             this.type = val & 7;
12435             readField(tag, result, this);
12436             if (this.pos === startPos)
12437               this.skip(val);
12438           }
12439           return result;
12440         },
12441         readMessage: function(readField, result) {
12442           return this.readFields(readField, result, this.readVarint() + this.pos);
12443         },
12444         readFixed32: function() {
12445           var val = readUInt32(this.buf, this.pos);
12446           this.pos += 4;
12447           return val;
12448         },
12449         readSFixed32: function() {
12450           var val = readInt32(this.buf, this.pos);
12451           this.pos += 4;
12452           return val;
12453         },
12454         readFixed64: function() {
12455           var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12456           this.pos += 8;
12457           return val;
12458         },
12459         readSFixed64: function() {
12460           var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12461           this.pos += 8;
12462           return val;
12463         },
12464         readFloat: function() {
12465           var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12466           this.pos += 4;
12467           return val;
12468         },
12469         readDouble: function() {
12470           var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12471           this.pos += 8;
12472           return val;
12473         },
12474         readVarint: function(isSigned) {
12475           var buf = this.buf, val, b;
12476           b = buf[this.pos++];
12477           val = b & 127;
12478           if (b < 128)
12479             return val;
12480           b = buf[this.pos++];
12481           val |= (b & 127) << 7;
12482           if (b < 128)
12483             return val;
12484           b = buf[this.pos++];
12485           val |= (b & 127) << 14;
12486           if (b < 128)
12487             return val;
12488           b = buf[this.pos++];
12489           val |= (b & 127) << 21;
12490           if (b < 128)
12491             return val;
12492           b = buf[this.pos];
12493           val |= (b & 15) << 28;
12494           return readVarintRemainder(val, isSigned, this);
12495         },
12496         readVarint64: function() {
12497           return this.readVarint(true);
12498         },
12499         readSVarint: function() {
12500           var num = this.readVarint();
12501           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12502         },
12503         readBoolean: function() {
12504           return Boolean(this.readVarint());
12505         },
12506         readString: function() {
12507           var end = this.readVarint() + this.pos;
12508           var pos = this.pos;
12509           this.pos = end;
12510           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12511             return readUtf8TextDecoder(this.buf, pos, end);
12512           }
12513           return readUtf8(this.buf, pos, end);
12514         },
12515         readBytes: function() {
12516           var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12517           this.pos = end;
12518           return buffer;
12519         },
12520         readPackedVarint: function(arr, isSigned) {
12521           if (this.type !== Pbf.Bytes)
12522             return arr.push(this.readVarint(isSigned));
12523           var end = readPackedEnd(this);
12524           arr = arr || [];
12525           while (this.pos < end)
12526             arr.push(this.readVarint(isSigned));
12527           return arr;
12528         },
12529         readPackedSVarint: function(arr) {
12530           if (this.type !== Pbf.Bytes)
12531             return arr.push(this.readSVarint());
12532           var end = readPackedEnd(this);
12533           arr = arr || [];
12534           while (this.pos < end)
12535             arr.push(this.readSVarint());
12536           return arr;
12537         },
12538         readPackedBoolean: function(arr) {
12539           if (this.type !== Pbf.Bytes)
12540             return arr.push(this.readBoolean());
12541           var end = readPackedEnd(this);
12542           arr = arr || [];
12543           while (this.pos < end)
12544             arr.push(this.readBoolean());
12545           return arr;
12546         },
12547         readPackedFloat: function(arr) {
12548           if (this.type !== Pbf.Bytes)
12549             return arr.push(this.readFloat());
12550           var end = readPackedEnd(this);
12551           arr = arr || [];
12552           while (this.pos < end)
12553             arr.push(this.readFloat());
12554           return arr;
12555         },
12556         readPackedDouble: function(arr) {
12557           if (this.type !== Pbf.Bytes)
12558             return arr.push(this.readDouble());
12559           var end = readPackedEnd(this);
12560           arr = arr || [];
12561           while (this.pos < end)
12562             arr.push(this.readDouble());
12563           return arr;
12564         },
12565         readPackedFixed32: function(arr) {
12566           if (this.type !== Pbf.Bytes)
12567             return arr.push(this.readFixed32());
12568           var end = readPackedEnd(this);
12569           arr = arr || [];
12570           while (this.pos < end)
12571             arr.push(this.readFixed32());
12572           return arr;
12573         },
12574         readPackedSFixed32: function(arr) {
12575           if (this.type !== Pbf.Bytes)
12576             return arr.push(this.readSFixed32());
12577           var end = readPackedEnd(this);
12578           arr = arr || [];
12579           while (this.pos < end)
12580             arr.push(this.readSFixed32());
12581           return arr;
12582         },
12583         readPackedFixed64: function(arr) {
12584           if (this.type !== Pbf.Bytes)
12585             return arr.push(this.readFixed64());
12586           var end = readPackedEnd(this);
12587           arr = arr || [];
12588           while (this.pos < end)
12589             arr.push(this.readFixed64());
12590           return arr;
12591         },
12592         readPackedSFixed64: function(arr) {
12593           if (this.type !== Pbf.Bytes)
12594             return arr.push(this.readSFixed64());
12595           var end = readPackedEnd(this);
12596           arr = arr || [];
12597           while (this.pos < end)
12598             arr.push(this.readSFixed64());
12599           return arr;
12600         },
12601         skip: function(val) {
12602           var type3 = val & 7;
12603           if (type3 === Pbf.Varint)
12604             while (this.buf[this.pos++] > 127) {
12605             }
12606           else if (type3 === Pbf.Bytes)
12607             this.pos = this.readVarint() + this.pos;
12608           else if (type3 === Pbf.Fixed32)
12609             this.pos += 4;
12610           else if (type3 === Pbf.Fixed64)
12611             this.pos += 8;
12612           else
12613             throw new Error("Unimplemented type: " + type3);
12614         },
12615         writeTag: function(tag, type3) {
12616           this.writeVarint(tag << 3 | type3);
12617         },
12618         realloc: function(min3) {
12619           var length = this.length || 16;
12620           while (length < this.pos + min3)
12621             length *= 2;
12622           if (length !== this.length) {
12623             var buf = new Uint8Array(length);
12624             buf.set(this.buf);
12625             this.buf = buf;
12626             this.length = length;
12627           }
12628         },
12629         finish: function() {
12630           this.length = this.pos;
12631           this.pos = 0;
12632           return this.buf.subarray(0, this.length);
12633         },
12634         writeFixed32: function(val) {
12635           this.realloc(4);
12636           writeInt32(this.buf, val, this.pos);
12637           this.pos += 4;
12638         },
12639         writeSFixed32: function(val) {
12640           this.realloc(4);
12641           writeInt32(this.buf, val, this.pos);
12642           this.pos += 4;
12643         },
12644         writeFixed64: function(val) {
12645           this.realloc(8);
12646           writeInt32(this.buf, val & -1, this.pos);
12647           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12648           this.pos += 8;
12649         },
12650         writeSFixed64: function(val) {
12651           this.realloc(8);
12652           writeInt32(this.buf, val & -1, this.pos);
12653           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12654           this.pos += 8;
12655         },
12656         writeVarint: function(val) {
12657           val = +val || 0;
12658           if (val > 268435455 || val < 0) {
12659             writeBigVarint(val, this);
12660             return;
12661           }
12662           this.realloc(4);
12663           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12664           if (val <= 127)
12665             return;
12666           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12667           if (val <= 127)
12668             return;
12669           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12670           if (val <= 127)
12671             return;
12672           this.buf[this.pos++] = val >>> 7 & 127;
12673         },
12674         writeSVarint: function(val) {
12675           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12676         },
12677         writeBoolean: function(val) {
12678           this.writeVarint(Boolean(val));
12679         },
12680         writeString: function(str2) {
12681           str2 = String(str2);
12682           this.realloc(str2.length * 4);
12683           this.pos++;
12684           var startPos = this.pos;
12685           this.pos = writeUtf8(this.buf, str2, this.pos);
12686           var len = this.pos - startPos;
12687           if (len >= 128)
12688             makeRoomForExtraLength(startPos, len, this);
12689           this.pos = startPos - 1;
12690           this.writeVarint(len);
12691           this.pos += len;
12692         },
12693         writeFloat: function(val) {
12694           this.realloc(4);
12695           ieee754.write(this.buf, val, this.pos, true, 23, 4);
12696           this.pos += 4;
12697         },
12698         writeDouble: function(val) {
12699           this.realloc(8);
12700           ieee754.write(this.buf, val, this.pos, true, 52, 8);
12701           this.pos += 8;
12702         },
12703         writeBytes: function(buffer) {
12704           var len = buffer.length;
12705           this.writeVarint(len);
12706           this.realloc(len);
12707           for (var i2 = 0; i2 < len; i2++)
12708             this.buf[this.pos++] = buffer[i2];
12709         },
12710         writeRawMessage: function(fn, obj) {
12711           this.pos++;
12712           var startPos = this.pos;
12713           fn(obj, this);
12714           var len = this.pos - startPos;
12715           if (len >= 128)
12716             makeRoomForExtraLength(startPos, len, this);
12717           this.pos = startPos - 1;
12718           this.writeVarint(len);
12719           this.pos += len;
12720         },
12721         writeMessage: function(tag, fn, obj) {
12722           this.writeTag(tag, Pbf.Bytes);
12723           this.writeRawMessage(fn, obj);
12724         },
12725         writePackedVarint: function(tag, arr) {
12726           if (arr.length)
12727             this.writeMessage(tag, writePackedVarint, arr);
12728         },
12729         writePackedSVarint: function(tag, arr) {
12730           if (arr.length)
12731             this.writeMessage(tag, writePackedSVarint, arr);
12732         },
12733         writePackedBoolean: function(tag, arr) {
12734           if (arr.length)
12735             this.writeMessage(tag, writePackedBoolean, arr);
12736         },
12737         writePackedFloat: function(tag, arr) {
12738           if (arr.length)
12739             this.writeMessage(tag, writePackedFloat, arr);
12740         },
12741         writePackedDouble: function(tag, arr) {
12742           if (arr.length)
12743             this.writeMessage(tag, writePackedDouble, arr);
12744         },
12745         writePackedFixed32: function(tag, arr) {
12746           if (arr.length)
12747             this.writeMessage(tag, writePackedFixed32, arr);
12748         },
12749         writePackedSFixed32: function(tag, arr) {
12750           if (arr.length)
12751             this.writeMessage(tag, writePackedSFixed32, arr);
12752         },
12753         writePackedFixed64: function(tag, arr) {
12754           if (arr.length)
12755             this.writeMessage(tag, writePackedFixed64, arr);
12756         },
12757         writePackedSFixed64: function(tag, arr) {
12758           if (arr.length)
12759             this.writeMessage(tag, writePackedSFixed64, arr);
12760         },
12761         writeBytesField: function(tag, buffer) {
12762           this.writeTag(tag, Pbf.Bytes);
12763           this.writeBytes(buffer);
12764         },
12765         writeFixed32Field: function(tag, val) {
12766           this.writeTag(tag, Pbf.Fixed32);
12767           this.writeFixed32(val);
12768         },
12769         writeSFixed32Field: function(tag, val) {
12770           this.writeTag(tag, Pbf.Fixed32);
12771           this.writeSFixed32(val);
12772         },
12773         writeFixed64Field: function(tag, val) {
12774           this.writeTag(tag, Pbf.Fixed64);
12775           this.writeFixed64(val);
12776         },
12777         writeSFixed64Field: function(tag, val) {
12778           this.writeTag(tag, Pbf.Fixed64);
12779           this.writeSFixed64(val);
12780         },
12781         writeVarintField: function(tag, val) {
12782           this.writeTag(tag, Pbf.Varint);
12783           this.writeVarint(val);
12784         },
12785         writeSVarintField: function(tag, val) {
12786           this.writeTag(tag, Pbf.Varint);
12787           this.writeSVarint(val);
12788         },
12789         writeStringField: function(tag, str2) {
12790           this.writeTag(tag, Pbf.Bytes);
12791           this.writeString(str2);
12792         },
12793         writeFloatField: function(tag, val) {
12794           this.writeTag(tag, Pbf.Fixed32);
12795           this.writeFloat(val);
12796         },
12797         writeDoubleField: function(tag, val) {
12798           this.writeTag(tag, Pbf.Fixed64);
12799           this.writeDouble(val);
12800         },
12801         writeBooleanField: function(tag, val) {
12802           this.writeVarintField(tag, Boolean(val));
12803         }
12804       };
12805       function readVarintRemainder(l, s, p) {
12806         var buf = p.buf, h, b;
12807         b = buf[p.pos++];
12808         h = (b & 112) >> 4;
12809         if (b < 128)
12810           return toNum(l, h, s);
12811         b = buf[p.pos++];
12812         h |= (b & 127) << 3;
12813         if (b < 128)
12814           return toNum(l, h, s);
12815         b = buf[p.pos++];
12816         h |= (b & 127) << 10;
12817         if (b < 128)
12818           return toNum(l, h, s);
12819         b = buf[p.pos++];
12820         h |= (b & 127) << 17;
12821         if (b < 128)
12822           return toNum(l, h, s);
12823         b = buf[p.pos++];
12824         h |= (b & 127) << 24;
12825         if (b < 128)
12826           return toNum(l, h, s);
12827         b = buf[p.pos++];
12828         h |= (b & 1) << 31;
12829         if (b < 128)
12830           return toNum(l, h, s);
12831         throw new Error("Expected varint not more than 10 bytes");
12832       }
12833       function readPackedEnd(pbf) {
12834         return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
12835       }
12836       function toNum(low, high, isSigned) {
12837         if (isSigned) {
12838           return high * 4294967296 + (low >>> 0);
12839         }
12840         return (high >>> 0) * 4294967296 + (low >>> 0);
12841       }
12842       function writeBigVarint(val, pbf) {
12843         var low, high;
12844         if (val >= 0) {
12845           low = val % 4294967296 | 0;
12846           high = val / 4294967296 | 0;
12847         } else {
12848           low = ~(-val % 4294967296);
12849           high = ~(-val / 4294967296);
12850           if (low ^ 4294967295) {
12851             low = low + 1 | 0;
12852           } else {
12853             low = 0;
12854             high = high + 1 | 0;
12855           }
12856         }
12857         if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
12858           throw new Error("Given varint doesn't fit into 10 bytes");
12859         }
12860         pbf.realloc(10);
12861         writeBigVarintLow(low, high, pbf);
12862         writeBigVarintHigh(high, pbf);
12863       }
12864       function writeBigVarintLow(low, high, pbf) {
12865         pbf.buf[pbf.pos++] = low & 127 | 128;
12866         low >>>= 7;
12867         pbf.buf[pbf.pos++] = low & 127 | 128;
12868         low >>>= 7;
12869         pbf.buf[pbf.pos++] = low & 127 | 128;
12870         low >>>= 7;
12871         pbf.buf[pbf.pos++] = low & 127 | 128;
12872         low >>>= 7;
12873         pbf.buf[pbf.pos] = low & 127;
12874       }
12875       function writeBigVarintHigh(high, pbf) {
12876         var lsb = (high & 7) << 4;
12877         pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
12878         if (!high)
12879           return;
12880         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12881         if (!high)
12882           return;
12883         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12884         if (!high)
12885           return;
12886         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12887         if (!high)
12888           return;
12889         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12890         if (!high)
12891           return;
12892         pbf.buf[pbf.pos++] = high & 127;
12893       }
12894       function makeRoomForExtraLength(startPos, len, pbf) {
12895         var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
12896         pbf.realloc(extraLen);
12897         for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
12898           pbf.buf[i2 + extraLen] = pbf.buf[i2];
12899       }
12900       function writePackedVarint(arr, pbf) {
12901         for (var i2 = 0; i2 < arr.length; i2++)
12902           pbf.writeVarint(arr[i2]);
12903       }
12904       function writePackedSVarint(arr, pbf) {
12905         for (var i2 = 0; i2 < arr.length; i2++)
12906           pbf.writeSVarint(arr[i2]);
12907       }
12908       function writePackedFloat(arr, pbf) {
12909         for (var i2 = 0; i2 < arr.length; i2++)
12910           pbf.writeFloat(arr[i2]);
12911       }
12912       function writePackedDouble(arr, pbf) {
12913         for (var i2 = 0; i2 < arr.length; i2++)
12914           pbf.writeDouble(arr[i2]);
12915       }
12916       function writePackedBoolean(arr, pbf) {
12917         for (var i2 = 0; i2 < arr.length; i2++)
12918           pbf.writeBoolean(arr[i2]);
12919       }
12920       function writePackedFixed32(arr, pbf) {
12921         for (var i2 = 0; i2 < arr.length; i2++)
12922           pbf.writeFixed32(arr[i2]);
12923       }
12924       function writePackedSFixed32(arr, pbf) {
12925         for (var i2 = 0; i2 < arr.length; i2++)
12926           pbf.writeSFixed32(arr[i2]);
12927       }
12928       function writePackedFixed64(arr, pbf) {
12929         for (var i2 = 0; i2 < arr.length; i2++)
12930           pbf.writeFixed64(arr[i2]);
12931       }
12932       function writePackedSFixed64(arr, pbf) {
12933         for (var i2 = 0; i2 < arr.length; i2++)
12934           pbf.writeSFixed64(arr[i2]);
12935       }
12936       function readUInt32(buf, pos) {
12937         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
12938       }
12939       function writeInt32(buf, val, pos) {
12940         buf[pos] = val;
12941         buf[pos + 1] = val >>> 8;
12942         buf[pos + 2] = val >>> 16;
12943         buf[pos + 3] = val >>> 24;
12944       }
12945       function readInt32(buf, pos) {
12946         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
12947       }
12948       function readUtf8(buf, pos, end) {
12949         var str2 = "";
12950         var i2 = pos;
12951         while (i2 < end) {
12952           var b0 = buf[i2];
12953           var c = null;
12954           var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
12955           if (i2 + bytesPerSequence > end)
12956             break;
12957           var b1, b2, b3;
12958           if (bytesPerSequence === 1) {
12959             if (b0 < 128) {
12960               c = b0;
12961             }
12962           } else if (bytesPerSequence === 2) {
12963             b1 = buf[i2 + 1];
12964             if ((b1 & 192) === 128) {
12965               c = (b0 & 31) << 6 | b1 & 63;
12966               if (c <= 127) {
12967                 c = null;
12968               }
12969             }
12970           } else if (bytesPerSequence === 3) {
12971             b1 = buf[i2 + 1];
12972             b2 = buf[i2 + 2];
12973             if ((b1 & 192) === 128 && (b2 & 192) === 128) {
12974               c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
12975               if (c <= 2047 || c >= 55296 && c <= 57343) {
12976                 c = null;
12977               }
12978             }
12979           } else if (bytesPerSequence === 4) {
12980             b1 = buf[i2 + 1];
12981             b2 = buf[i2 + 2];
12982             b3 = buf[i2 + 3];
12983             if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
12984               c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
12985               if (c <= 65535 || c >= 1114112) {
12986                 c = null;
12987               }
12988             }
12989           }
12990           if (c === null) {
12991             c = 65533;
12992             bytesPerSequence = 1;
12993           } else if (c > 65535) {
12994             c -= 65536;
12995             str2 += String.fromCharCode(c >>> 10 & 1023 | 55296);
12996             c = 56320 | c & 1023;
12997           }
12998           str2 += String.fromCharCode(c);
12999           i2 += bytesPerSequence;
13000         }
13001         return str2;
13002       }
13003       function readUtf8TextDecoder(buf, pos, end) {
13004         return utf8TextDecoder.decode(buf.subarray(pos, end));
13005       }
13006       function writeUtf8(buf, str2, pos) {
13007         for (var i2 = 0, c, lead; i2 < str2.length; i2++) {
13008           c = str2.charCodeAt(i2);
13009           if (c > 55295 && c < 57344) {
13010             if (lead) {
13011               if (c < 56320) {
13012                 buf[pos++] = 239;
13013                 buf[pos++] = 191;
13014                 buf[pos++] = 189;
13015                 lead = c;
13016                 continue;
13017               } else {
13018                 c = lead - 55296 << 10 | c - 56320 | 65536;
13019                 lead = null;
13020               }
13021             } else {
13022               if (c > 56319 || i2 + 1 === str2.length) {
13023                 buf[pos++] = 239;
13024                 buf[pos++] = 191;
13025                 buf[pos++] = 189;
13026               } else {
13027                 lead = c;
13028               }
13029               continue;
13030             }
13031           } else if (lead) {
13032             buf[pos++] = 239;
13033             buf[pos++] = 191;
13034             buf[pos++] = 189;
13035             lead = null;
13036           }
13037           if (c < 128) {
13038             buf[pos++] = c;
13039           } else {
13040             if (c < 2048) {
13041               buf[pos++] = c >> 6 | 192;
13042             } else {
13043               if (c < 65536) {
13044                 buf[pos++] = c >> 12 | 224;
13045               } else {
13046                 buf[pos++] = c >> 18 | 240;
13047                 buf[pos++] = c >> 12 & 63 | 128;
13048               }
13049               buf[pos++] = c >> 6 & 63 | 128;
13050             }
13051             buf[pos++] = c & 63 | 128;
13052           }
13053         }
13054         return pos;
13055       }
13056     }
13057   });
13058
13059   // node_modules/@mapbox/point-geometry/index.js
13060   var require_point_geometry = __commonJS({
13061     "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13062       "use strict";
13063       module2.exports = Point;
13064       function Point(x, y) {
13065         this.x = x;
13066         this.y = y;
13067       }
13068       Point.prototype = {
13069         clone: function() {
13070           return new Point(this.x, this.y);
13071         },
13072         add: function(p) {
13073           return this.clone()._add(p);
13074         },
13075         sub: function(p) {
13076           return this.clone()._sub(p);
13077         },
13078         multByPoint: function(p) {
13079           return this.clone()._multByPoint(p);
13080         },
13081         divByPoint: function(p) {
13082           return this.clone()._divByPoint(p);
13083         },
13084         mult: function(k) {
13085           return this.clone()._mult(k);
13086         },
13087         div: function(k) {
13088           return this.clone()._div(k);
13089         },
13090         rotate: function(a) {
13091           return this.clone()._rotate(a);
13092         },
13093         rotateAround: function(a, p) {
13094           return this.clone()._rotateAround(a, p);
13095         },
13096         matMult: function(m) {
13097           return this.clone()._matMult(m);
13098         },
13099         unit: function() {
13100           return this.clone()._unit();
13101         },
13102         perp: function() {
13103           return this.clone()._perp();
13104         },
13105         round: function() {
13106           return this.clone()._round();
13107         },
13108         mag: function() {
13109           return Math.sqrt(this.x * this.x + this.y * this.y);
13110         },
13111         equals: function(other) {
13112           return this.x === other.x && this.y === other.y;
13113         },
13114         dist: function(p) {
13115           return Math.sqrt(this.distSqr(p));
13116         },
13117         distSqr: function(p) {
13118           var dx = p.x - this.x, dy = p.y - this.y;
13119           return dx * dx + dy * dy;
13120         },
13121         angle: function() {
13122           return Math.atan2(this.y, this.x);
13123         },
13124         angleTo: function(b) {
13125           return Math.atan2(this.y - b.y, this.x - b.x);
13126         },
13127         angleWith: function(b) {
13128           return this.angleWithSep(b.x, b.y);
13129         },
13130         angleWithSep: function(x, y) {
13131           return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
13132         },
13133         _matMult: function(m) {
13134           var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
13135           this.x = x;
13136           this.y = y;
13137           return this;
13138         },
13139         _add: function(p) {
13140           this.x += p.x;
13141           this.y += p.y;
13142           return this;
13143         },
13144         _sub: function(p) {
13145           this.x -= p.x;
13146           this.y -= p.y;
13147           return this;
13148         },
13149         _mult: function(k) {
13150           this.x *= k;
13151           this.y *= k;
13152           return this;
13153         },
13154         _div: function(k) {
13155           this.x /= k;
13156           this.y /= k;
13157           return this;
13158         },
13159         _multByPoint: function(p) {
13160           this.x *= p.x;
13161           this.y *= p.y;
13162           return this;
13163         },
13164         _divByPoint: function(p) {
13165           this.x /= p.x;
13166           this.y /= p.y;
13167           return this;
13168         },
13169         _unit: function() {
13170           this._div(this.mag());
13171           return this;
13172         },
13173         _perp: function() {
13174           var y = this.y;
13175           this.y = this.x;
13176           this.x = -y;
13177           return this;
13178         },
13179         _rotate: function(angle2) {
13180           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = cos2 * this.x - sin2 * this.y, y = sin2 * this.x + cos2 * this.y;
13181           this.x = x;
13182           this.y = y;
13183           return this;
13184         },
13185         _rotateAround: function(angle2, p) {
13186           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = p.x + cos2 * (this.x - p.x) - sin2 * (this.y - p.y), y = p.y + sin2 * (this.x - p.x) + cos2 * (this.y - p.y);
13187           this.x = x;
13188           this.y = y;
13189           return this;
13190         },
13191         _round: function() {
13192           this.x = Math.round(this.x);
13193           this.y = Math.round(this.y);
13194           return this;
13195         }
13196       };
13197       Point.convert = function(a) {
13198         if (a instanceof Point) {
13199           return a;
13200         }
13201         if (Array.isArray(a)) {
13202           return new Point(a[0], a[1]);
13203         }
13204         return a;
13205       };
13206     }
13207   });
13208
13209   // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13210   var require_vectortilefeature = __commonJS({
13211     "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13212       "use strict";
13213       var Point = require_point_geometry();
13214       module2.exports = VectorTileFeature;
13215       function VectorTileFeature(pbf, end, extent, keys, values) {
13216         this.properties = {};
13217         this.extent = extent;
13218         this.type = 0;
13219         this._pbf = pbf;
13220         this._geometry = -1;
13221         this._keys = keys;
13222         this._values = values;
13223         pbf.readFields(readFeature, this, end);
13224       }
13225       function readFeature(tag, feature3, pbf) {
13226         if (tag == 1)
13227           feature3.id = pbf.readVarint();
13228         else if (tag == 2)
13229           readTag(pbf, feature3);
13230         else if (tag == 3)
13231           feature3.type = pbf.readVarint();
13232         else if (tag == 4)
13233           feature3._geometry = pbf.pos;
13234       }
13235       function readTag(pbf, feature3) {
13236         var end = pbf.readVarint() + pbf.pos;
13237         while (pbf.pos < end) {
13238           var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13239           feature3.properties[key] = value;
13240         }
13241       }
13242       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13243       VectorTileFeature.prototype.loadGeometry = function() {
13244         var pbf = this._pbf;
13245         pbf.pos = this._geometry;
13246         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, lines = [], line;
13247         while (pbf.pos < end) {
13248           if (length <= 0) {
13249             var cmdLen = pbf.readVarint();
13250             cmd = cmdLen & 7;
13251             length = cmdLen >> 3;
13252           }
13253           length--;
13254           if (cmd === 1 || cmd === 2) {
13255             x += pbf.readSVarint();
13256             y += pbf.readSVarint();
13257             if (cmd === 1) {
13258               if (line)
13259                 lines.push(line);
13260               line = [];
13261             }
13262             line.push(new Point(x, y));
13263           } else if (cmd === 7) {
13264             if (line) {
13265               line.push(line[0].clone());
13266             }
13267           } else {
13268             throw new Error("unknown command " + cmd);
13269           }
13270         }
13271         if (line)
13272           lines.push(line);
13273         return lines;
13274       };
13275       VectorTileFeature.prototype.bbox = function() {
13276         var pbf = this._pbf;
13277         pbf.pos = this._geometry;
13278         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, x12 = Infinity, x2 = -Infinity, y12 = Infinity, y2 = -Infinity;
13279         while (pbf.pos < end) {
13280           if (length <= 0) {
13281             var cmdLen = pbf.readVarint();
13282             cmd = cmdLen & 7;
13283             length = cmdLen >> 3;
13284           }
13285           length--;
13286           if (cmd === 1 || cmd === 2) {
13287             x += pbf.readSVarint();
13288             y += pbf.readSVarint();
13289             if (x < x12)
13290               x12 = x;
13291             if (x > x2)
13292               x2 = x;
13293             if (y < y12)
13294               y12 = y;
13295             if (y > y2)
13296               y2 = y;
13297           } else if (cmd !== 7) {
13298             throw new Error("unknown command " + cmd);
13299           }
13300         }
13301         return [x12, y12, x2, y2];
13302       };
13303       VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
13304         var size = this.extent * Math.pow(2, z), x05 = this.extent * x, y05 = this.extent * y, coords = this.loadGeometry(), type3 = VectorTileFeature.types[this.type], i2, j2;
13305         function project(line) {
13306           for (var j3 = 0; j3 < line.length; j3++) {
13307             var p = line[j3], y2 = 180 - (p.y + y05) * 360 / size;
13308             line[j3] = [
13309               (p.x + x05) * 360 / size - 180,
13310               360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
13311             ];
13312           }
13313         }
13314         switch (this.type) {
13315           case 1:
13316             var points = [];
13317             for (i2 = 0; i2 < coords.length; i2++) {
13318               points[i2] = coords[i2][0];
13319             }
13320             coords = points;
13321             project(coords);
13322             break;
13323           case 2:
13324             for (i2 = 0; i2 < coords.length; i2++) {
13325               project(coords[i2]);
13326             }
13327             break;
13328           case 3:
13329             coords = classifyRings(coords);
13330             for (i2 = 0; i2 < coords.length; i2++) {
13331               for (j2 = 0; j2 < coords[i2].length; j2++) {
13332                 project(coords[i2][j2]);
13333               }
13334             }
13335             break;
13336         }
13337         if (coords.length === 1) {
13338           coords = coords[0];
13339         } else {
13340           type3 = "Multi" + type3;
13341         }
13342         var result = {
13343           type: "Feature",
13344           geometry: {
13345             type: type3,
13346             coordinates: coords
13347           },
13348           properties: this.properties
13349         };
13350         if ("id" in this) {
13351           result.id = this.id;
13352         }
13353         return result;
13354       };
13355       function classifyRings(rings) {
13356         var len = rings.length;
13357         if (len <= 1)
13358           return [rings];
13359         var polygons = [], polygon2, ccw;
13360         for (var i2 = 0; i2 < len; i2++) {
13361           var area = signedArea(rings[i2]);
13362           if (area === 0)
13363             continue;
13364           if (ccw === void 0)
13365             ccw = area < 0;
13366           if (ccw === area < 0) {
13367             if (polygon2)
13368               polygons.push(polygon2);
13369             polygon2 = [rings[i2]];
13370           } else {
13371             polygon2.push(rings[i2]);
13372           }
13373         }
13374         if (polygon2)
13375           polygons.push(polygon2);
13376         return polygons;
13377       }
13378       function signedArea(ring) {
13379         var sum = 0;
13380         for (var i2 = 0, len = ring.length, j2 = len - 1, p1, p2; i2 < len; j2 = i2++) {
13381           p1 = ring[i2];
13382           p2 = ring[j2];
13383           sum += (p2.x - p1.x) * (p1.y + p2.y);
13384         }
13385         return sum;
13386       }
13387     }
13388   });
13389
13390   // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13391   var require_vectortilelayer = __commonJS({
13392     "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13393       "use strict";
13394       var VectorTileFeature = require_vectortilefeature();
13395       module2.exports = VectorTileLayer;
13396       function VectorTileLayer(pbf, end) {
13397         this.version = 1;
13398         this.name = null;
13399         this.extent = 4096;
13400         this.length = 0;
13401         this._pbf = pbf;
13402         this._keys = [];
13403         this._values = [];
13404         this._features = [];
13405         pbf.readFields(readLayer, this, end);
13406         this.length = this._features.length;
13407       }
13408       function readLayer(tag, layer, pbf) {
13409         if (tag === 15)
13410           layer.version = pbf.readVarint();
13411         else if (tag === 1)
13412           layer.name = pbf.readString();
13413         else if (tag === 5)
13414           layer.extent = pbf.readVarint();
13415         else if (tag === 2)
13416           layer._features.push(pbf.pos);
13417         else if (tag === 3)
13418           layer._keys.push(pbf.readString());
13419         else if (tag === 4)
13420           layer._values.push(readValueMessage(pbf));
13421       }
13422       function readValueMessage(pbf) {
13423         var value = null, end = pbf.readVarint() + pbf.pos;
13424         while (pbf.pos < end) {
13425           var tag = pbf.readVarint() >> 3;
13426           value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
13427         }
13428         return value;
13429       }
13430       VectorTileLayer.prototype.feature = function(i2) {
13431         if (i2 < 0 || i2 >= this._features.length)
13432           throw new Error("feature index out of bounds");
13433         this._pbf.pos = this._features[i2];
13434         var end = this._pbf.readVarint() + this._pbf.pos;
13435         return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13436       };
13437     }
13438   });
13439
13440   // node_modules/@mapbox/vector-tile/lib/vectortile.js
13441   var require_vectortile = __commonJS({
13442     "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13443       "use strict";
13444       var VectorTileLayer = require_vectortilelayer();
13445       module2.exports = VectorTile2;
13446       function VectorTile2(pbf, end) {
13447         this.layers = pbf.readFields(readTile, {}, end);
13448       }
13449       function readTile(tag, layers, pbf) {
13450         if (tag === 3) {
13451           var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13452           if (layer.length)
13453             layers[layer.name] = layer;
13454         }
13455       }
13456     }
13457   });
13458
13459   // node_modules/@mapbox/vector-tile/index.js
13460   var require_vector_tile = __commonJS({
13461     "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13462       module2.exports.VectorTile = require_vectortile();
13463       module2.exports.VectorTileFeature = require_vectortilefeature();
13464       module2.exports.VectorTileLayer = require_vectortilelayer();
13465     }
13466   });
13467
13468   // node_modules/fast-json-stable-stringify/index.js
13469   var require_fast_json_stable_stringify = __commonJS({
13470     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13471       "use strict";
13472       module2.exports = function(data, opts) {
13473         if (!opts)
13474           opts = {};
13475         if (typeof opts === "function")
13476           opts = { cmp: opts };
13477         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13478         var cmp = opts.cmp && function(f2) {
13479           return function(node) {
13480             return function(a, b) {
13481               var aobj = { key: a, value: node[a] };
13482               var bobj = { key: b, value: node[b] };
13483               return f2(aobj, bobj);
13484             };
13485           };
13486         }(opts.cmp);
13487         var seen = [];
13488         return function stringify3(node) {
13489           if (node && node.toJSON && typeof node.toJSON === "function") {
13490             node = node.toJSON();
13491           }
13492           if (node === void 0)
13493             return;
13494           if (typeof node == "number")
13495             return isFinite(node) ? "" + node : "null";
13496           if (typeof node !== "object")
13497             return JSON.stringify(node);
13498           var i2, out;
13499           if (Array.isArray(node)) {
13500             out = "[";
13501             for (i2 = 0; i2 < node.length; i2++) {
13502               if (i2)
13503                 out += ",";
13504               out += stringify3(node[i2]) || "null";
13505             }
13506             return out + "]";
13507           }
13508           if (node === null)
13509             return "null";
13510           if (seen.indexOf(node) !== -1) {
13511             if (cycles)
13512               return JSON.stringify("__cycle__");
13513             throw new TypeError("Converting circular structure to JSON");
13514           }
13515           var seenIndex = seen.push(node) - 1;
13516           var keys = Object.keys(node).sort(cmp && cmp(node));
13517           out = "";
13518           for (i2 = 0; i2 < keys.length; i2++) {
13519             var key = keys[i2];
13520             var value = stringify3(node[key]);
13521             if (!value)
13522               continue;
13523             if (out)
13524               out += ",";
13525             out += JSON.stringify(key) + ":" + value;
13526           }
13527           seen.splice(seenIndex, 1);
13528           return "{" + out + "}";
13529         }(data);
13530       };
13531     }
13532   });
13533
13534   // node_modules/@mapbox/sexagesimal/index.js
13535   var require_sexagesimal = __commonJS({
13536     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13537       module2.exports = element;
13538       module2.exports.pair = pair2;
13539       module2.exports.format = format2;
13540       module2.exports.formatPair = formatPair;
13541       module2.exports.coordToDMS = coordToDMS;
13542       function element(input, dims) {
13543         var result = search(input, dims);
13544         return result === null ? null : result.val;
13545       }
13546       function formatPair(input) {
13547         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13548       }
13549       function format2(input, dim) {
13550         var dms = coordToDMS(input, dim);
13551         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13552       }
13553       function coordToDMS(input, dim) {
13554         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13555         var dir = dirs[input >= 0 ? 0 : 1];
13556         var abs3 = Math.abs(input);
13557         var whole = Math.floor(abs3);
13558         var fraction = abs3 - whole;
13559         var fractionMinutes = fraction * 60;
13560         var minutes = Math.floor(fractionMinutes);
13561         var seconds = Math.floor((fractionMinutes - minutes) * 60);
13562         return {
13563           whole,
13564           minutes,
13565           seconds,
13566           dir
13567         };
13568       }
13569       function search(input, dims) {
13570         if (!dims)
13571           dims = "NSEW";
13572         if (typeof input !== "string")
13573           return null;
13574         input = input.toUpperCase();
13575         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13576         var m = input.match(regex);
13577         if (!m)
13578           return null;
13579         var matched = m[0];
13580         var dim;
13581         if (m[1] && m[5]) {
13582           dim = m[1];
13583           matched = matched.slice(0, -1);
13584         } else {
13585           dim = m[1] || m[5];
13586         }
13587         if (dim && dims.indexOf(dim) === -1)
13588           return null;
13589         var deg = m[2] ? parseFloat(m[2]) : 0;
13590         var min3 = m[3] ? parseFloat(m[3]) / 60 : 0;
13591         var sec = m[4] ? parseFloat(m[4]) / 3600 : 0;
13592         var sign2 = deg < 0 ? -1 : 1;
13593         if (dim === "S" || dim === "W")
13594           sign2 *= -1;
13595         return {
13596           val: (Math.abs(deg) + min3 + sec) * sign2,
13597           dim,
13598           matched,
13599           remain: input.slice(matched.length)
13600         };
13601       }
13602       function pair2(input, dims) {
13603         input = input.trim();
13604         var one2 = search(input, dims);
13605         if (!one2)
13606           return null;
13607         input = one2.remain.trim();
13608         var two = search(input, dims);
13609         if (!two || two.remain)
13610           return null;
13611         if (one2.dim) {
13612           return swapdim(one2.val, two.val, one2.dim);
13613         } else {
13614           return [one2.val, two.val];
13615         }
13616       }
13617       function swapdim(a, b, dim) {
13618         if (dim === "N" || dim === "S")
13619           return [a, b];
13620         if (dim === "W" || dim === "E")
13621           return [b, a];
13622       }
13623     }
13624   });
13625
13626   // node_modules/store/src/util.js
13627   var require_util = __commonJS({
13628     "node_modules/store/src/util.js"(exports2, module2) {
13629       var assign = make_assign();
13630       var create2 = make_create();
13631       var trim = make_trim();
13632       var Global = typeof window !== "undefined" ? window : global;
13633       module2.exports = {
13634         assign,
13635         create: create2,
13636         trim,
13637         bind,
13638         slice,
13639         each,
13640         map: map2,
13641         pluck,
13642         isList,
13643         isFunction,
13644         isObject: isObject2,
13645         Global
13646       };
13647       function make_assign() {
13648         if (Object.assign) {
13649           return Object.assign;
13650         } else {
13651           return function shimAssign(obj, props1, props2, etc) {
13652             for (var i2 = 1; i2 < arguments.length; i2++) {
13653               each(Object(arguments[i2]), function(val, key) {
13654                 obj[key] = val;
13655               });
13656             }
13657             return obj;
13658           };
13659         }
13660       }
13661       function make_create() {
13662         if (Object.create) {
13663           return function create3(obj, assignProps1, assignProps2, etc) {
13664             var assignArgsList = slice(arguments, 1);
13665             return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
13666           };
13667         } else {
13668           let F2 = function() {
13669           };
13670           var F = F2;
13671           return function create3(obj, assignProps1, assignProps2, etc) {
13672             var assignArgsList = slice(arguments, 1);
13673             F2.prototype = obj;
13674             return assign.apply(this, [new F2()].concat(assignArgsList));
13675           };
13676         }
13677       }
13678       function make_trim() {
13679         if (String.prototype.trim) {
13680           return function trim2(str2) {
13681             return String.prototype.trim.call(str2);
13682           };
13683         } else {
13684           return function trim2(str2) {
13685             return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
13686           };
13687         }
13688       }
13689       function bind(obj, fn) {
13690         return function() {
13691           return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
13692         };
13693       }
13694       function slice(arr, index) {
13695         return Array.prototype.slice.call(arr, index || 0);
13696       }
13697       function each(obj, fn) {
13698         pluck(obj, function(val, key) {
13699           fn(val, key);
13700           return false;
13701         });
13702       }
13703       function map2(obj, fn) {
13704         var res = isList(obj) ? [] : {};
13705         pluck(obj, function(v, k) {
13706           res[k] = fn(v, k);
13707           return false;
13708         });
13709         return res;
13710       }
13711       function pluck(obj, fn) {
13712         if (isList(obj)) {
13713           for (var i2 = 0; i2 < obj.length; i2++) {
13714             if (fn(obj[i2], i2)) {
13715               return obj[i2];
13716             }
13717           }
13718         } else {
13719           for (var key in obj) {
13720             if (obj.hasOwnProperty(key)) {
13721               if (fn(obj[key], key)) {
13722                 return obj[key];
13723               }
13724             }
13725           }
13726         }
13727       }
13728       function isList(val) {
13729         return val != null && typeof val != "function" && typeof val.length == "number";
13730       }
13731       function isFunction(val) {
13732         return val && {}.toString.call(val) === "[object Function]";
13733       }
13734       function isObject2(val) {
13735         return val && {}.toString.call(val) === "[object Object]";
13736       }
13737     }
13738   });
13739
13740   // node_modules/store/src/store-engine.js
13741   var require_store_engine = __commonJS({
13742     "node_modules/store/src/store-engine.js"(exports2, module2) {
13743       var util = require_util();
13744       var slice = util.slice;
13745       var pluck = util.pluck;
13746       var each = util.each;
13747       var bind = util.bind;
13748       var create2 = util.create;
13749       var isList = util.isList;
13750       var isFunction = util.isFunction;
13751       var isObject2 = util.isObject;
13752       module2.exports = {
13753         createStore
13754       };
13755       var storeAPI = {
13756         version: "2.0.12",
13757         enabled: false,
13758         get: function(key, optionalDefaultValue) {
13759           var data = this.storage.read(this._namespacePrefix + key);
13760           return this._deserialize(data, optionalDefaultValue);
13761         },
13762         set: function(key, value) {
13763           if (value === void 0) {
13764             return this.remove(key);
13765           }
13766           this.storage.write(this._namespacePrefix + key, this._serialize(value));
13767           return value;
13768         },
13769         remove: function(key) {
13770           this.storage.remove(this._namespacePrefix + key);
13771         },
13772         each: function(callback) {
13773           var self2 = this;
13774           this.storage.each(function(val, namespacedKey) {
13775             callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
13776           });
13777         },
13778         clearAll: function() {
13779           this.storage.clearAll();
13780         },
13781         hasNamespace: function(namespace) {
13782           return this._namespacePrefix == "__storejs_" + namespace + "_";
13783         },
13784         createStore: function() {
13785           return createStore.apply(this, arguments);
13786         },
13787         addPlugin: function(plugin) {
13788           this._addPlugin(plugin);
13789         },
13790         namespace: function(namespace) {
13791           return createStore(this.storage, this.plugins, namespace);
13792         }
13793       };
13794       function _warn() {
13795         var _console = typeof console == "undefined" ? null : console;
13796         if (!_console) {
13797           return;
13798         }
13799         var fn = _console.warn ? _console.warn : _console.log;
13800         fn.apply(_console, arguments);
13801       }
13802       function createStore(storages, plugins, namespace) {
13803         if (!namespace) {
13804           namespace = "";
13805         }
13806         if (storages && !isList(storages)) {
13807           storages = [storages];
13808         }
13809         if (plugins && !isList(plugins)) {
13810           plugins = [plugins];
13811         }
13812         var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
13813         var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
13814         var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
13815         if (!legalNamespaces.test(namespace)) {
13816           throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
13817         }
13818         var _privateStoreProps = {
13819           _namespacePrefix: namespacePrefix,
13820           _namespaceRegexp: namespaceRegexp,
13821           _testStorage: function(storage) {
13822             try {
13823               var testStr = "__storejs__test__";
13824               storage.write(testStr, testStr);
13825               var ok = storage.read(testStr) === testStr;
13826               storage.remove(testStr);
13827               return ok;
13828             } catch (e) {
13829               return false;
13830             }
13831           },
13832           _assignPluginFnProp: function(pluginFnProp, propName) {
13833             var oldFn = this[propName];
13834             this[propName] = function pluginFn() {
13835               var args = slice(arguments, 0);
13836               var self2 = this;
13837               function super_fn() {
13838                 if (!oldFn) {
13839                   return;
13840                 }
13841                 each(arguments, function(arg, i2) {
13842                   args[i2] = arg;
13843                 });
13844                 return oldFn.apply(self2, args);
13845               }
13846               var newFnArgs = [super_fn].concat(args);
13847               return pluginFnProp.apply(self2, newFnArgs);
13848             };
13849           },
13850           _serialize: function(obj) {
13851             return JSON.stringify(obj);
13852           },
13853           _deserialize: function(strVal, defaultVal) {
13854             if (!strVal) {
13855               return defaultVal;
13856             }
13857             var val = "";
13858             try {
13859               val = JSON.parse(strVal);
13860             } catch (e) {
13861               val = strVal;
13862             }
13863             return val !== void 0 ? val : defaultVal;
13864           },
13865           _addStorage: function(storage) {
13866             if (this.enabled) {
13867               return;
13868             }
13869             if (this._testStorage(storage)) {
13870               this.storage = storage;
13871               this.enabled = true;
13872             }
13873           },
13874           _addPlugin: function(plugin) {
13875             var self2 = this;
13876             if (isList(plugin)) {
13877               each(plugin, function(plugin2) {
13878                 self2._addPlugin(plugin2);
13879               });
13880               return;
13881             }
13882             var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
13883               return plugin === seenPlugin2;
13884             });
13885             if (seenPlugin) {
13886               return;
13887             }
13888             this.plugins.push(plugin);
13889             if (!isFunction(plugin)) {
13890               throw new Error("Plugins must be function values that return objects");
13891             }
13892             var pluginProperties = plugin.call(this);
13893             if (!isObject2(pluginProperties)) {
13894               throw new Error("Plugins must return an object of function properties");
13895             }
13896             each(pluginProperties, function(pluginFnProp, propName) {
13897               if (!isFunction(pluginFnProp)) {
13898                 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
13899               }
13900               self2._assignPluginFnProp(pluginFnProp, propName);
13901             });
13902           },
13903           addStorage: function(storage) {
13904             _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
13905             this._addStorage(storage);
13906           }
13907         };
13908         var store2 = create2(_privateStoreProps, storeAPI, {
13909           plugins: []
13910         });
13911         store2.raw = {};
13912         each(store2, function(prop, propName) {
13913           if (isFunction(prop)) {
13914             store2.raw[propName] = bind(store2, prop);
13915           }
13916         });
13917         each(storages, function(storage) {
13918           store2._addStorage(storage);
13919         });
13920         each(plugins, function(plugin) {
13921           store2._addPlugin(plugin);
13922         });
13923         return store2;
13924       }
13925     }
13926   });
13927
13928   // node_modules/store/storages/localStorage.js
13929   var require_localStorage = __commonJS({
13930     "node_modules/store/storages/localStorage.js"(exports2, module2) {
13931       var util = require_util();
13932       var Global = util.Global;
13933       module2.exports = {
13934         name: "localStorage",
13935         read,
13936         write,
13937         each,
13938         remove: remove2,
13939         clearAll
13940       };
13941       function localStorage2() {
13942         return Global.localStorage;
13943       }
13944       function read(key) {
13945         return localStorage2().getItem(key);
13946       }
13947       function write(key, data) {
13948         return localStorage2().setItem(key, data);
13949       }
13950       function each(fn) {
13951         for (var i2 = localStorage2().length - 1; i2 >= 0; i2--) {
13952           var key = localStorage2().key(i2);
13953           fn(read(key), key);
13954         }
13955       }
13956       function remove2(key) {
13957         return localStorage2().removeItem(key);
13958       }
13959       function clearAll() {
13960         return localStorage2().clear();
13961       }
13962     }
13963   });
13964
13965   // node_modules/store/storages/oldFF-globalStorage.js
13966   var require_oldFF_globalStorage = __commonJS({
13967     "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
13968       var util = require_util();
13969       var Global = util.Global;
13970       module2.exports = {
13971         name: "oldFF-globalStorage",
13972         read,
13973         write,
13974         each,
13975         remove: remove2,
13976         clearAll
13977       };
13978       var globalStorage = Global.globalStorage;
13979       function read(key) {
13980         return globalStorage[key];
13981       }
13982       function write(key, data) {
13983         globalStorage[key] = data;
13984       }
13985       function each(fn) {
13986         for (var i2 = globalStorage.length - 1; i2 >= 0; i2--) {
13987           var key = globalStorage.key(i2);
13988           fn(globalStorage[key], key);
13989         }
13990       }
13991       function remove2(key) {
13992         return globalStorage.removeItem(key);
13993       }
13994       function clearAll() {
13995         each(function(key, _) {
13996           delete globalStorage[key];
13997         });
13998       }
13999     }
14000   });
14001
14002   // node_modules/store/storages/oldIE-userDataStorage.js
14003   var require_oldIE_userDataStorage = __commonJS({
14004     "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14005       var util = require_util();
14006       var Global = util.Global;
14007       module2.exports = {
14008         name: "oldIE-userDataStorage",
14009         write,
14010         read,
14011         each,
14012         remove: remove2,
14013         clearAll
14014       };
14015       var storageName = "storejs";
14016       var doc = Global.document;
14017       var _withStorageEl = _makeIEStorageElFunction();
14018       var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14019       function write(unfixedKey, data) {
14020         if (disable) {
14021           return;
14022         }
14023         var fixedKey = fixKey(unfixedKey);
14024         _withStorageEl(function(storageEl) {
14025           storageEl.setAttribute(fixedKey, data);
14026           storageEl.save(storageName);
14027         });
14028       }
14029       function read(unfixedKey) {
14030         if (disable) {
14031           return;
14032         }
14033         var fixedKey = fixKey(unfixedKey);
14034         var res = null;
14035         _withStorageEl(function(storageEl) {
14036           res = storageEl.getAttribute(fixedKey);
14037         });
14038         return res;
14039       }
14040       function each(callback) {
14041         _withStorageEl(function(storageEl) {
14042           var attributes = storageEl.XMLDocument.documentElement.attributes;
14043           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14044             var attr = attributes[i2];
14045             callback(storageEl.getAttribute(attr.name), attr.name);
14046           }
14047         });
14048       }
14049       function remove2(unfixedKey) {
14050         var fixedKey = fixKey(unfixedKey);
14051         _withStorageEl(function(storageEl) {
14052           storageEl.removeAttribute(fixedKey);
14053           storageEl.save(storageName);
14054         });
14055       }
14056       function clearAll() {
14057         _withStorageEl(function(storageEl) {
14058           var attributes = storageEl.XMLDocument.documentElement.attributes;
14059           storageEl.load(storageName);
14060           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14061             storageEl.removeAttribute(attributes[i2].name);
14062           }
14063           storageEl.save(storageName);
14064         });
14065       }
14066       var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14067       function fixKey(key) {
14068         return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14069       }
14070       function _makeIEStorageElFunction() {
14071         if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14072           return null;
14073         }
14074         var scriptTag = "script", storageOwner, storageContainer, storageEl;
14075         try {
14076           storageContainer = new ActiveXObject("htmlfile");
14077           storageContainer.open();
14078           storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14079           storageContainer.close();
14080           storageOwner = storageContainer.w.frames[0].document;
14081           storageEl = storageOwner.createElement("div");
14082         } catch (e) {
14083           storageEl = doc.createElement("div");
14084           storageOwner = doc.body;
14085         }
14086         return function(storeFunction) {
14087           var args = [].slice.call(arguments, 0);
14088           args.unshift(storageEl);
14089           storageOwner.appendChild(storageEl);
14090           storageEl.addBehavior("#default#userData");
14091           storageEl.load(storageName);
14092           storeFunction.apply(this, args);
14093           storageOwner.removeChild(storageEl);
14094           return;
14095         };
14096       }
14097     }
14098   });
14099
14100   // node_modules/store/storages/cookieStorage.js
14101   var require_cookieStorage = __commonJS({
14102     "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14103       var util = require_util();
14104       var Global = util.Global;
14105       var trim = util.trim;
14106       module2.exports = {
14107         name: "cookieStorage",
14108         read,
14109         write,
14110         each,
14111         remove: remove2,
14112         clearAll
14113       };
14114       var doc = Global.document;
14115       function read(key) {
14116         if (!key || !_has(key)) {
14117           return null;
14118         }
14119         var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14120         return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14121       }
14122       function each(callback) {
14123         var cookies = doc.cookie.split(/; ?/g);
14124         for (var i2 = cookies.length - 1; i2 >= 0; i2--) {
14125           if (!trim(cookies[i2])) {
14126             continue;
14127           }
14128           var kvp = cookies[i2].split("=");
14129           var key = unescape(kvp[0]);
14130           var val = unescape(kvp[1]);
14131           callback(val, key);
14132         }
14133       }
14134       function write(key, data) {
14135         if (!key) {
14136           return;
14137         }
14138         doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14139       }
14140       function remove2(key) {
14141         if (!key || !_has(key)) {
14142           return;
14143         }
14144         doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14145       }
14146       function clearAll() {
14147         each(function(_, key) {
14148           remove2(key);
14149         });
14150       }
14151       function _has(key) {
14152         return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14153       }
14154     }
14155   });
14156
14157   // node_modules/store/storages/sessionStorage.js
14158   var require_sessionStorage = __commonJS({
14159     "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14160       var util = require_util();
14161       var Global = util.Global;
14162       module2.exports = {
14163         name: "sessionStorage",
14164         read,
14165         write,
14166         each,
14167         remove: remove2,
14168         clearAll
14169       };
14170       function sessionStorage() {
14171         return Global.sessionStorage;
14172       }
14173       function read(key) {
14174         return sessionStorage().getItem(key);
14175       }
14176       function write(key, data) {
14177         return sessionStorage().setItem(key, data);
14178       }
14179       function each(fn) {
14180         for (var i2 = sessionStorage().length - 1; i2 >= 0; i2--) {
14181           var key = sessionStorage().key(i2);
14182           fn(read(key), key);
14183         }
14184       }
14185       function remove2(key) {
14186         return sessionStorage().removeItem(key);
14187       }
14188       function clearAll() {
14189         return sessionStorage().clear();
14190       }
14191     }
14192   });
14193
14194   // node_modules/store/storages/memoryStorage.js
14195   var require_memoryStorage = __commonJS({
14196     "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14197       module2.exports = {
14198         name: "memoryStorage",
14199         read,
14200         write,
14201         each,
14202         remove: remove2,
14203         clearAll
14204       };
14205       var memoryStorage = {};
14206       function read(key) {
14207         return memoryStorage[key];
14208       }
14209       function write(key, data) {
14210         memoryStorage[key] = data;
14211       }
14212       function each(callback) {
14213         for (var key in memoryStorage) {
14214           if (memoryStorage.hasOwnProperty(key)) {
14215             callback(memoryStorage[key], key);
14216           }
14217         }
14218       }
14219       function remove2(key) {
14220         delete memoryStorage[key];
14221       }
14222       function clearAll(key) {
14223         memoryStorage = {};
14224       }
14225     }
14226   });
14227
14228   // node_modules/store/storages/all.js
14229   var require_all = __commonJS({
14230     "node_modules/store/storages/all.js"(exports2, module2) {
14231       module2.exports = [
14232         require_localStorage(),
14233         require_oldFF_globalStorage(),
14234         require_oldIE_userDataStorage(),
14235         require_cookieStorage(),
14236         require_sessionStorage(),
14237         require_memoryStorage()
14238       ];
14239     }
14240   });
14241
14242   // node_modules/store/plugins/lib/json2.js
14243   var require_json2 = __commonJS({
14244     "node_modules/store/plugins/lib/json2.js"(exports, module) {
14245       if (typeof JSON !== "object") {
14246         JSON = {};
14247       }
14248       (function() {
14249         "use strict";
14250         var rx_one = /^[\],:{}\s]*$/;
14251         var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14252         var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14253         var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14254         var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14255         var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14256         function f(n2) {
14257           return n2 < 10 ? "0" + n2 : n2;
14258         }
14259         function this_value() {
14260           return this.valueOf();
14261         }
14262         if (typeof Date.prototype.toJSON !== "function") {
14263           Date.prototype.toJSON = function() {
14264             return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null;
14265           };
14266           Boolean.prototype.toJSON = this_value;
14267           Number.prototype.toJSON = this_value;
14268           String.prototype.toJSON = this_value;
14269         }
14270         var gap;
14271         var indent;
14272         var meta;
14273         var rep;
14274         function quote(string) {
14275           rx_escapable.lastIndex = 0;
14276           return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a) {
14277             var c = meta[a];
14278             return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14279           }) + '"' : '"' + string + '"';
14280         }
14281         function str(key, holder) {
14282           var i2;
14283           var k;
14284           var v;
14285           var length;
14286           var mind = gap;
14287           var partial;
14288           var value = holder[key];
14289           if (value && typeof value === "object" && typeof value.toJSON === "function") {
14290             value = value.toJSON(key);
14291           }
14292           if (typeof rep === "function") {
14293             value = rep.call(holder, key, value);
14294           }
14295           switch (typeof value) {
14296             case "string":
14297               return quote(value);
14298             case "number":
14299               return isFinite(value) ? String(value) : "null";
14300             case "boolean":
14301             case "null":
14302               return String(value);
14303             case "object":
14304               if (!value) {
14305                 return "null";
14306               }
14307               gap += indent;
14308               partial = [];
14309               if (Object.prototype.toString.apply(value) === "[object Array]") {
14310                 length = value.length;
14311                 for (i2 = 0; i2 < length; i2 += 1) {
14312                   partial[i2] = str(i2, value) || "null";
14313                 }
14314                 v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14315                 gap = mind;
14316                 return v;
14317               }
14318               if (rep && typeof rep === "object") {
14319                 length = rep.length;
14320                 for (i2 = 0; i2 < length; i2 += 1) {
14321                   if (typeof rep[i2] === "string") {
14322                     k = rep[i2];
14323                     v = str(k, value);
14324                     if (v) {
14325                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14326                     }
14327                   }
14328                 }
14329               } else {
14330                 for (k in value) {
14331                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14332                     v = str(k, value);
14333                     if (v) {
14334                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14335                     }
14336                   }
14337                 }
14338               }
14339               v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14340               gap = mind;
14341               return v;
14342           }
14343         }
14344         if (typeof JSON.stringify !== "function") {
14345           meta = {
14346             "\b": "\\b",
14347             "   ": "\\t",
14348             "\n": "\\n",
14349             "\f": "\\f",
14350             "\r": "\\r",
14351             '"': '\\"',
14352             "\\": "\\\\"
14353           };
14354           JSON.stringify = function(value, replacer, space) {
14355             var i2;
14356             gap = "";
14357             indent = "";
14358             if (typeof space === "number") {
14359               for (i2 = 0; i2 < space; i2 += 1) {
14360                 indent += " ";
14361               }
14362             } else if (typeof space === "string") {
14363               indent = space;
14364             }
14365             rep = replacer;
14366             if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14367               throw new Error("JSON.stringify");
14368             }
14369             return str("", { "": value });
14370           };
14371         }
14372         if (typeof JSON.parse !== "function") {
14373           JSON.parse = function(text, reviver) {
14374             var j;
14375             function walk(holder, key) {
14376               var k;
14377               var v;
14378               var value = holder[key];
14379               if (value && typeof value === "object") {
14380                 for (k in value) {
14381                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14382                     v = walk(value, k);
14383                     if (v !== void 0) {
14384                       value[k] = v;
14385                     } else {
14386                       delete value[k];
14387                     }
14388                   }
14389                 }
14390               }
14391               return reviver.call(holder, key, value);
14392             }
14393             text = String(text);
14394             rx_dangerous.lastIndex = 0;
14395             if (rx_dangerous.test(text)) {
14396               text = text.replace(rx_dangerous, function(a) {
14397                 return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14398               });
14399             }
14400             if (rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) {
14401               j = eval("(" + text + ")");
14402               return typeof reviver === "function" ? walk({ "": j }, "") : j;
14403             }
14404             throw new SyntaxError("JSON.parse");
14405           };
14406         }
14407       })();
14408     }
14409   });
14410
14411   // node_modules/store/plugins/json2.js
14412   var require_json22 = __commonJS({
14413     "node_modules/store/plugins/json2.js"(exports2, module2) {
14414       module2.exports = json2Plugin;
14415       function json2Plugin() {
14416         require_json2();
14417         return {};
14418       }
14419     }
14420   });
14421
14422   // node_modules/store/dist/store.legacy.js
14423   var require_store_legacy = __commonJS({
14424     "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14425       var engine = require_store_engine();
14426       var storages = require_all();
14427       var plugins = [require_json22()];
14428       module2.exports = engine.createStore(storages, plugins);
14429     }
14430   });
14431
14432   // node_modules/whatwg-fetch/fetch.js
14433   var global2 = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global2 !== "undefined" && global2;
14434   var support = {
14435     searchParams: "URLSearchParams" in global2,
14436     iterable: "Symbol" in global2 && "iterator" in Symbol,
14437     blob: "FileReader" in global2 && "Blob" in global2 && function() {
14438       try {
14439         new Blob();
14440         return true;
14441       } catch (e) {
14442         return false;
14443       }
14444     }(),
14445     formData: "FormData" in global2,
14446     arrayBuffer: "ArrayBuffer" in global2
14447   };
14448   function isDataView(obj) {
14449     return obj && DataView.prototype.isPrototypeOf(obj);
14450   }
14451   if (support.arrayBuffer) {
14452     viewClasses = [
14453       "[object Int8Array]",
14454       "[object Uint8Array]",
14455       "[object Uint8ClampedArray]",
14456       "[object Int16Array]",
14457       "[object Uint16Array]",
14458       "[object Int32Array]",
14459       "[object Uint32Array]",
14460       "[object Float32Array]",
14461       "[object Float64Array]"
14462     ];
14463     isArrayBufferView = ArrayBuffer.isView || function(obj) {
14464       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14465     };
14466   }
14467   var viewClasses;
14468   var isArrayBufferView;
14469   function normalizeName(name2) {
14470     if (typeof name2 !== "string") {
14471       name2 = String(name2);
14472     }
14473     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name2) || name2 === "") {
14474       throw new TypeError('Invalid character in header field name: "' + name2 + '"');
14475     }
14476     return name2.toLowerCase();
14477   }
14478   function normalizeValue(value) {
14479     if (typeof value !== "string") {
14480       value = String(value);
14481     }
14482     return value;
14483   }
14484   function iteratorFor(items) {
14485     var iterator = {
14486       next: function() {
14487         var value = items.shift();
14488         return { done: value === void 0, value };
14489       }
14490     };
14491     if (support.iterable) {
14492       iterator[Symbol.iterator] = function() {
14493         return iterator;
14494       };
14495     }
14496     return iterator;
14497   }
14498   function Headers(headers) {
14499     this.map = {};
14500     if (headers instanceof Headers) {
14501       headers.forEach(function(value, name2) {
14502         this.append(name2, value);
14503       }, this);
14504     } else if (Array.isArray(headers)) {
14505       headers.forEach(function(header) {
14506         this.append(header[0], header[1]);
14507       }, this);
14508     } else if (headers) {
14509       Object.getOwnPropertyNames(headers).forEach(function(name2) {
14510         this.append(name2, headers[name2]);
14511       }, this);
14512     }
14513   }
14514   Headers.prototype.append = function(name2, value) {
14515     name2 = normalizeName(name2);
14516     value = normalizeValue(value);
14517     var oldValue = this.map[name2];
14518     this.map[name2] = oldValue ? oldValue + ", " + value : value;
14519   };
14520   Headers.prototype["delete"] = function(name2) {
14521     delete this.map[normalizeName(name2)];
14522   };
14523   Headers.prototype.get = function(name2) {
14524     name2 = normalizeName(name2);
14525     return this.has(name2) ? this.map[name2] : null;
14526   };
14527   Headers.prototype.has = function(name2) {
14528     return this.map.hasOwnProperty(normalizeName(name2));
14529   };
14530   Headers.prototype.set = function(name2, value) {
14531     this.map[normalizeName(name2)] = normalizeValue(value);
14532   };
14533   Headers.prototype.forEach = function(callback, thisArg) {
14534     for (var name2 in this.map) {
14535       if (this.map.hasOwnProperty(name2)) {
14536         callback.call(thisArg, this.map[name2], name2, this);
14537       }
14538     }
14539   };
14540   Headers.prototype.keys = function() {
14541     var items = [];
14542     this.forEach(function(value, name2) {
14543       items.push(name2);
14544     });
14545     return iteratorFor(items);
14546   };
14547   Headers.prototype.values = function() {
14548     var items = [];
14549     this.forEach(function(value) {
14550       items.push(value);
14551     });
14552     return iteratorFor(items);
14553   };
14554   Headers.prototype.entries = function() {
14555     var items = [];
14556     this.forEach(function(value, name2) {
14557       items.push([name2, value]);
14558     });
14559     return iteratorFor(items);
14560   };
14561   if (support.iterable) {
14562     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14563   }
14564   function consumed(body) {
14565     if (body.bodyUsed) {
14566       return Promise.reject(new TypeError("Already read"));
14567     }
14568     body.bodyUsed = true;
14569   }
14570   function fileReaderReady(reader) {
14571     return new Promise(function(resolve, reject) {
14572       reader.onload = function() {
14573         resolve(reader.result);
14574       };
14575       reader.onerror = function() {
14576         reject(reader.error);
14577       };
14578     });
14579   }
14580   function readBlobAsArrayBuffer(blob) {
14581     var reader = new FileReader();
14582     var promise = fileReaderReady(reader);
14583     reader.readAsArrayBuffer(blob);
14584     return promise;
14585   }
14586   function readBlobAsText(blob) {
14587     var reader = new FileReader();
14588     var promise = fileReaderReady(reader);
14589     reader.readAsText(blob);
14590     return promise;
14591   }
14592   function readArrayBufferAsText(buf) {
14593     var view = new Uint8Array(buf);
14594     var chars = new Array(view.length);
14595     for (var i2 = 0; i2 < view.length; i2++) {
14596       chars[i2] = String.fromCharCode(view[i2]);
14597     }
14598     return chars.join("");
14599   }
14600   function bufferClone(buf) {
14601     if (buf.slice) {
14602       return buf.slice(0);
14603     } else {
14604       var view = new Uint8Array(buf.byteLength);
14605       view.set(new Uint8Array(buf));
14606       return view.buffer;
14607     }
14608   }
14609   function Body() {
14610     this.bodyUsed = false;
14611     this._initBody = function(body) {
14612       this.bodyUsed = this.bodyUsed;
14613       this._bodyInit = body;
14614       if (!body) {
14615         this._bodyText = "";
14616       } else if (typeof body === "string") {
14617         this._bodyText = body;
14618       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14619         this._bodyBlob = body;
14620       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14621         this._bodyFormData = body;
14622       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14623         this._bodyText = body.toString();
14624       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14625         this._bodyArrayBuffer = bufferClone(body.buffer);
14626         this._bodyInit = new Blob([this._bodyArrayBuffer]);
14627       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
14628         this._bodyArrayBuffer = bufferClone(body);
14629       } else {
14630         this._bodyText = body = Object.prototype.toString.call(body);
14631       }
14632       if (!this.headers.get("content-type")) {
14633         if (typeof body === "string") {
14634           this.headers.set("content-type", "text/plain;charset=UTF-8");
14635         } else if (this._bodyBlob && this._bodyBlob.type) {
14636           this.headers.set("content-type", this._bodyBlob.type);
14637         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14638           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
14639         }
14640       }
14641     };
14642     if (support.blob) {
14643       this.blob = function() {
14644         var rejected = consumed(this);
14645         if (rejected) {
14646           return rejected;
14647         }
14648         if (this._bodyBlob) {
14649           return Promise.resolve(this._bodyBlob);
14650         } else if (this._bodyArrayBuffer) {
14651           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
14652         } else if (this._bodyFormData) {
14653           throw new Error("could not read FormData body as blob");
14654         } else {
14655           return Promise.resolve(new Blob([this._bodyText]));
14656         }
14657       };
14658       this.arrayBuffer = function() {
14659         if (this._bodyArrayBuffer) {
14660           var isConsumed = consumed(this);
14661           if (isConsumed) {
14662             return isConsumed;
14663           }
14664           if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
14665             return Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset, this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength));
14666           } else {
14667             return Promise.resolve(this._bodyArrayBuffer);
14668           }
14669         } else {
14670           return this.blob().then(readBlobAsArrayBuffer);
14671         }
14672       };
14673     }
14674     this.text = function() {
14675       var rejected = consumed(this);
14676       if (rejected) {
14677         return rejected;
14678       }
14679       if (this._bodyBlob) {
14680         return readBlobAsText(this._bodyBlob);
14681       } else if (this._bodyArrayBuffer) {
14682         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
14683       } else if (this._bodyFormData) {
14684         throw new Error("could not read FormData body as text");
14685       } else {
14686         return Promise.resolve(this._bodyText);
14687       }
14688     };
14689     if (support.formData) {
14690       this.formData = function() {
14691         return this.text().then(decode);
14692       };
14693     }
14694     this.json = function() {
14695       return this.text().then(JSON.parse);
14696     };
14697     return this;
14698   }
14699   var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
14700   function normalizeMethod(method) {
14701     var upcased = method.toUpperCase();
14702     return methods.indexOf(upcased) > -1 ? upcased : method;
14703   }
14704   function Request(input, options2) {
14705     if (!(this instanceof Request)) {
14706       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14707     }
14708     options2 = options2 || {};
14709     var body = options2.body;
14710     if (input instanceof Request) {
14711       if (input.bodyUsed) {
14712         throw new TypeError("Already read");
14713       }
14714       this.url = input.url;
14715       this.credentials = input.credentials;
14716       if (!options2.headers) {
14717         this.headers = new Headers(input.headers);
14718       }
14719       this.method = input.method;
14720       this.mode = input.mode;
14721       this.signal = input.signal;
14722       if (!body && input._bodyInit != null) {
14723         body = input._bodyInit;
14724         input.bodyUsed = true;
14725       }
14726     } else {
14727       this.url = String(input);
14728     }
14729     this.credentials = options2.credentials || this.credentials || "same-origin";
14730     if (options2.headers || !this.headers) {
14731       this.headers = new Headers(options2.headers);
14732     }
14733     this.method = normalizeMethod(options2.method || this.method || "GET");
14734     this.mode = options2.mode || this.mode || null;
14735     this.signal = options2.signal || this.signal;
14736     this.referrer = null;
14737     if ((this.method === "GET" || this.method === "HEAD") && body) {
14738       throw new TypeError("Body not allowed for GET or HEAD requests");
14739     }
14740     this._initBody(body);
14741     if (this.method === "GET" || this.method === "HEAD") {
14742       if (options2.cache === "no-store" || options2.cache === "no-cache") {
14743         var reParamSearch = /([?&])_=[^&]*/;
14744         if (reParamSearch.test(this.url)) {
14745           this.url = this.url.replace(reParamSearch, "$1_=" + new Date().getTime());
14746         } else {
14747           var reQueryString = /\?/;
14748           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + new Date().getTime();
14749         }
14750       }
14751     }
14752   }
14753   Request.prototype.clone = function() {
14754     return new Request(this, { body: this._bodyInit });
14755   };
14756   function decode(body) {
14757     var form = new FormData();
14758     body.trim().split("&").forEach(function(bytes) {
14759       if (bytes) {
14760         var split = bytes.split("=");
14761         var name2 = split.shift().replace(/\+/g, " ");
14762         var value = split.join("=").replace(/\+/g, " ");
14763         form.append(decodeURIComponent(name2), decodeURIComponent(value));
14764       }
14765     });
14766     return form;
14767   }
14768   function parseHeaders(rawHeaders) {
14769     var headers = new Headers();
14770     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
14771     preProcessedHeaders.split("\r").map(function(header) {
14772       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
14773     }).forEach(function(line) {
14774       var parts = line.split(":");
14775       var key = parts.shift().trim();
14776       if (key) {
14777         var value = parts.join(":").trim();
14778         headers.append(key, value);
14779       }
14780     });
14781     return headers;
14782   }
14783   Body.call(Request.prototype);
14784   function Response(bodyInit, options2) {
14785     if (!(this instanceof Response)) {
14786       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14787     }
14788     if (!options2) {
14789       options2 = {};
14790     }
14791     this.type = "default";
14792     this.status = options2.status === void 0 ? 200 : options2.status;
14793     this.ok = this.status >= 200 && this.status < 300;
14794     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
14795     this.headers = new Headers(options2.headers);
14796     this.url = options2.url || "";
14797     this._initBody(bodyInit);
14798   }
14799   Body.call(Response.prototype);
14800   Response.prototype.clone = function() {
14801     return new Response(this._bodyInit, {
14802       status: this.status,
14803       statusText: this.statusText,
14804       headers: new Headers(this.headers),
14805       url: this.url
14806     });
14807   };
14808   Response.error = function() {
14809     var response = new Response(null, { status: 0, statusText: "" });
14810     response.type = "error";
14811     return response;
14812   };
14813   var redirectStatuses = [301, 302, 303, 307, 308];
14814   Response.redirect = function(url, status) {
14815     if (redirectStatuses.indexOf(status) === -1) {
14816       throw new RangeError("Invalid status code");
14817     }
14818     return new Response(null, { status, headers: { location: url } });
14819   };
14820   var DOMException2 = global2.DOMException;
14821   try {
14822     new DOMException2();
14823   } catch (err) {
14824     DOMException2 = function(message, name2) {
14825       this.message = message;
14826       this.name = name2;
14827       var error = Error(message);
14828       this.stack = error.stack;
14829     };
14830     DOMException2.prototype = Object.create(Error.prototype);
14831     DOMException2.prototype.constructor = DOMException2;
14832   }
14833   function fetch2(input, init2) {
14834     return new Promise(function(resolve, reject) {
14835       var request3 = new Request(input, init2);
14836       if (request3.signal && request3.signal.aborted) {
14837         return reject(new DOMException2("Aborted", "AbortError"));
14838       }
14839       var xhr = new XMLHttpRequest();
14840       function abortXhr() {
14841         xhr.abort();
14842       }
14843       xhr.onload = function() {
14844         var options2 = {
14845           status: xhr.status,
14846           statusText: xhr.statusText,
14847           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
14848         };
14849         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
14850         var body = "response" in xhr ? xhr.response : xhr.responseText;
14851         setTimeout(function() {
14852           resolve(new Response(body, options2));
14853         }, 0);
14854       };
14855       xhr.onerror = function() {
14856         setTimeout(function() {
14857           reject(new TypeError("Network request failed"));
14858         }, 0);
14859       };
14860       xhr.ontimeout = function() {
14861         setTimeout(function() {
14862           reject(new TypeError("Network request failed"));
14863         }, 0);
14864       };
14865       xhr.onabort = function() {
14866         setTimeout(function() {
14867           reject(new DOMException2("Aborted", "AbortError"));
14868         }, 0);
14869       };
14870       function fixUrl(url) {
14871         try {
14872           return url === "" && global2.location.href ? global2.location.href : url;
14873         } catch (e) {
14874           return url;
14875         }
14876       }
14877       xhr.open(request3.method, fixUrl(request3.url), true);
14878       if (request3.credentials === "include") {
14879         xhr.withCredentials = true;
14880       } else if (request3.credentials === "omit") {
14881         xhr.withCredentials = false;
14882       }
14883       if ("responseType" in xhr) {
14884         if (support.blob) {
14885           xhr.responseType = "blob";
14886         } else if (support.arrayBuffer && request3.headers.get("Content-Type") && request3.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
14887           xhr.responseType = "arraybuffer";
14888         }
14889       }
14890       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers)) {
14891         Object.getOwnPropertyNames(init2.headers).forEach(function(name2) {
14892           xhr.setRequestHeader(name2, normalizeValue(init2.headers[name2]));
14893         });
14894       } else {
14895         request3.headers.forEach(function(value, name2) {
14896           xhr.setRequestHeader(name2, value);
14897         });
14898       }
14899       if (request3.signal) {
14900         request3.signal.addEventListener("abort", abortXhr);
14901         xhr.onreadystatechange = function() {
14902           if (xhr.readyState === 4) {
14903             request3.signal.removeEventListener("abort", abortXhr);
14904           }
14905         };
14906       }
14907       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
14908     });
14909   }
14910   fetch2.polyfill = true;
14911   if (!global2.fetch) {
14912     global2.fetch = fetch2;
14913     global2.Headers = Headers;
14914     global2.Request = Request;
14915     global2.Response = Response;
14916   }
14917
14918   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
14919   (function(factory) {
14920     typeof define === "function" && define.amd ? define(factory) : factory();
14921   })(function() {
14922     "use strict";
14923     function _classCallCheck(instance, Constructor) {
14924       if (!(instance instanceof Constructor)) {
14925         throw new TypeError("Cannot call a class as a function");
14926       }
14927     }
14928     function _defineProperties(target, props) {
14929       for (var i2 = 0; i2 < props.length; i2++) {
14930         var descriptor = props[i2];
14931         descriptor.enumerable = descriptor.enumerable || false;
14932         descriptor.configurable = true;
14933         if ("value" in descriptor)
14934           descriptor.writable = true;
14935         Object.defineProperty(target, descriptor.key, descriptor);
14936       }
14937     }
14938     function _createClass(Constructor, protoProps, staticProps) {
14939       if (protoProps)
14940         _defineProperties(Constructor.prototype, protoProps);
14941       if (staticProps)
14942         _defineProperties(Constructor, staticProps);
14943       return Constructor;
14944     }
14945     function _inherits(subClass, superClass) {
14946       if (typeof superClass !== "function" && superClass !== null) {
14947         throw new TypeError("Super expression must either be null or a function");
14948       }
14949       subClass.prototype = Object.create(superClass && superClass.prototype, {
14950         constructor: {
14951           value: subClass,
14952           writable: true,
14953           configurable: true
14954         }
14955       });
14956       if (superClass)
14957         _setPrototypeOf(subClass, superClass);
14958     }
14959     function _getPrototypeOf(o) {
14960       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
14961         return o2.__proto__ || Object.getPrototypeOf(o2);
14962       };
14963       return _getPrototypeOf(o);
14964     }
14965     function _setPrototypeOf(o, p) {
14966       _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
14967         o2.__proto__ = p2;
14968         return o2;
14969       };
14970       return _setPrototypeOf(o, p);
14971     }
14972     function _isNativeReflectConstruct() {
14973       if (typeof Reflect === "undefined" || !Reflect.construct)
14974         return false;
14975       if (Reflect.construct.sham)
14976         return false;
14977       if (typeof Proxy === "function")
14978         return true;
14979       try {
14980         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
14981         }));
14982         return true;
14983       } catch (e) {
14984         return false;
14985       }
14986     }
14987     function _assertThisInitialized(self2) {
14988       if (self2 === void 0) {
14989         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14990       }
14991       return self2;
14992     }
14993     function _possibleConstructorReturn(self2, call) {
14994       if (call && (typeof call === "object" || typeof call === "function")) {
14995         return call;
14996       }
14997       return _assertThisInitialized(self2);
14998     }
14999     function _createSuper(Derived) {
15000       var hasNativeReflectConstruct = _isNativeReflectConstruct();
15001       return function _createSuperInternal() {
15002         var Super = _getPrototypeOf(Derived), result;
15003         if (hasNativeReflectConstruct) {
15004           var NewTarget = _getPrototypeOf(this).constructor;
15005           result = Reflect.construct(Super, arguments, NewTarget);
15006         } else {
15007           result = Super.apply(this, arguments);
15008         }
15009         return _possibleConstructorReturn(this, result);
15010       };
15011     }
15012     function _superPropBase(object, property) {
15013       while (!Object.prototype.hasOwnProperty.call(object, property)) {
15014         object = _getPrototypeOf(object);
15015         if (object === null)
15016           break;
15017       }
15018       return object;
15019     }
15020     function _get(target, property, receiver) {
15021       if (typeof Reflect !== "undefined" && Reflect.get) {
15022         _get = Reflect.get;
15023       } else {
15024         _get = function _get2(target2, property2, receiver2) {
15025           var base = _superPropBase(target2, property2);
15026           if (!base)
15027             return;
15028           var desc = Object.getOwnPropertyDescriptor(base, property2);
15029           if (desc.get) {
15030             return desc.get.call(receiver2);
15031           }
15032           return desc.value;
15033         };
15034       }
15035       return _get(target, property, receiver || target);
15036     }
15037     var Emitter = /* @__PURE__ */ function() {
15038       function Emitter2() {
15039         _classCallCheck(this, Emitter2);
15040         Object.defineProperty(this, "listeners", {
15041           value: {},
15042           writable: true,
15043           configurable: true
15044         });
15045       }
15046       _createClass(Emitter2, [{
15047         key: "addEventListener",
15048         value: function addEventListener(type3, callback, options2) {
15049           if (!(type3 in this.listeners)) {
15050             this.listeners[type3] = [];
15051           }
15052           this.listeners[type3].push({
15053             callback,
15054             options: options2
15055           });
15056         }
15057       }, {
15058         key: "removeEventListener",
15059         value: function removeEventListener(type3, callback) {
15060           if (!(type3 in this.listeners)) {
15061             return;
15062           }
15063           var stack = this.listeners[type3];
15064           for (var i2 = 0, l = stack.length; i2 < l; i2++) {
15065             if (stack[i2].callback === callback) {
15066               stack.splice(i2, 1);
15067               return;
15068             }
15069           }
15070         }
15071       }, {
15072         key: "dispatchEvent",
15073         value: function dispatchEvent2(event) {
15074           if (!(event.type in this.listeners)) {
15075             return;
15076           }
15077           var stack = this.listeners[event.type];
15078           var stackToCall = stack.slice();
15079           for (var i2 = 0, l = stackToCall.length; i2 < l; i2++) {
15080             var listener = stackToCall[i2];
15081             try {
15082               listener.callback.call(this, event);
15083             } catch (e) {
15084               Promise.resolve().then(function() {
15085                 throw e;
15086               });
15087             }
15088             if (listener.options && listener.options.once) {
15089               this.removeEventListener(event.type, listener.callback);
15090             }
15091           }
15092           return !event.defaultPrevented;
15093         }
15094       }]);
15095       return Emitter2;
15096     }();
15097     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15098       _inherits(AbortSignal2, _Emitter);
15099       var _super = _createSuper(AbortSignal2);
15100       function AbortSignal2() {
15101         var _this;
15102         _classCallCheck(this, AbortSignal2);
15103         _this = _super.call(this);
15104         if (!_this.listeners) {
15105           Emitter.call(_assertThisInitialized(_this));
15106         }
15107         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15108           value: false,
15109           writable: true,
15110           configurable: true
15111         });
15112         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15113           value: null,
15114           writable: true,
15115           configurable: true
15116         });
15117         return _this;
15118       }
15119       _createClass(AbortSignal2, [{
15120         key: "toString",
15121         value: function toString2() {
15122           return "[object AbortSignal]";
15123         }
15124       }, {
15125         key: "dispatchEvent",
15126         value: function dispatchEvent2(event) {
15127           if (event.type === "abort") {
15128             this.aborted = true;
15129             if (typeof this.onabort === "function") {
15130               this.onabort.call(this, event);
15131             }
15132           }
15133           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15134         }
15135       }]);
15136       return AbortSignal2;
15137     }(Emitter);
15138     var AbortController2 = /* @__PURE__ */ function() {
15139       function AbortController3() {
15140         _classCallCheck(this, AbortController3);
15141         Object.defineProperty(this, "signal", {
15142           value: new AbortSignal(),
15143           writable: true,
15144           configurable: true
15145         });
15146       }
15147       _createClass(AbortController3, [{
15148         key: "abort",
15149         value: function abort() {
15150           var event;
15151           try {
15152             event = new Event("abort");
15153           } catch (e) {
15154             if (typeof document !== "undefined") {
15155               if (!document.createEvent) {
15156                 event = document.createEventObject();
15157                 event.type = "abort";
15158               } else {
15159                 event = document.createEvent("Event");
15160                 event.initEvent("abort", false, false);
15161               }
15162             } else {
15163               event = {
15164                 type: "abort",
15165                 bubbles: false,
15166                 cancelable: false
15167               };
15168             }
15169           }
15170           this.signal.dispatchEvent(event);
15171         }
15172       }, {
15173         key: "toString",
15174         value: function toString2() {
15175           return "[object AbortController]";
15176         }
15177       }]);
15178       return AbortController3;
15179     }();
15180     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15181       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15182       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15183     }
15184     function polyfillNeeded(self2) {
15185       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15186         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15187         return true;
15188       }
15189       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15190     }
15191     function abortableFetchDecorator(patchTargets) {
15192       if (typeof patchTargets === "function") {
15193         patchTargets = {
15194           fetch: patchTargets
15195         };
15196       }
15197       var _patchTargets = patchTargets, fetch3 = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch3.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
15198       if (!polyfillNeeded({
15199         fetch: fetch3,
15200         Request: NativeRequest,
15201         AbortController: NativeAbortController,
15202         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15203       })) {
15204         return {
15205           fetch: fetch3,
15206           Request: Request2
15207         };
15208       }
15209       var Request2 = NativeRequest;
15210       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15211         Request2 = function Request3(input, init2) {
15212           var signal;
15213           if (init2 && init2.signal) {
15214             signal = init2.signal;
15215             delete init2.signal;
15216           }
15217           var request3 = new NativeRequest(input, init2);
15218           if (signal) {
15219             Object.defineProperty(request3, "signal", {
15220               writable: false,
15221               enumerable: false,
15222               configurable: true,
15223               value: signal
15224             });
15225           }
15226           return request3;
15227         };
15228         Request2.prototype = NativeRequest.prototype;
15229       }
15230       var realFetch = fetch3;
15231       var abortableFetch = function abortableFetch2(input, init2) {
15232         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15233         if (signal) {
15234           var abortError;
15235           try {
15236             abortError = new DOMException("Aborted", "AbortError");
15237           } catch (err) {
15238             abortError = new Error("Aborted");
15239             abortError.name = "AbortError";
15240           }
15241           if (signal.aborted) {
15242             return Promise.reject(abortError);
15243           }
15244           var cancellation = new Promise(function(_, reject) {
15245             signal.addEventListener("abort", function() {
15246               return reject(abortError);
15247             }, {
15248               once: true
15249             });
15250           });
15251           if (init2 && init2.signal) {
15252             delete init2.signal;
15253           }
15254           return Promise.race([cancellation, realFetch(input, init2)]);
15255         }
15256         return realFetch(input, init2);
15257       };
15258       return {
15259         fetch: abortableFetch,
15260         Request: Request2
15261       };
15262     }
15263     (function(self2) {
15264       if (!polyfillNeeded(self2)) {
15265         return;
15266       }
15267       if (!self2.fetch) {
15268         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15269         return;
15270       }
15271       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15272       self2.fetch = fetch3;
15273       self2.Request = Request2;
15274       Object.defineProperty(self2, "AbortController", {
15275         writable: true,
15276         enumerable: false,
15277         configurable: true,
15278         value: AbortController2
15279       });
15280       Object.defineProperty(self2, "AbortSignal", {
15281         writable: true,
15282         enumerable: false,
15283         configurable: true,
15284         value: AbortSignal
15285       });
15286     })(typeof self !== "undefined" ? self : global);
15287   });
15288
15289   // modules/index.js
15290   var modules_exports = {};
15291   __export(modules_exports, {
15292     QAItem: () => QAItem,
15293     actionAddEntity: () => actionAddEntity,
15294     actionAddMember: () => actionAddMember,
15295     actionAddMidpoint: () => actionAddMidpoint,
15296     actionAddVertex: () => actionAddVertex,
15297     actionChangeMember: () => actionChangeMember,
15298     actionChangePreset: () => actionChangePreset,
15299     actionChangeTags: () => actionChangeTags,
15300     actionCircularize: () => actionCircularize,
15301     actionConnect: () => actionConnect,
15302     actionCopyEntities: () => actionCopyEntities,
15303     actionDeleteMember: () => actionDeleteMember,
15304     actionDeleteMultiple: () => actionDeleteMultiple,
15305     actionDeleteNode: () => actionDeleteNode,
15306     actionDeleteRelation: () => actionDeleteRelation,
15307     actionDeleteWay: () => actionDeleteWay,
15308     actionDiscardTags: () => actionDiscardTags,
15309     actionDisconnect: () => actionDisconnect,
15310     actionExtract: () => actionExtract,
15311     actionJoin: () => actionJoin,
15312     actionMerge: () => actionMerge,
15313     actionMergeNodes: () => actionMergeNodes,
15314     actionMergePolygon: () => actionMergePolygon,
15315     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15316     actionMove: () => actionMove,
15317     actionMoveMember: () => actionMoveMember,
15318     actionMoveNode: () => actionMoveNode,
15319     actionNoop: () => actionNoop,
15320     actionOrthogonalize: () => actionOrthogonalize,
15321     actionReflect: () => actionReflect,
15322     actionRestrictTurn: () => actionRestrictTurn,
15323     actionReverse: () => actionReverse,
15324     actionRevert: () => actionRevert,
15325     actionRotate: () => actionRotate,
15326     actionScale: () => actionScale,
15327     actionSplit: () => actionSplit,
15328     actionStraightenNodes: () => actionStraightenNodes,
15329     actionStraightenWay: () => actionStraightenWay,
15330     actionUnrestrictTurn: () => actionUnrestrictTurn,
15331     actionUpgradeTags: () => actionUpgradeTags,
15332     behaviorAddWay: () => behaviorAddWay,
15333     behaviorBreathe: () => behaviorBreathe,
15334     behaviorDrag: () => behaviorDrag,
15335     behaviorDraw: () => behaviorDraw,
15336     behaviorDrawWay: () => behaviorDrawWay,
15337     behaviorEdit: () => behaviorEdit,
15338     behaviorHash: () => behaviorHash,
15339     behaviorHover: () => behaviorHover,
15340     behaviorLasso: () => behaviorLasso,
15341     behaviorOperation: () => behaviorOperation,
15342     behaviorPaste: () => behaviorPaste,
15343     behaviorSelect: () => behaviorSelect,
15344     coreContext: () => coreContext,
15345     coreDifference: () => coreDifference,
15346     coreFileFetcher: () => coreFileFetcher,
15347     coreGraph: () => coreGraph,
15348     coreHistory: () => coreHistory,
15349     coreLocalizer: () => coreLocalizer,
15350     coreLocations: () => coreLocations,
15351     coreTree: () => coreTree,
15352     coreUploader: () => coreUploader,
15353     coreValidator: () => coreValidator,
15354     d3: () => d3,
15355     debug: () => debug,
15356     fileFetcher: () => _mainFileFetcher,
15357     geoAngle: () => geoAngle,
15358     geoChooseEdge: () => geoChooseEdge,
15359     geoEdgeEqual: () => geoEdgeEqual,
15360     geoExtent: () => geoExtent,
15361     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15362     geoHasLineIntersections: () => geoHasLineIntersections,
15363     geoHasSelfIntersections: () => geoHasSelfIntersections,
15364     geoLatToMeters: () => geoLatToMeters,
15365     geoLineIntersection: () => geoLineIntersection,
15366     geoLonToMeters: () => geoLonToMeters,
15367     geoMetersToLat: () => geoMetersToLat,
15368     geoMetersToLon: () => geoMetersToLon,
15369     geoMetersToOffset: () => geoMetersToOffset,
15370     geoOffsetToMeters: () => geoOffsetToMeters,
15371     geoOrthoCalcScore: () => geoOrthoCalcScore,
15372     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15373     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15374     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15375     geoPathHasIntersections: () => geoPathHasIntersections,
15376     geoPathIntersections: () => geoPathIntersections,
15377     geoPathLength: () => geoPathLength,
15378     geoPointInPolygon: () => geoPointInPolygon,
15379     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15380     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15381     geoRawMercator: () => geoRawMercator,
15382     geoRotate: () => geoRotate,
15383     geoScaleToZoom: () => geoScaleToZoom,
15384     geoSphericalClosestNode: () => geoSphericalClosestNode,
15385     geoSphericalDistance: () => geoSphericalDistance,
15386     geoVecAdd: () => geoVecAdd,
15387     geoVecAngle: () => geoVecAngle,
15388     geoVecCross: () => geoVecCross,
15389     geoVecDot: () => geoVecDot,
15390     geoVecEqual: () => geoVecEqual,
15391     geoVecFloor: () => geoVecFloor,
15392     geoVecInterp: () => geoVecInterp,
15393     geoVecLength: () => geoVecLength,
15394     geoVecLengthSquare: () => geoVecLengthSquare,
15395     geoVecNormalize: () => geoVecNormalize,
15396     geoVecNormalizedDot: () => geoVecNormalizedDot,
15397     geoVecProject: () => geoVecProject,
15398     geoVecScale: () => geoVecScale,
15399     geoVecSubtract: () => geoVecSubtract,
15400     geoViewportEdge: () => geoViewportEdge,
15401     geoZoomToScale: () => geoZoomToScale,
15402     localizer: () => _mainLocalizer,
15403     locationManager: () => _mainLocations,
15404     modeAddArea: () => modeAddArea,
15405     modeAddLine: () => modeAddLine,
15406     modeAddNote: () => modeAddNote,
15407     modeAddPoint: () => modeAddPoint,
15408     modeBrowse: () => modeBrowse,
15409     modeDragNode: () => modeDragNode,
15410     modeDragNote: () => modeDragNote,
15411     modeDrawArea: () => modeDrawArea,
15412     modeDrawLine: () => modeDrawLine,
15413     modeMove: () => modeMove,
15414     modeRotate: () => modeRotate,
15415     modeSave: () => modeSave,
15416     modeSelect: () => modeSelect,
15417     modeSelectData: () => modeSelectData,
15418     modeSelectError: () => modeSelectError,
15419     modeSelectNote: () => modeSelectNote,
15420     operationCircularize: () => operationCircularize,
15421     operationContinue: () => operationContinue,
15422     operationCopy: () => operationCopy,
15423     operationDelete: () => operationDelete,
15424     operationDisconnect: () => operationDisconnect,
15425     operationDowngrade: () => operationDowngrade,
15426     operationExtract: () => operationExtract,
15427     operationMerge: () => operationMerge,
15428     operationMove: () => operationMove,
15429     operationOrthogonalize: () => operationOrthogonalize,
15430     operationPaste: () => operationPaste,
15431     operationReflectLong: () => operationReflectLong,
15432     operationReflectShort: () => operationReflectShort,
15433     operationReverse: () => operationReverse,
15434     operationRotate: () => operationRotate,
15435     operationSplit: () => operationSplit,
15436     operationStraighten: () => operationStraighten,
15437     osmAreaKeys: () => osmAreaKeys,
15438     osmChangeset: () => osmChangeset,
15439     osmEntity: () => osmEntity,
15440     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15441     osmInferRestriction: () => osmInferRestriction,
15442     osmIntersection: () => osmIntersection,
15443     osmIsInterestingTag: () => osmIsInterestingTag,
15444     osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15445     osmJoinWays: () => osmJoinWays,
15446     osmLanes: () => osmLanes,
15447     osmNode: () => osmNode,
15448     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15449     osmNote: () => osmNote,
15450     osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15451     osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15452     osmOneWayTags: () => osmOneWayTags,
15453     osmPavedTags: () => osmPavedTags,
15454     osmPointTags: () => osmPointTags,
15455     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15456     osmRelation: () => osmRelation,
15457     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15458     osmSetAreaKeys: () => osmSetAreaKeys,
15459     osmSetPointTags: () => osmSetPointTags,
15460     osmSetVertexTags: () => osmSetVertexTags,
15461     osmTagSuggestingArea: () => osmTagSuggestingArea,
15462     osmTurn: () => osmTurn,
15463     osmVertexTags: () => osmVertexTags,
15464     osmWay: () => osmWay,
15465     prefs: () => corePreferences,
15466     presetCategory: () => presetCategory,
15467     presetCollection: () => presetCollection,
15468     presetField: () => presetField,
15469     presetIndex: () => presetIndex,
15470     presetManager: () => _mainPresetIndex,
15471     presetPreset: () => presetPreset,
15472     rendererBackground: () => rendererBackground,
15473     rendererBackgroundSource: () => rendererBackgroundSource,
15474     rendererFeatures: () => rendererFeatures,
15475     rendererMap: () => rendererMap,
15476     rendererPhotos: () => rendererPhotos,
15477     rendererTileLayer: () => rendererTileLayer,
15478     serviceImproveOSM: () => improveOSM_default,
15479     serviceKartaview: () => kartaview_default,
15480     serviceKeepRight: () => keepRight_default,
15481     serviceMapRules: () => maprules_default,
15482     serviceMapillary: () => mapillary_default,
15483     serviceNominatim: () => nominatim_default,
15484     serviceNsi: () => nsi_default,
15485     serviceOsm: () => osm_default,
15486     serviceOsmWikibase: () => osm_wikibase_default,
15487     serviceOsmose: () => osmose_default,
15488     serviceStreetside: () => streetside_default,
15489     serviceTaginfo: () => taginfo_default,
15490     serviceVectorTile: () => vector_tile_default,
15491     serviceWikidata: () => wikidata_default,
15492     serviceWikipedia: () => wikipedia_default,
15493     services: () => services,
15494     svgAreas: () => svgAreas,
15495     svgData: () => svgData,
15496     svgDebug: () => svgDebug,
15497     svgDefs: () => svgDefs,
15498     svgGeolocate: () => svgGeolocate,
15499     svgIcon: () => svgIcon,
15500     svgKartaviewImages: () => svgKartaviewImages,
15501     svgKeepRight: () => svgKeepRight,
15502     svgLabels: () => svgLabels,
15503     svgLayers: () => svgLayers,
15504     svgLines: () => svgLines,
15505     svgMapillaryImages: () => svgMapillaryImages,
15506     svgMapillarySigns: () => svgMapillarySigns,
15507     svgMarkerSegments: () => svgMarkerSegments,
15508     svgMidpoints: () => svgMidpoints,
15509     svgNotes: () => svgNotes,
15510     svgOsm: () => svgOsm,
15511     svgPassiveVertex: () => svgPassiveVertex,
15512     svgPath: () => svgPath,
15513     svgPointTransform: () => svgPointTransform,
15514     svgPoints: () => svgPoints,
15515     svgRelationMemberTags: () => svgRelationMemberTags,
15516     svgSegmentWay: () => svgSegmentWay,
15517     svgStreetside: () => svgStreetside,
15518     svgTagClasses: () => svgTagClasses,
15519     svgTagPattern: () => svgTagPattern,
15520     svgTouch: () => svgTouch,
15521     svgTurns: () => svgTurns,
15522     svgVertices: () => svgVertices,
15523     t: () => _t,
15524     uiAccount: () => uiAccount,
15525     uiAttribution: () => uiAttribution,
15526     uiChangesetEditor: () => uiChangesetEditor,
15527     uiCmd: () => uiCmd,
15528     uiCombobox: () => uiCombobox,
15529     uiCommit: () => uiCommit,
15530     uiCommitWarnings: () => uiCommitWarnings,
15531     uiConfirm: () => uiConfirm,
15532     uiConflicts: () => uiConflicts,
15533     uiContributors: () => uiContributors,
15534     uiCurtain: () => uiCurtain,
15535     uiDataEditor: () => uiDataEditor,
15536     uiDataHeader: () => uiDataHeader,
15537     uiDisclosure: () => uiDisclosure,
15538     uiEditMenu: () => uiEditMenu,
15539     uiEntityEditor: () => uiEntityEditor,
15540     uiFeatureInfo: () => uiFeatureInfo,
15541     uiFeatureList: () => uiFeatureList,
15542     uiField: () => uiField,
15543     uiFieldAccess: () => uiFieldAccess,
15544     uiFieldAddress: () => uiFieldAddress,
15545     uiFieldCheck: () => uiFieldCheck,
15546     uiFieldCombo: () => uiFieldCombo,
15547     uiFieldCycleway: () => uiFieldCycleway,
15548     uiFieldDefaultCheck: () => uiFieldCheck,
15549     uiFieldEmail: () => uiFieldText,
15550     uiFieldHelp: () => uiFieldHelp,
15551     uiFieldIdentifier: () => uiFieldText,
15552     uiFieldLanes: () => uiFieldLanes,
15553     uiFieldLocalized: () => uiFieldLocalized,
15554     uiFieldManyCombo: () => uiFieldCombo,
15555     uiFieldMultiCombo: () => uiFieldCombo,
15556     uiFieldNetworkCombo: () => uiFieldCombo,
15557     uiFieldNumber: () => uiFieldText,
15558     uiFieldOnewayCheck: () => uiFieldCheck,
15559     uiFieldRadio: () => uiFieldRadio,
15560     uiFieldRestrictions: () => uiFieldRestrictions,
15561     uiFieldRoadheight: () => uiFieldRoadheight,
15562     uiFieldRoadspeed: () => uiFieldRoadspeed,
15563     uiFieldSemiCombo: () => uiFieldCombo,
15564     uiFieldStructureRadio: () => uiFieldRadio,
15565     uiFieldTel: () => uiFieldText,
15566     uiFieldText: () => uiFieldText,
15567     uiFieldTextarea: () => uiFieldTextarea,
15568     uiFieldTypeCombo: () => uiFieldCombo,
15569     uiFieldUrl: () => uiFieldText,
15570     uiFieldWikidata: () => uiFieldWikidata,
15571     uiFieldWikipedia: () => uiFieldWikipedia,
15572     uiFields: () => uiFields,
15573     uiFlash: () => uiFlash,
15574     uiFormFields: () => uiFormFields,
15575     uiFullScreen: () => uiFullScreen,
15576     uiGeolocate: () => uiGeolocate,
15577     uiImproveOsmComments: () => uiImproveOsmComments,
15578     uiImproveOsmDetails: () => uiImproveOsmDetails,
15579     uiImproveOsmEditor: () => uiImproveOsmEditor,
15580     uiImproveOsmHeader: () => uiImproveOsmHeader,
15581     uiInfo: () => uiInfo,
15582     uiInfoPanels: () => uiInfoPanels,
15583     uiInit: () => uiInit,
15584     uiInspector: () => uiInspector,
15585     uiIntro: () => uiIntro,
15586     uiIssuesInfo: () => uiIssuesInfo,
15587     uiKeepRightDetails: () => uiKeepRightDetails,
15588     uiKeepRightEditor: () => uiKeepRightEditor,
15589     uiKeepRightHeader: () => uiKeepRightHeader,
15590     uiLasso: () => uiLasso,
15591     uiLoading: () => uiLoading,
15592     uiMapInMap: () => uiMapInMap,
15593     uiModal: () => uiModal,
15594     uiNoteComments: () => uiNoteComments,
15595     uiNoteEditor: () => uiNoteEditor,
15596     uiNoteHeader: () => uiNoteHeader,
15597     uiNoteReport: () => uiNoteReport,
15598     uiNotice: () => uiNotice,
15599     uiPaneBackground: () => uiPaneBackground,
15600     uiPaneHelp: () => uiPaneHelp,
15601     uiPaneIssues: () => uiPaneIssues,
15602     uiPaneMapData: () => uiPaneMapData,
15603     uiPanePreferences: () => uiPanePreferences,
15604     uiPanelBackground: () => uiPanelBackground,
15605     uiPanelHistory: () => uiPanelHistory,
15606     uiPanelLocation: () => uiPanelLocation,
15607     uiPanelMeasurement: () => uiPanelMeasurement,
15608     uiPopover: () => uiPopover,
15609     uiPresetIcon: () => uiPresetIcon,
15610     uiPresetList: () => uiPresetList,
15611     uiRestore: () => uiRestore,
15612     uiScale: () => uiScale,
15613     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
15614     uiSectionBackgroundList: () => uiSectionBackgroundList,
15615     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
15616     uiSectionChanges: () => uiSectionChanges,
15617     uiSectionDataLayers: () => uiSectionDataLayers,
15618     uiSectionEntityIssues: () => uiSectionEntityIssues,
15619     uiSectionFeatureType: () => uiSectionFeatureType,
15620     uiSectionMapFeatures: () => uiSectionMapFeatures,
15621     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
15622     uiSectionOverlayList: () => uiSectionOverlayList,
15623     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
15624     uiSectionPresetFields: () => uiSectionPresetFields,
15625     uiSectionPrivacy: () => uiSectionPrivacy,
15626     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
15627     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
15628     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
15629     uiSectionSelectionList: () => uiSectionSelectionList,
15630     uiSectionValidationIssues: () => uiSectionValidationIssues,
15631     uiSectionValidationOptions: () => uiSectionValidationOptions,
15632     uiSectionValidationRules: () => uiSectionValidationRules,
15633     uiSectionValidationStatus: () => uiSectionValidationStatus,
15634     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
15635     uiSettingsCustomData: () => uiSettingsCustomData,
15636     uiSidebar: () => uiSidebar,
15637     uiSourceSwitch: () => uiSourceSwitch,
15638     uiSpinner: () => uiSpinner,
15639     uiSplash: () => uiSplash,
15640     uiStatus: () => uiStatus,
15641     uiSuccess: () => uiSuccess,
15642     uiTagReference: () => uiTagReference,
15643     uiToggle: () => uiToggle,
15644     uiTooltip: () => uiTooltip,
15645     uiVersion: () => uiVersion,
15646     uiViewOnKeepRight: () => uiViewOnKeepRight,
15647     uiViewOnOSM: () => uiViewOnOSM,
15648     uiZoom: () => uiZoom,
15649     utilAesDecrypt: () => utilAesDecrypt,
15650     utilAesEncrypt: () => utilAesEncrypt,
15651     utilArrayChunk: () => utilArrayChunk,
15652     utilArrayDifference: () => utilArrayDifference,
15653     utilArrayFlatten: () => utilArrayFlatten,
15654     utilArrayGroupBy: () => utilArrayGroupBy,
15655     utilArrayIdentical: () => utilArrayIdentical,
15656     utilArrayIntersection: () => utilArrayIntersection,
15657     utilArrayUnion: () => utilArrayUnion,
15658     utilArrayUniq: () => utilArrayUniq,
15659     utilArrayUniqBy: () => utilArrayUniqBy,
15660     utilAsyncMap: () => utilAsyncMap,
15661     utilCleanTags: () => utilCleanTags,
15662     utilCombinedTags: () => utilCombinedTags,
15663     utilCompareIDs: () => utilCompareIDs,
15664     utilDeepMemberSelector: () => utilDeepMemberSelector,
15665     utilDetect: () => utilDetect,
15666     utilDisplayLabel: () => utilDisplayLabel,
15667     utilDisplayName: () => utilDisplayName,
15668     utilDisplayNameForPath: () => utilDisplayNameForPath,
15669     utilDisplayType: () => utilDisplayType,
15670     utilEditDistance: () => utilEditDistance,
15671     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
15672     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
15673     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
15674     utilEntityRoot: () => utilEntityRoot,
15675     utilEntitySelector: () => utilEntitySelector,
15676     utilFastMouse: () => utilFastMouse,
15677     utilFunctor: () => utilFunctor,
15678     utilGetAllNodes: () => utilGetAllNodes,
15679     utilGetSetValue: () => utilGetSetValue,
15680     utilHashcode: () => utilHashcode,
15681     utilHighlightEntities: () => utilHighlightEntities,
15682     utilKeybinding: () => utilKeybinding,
15683     utilNoAuto: () => utilNoAuto,
15684     utilObjectOmit: () => utilObjectOmit,
15685     utilOldestID: () => utilOldestID,
15686     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
15687     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
15688     utilQsString: () => utilQsString,
15689     utilRebind: () => utilRebind,
15690     utilSafeClassName: () => utilSafeClassName,
15691     utilSessionMutex: () => utilSessionMutex,
15692     utilSetTransform: () => utilSetTransform,
15693     utilStringQs: () => utilStringQs,
15694     utilTagDiff: () => utilTagDiff,
15695     utilTagText: () => utilTagText,
15696     utilTiler: () => utilTiler,
15697     utilTotalExtent: () => utilTotalExtent,
15698     utilTriggerEvent: () => utilTriggerEvent,
15699     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
15700     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
15701     utilUniqueDomId: () => utilUniqueDomId,
15702     utilWrap: () => utilWrap,
15703     validationAlmostJunction: () => validationAlmostJunction,
15704     validationCloseNodes: () => validationCloseNodes,
15705     validationCrossingWays: () => validationCrossingWays,
15706     validationDisconnectedWay: () => validationDisconnectedWay,
15707     validationFormatting: () => validationFormatting,
15708     validationHelpRequest: () => validationHelpRequest,
15709     validationImpossibleOneway: () => validationImpossibleOneway,
15710     validationIncompatibleSource: () => validationIncompatibleSource,
15711     validationMaprules: () => validationMaprules,
15712     validationMismatchedGeometry: () => validationMismatchedGeometry,
15713     validationMissingRole: () => validationMissingRole,
15714     validationMissingTag: () => validationMissingTag,
15715     validationOutdatedTags: () => validationOutdatedTags,
15716     validationPrivateData: () => validationPrivateData,
15717     validationSuspiciousName: () => validationSuspiciousName,
15718     validationUnsquareWay: () => validationUnsquareWay
15719   });
15720
15721   // modules/actions/add_entity.js
15722   function actionAddEntity(way) {
15723     return function(graph) {
15724       return graph.replace(way);
15725     };
15726   }
15727
15728   // modules/actions/reverse.js
15729   function actionReverse(entityID, options2) {
15730     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
15731     var numeric = /^([+\-]?)(?=[\d.])/;
15732     var directionKey = /direction$/;
15733     var turn_lanes = /^turn:lanes:?/;
15734     var keyReplacements = [
15735       [/:right$/, ":left"],
15736       [/:left$/, ":right"],
15737       [/:forward$/, ":backward"],
15738       [/:backward$/, ":forward"],
15739       [/:right:/, ":left:"],
15740       [/:left:/, ":right:"],
15741       [/:forward:/, ":backward:"],
15742       [/:backward:/, ":forward:"]
15743     ];
15744     var valueReplacements = {
15745       left: "right",
15746       right: "left",
15747       up: "down",
15748       down: "up",
15749       forward: "backward",
15750       backward: "forward",
15751       forwards: "backward",
15752       backwards: "forward"
15753     };
15754     var roleReplacements = {
15755       forward: "backward",
15756       backward: "forward",
15757       forwards: "backward",
15758       backwards: "forward"
15759     };
15760     var onewayReplacements = {
15761       yes: "-1",
15762       "1": "-1",
15763       "-1": "yes"
15764     };
15765     var compassReplacements = {
15766       N: "S",
15767       NNE: "SSW",
15768       NE: "SW",
15769       ENE: "WSW",
15770       E: "W",
15771       ESE: "WNW",
15772       SE: "NW",
15773       SSE: "NNW",
15774       S: "N",
15775       SSW: "NNE",
15776       SW: "NE",
15777       WSW: "ENE",
15778       W: "E",
15779       WNW: "ESE",
15780       NW: "SE",
15781       NNW: "SSE"
15782     };
15783     function reverseKey(key) {
15784       for (var i2 = 0; i2 < keyReplacements.length; ++i2) {
15785         var replacement = keyReplacements[i2];
15786         if (replacement[0].test(key)) {
15787           return key.replace(replacement[0], replacement[1]);
15788         }
15789       }
15790       return key;
15791     }
15792     function reverseValue(key, value, includeAbsolute) {
15793       if (ignoreKey.test(key))
15794         return value;
15795       if (turn_lanes.test(key)) {
15796         return value;
15797       } else if (key === "incline" && numeric.test(value)) {
15798         return value.replace(numeric, function(_, sign2) {
15799           return sign2 === "-" ? "" : "-";
15800         });
15801       } else if (options2 && options2.reverseOneway && key === "oneway") {
15802         return onewayReplacements[value] || value;
15803       } else if (includeAbsolute && directionKey.test(key)) {
15804         if (compassReplacements[value])
15805           return compassReplacements[value];
15806         var degrees3 = parseFloat(value);
15807         if (typeof degrees3 === "number" && !isNaN(degrees3)) {
15808           if (degrees3 < 180) {
15809             degrees3 += 180;
15810           } else {
15811             degrees3 -= 180;
15812           }
15813           return degrees3.toString();
15814         }
15815       }
15816       return valueReplacements[value] || value;
15817     }
15818     function reverseNodeTags(graph, nodeIDs) {
15819       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
15820         var node = graph.hasEntity(nodeIDs[i2]);
15821         if (!node || !Object.keys(node.tags).length)
15822           continue;
15823         var tags = {};
15824         for (var key in node.tags) {
15825           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
15826         }
15827         graph = graph.replace(node.update({ tags }));
15828       }
15829       return graph;
15830     }
15831     function reverseWay(graph, way) {
15832       var nodes = way.nodes.slice().reverse();
15833       var tags = {};
15834       var role;
15835       for (var key in way.tags) {
15836         tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
15837       }
15838       graph.parentRelations(way).forEach(function(relation) {
15839         relation.members.forEach(function(member, index) {
15840           if (member.id === way.id && (role = roleReplacements[member.role])) {
15841             relation = relation.updateMember({ role }, index);
15842             graph = graph.replace(relation);
15843           }
15844         });
15845       });
15846       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
15847     }
15848     var action = function(graph) {
15849       var entity = graph.entity(entityID);
15850       if (entity.type === "way") {
15851         return reverseWay(graph, entity);
15852       }
15853       return reverseNodeTags(graph, [entityID]);
15854     };
15855     action.disabled = function(graph) {
15856       var entity = graph.hasEntity(entityID);
15857       if (!entity || entity.type === "way")
15858         return false;
15859       for (var key in entity.tags) {
15860         var value = entity.tags[key];
15861         if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
15862           return false;
15863         }
15864       }
15865       return "nondirectional_node";
15866     };
15867     action.entityID = function() {
15868       return entityID;
15869     };
15870     return action;
15871   }
15872
15873   // modules/osm/tags.js
15874   function osmIsInterestingTag(key) {
15875     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && key.indexOf("tiger:") !== 0;
15876   }
15877   var osmAreaKeys = {};
15878   function osmSetAreaKeys(value) {
15879     osmAreaKeys = value;
15880   }
15881   var osmAreaKeysExceptions = {
15882     highway: {
15883       elevator: true,
15884       rest_area: true,
15885       services: true
15886     },
15887     public_transport: {
15888       platform: true
15889     },
15890     railway: {
15891       platform: true,
15892       roundhouse: true,
15893       station: true,
15894       traverser: true,
15895       turntable: true,
15896       wash: true
15897     },
15898     waterway: {
15899       dam: true
15900     }
15901   };
15902   function osmTagSuggestingArea(tags) {
15903     if (tags.area === "yes")
15904       return { area: "yes" };
15905     if (tags.area === "no")
15906       return null;
15907     var returnTags = {};
15908     for (var key in tags) {
15909       if (key in osmAreaKeys && !(tags[key] in osmAreaKeys[key])) {
15910         returnTags[key] = tags[key];
15911         return returnTags;
15912       }
15913       if (key in osmAreaKeysExceptions && tags[key] in osmAreaKeysExceptions[key]) {
15914         returnTags[key] = tags[key];
15915         return returnTags;
15916       }
15917     }
15918     return null;
15919   }
15920   var osmPointTags = {};
15921   function osmSetPointTags(value) {
15922     osmPointTags = value;
15923   }
15924   var osmVertexTags = {};
15925   function osmSetVertexTags(value) {
15926     osmVertexTags = value;
15927   }
15928   function osmNodeGeometriesForTags(nodeTags) {
15929     var geometries = {};
15930     for (var key in nodeTags) {
15931       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
15932         geometries.point = true;
15933       }
15934       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
15935         geometries.vertex = true;
15936       }
15937       if (geometries.point && geometries.vertex)
15938         break;
15939     }
15940     return geometries;
15941   }
15942   var osmOneWayTags = {
15943     "aerialway": {
15944       "chair_lift": true,
15945       "drag_lift": true,
15946       "j-bar": true,
15947       "magic_carpet": true,
15948       "mixed_lift": true,
15949       "platter": true,
15950       "rope_tow": true,
15951       "t-bar": true,
15952       "zip_line": true
15953     },
15954     "highway": {
15955       "motorway": true
15956     },
15957     "junction": {
15958       "circular": true,
15959       "roundabout": true
15960     },
15961     "man_made": {
15962       "goods_conveyor": true,
15963       "piste:halfpipe": true
15964     },
15965     "piste:type": {
15966       "downhill": true,
15967       "sled": true,
15968       "yes": true
15969     },
15970     "seamark:type": {
15971       "separation_lane": true,
15972       "separation_roundabout": true
15973     },
15974     "waterway": {
15975       "canal": true,
15976       "ditch": true,
15977       "drain": true,
15978       "fish_pass": true,
15979       "river": true,
15980       "stream": true,
15981       "tidal_channel": true
15982     }
15983   };
15984   var osmPavedTags = {
15985     "surface": {
15986       "paved": true,
15987       "asphalt": true,
15988       "concrete": true,
15989       "concrete:lanes": true,
15990       "concrete:plates": true
15991     },
15992     "tracktype": {
15993       "grade1": true
15994     }
15995   };
15996   var osmSemipavedTags = {
15997     "surface": {
15998       "cobblestone": true,
15999       "cobblestone:flattened": true,
16000       "unhewn_cobblestone": true,
16001       "sett": true,
16002       "paving_stones": true,
16003       "metal": true,
16004       "wood": true
16005     }
16006   };
16007   var osmRightSideIsInsideTags = {
16008     "natural": {
16009       "cliff": true,
16010       "coastline": "coastline"
16011     },
16012     "barrier": {
16013       "retaining_wall": true,
16014       "kerb": true,
16015       "guard_rail": true,
16016       "city_wall": true
16017     },
16018     "man_made": {
16019       "embankment": true
16020     },
16021     "waterway": {
16022       "weir": true
16023     }
16024   };
16025   var osmRoutableHighwayTagValues = {
16026     motorway: true,
16027     trunk: true,
16028     primary: true,
16029     secondary: true,
16030     tertiary: true,
16031     residential: true,
16032     motorway_link: true,
16033     trunk_link: true,
16034     primary_link: true,
16035     secondary_link: true,
16036     tertiary_link: true,
16037     unclassified: true,
16038     road: true,
16039     service: true,
16040     track: true,
16041     living_street: true,
16042     bus_guideway: true,
16043     path: true,
16044     footway: true,
16045     cycleway: true,
16046     bridleway: true,
16047     pedestrian: true,
16048     corridor: true,
16049     steps: true
16050   };
16051   var osmPathHighwayTagValues = {
16052     path: true,
16053     footway: true,
16054     cycleway: true,
16055     bridleway: true,
16056     pedestrian: true,
16057     corridor: true,
16058     steps: true
16059   };
16060   var osmRailwayTrackTagValues = {
16061     rail: true,
16062     light_rail: true,
16063     tram: true,
16064     subway: true,
16065     monorail: true,
16066     funicular: true,
16067     miniature: true,
16068     narrow_gauge: true,
16069     disused: true,
16070     preserved: true
16071   };
16072   var osmFlowingWaterwayTagValues = {
16073     canal: true,
16074     ditch: true,
16075     drain: true,
16076     fish_pass: true,
16077     river: true,
16078     stream: true,
16079     tidal_channel: true
16080   };
16081
16082   // node_modules/d3-array/src/ascending.js
16083   function ascending(a, b) {
16084     return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
16085   }
16086
16087   // node_modules/d3-array/src/descending.js
16088   function descending(a, b) {
16089     return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
16090   }
16091
16092   // node_modules/d3-array/src/bisector.js
16093   function bisector(f2) {
16094     let compare1, compare2, delta;
16095     if (f2.length !== 2) {
16096       compare1 = ascending;
16097       compare2 = (d, x) => ascending(f2(d), x);
16098       delta = (d, x) => f2(d) - x;
16099     } else {
16100       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
16101       compare2 = f2;
16102       delta = f2;
16103     }
16104     function left(a, x, lo = 0, hi = a.length) {
16105       if (lo < hi) {
16106         if (compare1(x, x) !== 0)
16107           return hi;
16108         do {
16109           const mid = lo + hi >>> 1;
16110           if (compare2(a[mid], x) < 0)
16111             lo = mid + 1;
16112           else
16113             hi = mid;
16114         } while (lo < hi);
16115       }
16116       return lo;
16117     }
16118     function right(a, x, lo = 0, hi = a.length) {
16119       if (lo < hi) {
16120         if (compare1(x, x) !== 0)
16121           return hi;
16122         do {
16123           const mid = lo + hi >>> 1;
16124           if (compare2(a[mid], x) <= 0)
16125             lo = mid + 1;
16126           else
16127             hi = mid;
16128         } while (lo < hi);
16129       }
16130       return lo;
16131     }
16132     function center(a, x, lo = 0, hi = a.length) {
16133       const i2 = left(a, x, lo, hi - 1);
16134       return i2 > lo && delta(a[i2 - 1], x) > -delta(a[i2], x) ? i2 - 1 : i2;
16135     }
16136     return { left, center, right };
16137   }
16138   function zero() {
16139     return 0;
16140   }
16141
16142   // node_modules/d3-array/src/number.js
16143   function number(x) {
16144     return x === null ? NaN : +x;
16145   }
16146   function* numbers(values, valueof) {
16147     if (valueof === void 0) {
16148       for (let value of values) {
16149         if (value != null && (value = +value) >= value) {
16150           yield value;
16151         }
16152       }
16153     } else {
16154       let index = -1;
16155       for (let value of values) {
16156         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16157           yield value;
16158         }
16159       }
16160     }
16161   }
16162
16163   // node_modules/d3-array/src/bisect.js
16164   var ascendingBisect = bisector(ascending);
16165   var bisectRight = ascendingBisect.right;
16166   var bisectLeft = ascendingBisect.left;
16167   var bisectCenter = bisector(number).center;
16168   var bisect_default = bisectRight;
16169
16170   // node_modules/d3-array/src/fsum.js
16171   var Adder = class {
16172     constructor() {
16173       this._partials = new Float64Array(32);
16174       this._n = 0;
16175     }
16176     add(x) {
16177       const p = this._partials;
16178       let i2 = 0;
16179       for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
16180         const y = p[j2], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
16181         if (lo)
16182           p[i2++] = lo;
16183         x = hi;
16184       }
16185       p[i2] = x;
16186       this._n = i2 + 1;
16187       return this;
16188     }
16189     valueOf() {
16190       const p = this._partials;
16191       let n2 = this._n, x, y, lo, hi = 0;
16192       if (n2 > 0) {
16193         hi = p[--n2];
16194         while (n2 > 0) {
16195           x = hi;
16196           y = p[--n2];
16197           hi = x + y;
16198           lo = y - (hi - x);
16199           if (lo)
16200             break;
16201         }
16202         if (n2 > 0 && (lo < 0 && p[n2 - 1] < 0 || lo > 0 && p[n2 - 1] > 0)) {
16203           y = lo * 2;
16204           x = hi + y;
16205           if (y == x - hi)
16206             hi = x;
16207         }
16208       }
16209       return hi;
16210     }
16211   };
16212
16213   // node_modules/d3-array/src/sort.js
16214   function compareDefined(compare = ascending) {
16215     if (compare === ascending)
16216       return ascendingDefined;
16217     if (typeof compare !== "function")
16218       throw new TypeError("compare is not a function");
16219     return (a, b) => {
16220       const x = compare(a, b);
16221       if (x || x === 0)
16222         return x;
16223       return (compare(b, b) === 0) - (compare(a, a) === 0);
16224     };
16225   }
16226   function ascendingDefined(a, b) {
16227     return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
16228   }
16229
16230   // node_modules/d3-array/src/ticks.js
16231   var e10 = Math.sqrt(50);
16232   var e5 = Math.sqrt(10);
16233   var e2 = Math.sqrt(2);
16234   function ticks(start2, stop, count) {
16235     var reverse, i2 = -1, n2, ticks2, step;
16236     stop = +stop, start2 = +start2, count = +count;
16237     if (start2 === stop && count > 0)
16238       return [start2];
16239     if (reverse = stop < start2)
16240       n2 = start2, start2 = stop, stop = n2;
16241     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16242       return [];
16243     if (step > 0) {
16244       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16245       if (r0 * step < start2)
16246         ++r0;
16247       if (r1 * step > stop)
16248         --r1;
16249       ticks2 = new Array(n2 = r1 - r0 + 1);
16250       while (++i2 < n2)
16251         ticks2[i2] = (r0 + i2) * step;
16252     } else {
16253       step = -step;
16254       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16255       if (r0 / step < start2)
16256         ++r0;
16257       if (r1 / step > stop)
16258         --r1;
16259       ticks2 = new Array(n2 = r1 - r0 + 1);
16260       while (++i2 < n2)
16261         ticks2[i2] = (r0 + i2) / step;
16262     }
16263     if (reverse)
16264       ticks2.reverse();
16265     return ticks2;
16266   }
16267   function tickIncrement(start2, stop, count) {
16268     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16269     return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
16270   }
16271   function tickStep(start2, stop, count) {
16272     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16273     if (error >= e10)
16274       step1 *= 10;
16275     else if (error >= e5)
16276       step1 *= 5;
16277     else if (error >= e2)
16278       step1 *= 2;
16279     return stop < start2 ? -step1 : step1;
16280   }
16281
16282   // node_modules/d3-array/src/max.js
16283   function max(values, valueof) {
16284     let max3;
16285     if (valueof === void 0) {
16286       for (const value of values) {
16287         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16288           max3 = value;
16289         }
16290       }
16291     } else {
16292       let index = -1;
16293       for (let value of values) {
16294         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16295           max3 = value;
16296         }
16297       }
16298     }
16299     return max3;
16300   }
16301
16302   // node_modules/d3-array/src/min.js
16303   function min(values, valueof) {
16304     let min3;
16305     if (valueof === void 0) {
16306       for (const value of values) {
16307         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16308           min3 = value;
16309         }
16310       }
16311     } else {
16312       let index = -1;
16313       for (let value of values) {
16314         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16315           min3 = value;
16316         }
16317       }
16318     }
16319     return min3;
16320   }
16321
16322   // node_modules/d3-array/src/quickselect.js
16323   function quickselect(array2, k, left = 0, right = array2.length - 1, compare) {
16324     compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16325     while (right > left) {
16326       if (right - left > 600) {
16327         const n2 = right - left + 1;
16328         const m = k - left + 1;
16329         const z = Math.log(n2);
16330         const s = 0.5 * Math.exp(2 * z / 3);
16331         const sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
16332         const newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
16333         const newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
16334         quickselect(array2, k, newLeft, newRight, compare);
16335       }
16336       const t = array2[k];
16337       let i2 = left;
16338       let j2 = right;
16339       swap(array2, left, k);
16340       if (compare(array2[right], t) > 0)
16341         swap(array2, left, right);
16342       while (i2 < j2) {
16343         swap(array2, i2, j2), ++i2, --j2;
16344         while (compare(array2[i2], t) < 0)
16345           ++i2;
16346         while (compare(array2[j2], t) > 0)
16347           --j2;
16348       }
16349       if (compare(array2[left], t) === 0)
16350         swap(array2, left, j2);
16351       else
16352         ++j2, swap(array2, j2, right);
16353       if (j2 <= k)
16354         left = j2 + 1;
16355       if (k <= j2)
16356         right = j2 - 1;
16357     }
16358     return array2;
16359   }
16360   function swap(array2, i2, j2) {
16361     const t = array2[i2];
16362     array2[i2] = array2[j2];
16363     array2[j2] = t;
16364   }
16365
16366   // node_modules/d3-array/src/quantile.js
16367   function quantile(values, p, valueof) {
16368     values = Float64Array.from(numbers(values, valueof));
16369     if (!(n2 = values.length))
16370       return;
16371     if ((p = +p) <= 0 || n2 < 2)
16372       return min(values);
16373     if (p >= 1)
16374       return max(values);
16375     var n2, i2 = (n2 - 1) * p, i0 = Math.floor(i2), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
16376     return value0 + (value1 - value0) * (i2 - i0);
16377   }
16378
16379   // node_modules/d3-array/src/median.js
16380   function median(values, valueof) {
16381     return quantile(values, 0.5, valueof);
16382   }
16383
16384   // node_modules/d3-array/src/merge.js
16385   function* flatten(arrays) {
16386     for (const array2 of arrays) {
16387       yield* array2;
16388     }
16389   }
16390   function merge(arrays) {
16391     return Array.from(flatten(arrays));
16392   }
16393
16394   // node_modules/d3-array/src/range.js
16395   function range(start2, stop, step) {
16396     start2 = +start2, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n2 < 3 ? 1 : +step;
16397     var i2 = -1, n2 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n2);
16398     while (++i2 < n2) {
16399       range3[i2] = start2 + i2 * step;
16400     }
16401     return range3;
16402   }
16403
16404   // node_modules/d3-geo/src/math.js
16405   var epsilon = 1e-6;
16406   var epsilon2 = 1e-12;
16407   var pi = Math.PI;
16408   var halfPi = pi / 2;
16409   var quarterPi = pi / 4;
16410   var tau = pi * 2;
16411   var degrees = 180 / pi;
16412   var radians = pi / 180;
16413   var abs = Math.abs;
16414   var atan = Math.atan;
16415   var atan2 = Math.atan2;
16416   var cos = Math.cos;
16417   var exp = Math.exp;
16418   var log = Math.log;
16419   var sin = Math.sin;
16420   var sign = Math.sign || function(x) {
16421     return x > 0 ? 1 : x < 0 ? -1 : 0;
16422   };
16423   var sqrt = Math.sqrt;
16424   var tan = Math.tan;
16425   function acos(x) {
16426     return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
16427   }
16428   function asin(x) {
16429     return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
16430   }
16431
16432   // node_modules/d3-geo/src/noop.js
16433   function noop() {
16434   }
16435
16436   // node_modules/d3-geo/src/stream.js
16437   function streamGeometry(geometry, stream) {
16438     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16439       streamGeometryType[geometry.type](geometry, stream);
16440     }
16441   }
16442   var streamObjectType = {
16443     Feature: function(object, stream) {
16444       streamGeometry(object.geometry, stream);
16445     },
16446     FeatureCollection: function(object, stream) {
16447       var features2 = object.features, i2 = -1, n2 = features2.length;
16448       while (++i2 < n2)
16449         streamGeometry(features2[i2].geometry, stream);
16450     }
16451   };
16452   var streamGeometryType = {
16453     Sphere: function(object, stream) {
16454       stream.sphere();
16455     },
16456     Point: function(object, stream) {
16457       object = object.coordinates;
16458       stream.point(object[0], object[1], object[2]);
16459     },
16460     MultiPoint: function(object, stream) {
16461       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16462       while (++i2 < n2)
16463         object = coordinates[i2], stream.point(object[0], object[1], object[2]);
16464     },
16465     LineString: function(object, stream) {
16466       streamLine(object.coordinates, stream, 0);
16467     },
16468     MultiLineString: function(object, stream) {
16469       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16470       while (++i2 < n2)
16471         streamLine(coordinates[i2], stream, 0);
16472     },
16473     Polygon: function(object, stream) {
16474       streamPolygon(object.coordinates, stream);
16475     },
16476     MultiPolygon: function(object, stream) {
16477       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16478       while (++i2 < n2)
16479         streamPolygon(coordinates[i2], stream);
16480     },
16481     GeometryCollection: function(object, stream) {
16482       var geometries = object.geometries, i2 = -1, n2 = geometries.length;
16483       while (++i2 < n2)
16484         streamGeometry(geometries[i2], stream);
16485     }
16486   };
16487   function streamLine(coordinates, stream, closed) {
16488     var i2 = -1, n2 = coordinates.length - closed, coordinate;
16489     stream.lineStart();
16490     while (++i2 < n2)
16491       coordinate = coordinates[i2], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16492     stream.lineEnd();
16493   }
16494   function streamPolygon(coordinates, stream) {
16495     var i2 = -1, n2 = coordinates.length;
16496     stream.polygonStart();
16497     while (++i2 < n2)
16498       streamLine(coordinates[i2], stream, 1);
16499     stream.polygonEnd();
16500   }
16501   function stream_default(object, stream) {
16502     if (object && streamObjectType.hasOwnProperty(object.type)) {
16503       streamObjectType[object.type](object, stream);
16504     } else {
16505       streamGeometry(object, stream);
16506     }
16507   }
16508
16509   // node_modules/d3-geo/src/area.js
16510   var areaRingSum = new Adder();
16511   var areaSum = new Adder();
16512   var lambda00;
16513   var phi00;
16514   var lambda0;
16515   var cosPhi0;
16516   var sinPhi0;
16517   var areaStream = {
16518     point: noop,
16519     lineStart: noop,
16520     lineEnd: noop,
16521     polygonStart: function() {
16522       areaRingSum = new Adder();
16523       areaStream.lineStart = areaRingStart;
16524       areaStream.lineEnd = areaRingEnd;
16525     },
16526     polygonEnd: function() {
16527       var areaRing = +areaRingSum;
16528       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
16529       this.lineStart = this.lineEnd = this.point = noop;
16530     },
16531     sphere: function() {
16532       areaSum.add(tau);
16533     }
16534   };
16535   function areaRingStart() {
16536     areaStream.point = areaPointFirst;
16537   }
16538   function areaRingEnd() {
16539     areaPoint(lambda00, phi00);
16540   }
16541   function areaPointFirst(lambda, phi) {
16542     areaStream.point = areaPoint;
16543     lambda00 = lambda, phi00 = phi;
16544     lambda *= radians, phi *= radians;
16545     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
16546   }
16547   function areaPoint(lambda, phi) {
16548     lambda *= radians, phi *= radians;
16549     phi = phi / 2 + quarterPi;
16550     var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * cos(adLambda), v = k * sdLambda * sin(adLambda);
16551     areaRingSum.add(atan2(v, u));
16552     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
16553   }
16554   function area_default(object) {
16555     areaSum = new Adder();
16556     stream_default(object, areaStream);
16557     return areaSum * 2;
16558   }
16559
16560   // node_modules/d3-geo/src/cartesian.js
16561   function spherical(cartesian2) {
16562     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
16563   }
16564   function cartesian(spherical2) {
16565     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
16566     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
16567   }
16568   function cartesianDot(a, b) {
16569     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
16570   }
16571   function cartesianCross(a, b) {
16572     return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
16573   }
16574   function cartesianAddInPlace(a, b) {
16575     a[0] += b[0], a[1] += b[1], a[2] += b[2];
16576   }
16577   function cartesianScale(vector, k) {
16578     return [vector[0] * k, vector[1] * k, vector[2] * k];
16579   }
16580   function cartesianNormalizeInPlace(d) {
16581     var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
16582     d[0] /= l, d[1] /= l, d[2] /= l;
16583   }
16584
16585   // node_modules/d3-geo/src/bounds.js
16586   var lambda02;
16587   var phi0;
16588   var lambda1;
16589   var phi1;
16590   var lambda2;
16591   var lambda002;
16592   var phi002;
16593   var p0;
16594   var deltaSum;
16595   var ranges;
16596   var range2;
16597   var boundsStream = {
16598     point: boundsPoint,
16599     lineStart: boundsLineStart,
16600     lineEnd: boundsLineEnd,
16601     polygonStart: function() {
16602       boundsStream.point = boundsRingPoint;
16603       boundsStream.lineStart = boundsRingStart;
16604       boundsStream.lineEnd = boundsRingEnd;
16605       deltaSum = new Adder();
16606       areaStream.polygonStart();
16607     },
16608     polygonEnd: function() {
16609       areaStream.polygonEnd();
16610       boundsStream.point = boundsPoint;
16611       boundsStream.lineStart = boundsLineStart;
16612       boundsStream.lineEnd = boundsLineEnd;
16613       if (areaRingSum < 0)
16614         lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16615       else if (deltaSum > epsilon)
16616         phi1 = 90;
16617       else if (deltaSum < -epsilon)
16618         phi0 = -90;
16619       range2[0] = lambda02, range2[1] = lambda1;
16620     },
16621     sphere: function() {
16622       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16623     }
16624   };
16625   function boundsPoint(lambda, phi) {
16626     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16627     if (phi < phi0)
16628       phi0 = phi;
16629     if (phi > phi1)
16630       phi1 = phi;
16631   }
16632   function linePoint(lambda, phi) {
16633     var p = cartesian([lambda * radians, phi * radians]);
16634     if (p0) {
16635       var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
16636       cartesianNormalizeInPlace(inflection);
16637       inflection = spherical(inflection);
16638       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
16639       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16640         phii = inflection[1] * degrees;
16641         if (phii > phi1)
16642           phi1 = phii;
16643       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16644         phii = -inflection[1] * degrees;
16645         if (phii < phi0)
16646           phi0 = phii;
16647       } else {
16648         if (phi < phi0)
16649           phi0 = phi;
16650         if (phi > phi1)
16651           phi1 = phi;
16652       }
16653       if (antimeridian) {
16654         if (lambda < lambda2) {
16655           if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16656             lambda1 = lambda;
16657         } else {
16658           if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16659             lambda02 = lambda;
16660         }
16661       } else {
16662         if (lambda1 >= lambda02) {
16663           if (lambda < lambda02)
16664             lambda02 = lambda;
16665           if (lambda > lambda1)
16666             lambda1 = lambda;
16667         } else {
16668           if (lambda > lambda2) {
16669             if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16670               lambda1 = lambda;
16671           } else {
16672             if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16673               lambda02 = lambda;
16674           }
16675         }
16676       }
16677     } else {
16678       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16679     }
16680     if (phi < phi0)
16681       phi0 = phi;
16682     if (phi > phi1)
16683       phi1 = phi;
16684     p0 = p, lambda2 = lambda;
16685   }
16686   function boundsLineStart() {
16687     boundsStream.point = linePoint;
16688   }
16689   function boundsLineEnd() {
16690     range2[0] = lambda02, range2[1] = lambda1;
16691     boundsStream.point = boundsPoint;
16692     p0 = null;
16693   }
16694   function boundsRingPoint(lambda, phi) {
16695     if (p0) {
16696       var delta = lambda - lambda2;
16697       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
16698     } else {
16699       lambda002 = lambda, phi002 = phi;
16700     }
16701     areaStream.point(lambda, phi);
16702     linePoint(lambda, phi);
16703   }
16704   function boundsRingStart() {
16705     areaStream.lineStart();
16706   }
16707   function boundsRingEnd() {
16708     boundsRingPoint(lambda002, phi002);
16709     areaStream.lineEnd();
16710     if (abs(deltaSum) > epsilon)
16711       lambda02 = -(lambda1 = 180);
16712     range2[0] = lambda02, range2[1] = lambda1;
16713     p0 = null;
16714   }
16715   function angle(lambda04, lambda12) {
16716     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
16717   }
16718   function rangeCompare(a, b) {
16719     return a[0] - b[0];
16720   }
16721   function rangeContains(range3, x) {
16722     return range3[0] <= range3[1] ? range3[0] <= x && x <= range3[1] : x < range3[0] || range3[1] < x;
16723   }
16724   function bounds_default(feature3) {
16725     var i2, n2, a, b, merged, deltaMax, delta;
16726     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
16727     ranges = [];
16728     stream_default(feature3, boundsStream);
16729     if (n2 = ranges.length) {
16730       ranges.sort(rangeCompare);
16731       for (i2 = 1, a = ranges[0], merged = [a]; i2 < n2; ++i2) {
16732         b = ranges[i2];
16733         if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {
16734           if (angle(a[0], b[1]) > angle(a[0], a[1]))
16735             a[1] = b[1];
16736           if (angle(b[0], a[1]) > angle(a[0], a[1]))
16737             a[0] = b[0];
16738         } else {
16739           merged.push(a = b);
16740         }
16741       }
16742       for (deltaMax = -Infinity, n2 = merged.length - 1, i2 = 0, a = merged[n2]; i2 <= n2; a = b, ++i2) {
16743         b = merged[i2];
16744         if ((delta = angle(a[1], b[0])) > deltaMax)
16745           deltaMax = delta, lambda02 = b[0], lambda1 = a[1];
16746       }
16747     }
16748     ranges = range2 = null;
16749     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
16750   }
16751
16752   // node_modules/d3-geo/src/compose.js
16753   function compose_default(a, b) {
16754     function compose(x, y) {
16755       return x = a(x, y), b(x[0], x[1]);
16756     }
16757     if (a.invert && b.invert)
16758       compose.invert = function(x, y) {
16759         return x = b.invert(x, y), x && a.invert(x[0], x[1]);
16760       };
16761     return compose;
16762   }
16763
16764   // node_modules/d3-geo/src/rotation.js
16765   function rotationIdentity(lambda, phi) {
16766     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
16767   }
16768   rotationIdentity.invert = rotationIdentity;
16769   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
16770     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
16771   }
16772   function forwardRotationLambda(deltaLambda) {
16773     return function(lambda, phi) {
16774       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
16775     };
16776   }
16777   function rotationLambda(deltaLambda) {
16778     var rotation = forwardRotationLambda(deltaLambda);
16779     rotation.invert = forwardRotationLambda(-deltaLambda);
16780     return rotation;
16781   }
16782   function rotationPhiGamma(deltaPhi, deltaGamma) {
16783     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
16784     function rotation(lambda, phi) {
16785       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
16786       return [
16787         atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
16788         asin(k * cosDeltaGamma + y * sinDeltaGamma)
16789       ];
16790     }
16791     rotation.invert = function(lambda, phi) {
16792       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
16793       return [
16794         atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
16795         asin(k * cosDeltaPhi - x * sinDeltaPhi)
16796       ];
16797     };
16798     return rotation;
16799   }
16800   function rotation_default(rotate) {
16801     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
16802     function forward(coordinates) {
16803       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
16804       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16805     }
16806     forward.invert = function(coordinates) {
16807       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
16808       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16809     };
16810     return forward;
16811   }
16812
16813   // node_modules/d3-geo/src/circle.js
16814   function circleStream(stream, radius, delta, direction, t0, t1) {
16815     if (!delta)
16816       return;
16817     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
16818     if (t0 == null) {
16819       t0 = radius + direction * tau;
16820       t1 = radius - step / 2;
16821     } else {
16822       t0 = circleRadius(cosRadius, t0);
16823       t1 = circleRadius(cosRadius, t1);
16824       if (direction > 0 ? t0 < t1 : t0 > t1)
16825         t0 += direction * tau;
16826     }
16827     for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
16828       point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
16829       stream.point(point[0], point[1]);
16830     }
16831   }
16832   function circleRadius(cosRadius, point) {
16833     point = cartesian(point), point[0] -= cosRadius;
16834     cartesianNormalizeInPlace(point);
16835     var radius = acos(-point[1]);
16836     return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
16837   }
16838
16839   // node_modules/d3-geo/src/clip/buffer.js
16840   function buffer_default() {
16841     var lines = [], line;
16842     return {
16843       point: function(x, y, m) {
16844         line.push([x, y, m]);
16845       },
16846       lineStart: function() {
16847         lines.push(line = []);
16848       },
16849       lineEnd: noop,
16850       rejoin: function() {
16851         if (lines.length > 1)
16852           lines.push(lines.pop().concat(lines.shift()));
16853       },
16854       result: function() {
16855         var result = lines;
16856         lines = [];
16857         line = null;
16858         return result;
16859       }
16860     };
16861   }
16862
16863   // node_modules/d3-geo/src/pointEqual.js
16864   function pointEqual_default(a, b) {
16865     return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;
16866   }
16867
16868   // node_modules/d3-geo/src/clip/rejoin.js
16869   function Intersection(point, points, other, entry) {
16870     this.x = point;
16871     this.z = points;
16872     this.o = other;
16873     this.e = entry;
16874     this.v = false;
16875     this.n = this.p = null;
16876   }
16877   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
16878     var subject = [], clip = [], i2, n2;
16879     segments.forEach(function(segment) {
16880       if ((n3 = segment.length - 1) <= 0)
16881         return;
16882       var n3, p02 = segment[0], p1 = segment[n3], x;
16883       if (pointEqual_default(p02, p1)) {
16884         if (!p02[2] && !p1[2]) {
16885           stream.lineStart();
16886           for (i2 = 0; i2 < n3; ++i2)
16887             stream.point((p02 = segment[i2])[0], p02[1]);
16888           stream.lineEnd();
16889           return;
16890         }
16891         p1[0] += 2 * epsilon;
16892       }
16893       subject.push(x = new Intersection(p02, segment, null, true));
16894       clip.push(x.o = new Intersection(p02, null, x, false));
16895       subject.push(x = new Intersection(p1, segment, null, false));
16896       clip.push(x.o = new Intersection(p1, null, x, true));
16897     });
16898     if (!subject.length)
16899       return;
16900     clip.sort(compareIntersection2);
16901     link(subject);
16902     link(clip);
16903     for (i2 = 0, n2 = clip.length; i2 < n2; ++i2) {
16904       clip[i2].e = startInside = !startInside;
16905     }
16906     var start2 = subject[0], points, point;
16907     while (1) {
16908       var current = start2, isSubject = true;
16909       while (current.v)
16910         if ((current = current.n) === start2)
16911           return;
16912       points = current.z;
16913       stream.lineStart();
16914       do {
16915         current.v = current.o.v = true;
16916         if (current.e) {
16917           if (isSubject) {
16918             for (i2 = 0, n2 = points.length; i2 < n2; ++i2)
16919               stream.point((point = points[i2])[0], point[1]);
16920           } else {
16921             interpolate(current.x, current.n.x, 1, stream);
16922           }
16923           current = current.n;
16924         } else {
16925           if (isSubject) {
16926             points = current.p.z;
16927             for (i2 = points.length - 1; i2 >= 0; --i2)
16928               stream.point((point = points[i2])[0], point[1]);
16929           } else {
16930             interpolate(current.x, current.p.x, -1, stream);
16931           }
16932           current = current.p;
16933         }
16934         current = current.o;
16935         points = current.z;
16936         isSubject = !isSubject;
16937       } while (!current.v);
16938       stream.lineEnd();
16939     }
16940   }
16941   function link(array2) {
16942     if (!(n2 = array2.length))
16943       return;
16944     var n2, i2 = 0, a = array2[0], b;
16945     while (++i2 < n2) {
16946       a.n = b = array2[i2];
16947       b.p = a;
16948       a = b;
16949     }
16950     a.n = b = array2[0];
16951     b.p = a;
16952   }
16953
16954   // node_modules/d3-geo/src/polygonContains.js
16955   function longitude(point) {
16956     return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
16957   }
16958   function polygonContains_default(polygon2, point) {
16959     var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
16960     var sum = new Adder();
16961     if (sinPhi === 1)
16962       phi = halfPi + epsilon;
16963     else if (sinPhi === -1)
16964       phi = -halfPi - epsilon;
16965     for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
16966       if (!(m = (ring = polygon2[i2]).length))
16967         continue;
16968       var ring, m, point0 = ring[m - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
16969       for (var j2 = 0; j2 < m; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
16970         var point1 = ring[j2], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k = sinPhi03 * sinPhi1;
16971         sum.add(atan2(k * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k * cos(absDelta)));
16972         angle2 += antimeridian ? delta + sign2 * tau : delta;
16973         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
16974           var arc = cartesianCross(cartesian(point0), cartesian(point1));
16975           cartesianNormalizeInPlace(arc);
16976           var intersection = cartesianCross(normal, arc);
16977           cartesianNormalizeInPlace(intersection);
16978           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
16979           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
16980             winding += antimeridian ^ delta >= 0 ? 1 : -1;
16981           }
16982         }
16983       }
16984     }
16985     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
16986   }
16987
16988   // node_modules/d3-geo/src/clip/index.js
16989   function clip_default(pointVisible, clipLine, interpolate, start2) {
16990     return function(sink) {
16991       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
16992       var clip = {
16993         point,
16994         lineStart,
16995         lineEnd,
16996         polygonStart: function() {
16997           clip.point = pointRing;
16998           clip.lineStart = ringStart;
16999           clip.lineEnd = ringEnd;
17000           segments = [];
17001           polygon2 = [];
17002         },
17003         polygonEnd: function() {
17004           clip.point = point;
17005           clip.lineStart = lineStart;
17006           clip.lineEnd = lineEnd;
17007           segments = merge(segments);
17008           var startInside = polygonContains_default(polygon2, start2);
17009           if (segments.length) {
17010             if (!polygonStarted)
17011               sink.polygonStart(), polygonStarted = true;
17012             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17013           } else if (startInside) {
17014             if (!polygonStarted)
17015               sink.polygonStart(), polygonStarted = true;
17016             sink.lineStart();
17017             interpolate(null, null, 1, sink);
17018             sink.lineEnd();
17019           }
17020           if (polygonStarted)
17021             sink.polygonEnd(), polygonStarted = false;
17022           segments = polygon2 = null;
17023         },
17024         sphere: function() {
17025           sink.polygonStart();
17026           sink.lineStart();
17027           interpolate(null, null, 1, sink);
17028           sink.lineEnd();
17029           sink.polygonEnd();
17030         }
17031       };
17032       function point(lambda, phi) {
17033         if (pointVisible(lambda, phi))
17034           sink.point(lambda, phi);
17035       }
17036       function pointLine(lambda, phi) {
17037         line.point(lambda, phi);
17038       }
17039       function lineStart() {
17040         clip.point = pointLine;
17041         line.lineStart();
17042       }
17043       function lineEnd() {
17044         clip.point = point;
17045         line.lineEnd();
17046       }
17047       function pointRing(lambda, phi) {
17048         ring.push([lambda, phi]);
17049         ringSink.point(lambda, phi);
17050       }
17051       function ringStart() {
17052         ringSink.lineStart();
17053         ring = [];
17054       }
17055       function ringEnd() {
17056         pointRing(ring[0][0], ring[0][1]);
17057         ringSink.lineEnd();
17058         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i2, n2 = ringSegments.length, m, segment, point2;
17059         ring.pop();
17060         polygon2.push(ring);
17061         ring = null;
17062         if (!n2)
17063           return;
17064         if (clean2 & 1) {
17065           segment = ringSegments[0];
17066           if ((m = segment.length - 1) > 0) {
17067             if (!polygonStarted)
17068               sink.polygonStart(), polygonStarted = true;
17069             sink.lineStart();
17070             for (i2 = 0; i2 < m; ++i2)
17071               sink.point((point2 = segment[i2])[0], point2[1]);
17072             sink.lineEnd();
17073           }
17074           return;
17075         }
17076         if (n2 > 1 && clean2 & 2)
17077           ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17078         segments.push(ringSegments.filter(validSegment));
17079       }
17080       return clip;
17081     };
17082   }
17083   function validSegment(segment) {
17084     return segment.length > 1;
17085   }
17086   function compareIntersection(a, b) {
17087     return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);
17088   }
17089
17090   // node_modules/d3-geo/src/clip/antimeridian.js
17091   var antimeridian_default = clip_default(function() {
17092     return true;
17093   }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi, -halfPi]);
17094   function clipAntimeridianLine(stream) {
17095     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17096     return {
17097       lineStart: function() {
17098         stream.lineStart();
17099         clean2 = 1;
17100       },
17101       point: function(lambda12, phi12) {
17102         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17103         if (abs(delta - pi) < epsilon) {
17104           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17105           stream.point(sign0, phi02);
17106           stream.lineEnd();
17107           stream.lineStart();
17108           stream.point(sign1, phi02);
17109           stream.point(lambda12, phi02);
17110           clean2 = 0;
17111         } else if (sign0 !== sign1 && delta >= pi) {
17112           if (abs(lambda04 - sign0) < epsilon)
17113             lambda04 -= sign0 * epsilon;
17114           if (abs(lambda12 - sign1) < epsilon)
17115             lambda12 -= sign1 * epsilon;
17116           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17117           stream.point(sign0, phi02);
17118           stream.lineEnd();
17119           stream.lineStart();
17120           stream.point(sign1, phi02);
17121           clean2 = 0;
17122         }
17123         stream.point(lambda04 = lambda12, phi02 = phi12);
17124         sign0 = sign1;
17125       },
17126       lineEnd: function() {
17127         stream.lineEnd();
17128         lambda04 = phi02 = NaN;
17129       },
17130       clean: function() {
17131         return 2 - clean2;
17132       }
17133     };
17134   }
17135   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17136     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17137     return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi02) * (cosPhi1 = cos(phi12)) * sin(lambda12) - sin(phi12) * (cosPhi03 = cos(phi02)) * sin(lambda04)) / (cosPhi03 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2;
17138   }
17139   function clipAntimeridianInterpolate(from, to, direction, stream) {
17140     var phi;
17141     if (from == null) {
17142       phi = direction * halfPi;
17143       stream.point(-pi, phi);
17144       stream.point(0, phi);
17145       stream.point(pi, phi);
17146       stream.point(pi, 0);
17147       stream.point(pi, -phi);
17148       stream.point(0, -phi);
17149       stream.point(-pi, -phi);
17150       stream.point(-pi, 0);
17151       stream.point(-pi, phi);
17152     } else if (abs(from[0] - to[0]) > epsilon) {
17153       var lambda = from[0] < to[0] ? pi : -pi;
17154       phi = direction * lambda / 2;
17155       stream.point(-lambda, phi);
17156       stream.point(0, phi);
17157       stream.point(lambda, phi);
17158     } else {
17159       stream.point(to[0], to[1]);
17160     }
17161   }
17162
17163   // node_modules/d3-geo/src/clip/circle.js
17164   function circle_default(radius) {
17165     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17166     function interpolate(from, to, direction, stream) {
17167       circleStream(stream, radius, delta, direction, from, to);
17168     }
17169     function visible(lambda, phi) {
17170       return cos(lambda) * cos(phi) > cr;
17171     }
17172     function clipLine(stream) {
17173       var point0, c0, v0, v00, clean2;
17174       return {
17175         lineStart: function() {
17176           v00 = v0 = false;
17177           clean2 = 1;
17178         },
17179         point: function(lambda, phi) {
17180           var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
17181           if (!point0 && (v00 = v0 = v))
17182             stream.lineStart();
17183           if (v !== v0) {
17184             point2 = intersect2(point0, point1);
17185             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17186               point1[2] = 1;
17187           }
17188           if (v !== v0) {
17189             clean2 = 0;
17190             if (v) {
17191               stream.lineStart();
17192               point2 = intersect2(point1, point0);
17193               stream.point(point2[0], point2[1]);
17194             } else {
17195               point2 = intersect2(point0, point1);
17196               stream.point(point2[0], point2[1], 2);
17197               stream.lineEnd();
17198             }
17199             point0 = point2;
17200           } else if (notHemisphere && point0 && smallRadius ^ v) {
17201             var t;
17202             if (!(c & c0) && (t = intersect2(point1, point0, true))) {
17203               clean2 = 0;
17204               if (smallRadius) {
17205                 stream.lineStart();
17206                 stream.point(t[0][0], t[0][1]);
17207                 stream.point(t[1][0], t[1][1]);
17208                 stream.lineEnd();
17209               } else {
17210                 stream.point(t[1][0], t[1][1]);
17211                 stream.lineEnd();
17212                 stream.lineStart();
17213                 stream.point(t[0][0], t[0][1], 3);
17214               }
17215             }
17216           }
17217           if (v && (!point0 || !pointEqual_default(point0, point1))) {
17218             stream.point(point1[0], point1[1]);
17219           }
17220           point0 = point1, v0 = v, c0 = c;
17221         },
17222         lineEnd: function() {
17223           if (v0)
17224             stream.lineEnd();
17225           point0 = null;
17226         },
17227         clean: function() {
17228           return clean2 | (v00 && v0) << 1;
17229         }
17230       };
17231     }
17232     function intersect2(a, b, two) {
17233       var pa = cartesian(a), pb = cartesian(b);
17234       var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
17235       if (!determinant)
17236         return !two && a;
17237       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2);
17238       cartesianAddInPlace(A, B);
17239       var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
17240       if (t2 < 0)
17241         return;
17242       var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
17243       cartesianAddInPlace(q, A);
17244       q = spherical(q);
17245       if (!two)
17246         return q;
17247       var lambda04 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z;
17248       if (lambda12 < lambda04)
17249         z = lambda04, lambda04 = lambda12, lambda12 = z;
17250       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17251       if (!polar && phi12 < phi02)
17252         z = phi02, phi02 = phi12, phi12 = z;
17253       if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs(q[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi ^ (lambda04 <= q[0] && q[0] <= lambda12)) {
17254         var q1 = cartesianScale(u, (-w + t) / uu);
17255         cartesianAddInPlace(q1, A);
17256         return [q, spherical(q1)];
17257       }
17258     }
17259     function code(lambda, phi) {
17260       var r = smallRadius ? radius : pi - radius, code2 = 0;
17261       if (lambda < -r)
17262         code2 |= 1;
17263       else if (lambda > r)
17264         code2 |= 2;
17265       if (phi < -r)
17266         code2 |= 4;
17267       else if (phi > r)
17268         code2 |= 8;
17269       return code2;
17270     }
17271     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17272   }
17273
17274   // node_modules/d3-geo/src/clip/line.js
17275   function line_default(a, b, x05, y05, x12, y12) {
17276     var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
17277     r = x05 - ax;
17278     if (!dx && r > 0)
17279       return;
17280     r /= dx;
17281     if (dx < 0) {
17282       if (r < t0)
17283         return;
17284       if (r < t1)
17285         t1 = r;
17286     } else if (dx > 0) {
17287       if (r > t1)
17288         return;
17289       if (r > t0)
17290         t0 = r;
17291     }
17292     r = x12 - ax;
17293     if (!dx && r < 0)
17294       return;
17295     r /= dx;
17296     if (dx < 0) {
17297       if (r > t1)
17298         return;
17299       if (r > t0)
17300         t0 = r;
17301     } else if (dx > 0) {
17302       if (r < t0)
17303         return;
17304       if (r < t1)
17305         t1 = r;
17306     }
17307     r = y05 - ay;
17308     if (!dy && r > 0)
17309       return;
17310     r /= dy;
17311     if (dy < 0) {
17312       if (r < t0)
17313         return;
17314       if (r < t1)
17315         t1 = r;
17316     } else if (dy > 0) {
17317       if (r > t1)
17318         return;
17319       if (r > t0)
17320         t0 = r;
17321     }
17322     r = y12 - ay;
17323     if (!dy && r < 0)
17324       return;
17325     r /= dy;
17326     if (dy < 0) {
17327       if (r > t1)
17328         return;
17329       if (r > t0)
17330         t0 = r;
17331     } else if (dy > 0) {
17332       if (r < t0)
17333         return;
17334       if (r < t1)
17335         t1 = r;
17336     }
17337     if (t0 > 0)
17338       a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
17339     if (t1 < 1)
17340       b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
17341     return true;
17342   }
17343
17344   // node_modules/d3-geo/src/clip/rectangle.js
17345   var clipMax = 1e9;
17346   var clipMin = -clipMax;
17347   function clipRectangle(x05, y05, x12, y12) {
17348     function visible(x, y) {
17349       return x05 <= x && x <= x12 && y05 <= y && y <= y12;
17350     }
17351     function interpolate(from, to, direction, stream) {
17352       var a = 0, a1 = 0;
17353       if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17354         do
17355           stream.point(a === 0 || a === 3 ? x05 : x12, a > 1 ? y12 : y05);
17356         while ((a = (a + direction + 4) % 4) !== a1);
17357       } else {
17358         stream.point(to[0], to[1]);
17359       }
17360     }
17361     function corner(p, direction) {
17362       return abs(p[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
17363     }
17364     function compareIntersection2(a, b) {
17365       return comparePoint(a.x, b.x);
17366     }
17367     function comparePoint(a, b) {
17368       var ca = corner(a, 1), cb = corner(b, 1);
17369       return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
17370     }
17371     return function(stream) {
17372       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17373       var clipStream = {
17374         point,
17375         lineStart,
17376         lineEnd,
17377         polygonStart,
17378         polygonEnd
17379       };
17380       function point(x, y) {
17381         if (visible(x, y))
17382           activeStream.point(x, y);
17383       }
17384       function polygonInside() {
17385         var winding = 0;
17386         for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17387           for (var ring2 = polygon2[i2], j2 = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m; ++j2) {
17388             a0 = b0, a1 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
17389             if (a1 <= y12) {
17390               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17391                 ++winding;
17392             } else {
17393               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17394                 --winding;
17395             }
17396           }
17397         }
17398         return winding;
17399       }
17400       function polygonStart() {
17401         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17402       }
17403       function polygonEnd() {
17404         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17405         if (cleanInside || visible2) {
17406           stream.polygonStart();
17407           if (cleanInside) {
17408             stream.lineStart();
17409             interpolate(null, null, 1, stream);
17410             stream.lineEnd();
17411           }
17412           if (visible2) {
17413             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17414           }
17415           stream.polygonEnd();
17416         }
17417         activeStream = stream, segments = polygon2 = ring = null;
17418       }
17419       function lineStart() {
17420         clipStream.point = linePoint2;
17421         if (polygon2)
17422           polygon2.push(ring = []);
17423         first = true;
17424         v_ = false;
17425         x_ = y_ = NaN;
17426       }
17427       function lineEnd() {
17428         if (segments) {
17429           linePoint2(x__, y__);
17430           if (v__ && v_)
17431             bufferStream.rejoin();
17432           segments.push(bufferStream.result());
17433         }
17434         clipStream.point = point;
17435         if (v_)
17436           activeStream.lineEnd();
17437       }
17438       function linePoint2(x, y) {
17439         var v = visible(x, y);
17440         if (polygon2)
17441           ring.push([x, y]);
17442         if (first) {
17443           x__ = x, y__ = y, v__ = v;
17444           first = false;
17445           if (v) {
17446             activeStream.lineStart();
17447             activeStream.point(x, y);
17448           }
17449         } else {
17450           if (v && v_)
17451             activeStream.point(x, y);
17452           else {
17453             var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
17454             if (line_default(a, b, x05, y05, x12, y12)) {
17455               if (!v_) {
17456                 activeStream.lineStart();
17457                 activeStream.point(a[0], a[1]);
17458               }
17459               activeStream.point(b[0], b[1]);
17460               if (!v)
17461                 activeStream.lineEnd();
17462               clean2 = false;
17463             } else if (v) {
17464               activeStream.lineStart();
17465               activeStream.point(x, y);
17466               clean2 = false;
17467             }
17468           }
17469         }
17470         x_ = x, y_ = y, v_ = v;
17471       }
17472       return clipStream;
17473     };
17474   }
17475
17476   // node_modules/d3-geo/src/length.js
17477   var lengthSum;
17478   var lambda03;
17479   var sinPhi02;
17480   var cosPhi02;
17481   var lengthStream = {
17482     sphere: noop,
17483     point: noop,
17484     lineStart: lengthLineStart,
17485     lineEnd: noop,
17486     polygonStart: noop,
17487     polygonEnd: noop
17488   };
17489   function lengthLineStart() {
17490     lengthStream.point = lengthPointFirst;
17491     lengthStream.lineEnd = lengthLineEnd;
17492   }
17493   function lengthLineEnd() {
17494     lengthStream.point = lengthStream.lineEnd = noop;
17495   }
17496   function lengthPointFirst(lambda, phi) {
17497     lambda *= radians, phi *= radians;
17498     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
17499     lengthStream.point = lengthPoint;
17500   }
17501   function lengthPoint(lambda, phi) {
17502     lambda *= radians, phi *= radians;
17503     var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x = cosPhi * sinDelta, y = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
17504     lengthSum.add(atan2(sqrt(x * x + y * y), z));
17505     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
17506   }
17507   function length_default(object) {
17508     lengthSum = new Adder();
17509     stream_default(object, lengthStream);
17510     return +lengthSum;
17511   }
17512
17513   // node_modules/d3-geo/src/identity.js
17514   var identity_default = (x) => x;
17515
17516   // node_modules/d3-geo/src/path/area.js
17517   var areaSum2 = new Adder();
17518   var areaRingSum2 = new Adder();
17519   var x00;
17520   var y00;
17521   var x0;
17522   var y0;
17523   var areaStream2 = {
17524     point: noop,
17525     lineStart: noop,
17526     lineEnd: noop,
17527     polygonStart: function() {
17528       areaStream2.lineStart = areaRingStart2;
17529       areaStream2.lineEnd = areaRingEnd2;
17530     },
17531     polygonEnd: function() {
17532       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
17533       areaSum2.add(abs(areaRingSum2));
17534       areaRingSum2 = new Adder();
17535     },
17536     result: function() {
17537       var area = areaSum2 / 2;
17538       areaSum2 = new Adder();
17539       return area;
17540     }
17541   };
17542   function areaRingStart2() {
17543     areaStream2.point = areaPointFirst2;
17544   }
17545   function areaPointFirst2(x, y) {
17546     areaStream2.point = areaPoint2;
17547     x00 = x0 = x, y00 = y0 = y;
17548   }
17549   function areaPoint2(x, y) {
17550     areaRingSum2.add(y0 * x - x0 * y);
17551     x0 = x, y0 = y;
17552   }
17553   function areaRingEnd2() {
17554     areaPoint2(x00, y00);
17555   }
17556   var area_default2 = areaStream2;
17557
17558   // node_modules/d3-geo/src/path/bounds.js
17559   var x02 = Infinity;
17560   var y02 = x02;
17561   var x1 = -x02;
17562   var y1 = x1;
17563   var boundsStream2 = {
17564     point: boundsPoint2,
17565     lineStart: noop,
17566     lineEnd: noop,
17567     polygonStart: noop,
17568     polygonEnd: noop,
17569     result: function() {
17570       var bounds = [[x02, y02], [x1, y1]];
17571       x1 = y1 = -(y02 = x02 = Infinity);
17572       return bounds;
17573     }
17574   };
17575   function boundsPoint2(x, y) {
17576     if (x < x02)
17577       x02 = x;
17578     if (x > x1)
17579       x1 = x;
17580     if (y < y02)
17581       y02 = y;
17582     if (y > y1)
17583       y1 = y;
17584   }
17585   var bounds_default2 = boundsStream2;
17586
17587   // node_modules/d3-geo/src/path/centroid.js
17588   var X0 = 0;
17589   var Y0 = 0;
17590   var Z0 = 0;
17591   var X1 = 0;
17592   var Y1 = 0;
17593   var Z1 = 0;
17594   var X2 = 0;
17595   var Y2 = 0;
17596   var Z2 = 0;
17597   var x002;
17598   var y002;
17599   var x03;
17600   var y03;
17601   var centroidStream = {
17602     point: centroidPoint,
17603     lineStart: centroidLineStart,
17604     lineEnd: centroidLineEnd,
17605     polygonStart: function() {
17606       centroidStream.lineStart = centroidRingStart;
17607       centroidStream.lineEnd = centroidRingEnd;
17608     },
17609     polygonEnd: function() {
17610       centroidStream.point = centroidPoint;
17611       centroidStream.lineStart = centroidLineStart;
17612       centroidStream.lineEnd = centroidLineEnd;
17613     },
17614     result: function() {
17615       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
17616       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
17617       return centroid;
17618     }
17619   };
17620   function centroidPoint(x, y) {
17621     X0 += x;
17622     Y0 += y;
17623     ++Z0;
17624   }
17625   function centroidLineStart() {
17626     centroidStream.point = centroidPointFirstLine;
17627   }
17628   function centroidPointFirstLine(x, y) {
17629     centroidStream.point = centroidPointLine;
17630     centroidPoint(x03 = x, y03 = y);
17631   }
17632   function centroidPointLine(x, y) {
17633     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17634     X1 += z * (x03 + x) / 2;
17635     Y1 += z * (y03 + y) / 2;
17636     Z1 += z;
17637     centroidPoint(x03 = x, y03 = y);
17638   }
17639   function centroidLineEnd() {
17640     centroidStream.point = centroidPoint;
17641   }
17642   function centroidRingStart() {
17643     centroidStream.point = centroidPointFirstRing;
17644   }
17645   function centroidRingEnd() {
17646     centroidPointRing(x002, y002);
17647   }
17648   function centroidPointFirstRing(x, y) {
17649     centroidStream.point = centroidPointRing;
17650     centroidPoint(x002 = x03 = x, y002 = y03 = y);
17651   }
17652   function centroidPointRing(x, y) {
17653     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17654     X1 += z * (x03 + x) / 2;
17655     Y1 += z * (y03 + y) / 2;
17656     Z1 += z;
17657     z = y03 * x - x03 * y;
17658     X2 += z * (x03 + x);
17659     Y2 += z * (y03 + y);
17660     Z2 += z * 3;
17661     centroidPoint(x03 = x, y03 = y);
17662   }
17663   var centroid_default = centroidStream;
17664
17665   // node_modules/d3-geo/src/path/context.js
17666   function PathContext(context) {
17667     this._context = context;
17668   }
17669   PathContext.prototype = {
17670     _radius: 4.5,
17671     pointRadius: function(_) {
17672       return this._radius = _, this;
17673     },
17674     polygonStart: function() {
17675       this._line = 0;
17676     },
17677     polygonEnd: function() {
17678       this._line = NaN;
17679     },
17680     lineStart: function() {
17681       this._point = 0;
17682     },
17683     lineEnd: function() {
17684       if (this._line === 0)
17685         this._context.closePath();
17686       this._point = NaN;
17687     },
17688     point: function(x, y) {
17689       switch (this._point) {
17690         case 0: {
17691           this._context.moveTo(x, y);
17692           this._point = 1;
17693           break;
17694         }
17695         case 1: {
17696           this._context.lineTo(x, y);
17697           break;
17698         }
17699         default: {
17700           this._context.moveTo(x + this._radius, y);
17701           this._context.arc(x, y, this._radius, 0, tau);
17702           break;
17703         }
17704       }
17705     },
17706     result: noop
17707   };
17708
17709   // node_modules/d3-geo/src/path/measure.js
17710   var lengthSum2 = new Adder();
17711   var lengthRing;
17712   var x003;
17713   var y003;
17714   var x04;
17715   var y04;
17716   var lengthStream2 = {
17717     point: noop,
17718     lineStart: function() {
17719       lengthStream2.point = lengthPointFirst2;
17720     },
17721     lineEnd: function() {
17722       if (lengthRing)
17723         lengthPoint2(x003, y003);
17724       lengthStream2.point = noop;
17725     },
17726     polygonStart: function() {
17727       lengthRing = true;
17728     },
17729     polygonEnd: function() {
17730       lengthRing = null;
17731     },
17732     result: function() {
17733       var length = +lengthSum2;
17734       lengthSum2 = new Adder();
17735       return length;
17736     }
17737   };
17738   function lengthPointFirst2(x, y) {
17739     lengthStream2.point = lengthPoint2;
17740     x003 = x04 = x, y003 = y04 = y;
17741   }
17742   function lengthPoint2(x, y) {
17743     x04 -= x, y04 -= y;
17744     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
17745     x04 = x, y04 = y;
17746   }
17747   var measure_default = lengthStream2;
17748
17749   // node_modules/d3-geo/src/path/string.js
17750   function PathString() {
17751     this._string = [];
17752   }
17753   PathString.prototype = {
17754     _radius: 4.5,
17755     _circle: circle(4.5),
17756     pointRadius: function(_) {
17757       if ((_ = +_) !== this._radius)
17758         this._radius = _, this._circle = null;
17759       return this;
17760     },
17761     polygonStart: function() {
17762       this._line = 0;
17763     },
17764     polygonEnd: function() {
17765       this._line = NaN;
17766     },
17767     lineStart: function() {
17768       this._point = 0;
17769     },
17770     lineEnd: function() {
17771       if (this._line === 0)
17772         this._string.push("Z");
17773       this._point = NaN;
17774     },
17775     point: function(x, y) {
17776       switch (this._point) {
17777         case 0: {
17778           this._string.push("M", x, ",", y);
17779           this._point = 1;
17780           break;
17781         }
17782         case 1: {
17783           this._string.push("L", x, ",", y);
17784           break;
17785         }
17786         default: {
17787           if (this._circle == null)
17788             this._circle = circle(this._radius);
17789           this._string.push("M", x, ",", y, this._circle);
17790           break;
17791         }
17792       }
17793     },
17794     result: function() {
17795       if (this._string.length) {
17796         var result = this._string.join("");
17797         this._string = [];
17798         return result;
17799       } else {
17800         return null;
17801       }
17802     }
17803   };
17804   function circle(radius) {
17805     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
17806   }
17807
17808   // node_modules/d3-geo/src/path/index.js
17809   function path_default(projection2, context) {
17810     var pointRadius = 4.5, projectionStream, contextStream;
17811     function path(object) {
17812       if (object) {
17813         if (typeof pointRadius === "function")
17814           contextStream.pointRadius(+pointRadius.apply(this, arguments));
17815         stream_default(object, projectionStream(contextStream));
17816       }
17817       return contextStream.result();
17818     }
17819     path.area = function(object) {
17820       stream_default(object, projectionStream(area_default2));
17821       return area_default2.result();
17822     };
17823     path.measure = function(object) {
17824       stream_default(object, projectionStream(measure_default));
17825       return measure_default.result();
17826     };
17827     path.bounds = function(object) {
17828       stream_default(object, projectionStream(bounds_default2));
17829       return bounds_default2.result();
17830     };
17831     path.centroid = function(object) {
17832       stream_default(object, projectionStream(centroid_default));
17833       return centroid_default.result();
17834     };
17835     path.projection = function(_) {
17836       return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity_default) : (projection2 = _).stream, path) : projection2;
17837     };
17838     path.context = function(_) {
17839       if (!arguments.length)
17840         return context;
17841       contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);
17842       if (typeof pointRadius !== "function")
17843         contextStream.pointRadius(pointRadius);
17844       return path;
17845     };
17846     path.pointRadius = function(_) {
17847       if (!arguments.length)
17848         return pointRadius;
17849       pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
17850       return path;
17851     };
17852     return path.projection(projection2).context(context);
17853   }
17854
17855   // node_modules/d3-geo/src/transform.js
17856   function transform_default(methods2) {
17857     return {
17858       stream: transformer(methods2)
17859     };
17860   }
17861   function transformer(methods2) {
17862     return function(stream) {
17863       var s = new TransformStream();
17864       for (var key in methods2)
17865         s[key] = methods2[key];
17866       s.stream = stream;
17867       return s;
17868     };
17869   }
17870   function TransformStream() {
17871   }
17872   TransformStream.prototype = {
17873     constructor: TransformStream,
17874     point: function(x, y) {
17875       this.stream.point(x, y);
17876     },
17877     sphere: function() {
17878       this.stream.sphere();
17879     },
17880     lineStart: function() {
17881       this.stream.lineStart();
17882     },
17883     lineEnd: function() {
17884       this.stream.lineEnd();
17885     },
17886     polygonStart: function() {
17887       this.stream.polygonStart();
17888     },
17889     polygonEnd: function() {
17890       this.stream.polygonEnd();
17891     }
17892   };
17893
17894   // node_modules/d3-geo/src/projection/fit.js
17895   function fit(projection2, fitBounds, object) {
17896     var clip = projection2.clipExtent && projection2.clipExtent();
17897     projection2.scale(150).translate([0, 0]);
17898     if (clip != null)
17899       projection2.clipExtent(null);
17900     stream_default(object, projection2.stream(bounds_default2));
17901     fitBounds(bounds_default2.result());
17902     if (clip != null)
17903       projection2.clipExtent(clip);
17904     return projection2;
17905   }
17906   function fitExtent(projection2, extent, object) {
17907     return fit(projection2, function(b) {
17908       var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
17909       projection2.scale(150 * k).translate([x, y]);
17910     }, object);
17911   }
17912   function fitSize(projection2, size, object) {
17913     return fitExtent(projection2, [[0, 0], size], object);
17914   }
17915   function fitWidth(projection2, width, object) {
17916     return fit(projection2, function(b) {
17917       var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
17918       projection2.scale(150 * k).translate([x, y]);
17919     }, object);
17920   }
17921   function fitHeight(projection2, height, object) {
17922     return fit(projection2, function(b) {
17923       var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
17924       projection2.scale(150 * k).translate([x, y]);
17925     }, object);
17926   }
17927
17928   // node_modules/d3-geo/src/projection/resample.js
17929   var maxDepth = 16;
17930   var cosMinDistance = cos(30 * radians);
17931   function resample_default(project, delta2) {
17932     return +delta2 ? resample(project, delta2) : resampleNone(project);
17933   }
17934   function resampleNone(project) {
17935     return transformer({
17936       point: function(x, y) {
17937         x = project(x, y);
17938         this.stream.point(x[0], x[1]);
17939       }
17940     });
17941   }
17942   function resample(project, delta2) {
17943     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
17944       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
17945       if (d2 > 4 * delta2 && depth--) {
17946         var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda22 = abs(abs(c) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b, a), p = project(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
17947         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
17948           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream);
17949           stream.point(x2, y2);
17950           resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream);
17951         }
17952       }
17953     }
17954     return function(stream) {
17955       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
17956       var resampleStream = {
17957         point,
17958         lineStart,
17959         lineEnd,
17960         polygonStart: function() {
17961           stream.polygonStart();
17962           resampleStream.lineStart = ringStart;
17963         },
17964         polygonEnd: function() {
17965           stream.polygonEnd();
17966           resampleStream.lineStart = lineStart;
17967         }
17968       };
17969       function point(x, y) {
17970         x = project(x, y);
17971         stream.point(x[0], x[1]);
17972       }
17973       function lineStart() {
17974         x05 = NaN;
17975         resampleStream.point = linePoint2;
17976         stream.lineStart();
17977       }
17978       function linePoint2(lambda, phi) {
17979         var c = cartesian([lambda, phi]), p = project(lambda, phi);
17980         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p[0], y05 = p[1], lambda04 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
17981         stream.point(x05, y05);
17982       }
17983       function lineEnd() {
17984         resampleStream.point = point;
17985         stream.lineEnd();
17986       }
17987       function ringStart() {
17988         lineStart();
17989         resampleStream.point = ringPoint;
17990         resampleStream.lineEnd = ringEnd;
17991       }
17992       function ringPoint(lambda, phi) {
17993         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
17994         resampleStream.point = linePoint2;
17995       }
17996       function ringEnd() {
17997         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
17998         resampleStream.lineEnd = lineEnd;
17999         lineEnd();
18000       }
18001       return resampleStream;
18002     };
18003   }
18004
18005   // node_modules/d3-geo/src/projection/index.js
18006   var transformRadians = transformer({
18007     point: function(x, y) {
18008       this.stream.point(x * radians, y * radians);
18009     }
18010   });
18011   function transformRotate(rotate) {
18012     return transformer({
18013       point: function(x, y) {
18014         var r = rotate(x, y);
18015         return this.stream.point(r[0], r[1]);
18016       }
18017     });
18018   }
18019   function scaleTranslate(k, dx, dy, sx, sy) {
18020     function transform2(x, y) {
18021       x *= sx;
18022       y *= sy;
18023       return [dx + k * x, dy - k * y];
18024     }
18025     transform2.invert = function(x, y) {
18026       return [(x - dx) / k * sx, (dy - y) / k * sy];
18027     };
18028     return transform2;
18029   }
18030   function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
18031     if (!alpha)
18032       return scaleTranslate(k, dx, dy, sx, sy);
18033     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;
18034     function transform2(x, y) {
18035       x *= sx;
18036       y *= sy;
18037       return [a * x - b * y + dx, dy - b * x - a * y];
18038     }
18039     transform2.invert = function(x, y) {
18040       return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
18041     };
18042     return transform2;
18043   }
18044   function projection(project) {
18045     return projectionMutator(function() {
18046       return project;
18047     })();
18048   }
18049   function projectionMutator(projectAt) {
18050     var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
18051     function projection2(point) {
18052       return projectRotateTransform(point[0] * radians, point[1] * radians);
18053     }
18054     function invert(point) {
18055       point = projectRotateTransform.invert(point[0], point[1]);
18056       return point && [point[0] * degrees, point[1] * degrees];
18057     }
18058     projection2.stream = function(stream) {
18059       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18060     };
18061     projection2.preclip = function(_) {
18062       return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
18063     };
18064     projection2.postclip = function(_) {
18065       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18066     };
18067     projection2.clipAngle = function(_) {
18068       return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18069     };
18070     projection2.clipExtent = function(_) {
18071       return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18072     };
18073     projection2.scale = function(_) {
18074       return arguments.length ? (k = +_, recenter()) : k;
18075     };
18076     projection2.translate = function(_) {
18077       return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
18078     };
18079     projection2.center = function(_) {
18080       return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18081     };
18082     projection2.rotate = function(_) {
18083       return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
18084     };
18085     projection2.angle = function(_) {
18086       return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
18087     };
18088     projection2.reflectX = function(_) {
18089       return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
18090     };
18091     projection2.reflectY = function(_) {
18092       return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
18093     };
18094     projection2.precision = function(_) {
18095       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
18096     };
18097     projection2.fitExtent = function(extent, object) {
18098       return fitExtent(projection2, extent, object);
18099     };
18100     projection2.fitSize = function(size, object) {
18101       return fitSize(projection2, size, object);
18102     };
18103     projection2.fitWidth = function(width, object) {
18104       return fitWidth(projection2, width, object);
18105     };
18106     projection2.fitHeight = function(height, object) {
18107       return fitHeight(projection2, height, object);
18108     };
18109     function recenter() {
18110       var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);
18111       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18112       projectTransform = compose_default(project, transform2);
18113       projectRotateTransform = compose_default(rotate, projectTransform);
18114       projectResample = resample_default(projectTransform, delta2);
18115       return reset();
18116     }
18117     function reset() {
18118       cache = cacheStream = null;
18119       return projection2;
18120     }
18121     return function() {
18122       project = projectAt.apply(this, arguments);
18123       projection2.invert = project.invert && invert;
18124       return recenter();
18125     };
18126   }
18127
18128   // node_modules/d3-geo/src/projection/mercator.js
18129   function mercatorRaw(lambda, phi) {
18130     return [lambda, log(tan((halfPi + phi) / 2))];
18131   }
18132   mercatorRaw.invert = function(x, y) {
18133     return [x, 2 * atan(exp(y)) - halfPi];
18134   };
18135   function mercator_default() {
18136     return mercatorProjection(mercatorRaw).scale(961 / tau);
18137   }
18138   function mercatorProjection(project) {
18139     var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x05 = null, y05, x12, y12;
18140     m.scale = function(_) {
18141       return arguments.length ? (scale(_), reclip()) : scale();
18142     };
18143     m.translate = function(_) {
18144       return arguments.length ? (translate(_), reclip()) : translate();
18145     };
18146     m.center = function(_) {
18147       return arguments.length ? (center(_), reclip()) : center();
18148     };
18149     m.clipExtent = function(_) {
18150       return arguments.length ? (_ == null ? x05 = y05 = x12 = y12 = null : (x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18151     };
18152     function reclip() {
18153       var k = pi * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
18154       return clipExtent(x05 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x05), y05], [Math.min(t[0] + k, x12), y12]] : [[x05, Math.max(t[1] - k, y05)], [x12, Math.min(t[1] + k, y12)]]);
18155     }
18156     return reclip();
18157   }
18158
18159   // node_modules/d3-geo/src/projection/identity.js
18160   function identity_default2() {
18161     var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
18162       point: function(x, y) {
18163         var p = projection2([x, y]);
18164         this.stream.point(p[0], p[1]);
18165       }
18166     }), postclip = identity_default, cache, cacheStream;
18167     function reset() {
18168       kx = k * sx;
18169       ky = k * sy;
18170       cache = cacheStream = null;
18171       return projection2;
18172     }
18173     function projection2(p) {
18174       var x = p[0] * kx, y = p[1] * ky;
18175       if (alpha) {
18176         var t = y * ca - x * sa;
18177         x = x * ca + y * sa;
18178         y = t;
18179       }
18180       return [x + tx, y + ty];
18181     }
18182     projection2.invert = function(p) {
18183       var x = p[0] - tx, y = p[1] - ty;
18184       if (alpha) {
18185         var t = y * ca + x * sa;
18186         x = x * ca - y * sa;
18187         y = t;
18188       }
18189       return [x / kx, y / ky];
18190     };
18191     projection2.stream = function(stream) {
18192       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18193     };
18194     projection2.postclip = function(_) {
18195       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18196     };
18197     projection2.clipExtent = function(_) {
18198       return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18199     };
18200     projection2.scale = function(_) {
18201       return arguments.length ? (k = +_, reset()) : k;
18202     };
18203     projection2.translate = function(_) {
18204       return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
18205     };
18206     projection2.angle = function(_) {
18207       return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18208     };
18209     projection2.reflectX = function(_) {
18210       return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
18211     };
18212     projection2.reflectY = function(_) {
18213       return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;
18214     };
18215     projection2.fitExtent = function(extent, object) {
18216       return fitExtent(projection2, extent, object);
18217     };
18218     projection2.fitSize = function(size, object) {
18219       return fitSize(projection2, size, object);
18220     };
18221     projection2.fitWidth = function(width, object) {
18222       return fitWidth(projection2, width, object);
18223     };
18224     projection2.fitHeight = function(height, object) {
18225       return fitHeight(projection2, height, object);
18226     };
18227     return projection2;
18228   }
18229
18230   // modules/geo/geo.js
18231   var TAU = 2 * Math.PI;
18232   var EQUATORIAL_RADIUS = 6356752314245179e-9;
18233   var POLAR_RADIUS = 6378137;
18234   function geoLatToMeters(dLat) {
18235     return dLat * (TAU * POLAR_RADIUS / 360);
18236   }
18237   function geoLonToMeters(dLon, atLat) {
18238     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18239   }
18240   function geoMetersToLat(m) {
18241     return m / (TAU * POLAR_RADIUS / 360);
18242   }
18243   function geoMetersToLon(m, atLat) {
18244     return Math.abs(atLat) >= 90 ? 0 : m / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18245   }
18246   function geoMetersToOffset(meters, tileSize) {
18247     tileSize = tileSize || 256;
18248     return [
18249       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18250       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18251     ];
18252   }
18253   function geoOffsetToMeters(offset, tileSize) {
18254     tileSize = tileSize || 256;
18255     return [
18256       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18257       -offset[1] * TAU * POLAR_RADIUS / tileSize
18258     ];
18259   }
18260   function geoSphericalDistance(a, b) {
18261     var x = geoLonToMeters(a[0] - b[0], (a[1] + b[1]) / 2);
18262     var y = geoLatToMeters(a[1] - b[1]);
18263     return Math.sqrt(x * x + y * y);
18264   }
18265   function geoScaleToZoom(k, tileSize) {
18266     tileSize = tileSize || 256;
18267     var log2ts = Math.log(tileSize) * Math.LOG2E;
18268     return Math.log(k * TAU) / Math.LN2 - log2ts;
18269   }
18270   function geoZoomToScale(z, tileSize) {
18271     tileSize = tileSize || 256;
18272     return tileSize * Math.pow(2, z) / TAU;
18273   }
18274   function geoSphericalClosestNode(nodes, point) {
18275     var minDistance = Infinity, distance;
18276     var indexOfMin;
18277     for (var i2 in nodes) {
18278       distance = geoSphericalDistance(nodes[i2].loc, point);
18279       if (distance < minDistance) {
18280         minDistance = distance;
18281         indexOfMin = i2;
18282       }
18283     }
18284     if (indexOfMin !== void 0) {
18285       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18286     } else {
18287       return null;
18288     }
18289   }
18290
18291   // modules/geo/extent.js
18292   function geoExtent(min3, max3) {
18293     if (!(this instanceof geoExtent)) {
18294       return new geoExtent(min3, max3);
18295     } else if (min3 instanceof geoExtent) {
18296       return min3;
18297     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18298       this[0] = min3[0];
18299       this[1] = min3[1];
18300     } else {
18301       this[0] = min3 || [Infinity, Infinity];
18302       this[1] = max3 || min3 || [-Infinity, -Infinity];
18303     }
18304   }
18305   geoExtent.prototype = new Array(2);
18306   Object.assign(geoExtent.prototype, {
18307     equals: function(obj) {
18308       return this[0][0] === obj[0][0] && this[0][1] === obj[0][1] && this[1][0] === obj[1][0] && this[1][1] === obj[1][1];
18309     },
18310     extend: function(obj) {
18311       if (!(obj instanceof geoExtent))
18312         obj = new geoExtent(obj);
18313       return geoExtent([Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])], [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]);
18314     },
18315     _extend: function(extent) {
18316       this[0][0] = Math.min(extent[0][0], this[0][0]);
18317       this[0][1] = Math.min(extent[0][1], this[0][1]);
18318       this[1][0] = Math.max(extent[1][0], this[1][0]);
18319       this[1][1] = Math.max(extent[1][1], this[1][1]);
18320     },
18321     area: function() {
18322       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18323     },
18324     center: function() {
18325       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18326     },
18327     rectangle: function() {
18328       return [this[0][0], this[0][1], this[1][0], this[1][1]];
18329     },
18330     bbox: function() {
18331       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18332     },
18333     polygon: function() {
18334       return [
18335         [this[0][0], this[0][1]],
18336         [this[0][0], this[1][1]],
18337         [this[1][0], this[1][1]],
18338         [this[1][0], this[0][1]],
18339         [this[0][0], this[0][1]]
18340       ];
18341     },
18342     contains: function(obj) {
18343       if (!(obj instanceof geoExtent))
18344         obj = new geoExtent(obj);
18345       return obj[0][0] >= this[0][0] && obj[0][1] >= this[0][1] && obj[1][0] <= this[1][0] && obj[1][1] <= this[1][1];
18346     },
18347     intersects: function(obj) {
18348       if (!(obj instanceof geoExtent))
18349         obj = new geoExtent(obj);
18350       return obj[0][0] <= this[1][0] && obj[0][1] <= this[1][1] && obj[1][0] >= this[0][0] && obj[1][1] >= this[0][1];
18351     },
18352     intersection: function(obj) {
18353       if (!this.intersects(obj))
18354         return new geoExtent();
18355       return new geoExtent([Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])], [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]);
18356     },
18357     percentContainedIn: function(obj) {
18358       if (!(obj instanceof geoExtent))
18359         obj = new geoExtent(obj);
18360       var a1 = this.intersection(obj).area();
18361       var a2 = this.area();
18362       if (a1 === Infinity || a2 === Infinity) {
18363         return 0;
18364       } else if (a1 === 0 || a2 === 0) {
18365         if (obj.contains(this)) {
18366           return 1;
18367         }
18368         return 0;
18369       } else {
18370         return a1 / a2;
18371       }
18372     },
18373     padByMeters: function(meters) {
18374       var dLat = geoMetersToLat(meters);
18375       var dLon = geoMetersToLon(meters, this.center()[1]);
18376       return geoExtent([this[0][0] - dLon, this[0][1] - dLat], [this[1][0] + dLon, this[1][1] + dLat]);
18377     },
18378     toParam: function() {
18379       return this.rectangle().join(",");
18380     }
18381   });
18382
18383   // node_modules/d3-polygon/src/area.js
18384   function area_default3(polygon2) {
18385     var i2 = -1, n2 = polygon2.length, a, b = polygon2[n2 - 1], area = 0;
18386     while (++i2 < n2) {
18387       a = b;
18388       b = polygon2[i2];
18389       area += a[1] * b[0] - a[0] * b[1];
18390     }
18391     return area / 2;
18392   }
18393
18394   // node_modules/d3-polygon/src/centroid.js
18395   function centroid_default2(polygon2) {
18396     var i2 = -1, n2 = polygon2.length, x = 0, y = 0, a, b = polygon2[n2 - 1], c, k = 0;
18397     while (++i2 < n2) {
18398       a = b;
18399       b = polygon2[i2];
18400       k += c = a[0] * b[1] - b[0] * a[1];
18401       x += (a[0] + b[0]) * c;
18402       y += (a[1] + b[1]) * c;
18403     }
18404     return k *= 3, [x / k, y / k];
18405   }
18406
18407   // node_modules/d3-polygon/src/cross.js
18408   function cross_default(a, b, c) {
18409     return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
18410   }
18411
18412   // node_modules/d3-polygon/src/hull.js
18413   function lexicographicOrder(a, b) {
18414     return a[0] - b[0] || a[1] - b[1];
18415   }
18416   function computeUpperHullIndexes(points) {
18417     const n2 = points.length, indexes = [0, 1];
18418     let size = 2, i2;
18419     for (i2 = 2; i2 < n2; ++i2) {
18420       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i2]) <= 0)
18421         --size;
18422       indexes[size++] = i2;
18423     }
18424     return indexes.slice(0, size);
18425   }
18426   function hull_default(points) {
18427     if ((n2 = points.length) < 3)
18428       return null;
18429     var i2, n2, sortedPoints = new Array(n2), flippedPoints = new Array(n2);
18430     for (i2 = 0; i2 < n2; ++i2)
18431       sortedPoints[i2] = [+points[i2][0], +points[i2][1], i2];
18432     sortedPoints.sort(lexicographicOrder);
18433     for (i2 = 0; i2 < n2; ++i2)
18434       flippedPoints[i2] = [sortedPoints[i2][0], -sortedPoints[i2][1]];
18435     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18436     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18437     for (i2 = upperIndexes.length - 1; i2 >= 0; --i2)
18438       hull.push(points[sortedPoints[upperIndexes[i2]][2]]);
18439     for (i2 = +skipLeft; i2 < lowerIndexes.length - skipRight; ++i2)
18440       hull.push(points[sortedPoints[lowerIndexes[i2]][2]]);
18441     return hull;
18442   }
18443
18444   // modules/geo/vector.js
18445   function geoVecEqual(a, b, epsilon3) {
18446     if (epsilon3) {
18447       return Math.abs(a[0] - b[0]) <= epsilon3 && Math.abs(a[1] - b[1]) <= epsilon3;
18448     } else {
18449       return a[0] === b[0] && a[1] === b[1];
18450     }
18451   }
18452   function geoVecAdd(a, b) {
18453     return [a[0] + b[0], a[1] + b[1]];
18454   }
18455   function geoVecSubtract(a, b) {
18456     return [a[0] - b[0], a[1] - b[1]];
18457   }
18458   function geoVecScale(a, mag) {
18459     return [a[0] * mag, a[1] * mag];
18460   }
18461   function geoVecFloor(a) {
18462     return [Math.floor(a[0]), Math.floor(a[1])];
18463   }
18464   function geoVecInterp(a, b, t) {
18465     return [
18466       a[0] + (b[0] - a[0]) * t,
18467       a[1] + (b[1] - a[1]) * t
18468     ];
18469   }
18470   function geoVecLength(a, b) {
18471     return Math.sqrt(geoVecLengthSquare(a, b));
18472   }
18473   function geoVecLengthSquare(a, b) {
18474     b = b || [0, 0];
18475     var x = a[0] - b[0];
18476     var y = a[1] - b[1];
18477     return x * x + y * y;
18478   }
18479   function geoVecNormalize(a) {
18480     var length = Math.sqrt(a[0] * a[0] + a[1] * a[1]);
18481     if (length !== 0) {
18482       return geoVecScale(a, 1 / length);
18483     }
18484     return [0, 0];
18485   }
18486   function geoVecAngle(a, b) {
18487     return Math.atan2(b[1] - a[1], b[0] - a[0]);
18488   }
18489   function geoVecDot(a, b, origin) {
18490     origin = origin || [0, 0];
18491     var p = geoVecSubtract(a, origin);
18492     var q = geoVecSubtract(b, origin);
18493     return p[0] * q[0] + p[1] * q[1];
18494   }
18495   function geoVecNormalizedDot(a, b, origin) {
18496     origin = origin || [0, 0];
18497     var p = geoVecNormalize(geoVecSubtract(a, origin));
18498     var q = geoVecNormalize(geoVecSubtract(b, origin));
18499     return geoVecDot(p, q);
18500   }
18501   function geoVecCross(a, b, origin) {
18502     origin = origin || [0, 0];
18503     var p = geoVecSubtract(a, origin);
18504     var q = geoVecSubtract(b, origin);
18505     return p[0] * q[1] - p[1] * q[0];
18506   }
18507   function geoVecProject(a, points) {
18508     var min3 = Infinity;
18509     var idx;
18510     var target;
18511     for (var i2 = 0; i2 < points.length - 1; i2++) {
18512       var o = points[i2];
18513       var s = geoVecSubtract(points[i2 + 1], o);
18514       var v = geoVecSubtract(a, o);
18515       var proj = geoVecDot(v, s) / geoVecDot(s, s);
18516       var p;
18517       if (proj < 0) {
18518         p = o;
18519       } else if (proj > 1) {
18520         p = points[i2 + 1];
18521       } else {
18522         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18523       }
18524       var dist = geoVecLength(p, a);
18525       if (dist < min3) {
18526         min3 = dist;
18527         idx = i2 + 1;
18528         target = p;
18529       }
18530     }
18531     if (idx !== void 0) {
18532       return { index: idx, distance: min3, target };
18533     } else {
18534       return null;
18535     }
18536   }
18537
18538   // modules/geo/geom.js
18539   function geoAngle(a, b, projection2) {
18540     return geoVecAngle(projection2(a.loc), projection2(b.loc));
18541   }
18542   function geoEdgeEqual(a, b) {
18543     return a[0] === b[0] && a[1] === b[1] || a[0] === b[1] && a[1] === b[0];
18544   }
18545   function geoRotate(points, angle2, around) {
18546     return points.map(function(point) {
18547       var radial = geoVecSubtract(point, around);
18548       return [
18549         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
18550         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
18551       ];
18552     });
18553   }
18554   function geoChooseEdge(nodes, point, projection2, activeID) {
18555     var dist = geoVecLength;
18556     var points = nodes.map(function(n2) {
18557       return projection2(n2.loc);
18558     });
18559     var ids = nodes.map(function(n2) {
18560       return n2.id;
18561     });
18562     var min3 = Infinity;
18563     var idx;
18564     var loc;
18565     for (var i2 = 0; i2 < points.length - 1; i2++) {
18566       if (ids[i2] === activeID || ids[i2 + 1] === activeID)
18567         continue;
18568       var o = points[i2];
18569       var s = geoVecSubtract(points[i2 + 1], o);
18570       var v = geoVecSubtract(point, o);
18571       var proj = geoVecDot(v, s) / geoVecDot(s, s);
18572       var p;
18573       if (proj < 0) {
18574         p = o;
18575       } else if (proj > 1) {
18576         p = points[i2 + 1];
18577       } else {
18578         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18579       }
18580       var d = dist(p, point);
18581       if (d < min3) {
18582         min3 = d;
18583         idx = i2 + 1;
18584         loc = projection2.invert(p);
18585       }
18586     }
18587     if (idx !== void 0) {
18588       return { index: idx, distance: min3, loc };
18589     } else {
18590       return null;
18591     }
18592   }
18593   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
18594     var actives = [];
18595     var inactives = [];
18596     var j2, k, n1, n2, segment;
18597     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
18598       n1 = activeNodes[j2];
18599       n2 = activeNodes[j2 + 1];
18600       segment = [n1.loc, n2.loc];
18601       if (n1.id === activeID || n2.id === activeID) {
18602         actives.push(segment);
18603       }
18604     }
18605     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
18606       n1 = inactiveNodes[j2];
18607       n2 = inactiveNodes[j2 + 1];
18608       segment = [n1.loc, n2.loc];
18609       inactives.push(segment);
18610     }
18611     for (j2 = 0; j2 < actives.length; j2++) {
18612       for (k = 0; k < inactives.length; k++) {
18613         var p = actives[j2];
18614         var q = inactives[k];
18615         var hit = geoLineIntersection(p, q);
18616         if (hit) {
18617           return true;
18618         }
18619       }
18620     }
18621     return false;
18622   }
18623   function geoHasSelfIntersections(nodes, activeID) {
18624     var actives = [];
18625     var inactives = [];
18626     var j2, k;
18627     for (j2 = 0; j2 < nodes.length - 1; j2++) {
18628       var n1 = nodes[j2];
18629       var n2 = nodes[j2 + 1];
18630       var segment = [n1.loc, n2.loc];
18631       if (n1.id === activeID || n2.id === activeID) {
18632         actives.push(segment);
18633       } else {
18634         inactives.push(segment);
18635       }
18636     }
18637     for (j2 = 0; j2 < actives.length; j2++) {
18638       for (k = 0; k < inactives.length; k++) {
18639         var p = actives[j2];
18640         var q = inactives[k];
18641         if (geoVecEqual(p[1], q[0]) || geoVecEqual(p[0], q[1]) || geoVecEqual(p[0], q[0]) || geoVecEqual(p[1], q[1])) {
18642           continue;
18643         }
18644         var hit = geoLineIntersection(p, q);
18645         if (hit) {
18646           var epsilon3 = 1e-8;
18647           if (geoVecEqual(p[1], hit, epsilon3) || geoVecEqual(p[0], hit, epsilon3) || geoVecEqual(q[1], hit, epsilon3) || geoVecEqual(q[0], hit, epsilon3)) {
18648             continue;
18649           } else {
18650             return true;
18651           }
18652         }
18653       }
18654     }
18655     return false;
18656   }
18657   function geoLineIntersection(a, b) {
18658     var p = [a[0][0], a[0][1]];
18659     var p2 = [a[1][0], a[1][1]];
18660     var q = [b[0][0], b[0][1]];
18661     var q2 = [b[1][0], b[1][1]];
18662     var r = geoVecSubtract(p2, p);
18663     var s = geoVecSubtract(q2, q);
18664     var uNumerator = geoVecCross(geoVecSubtract(q, p), r);
18665     var denominator = geoVecCross(r, s);
18666     if (uNumerator && denominator) {
18667       var u = uNumerator / denominator;
18668       var t = geoVecCross(geoVecSubtract(q, p), s) / denominator;
18669       if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
18670         return geoVecInterp(p, p2, t);
18671       }
18672     }
18673     return null;
18674   }
18675   function geoPathIntersections(path1, path2) {
18676     var intersections = [];
18677     for (var i2 = 0; i2 < path1.length - 1; i2++) {
18678       for (var j2 = 0; j2 < path2.length - 1; j2++) {
18679         var a = [path1[i2], path1[i2 + 1]];
18680         var b = [path2[j2], path2[j2 + 1]];
18681         var hit = geoLineIntersection(a, b);
18682         if (hit) {
18683           intersections.push(hit);
18684         }
18685       }
18686     }
18687     return intersections;
18688   }
18689   function geoPathHasIntersections(path1, path2) {
18690     for (var i2 = 0; i2 < path1.length - 1; i2++) {
18691       for (var j2 = 0; j2 < path2.length - 1; j2++) {
18692         var a = [path1[i2], path1[i2 + 1]];
18693         var b = [path2[j2], path2[j2 + 1]];
18694         var hit = geoLineIntersection(a, b);
18695         if (hit) {
18696           return true;
18697         }
18698       }
18699     }
18700     return false;
18701   }
18702   function geoPointInPolygon(point, polygon2) {
18703     var x = point[0];
18704     var y = point[1];
18705     var inside = false;
18706     for (var i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) {
18707       var xi = polygon2[i2][0];
18708       var yi = polygon2[i2][1];
18709       var xj = polygon2[j2][0];
18710       var yj = polygon2[j2][1];
18711       var intersect2 = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
18712       if (intersect2)
18713         inside = !inside;
18714     }
18715     return inside;
18716   }
18717   function geoPolygonContainsPolygon(outer, inner) {
18718     return inner.every(function(point) {
18719       return geoPointInPolygon(point, outer);
18720     });
18721   }
18722   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
18723     function testPoints(outer2, inner2) {
18724       return inner2.some(function(point) {
18725         return geoPointInPolygon(point, outer2);
18726       });
18727     }
18728     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
18729   }
18730   function geoGetSmallestSurroundingRectangle(points) {
18731     var hull = hull_default(points);
18732     var centroid = centroid_default2(hull);
18733     var minArea = Infinity;
18734     var ssrExtent = [];
18735     var ssrAngle = 0;
18736     var c1 = hull[0];
18737     for (var i2 = 0; i2 <= hull.length - 1; i2++) {
18738       var c2 = i2 === hull.length - 1 ? hull[0] : hull[i2 + 1];
18739       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
18740       var poly = geoRotate(hull, -angle2, centroid);
18741       var extent = poly.reduce(function(extent2, point) {
18742         return extent2.extend(geoExtent(point));
18743       }, geoExtent());
18744       var area = extent.area();
18745       if (area < minArea) {
18746         minArea = area;
18747         ssrExtent = extent;
18748         ssrAngle = angle2;
18749       }
18750       c1 = c2;
18751     }
18752     return {
18753       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
18754       angle: ssrAngle
18755     };
18756   }
18757   function geoPathLength(path) {
18758     var length = 0;
18759     for (var i2 = 0; i2 < path.length - 1; i2++) {
18760       length += geoVecLength(path[i2], path[i2 + 1]);
18761     }
18762     return length;
18763   }
18764   function geoViewportEdge(point, dimensions) {
18765     var pad2 = [80, 20, 50, 20];
18766     var x = 0;
18767     var y = 0;
18768     if (point[0] > dimensions[0] - pad2[1]) {
18769       x = -10;
18770     }
18771     if (point[0] < pad2[3]) {
18772       x = 10;
18773     }
18774     if (point[1] > dimensions[1] - pad2[2]) {
18775       y = -10;
18776     }
18777     if (point[1] < pad2[0]) {
18778       y = 10;
18779     }
18780     if (x || y) {
18781       return [x, y];
18782     } else {
18783       return null;
18784     }
18785   }
18786
18787   // node_modules/d3-dispatch/src/dispatch.js
18788   var noop2 = { value: () => {
18789   } };
18790   function dispatch() {
18791     for (var i2 = 0, n2 = arguments.length, _ = {}, t; i2 < n2; ++i2) {
18792       if (!(t = arguments[i2] + "") || t in _ || /[\s.]/.test(t))
18793         throw new Error("illegal type: " + t);
18794       _[t] = [];
18795     }
18796     return new Dispatch(_);
18797   }
18798   function Dispatch(_) {
18799     this._ = _;
18800   }
18801   function parseTypenames(typenames, types) {
18802     return typenames.trim().split(/^|\s+/).map(function(t) {
18803       var name2 = "", i2 = t.indexOf(".");
18804       if (i2 >= 0)
18805         name2 = t.slice(i2 + 1), t = t.slice(0, i2);
18806       if (t && !types.hasOwnProperty(t))
18807         throw new Error("unknown type: " + t);
18808       return { type: t, name: name2 };
18809     });
18810   }
18811   Dispatch.prototype = dispatch.prototype = {
18812     constructor: Dispatch,
18813     on: function(typename, callback) {
18814       var _ = this._, T = parseTypenames(typename + "", _), t, i2 = -1, n2 = T.length;
18815       if (arguments.length < 2) {
18816         while (++i2 < n2)
18817           if ((t = (typename = T[i2]).type) && (t = get(_[t], typename.name)))
18818             return t;
18819         return;
18820       }
18821       if (callback != null && typeof callback !== "function")
18822         throw new Error("invalid callback: " + callback);
18823       while (++i2 < n2) {
18824         if (t = (typename = T[i2]).type)
18825           _[t] = set(_[t], typename.name, callback);
18826         else if (callback == null)
18827           for (t in _)
18828             _[t] = set(_[t], typename.name, null);
18829       }
18830       return this;
18831     },
18832     copy: function() {
18833       var copy2 = {}, _ = this._;
18834       for (var t in _)
18835         copy2[t] = _[t].slice();
18836       return new Dispatch(copy2);
18837     },
18838     call: function(type3, that) {
18839       if ((n2 = arguments.length - 2) > 0)
18840         for (var args = new Array(n2), i2 = 0, n2, t; i2 < n2; ++i2)
18841           args[i2] = arguments[i2 + 2];
18842       if (!this._.hasOwnProperty(type3))
18843         throw new Error("unknown type: " + type3);
18844       for (t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18845         t[i2].value.apply(that, args);
18846     },
18847     apply: function(type3, that, args) {
18848       if (!this._.hasOwnProperty(type3))
18849         throw new Error("unknown type: " + type3);
18850       for (var t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18851         t[i2].value.apply(that, args);
18852     }
18853   };
18854   function get(type3, name2) {
18855     for (var i2 = 0, n2 = type3.length, c; i2 < n2; ++i2) {
18856       if ((c = type3[i2]).name === name2) {
18857         return c.value;
18858       }
18859     }
18860   }
18861   function set(type3, name2, callback) {
18862     for (var i2 = 0, n2 = type3.length; i2 < n2; ++i2) {
18863       if (type3[i2].name === name2) {
18864         type3[i2] = noop2, type3 = type3.slice(0, i2).concat(type3.slice(i2 + 1));
18865         break;
18866       }
18867     }
18868     if (callback != null)
18869       type3.push({ name: name2, value: callback });
18870     return type3;
18871   }
18872   var dispatch_default = dispatch;
18873
18874   // node_modules/d3-selection/src/namespaces.js
18875   var xhtml = "http://www.w3.org/1999/xhtml";
18876   var namespaces_default = {
18877     svg: "http://www.w3.org/2000/svg",
18878     xhtml,
18879     xlink: "http://www.w3.org/1999/xlink",
18880     xml: "http://www.w3.org/XML/1998/namespace",
18881     xmlns: "http://www.w3.org/2000/xmlns/"
18882   };
18883
18884   // node_modules/d3-selection/src/namespace.js
18885   function namespace_default(name2) {
18886     var prefix = name2 += "", i2 = prefix.indexOf(":");
18887     if (i2 >= 0 && (prefix = name2.slice(0, i2)) !== "xmlns")
18888       name2 = name2.slice(i2 + 1);
18889     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name2 } : name2;
18890   }
18891
18892   // node_modules/d3-selection/src/creator.js
18893   function creatorInherit(name2) {
18894     return function() {
18895       var document2 = this.ownerDocument, uri = this.namespaceURI;
18896       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name2) : document2.createElementNS(uri, name2);
18897     };
18898   }
18899   function creatorFixed(fullname) {
18900     return function() {
18901       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
18902     };
18903   }
18904   function creator_default(name2) {
18905     var fullname = namespace_default(name2);
18906     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
18907   }
18908
18909   // node_modules/d3-selection/src/selector.js
18910   function none() {
18911   }
18912   function selector_default(selector) {
18913     return selector == null ? none : function() {
18914       return this.querySelector(selector);
18915     };
18916   }
18917
18918   // node_modules/d3-selection/src/selection/select.js
18919   function select_default(select) {
18920     if (typeof select !== "function")
18921       select = selector_default(select);
18922     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
18923       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
18924         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
18925           if ("__data__" in node)
18926             subnode.__data__ = node.__data__;
18927           subgroup[i2] = subnode;
18928         }
18929       }
18930     }
18931     return new Selection(subgroups, this._parents);
18932   }
18933
18934   // node_modules/d3-selection/src/array.js
18935   function array(x) {
18936     return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
18937   }
18938
18939   // node_modules/d3-selection/src/selectorAll.js
18940   function empty() {
18941     return [];
18942   }
18943   function selectorAll_default(selector) {
18944     return selector == null ? empty : function() {
18945       return this.querySelectorAll(selector);
18946     };
18947   }
18948
18949   // node_modules/d3-selection/src/selection/selectAll.js
18950   function arrayAll(select) {
18951     return function() {
18952       return array(select.apply(this, arguments));
18953     };
18954   }
18955   function selectAll_default(select) {
18956     if (typeof select === "function")
18957       select = arrayAll(select);
18958     else
18959       select = selectorAll_default(select);
18960     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
18961       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
18962         if (node = group[i2]) {
18963           subgroups.push(select.call(node, node.__data__, i2, group));
18964           parents.push(node);
18965         }
18966       }
18967     }
18968     return new Selection(subgroups, parents);
18969   }
18970
18971   // node_modules/d3-selection/src/matcher.js
18972   function matcher_default(selector) {
18973     return function() {
18974       return this.matches(selector);
18975     };
18976   }
18977   function childMatcher(selector) {
18978     return function(node) {
18979       return node.matches(selector);
18980     };
18981   }
18982
18983   // node_modules/d3-selection/src/selection/selectChild.js
18984   var find = Array.prototype.find;
18985   function childFind(match) {
18986     return function() {
18987       return find.call(this.children, match);
18988     };
18989   }
18990   function childFirst() {
18991     return this.firstElementChild;
18992   }
18993   function selectChild_default(match) {
18994     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
18995   }
18996
18997   // node_modules/d3-selection/src/selection/selectChildren.js
18998   var filter = Array.prototype.filter;
18999   function children() {
19000     return Array.from(this.children);
19001   }
19002   function childrenFilter(match) {
19003     return function() {
19004       return filter.call(this.children, match);
19005     };
19006   }
19007   function selectChildren_default(match) {
19008     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19009   }
19010
19011   // node_modules/d3-selection/src/selection/filter.js
19012   function filter_default(match) {
19013     if (typeof match !== "function")
19014       match = matcher_default(match);
19015     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19016       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
19017         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
19018           subgroup.push(node);
19019         }
19020       }
19021     }
19022     return new Selection(subgroups, this._parents);
19023   }
19024
19025   // node_modules/d3-selection/src/selection/sparse.js
19026   function sparse_default(update) {
19027     return new Array(update.length);
19028   }
19029
19030   // node_modules/d3-selection/src/selection/enter.js
19031   function enter_default() {
19032     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19033   }
19034   function EnterNode(parent, datum2) {
19035     this.ownerDocument = parent.ownerDocument;
19036     this.namespaceURI = parent.namespaceURI;
19037     this._next = null;
19038     this._parent = parent;
19039     this.__data__ = datum2;
19040   }
19041   EnterNode.prototype = {
19042     constructor: EnterNode,
19043     appendChild: function(child) {
19044       return this._parent.insertBefore(child, this._next);
19045     },
19046     insertBefore: function(child, next) {
19047       return this._parent.insertBefore(child, next);
19048     },
19049     querySelector: function(selector) {
19050       return this._parent.querySelector(selector);
19051     },
19052     querySelectorAll: function(selector) {
19053       return this._parent.querySelectorAll(selector);
19054     }
19055   };
19056
19057   // node_modules/d3-selection/src/constant.js
19058   function constant_default(x) {
19059     return function() {
19060       return x;
19061     };
19062   }
19063
19064   // node_modules/d3-selection/src/selection/data.js
19065   function bindIndex(parent, group, enter, update, exit, data) {
19066     var i2 = 0, node, groupLength = group.length, dataLength = data.length;
19067     for (; i2 < dataLength; ++i2) {
19068       if (node = group[i2]) {
19069         node.__data__ = data[i2];
19070         update[i2] = node;
19071       } else {
19072         enter[i2] = new EnterNode(parent, data[i2]);
19073       }
19074     }
19075     for (; i2 < groupLength; ++i2) {
19076       if (node = group[i2]) {
19077         exit[i2] = node;
19078       }
19079     }
19080   }
19081   function bindKey(parent, group, enter, update, exit, data, key) {
19082     var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19083     for (i2 = 0; i2 < groupLength; ++i2) {
19084       if (node = group[i2]) {
19085         keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
19086         if (nodeByKeyValue.has(keyValue)) {
19087           exit[i2] = node;
19088         } else {
19089           nodeByKeyValue.set(keyValue, node);
19090         }
19091       }
19092     }
19093     for (i2 = 0; i2 < dataLength; ++i2) {
19094       keyValue = key.call(parent, data[i2], i2, data) + "";
19095       if (node = nodeByKeyValue.get(keyValue)) {
19096         update[i2] = node;
19097         node.__data__ = data[i2];
19098         nodeByKeyValue.delete(keyValue);
19099       } else {
19100         enter[i2] = new EnterNode(parent, data[i2]);
19101       }
19102     }
19103     for (i2 = 0; i2 < groupLength; ++i2) {
19104       if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
19105         exit[i2] = node;
19106       }
19107     }
19108   }
19109   function datum(node) {
19110     return node.__data__;
19111   }
19112   function data_default(value, key) {
19113     if (!arguments.length)
19114       return Array.from(this, datum);
19115     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19116     if (typeof value !== "function")
19117       value = constant_default(value);
19118     for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j2 = 0; j2 < m; ++j2) {
19119       var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
19120       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19121       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19122         if (previous = enterGroup[i0]) {
19123           if (i0 >= i1)
19124             i1 = i0 + 1;
19125           while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19126             ;
19127           previous._next = next || null;
19128         }
19129       }
19130     }
19131     update = new Selection(update, parents);
19132     update._enter = enter;
19133     update._exit = exit;
19134     return update;
19135   }
19136   function arraylike(data) {
19137     return typeof data === "object" && "length" in data ? data : Array.from(data);
19138   }
19139
19140   // node_modules/d3-selection/src/selection/exit.js
19141   function exit_default() {
19142     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19143   }
19144
19145   // node_modules/d3-selection/src/selection/join.js
19146   function join_default(onenter, onupdate, onexit) {
19147     var enter = this.enter(), update = this, exit = this.exit();
19148     if (typeof onenter === "function") {
19149       enter = onenter(enter);
19150       if (enter)
19151         enter = enter.selection();
19152     } else {
19153       enter = enter.append(onenter + "");
19154     }
19155     if (onupdate != null) {
19156       update = onupdate(update);
19157       if (update)
19158         update = update.selection();
19159     }
19160     if (onexit == null)
19161       exit.remove();
19162     else
19163       onexit(exit);
19164     return enter && update ? enter.merge(update).order() : update;
19165   }
19166
19167   // node_modules/d3-selection/src/selection/merge.js
19168   function merge_default(context) {
19169     var selection2 = context.selection ? context.selection() : context;
19170     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
19171       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19172         if (node = group0[i2] || group1[i2]) {
19173           merge3[i2] = node;
19174         }
19175       }
19176     }
19177     for (; j2 < m0; ++j2) {
19178       merges[j2] = groups0[j2];
19179     }
19180     return new Selection(merges, this._parents);
19181   }
19182
19183   // node_modules/d3-selection/src/selection/order.js
19184   function order_default() {
19185     for (var groups = this._groups, j2 = -1, m = groups.length; ++j2 < m; ) {
19186       for (var group = groups[j2], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
19187         if (node = group[i2]) {
19188           if (next && node.compareDocumentPosition(next) ^ 4)
19189             next.parentNode.insertBefore(node, next);
19190           next = node;
19191         }
19192       }
19193     }
19194     return this;
19195   }
19196
19197   // node_modules/d3-selection/src/selection/sort.js
19198   function sort_default(compare) {
19199     if (!compare)
19200       compare = ascending2;
19201     function compareNode(a, b) {
19202       return a && b ? compare(a.__data__, b.__data__) : !a - !b;
19203     }
19204     for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19205       for (var group = groups[j2], n2 = group.length, sortgroup = sortgroups[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19206         if (node = group[i2]) {
19207           sortgroup[i2] = node;
19208         }
19209       }
19210       sortgroup.sort(compareNode);
19211     }
19212     return new Selection(sortgroups, this._parents).order();
19213   }
19214   function ascending2(a, b) {
19215     return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
19216   }
19217
19218   // node_modules/d3-selection/src/selection/call.js
19219   function call_default() {
19220     var callback = arguments[0];
19221     arguments[0] = this;
19222     callback.apply(null, arguments);
19223     return this;
19224   }
19225
19226   // node_modules/d3-selection/src/selection/nodes.js
19227   function nodes_default() {
19228     return Array.from(this);
19229   }
19230
19231   // node_modules/d3-selection/src/selection/node.js
19232   function node_default() {
19233     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19234       for (var group = groups[j2], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
19235         var node = group[i2];
19236         if (node)
19237           return node;
19238       }
19239     }
19240     return null;
19241   }
19242
19243   // node_modules/d3-selection/src/selection/size.js
19244   function size_default() {
19245     let size = 0;
19246     for (const node of this)
19247       ++size;
19248     return size;
19249   }
19250
19251   // node_modules/d3-selection/src/selection/empty.js
19252   function empty_default() {
19253     return !this.node();
19254   }
19255
19256   // node_modules/d3-selection/src/selection/each.js
19257   function each_default(callback) {
19258     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19259       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19260         if (node = group[i2])
19261           callback.call(node, node.__data__, i2, group);
19262       }
19263     }
19264     return this;
19265   }
19266
19267   // node_modules/d3-selection/src/selection/attr.js
19268   function attrRemove(name2) {
19269     return function() {
19270       this.removeAttribute(name2);
19271     };
19272   }
19273   function attrRemoveNS(fullname) {
19274     return function() {
19275       this.removeAttributeNS(fullname.space, fullname.local);
19276     };
19277   }
19278   function attrConstant(name2, value) {
19279     return function() {
19280       this.setAttribute(name2, value);
19281     };
19282   }
19283   function attrConstantNS(fullname, value) {
19284     return function() {
19285       this.setAttributeNS(fullname.space, fullname.local, value);
19286     };
19287   }
19288   function attrFunction(name2, value) {
19289     return function() {
19290       var v = value.apply(this, arguments);
19291       if (v == null)
19292         this.removeAttribute(name2);
19293       else
19294         this.setAttribute(name2, v);
19295     };
19296   }
19297   function attrFunctionNS(fullname, value) {
19298     return function() {
19299       var v = value.apply(this, arguments);
19300       if (v == null)
19301         this.removeAttributeNS(fullname.space, fullname.local);
19302       else
19303         this.setAttributeNS(fullname.space, fullname.local, v);
19304     };
19305   }
19306   function attr_default(name2, value) {
19307     var fullname = namespace_default(name2);
19308     if (arguments.length < 2) {
19309       var node = this.node();
19310       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19311     }
19312     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19313   }
19314
19315   // node_modules/d3-selection/src/window.js
19316   function window_default(node) {
19317     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19318   }
19319
19320   // node_modules/d3-selection/src/selection/style.js
19321   function styleRemove(name2) {
19322     return function() {
19323       this.style.removeProperty(name2);
19324     };
19325   }
19326   function styleConstant(name2, value, priority) {
19327     return function() {
19328       this.style.setProperty(name2, value, priority);
19329     };
19330   }
19331   function styleFunction(name2, value, priority) {
19332     return function() {
19333       var v = value.apply(this, arguments);
19334       if (v == null)
19335         this.style.removeProperty(name2);
19336       else
19337         this.style.setProperty(name2, v, priority);
19338     };
19339   }
19340   function style_default(name2, value, priority) {
19341     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name2, value, priority == null ? "" : priority)) : styleValue(this.node(), name2);
19342   }
19343   function styleValue(node, name2) {
19344     return node.style.getPropertyValue(name2) || window_default(node).getComputedStyle(node, null).getPropertyValue(name2);
19345   }
19346
19347   // node_modules/d3-selection/src/selection/property.js
19348   function propertyRemove(name2) {
19349     return function() {
19350       delete this[name2];
19351     };
19352   }
19353   function propertyConstant(name2, value) {
19354     return function() {
19355       this[name2] = value;
19356     };
19357   }
19358   function propertyFunction(name2, value) {
19359     return function() {
19360       var v = value.apply(this, arguments);
19361       if (v == null)
19362         delete this[name2];
19363       else
19364         this[name2] = v;
19365     };
19366   }
19367   function property_default(name2, value) {
19368     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name2, value)) : this.node()[name2];
19369   }
19370
19371   // node_modules/d3-selection/src/selection/classed.js
19372   function classArray(string) {
19373     return string.trim().split(/^|\s+/);
19374   }
19375   function classList(node) {
19376     return node.classList || new ClassList(node);
19377   }
19378   function ClassList(node) {
19379     this._node = node;
19380     this._names = classArray(node.getAttribute("class") || "");
19381   }
19382   ClassList.prototype = {
19383     add: function(name2) {
19384       var i2 = this._names.indexOf(name2);
19385       if (i2 < 0) {
19386         this._names.push(name2);
19387         this._node.setAttribute("class", this._names.join(" "));
19388       }
19389     },
19390     remove: function(name2) {
19391       var i2 = this._names.indexOf(name2);
19392       if (i2 >= 0) {
19393         this._names.splice(i2, 1);
19394         this._node.setAttribute("class", this._names.join(" "));
19395       }
19396     },
19397     contains: function(name2) {
19398       return this._names.indexOf(name2) >= 0;
19399     }
19400   };
19401   function classedAdd(node, names) {
19402     var list = classList(node), i2 = -1, n2 = names.length;
19403     while (++i2 < n2)
19404       list.add(names[i2]);
19405   }
19406   function classedRemove(node, names) {
19407     var list = classList(node), i2 = -1, n2 = names.length;
19408     while (++i2 < n2)
19409       list.remove(names[i2]);
19410   }
19411   function classedTrue(names) {
19412     return function() {
19413       classedAdd(this, names);
19414     };
19415   }
19416   function classedFalse(names) {
19417     return function() {
19418       classedRemove(this, names);
19419     };
19420   }
19421   function classedFunction(names, value) {
19422     return function() {
19423       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19424     };
19425   }
19426   function classed_default(name2, value) {
19427     var names = classArray(name2 + "");
19428     if (arguments.length < 2) {
19429       var list = classList(this.node()), i2 = -1, n2 = names.length;
19430       while (++i2 < n2)
19431         if (!list.contains(names[i2]))
19432           return false;
19433       return true;
19434     }
19435     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19436   }
19437
19438   // node_modules/d3-selection/src/selection/text.js
19439   function textRemove() {
19440     this.textContent = "";
19441   }
19442   function textConstant(value) {
19443     return function() {
19444       this.textContent = value;
19445     };
19446   }
19447   function textFunction(value) {
19448     return function() {
19449       var v = value.apply(this, arguments);
19450       this.textContent = v == null ? "" : v;
19451     };
19452   }
19453   function text_default(value) {
19454     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19455   }
19456
19457   // node_modules/d3-selection/src/selection/html.js
19458   function htmlRemove() {
19459     this.innerHTML = "";
19460   }
19461   function htmlConstant(value) {
19462     return function() {
19463       this.innerHTML = value;
19464     };
19465   }
19466   function htmlFunction(value) {
19467     return function() {
19468       var v = value.apply(this, arguments);
19469       this.innerHTML = v == null ? "" : v;
19470     };
19471   }
19472   function html_default(value) {
19473     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19474   }
19475
19476   // node_modules/d3-selection/src/selection/raise.js
19477   function raise() {
19478     if (this.nextSibling)
19479       this.parentNode.appendChild(this);
19480   }
19481   function raise_default() {
19482     return this.each(raise);
19483   }
19484
19485   // node_modules/d3-selection/src/selection/lower.js
19486   function lower() {
19487     if (this.previousSibling)
19488       this.parentNode.insertBefore(this, this.parentNode.firstChild);
19489   }
19490   function lower_default() {
19491     return this.each(lower);
19492   }
19493
19494   // node_modules/d3-selection/src/selection/append.js
19495   function append_default(name2) {
19496     var create2 = typeof name2 === "function" ? name2 : creator_default(name2);
19497     return this.select(function() {
19498       return this.appendChild(create2.apply(this, arguments));
19499     });
19500   }
19501
19502   // node_modules/d3-selection/src/selection/insert.js
19503   function constantNull() {
19504     return null;
19505   }
19506   function insert_default(name2, before) {
19507     var create2 = typeof name2 === "function" ? name2 : creator_default(name2), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
19508     return this.select(function() {
19509       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
19510     });
19511   }
19512
19513   // node_modules/d3-selection/src/selection/remove.js
19514   function remove() {
19515     var parent = this.parentNode;
19516     if (parent)
19517       parent.removeChild(this);
19518   }
19519   function remove_default() {
19520     return this.each(remove);
19521   }
19522
19523   // node_modules/d3-selection/src/selection/clone.js
19524   function selection_cloneShallow() {
19525     var clone = this.cloneNode(false), parent = this.parentNode;
19526     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19527   }
19528   function selection_cloneDeep() {
19529     var clone = this.cloneNode(true), parent = this.parentNode;
19530     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19531   }
19532   function clone_default(deep) {
19533     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
19534   }
19535
19536   // node_modules/d3-selection/src/selection/datum.js
19537   function datum_default(value) {
19538     return arguments.length ? this.property("__data__", value) : this.node().__data__;
19539   }
19540
19541   // node_modules/d3-selection/src/selection/on.js
19542   function contextListener(listener) {
19543     return function(event) {
19544       listener.call(this, event, this.__data__);
19545     };
19546   }
19547   function parseTypenames2(typenames) {
19548     return typenames.trim().split(/^|\s+/).map(function(t) {
19549       var name2 = "", i2 = t.indexOf(".");
19550       if (i2 >= 0)
19551         name2 = t.slice(i2 + 1), t = t.slice(0, i2);
19552       return { type: t, name: name2 };
19553     });
19554   }
19555   function onRemove(typename) {
19556     return function() {
19557       var on = this.__on;
19558       if (!on)
19559         return;
19560       for (var j2 = 0, i2 = -1, m = on.length, o; j2 < m; ++j2) {
19561         if (o = on[j2], (!typename.type || o.type === typename.type) && o.name === typename.name) {
19562           this.removeEventListener(o.type, o.listener, o.options);
19563         } else {
19564           on[++i2] = o;
19565         }
19566       }
19567       if (++i2)
19568         on.length = i2;
19569       else
19570         delete this.__on;
19571     };
19572   }
19573   function onAdd(typename, value, options2) {
19574     return function() {
19575       var on = this.__on, o, listener = contextListener(value);
19576       if (on)
19577         for (var j2 = 0, m = on.length; j2 < m; ++j2) {
19578           if ((o = on[j2]).type === typename.type && o.name === typename.name) {
19579             this.removeEventListener(o.type, o.listener, o.options);
19580             this.addEventListener(o.type, o.listener = listener, o.options = options2);
19581             o.value = value;
19582             return;
19583           }
19584         }
19585       this.addEventListener(typename.type, listener, options2);
19586       o = { type: typename.type, name: typename.name, value, listener, options: options2 };
19587       if (!on)
19588         this.__on = [o];
19589       else
19590         on.push(o);
19591     };
19592   }
19593   function on_default(typename, value, options2) {
19594     var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t;
19595     if (arguments.length < 2) {
19596       var on = this.node().__on;
19597       if (on)
19598         for (var j2 = 0, m = on.length, o; j2 < m; ++j2) {
19599           for (i2 = 0, o = on[j2]; i2 < n2; ++i2) {
19600             if ((t = typenames[i2]).type === o.type && t.name === o.name) {
19601               return o.value;
19602             }
19603           }
19604         }
19605       return;
19606     }
19607     on = value ? onAdd : onRemove;
19608     for (i2 = 0; i2 < n2; ++i2)
19609       this.each(on(typenames[i2], value, options2));
19610     return this;
19611   }
19612
19613   // node_modules/d3-selection/src/selection/dispatch.js
19614   function dispatchEvent(node, type3, params) {
19615     var window2 = window_default(node), event = window2.CustomEvent;
19616     if (typeof event === "function") {
19617       event = new event(type3, params);
19618     } else {
19619       event = window2.document.createEvent("Event");
19620       if (params)
19621         event.initEvent(type3, params.bubbles, params.cancelable), event.detail = params.detail;
19622       else
19623         event.initEvent(type3, false, false);
19624     }
19625     node.dispatchEvent(event);
19626   }
19627   function dispatchConstant(type3, params) {
19628     return function() {
19629       return dispatchEvent(this, type3, params);
19630     };
19631   }
19632   function dispatchFunction(type3, params) {
19633     return function() {
19634       return dispatchEvent(this, type3, params.apply(this, arguments));
19635     };
19636   }
19637   function dispatch_default2(type3, params) {
19638     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type3, params));
19639   }
19640
19641   // node_modules/d3-selection/src/selection/iterator.js
19642   function* iterator_default() {
19643     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19644       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19645         if (node = group[i2])
19646           yield node;
19647       }
19648     }
19649   }
19650
19651   // node_modules/d3-selection/src/selection/index.js
19652   var root = [null];
19653   function Selection(groups, parents) {
19654     this._groups = groups;
19655     this._parents = parents;
19656   }
19657   function selection() {
19658     return new Selection([[document.documentElement]], root);
19659   }
19660   function selection_selection() {
19661     return this;
19662   }
19663   Selection.prototype = selection.prototype = {
19664     constructor: Selection,
19665     select: select_default,
19666     selectAll: selectAll_default,
19667     selectChild: selectChild_default,
19668     selectChildren: selectChildren_default,
19669     filter: filter_default,
19670     data: data_default,
19671     enter: enter_default,
19672     exit: exit_default,
19673     join: join_default,
19674     merge: merge_default,
19675     selection: selection_selection,
19676     order: order_default,
19677     sort: sort_default,
19678     call: call_default,
19679     nodes: nodes_default,
19680     node: node_default,
19681     size: size_default,
19682     empty: empty_default,
19683     each: each_default,
19684     attr: attr_default,
19685     style: style_default,
19686     property: property_default,
19687     classed: classed_default,
19688     text: text_default,
19689     html: html_default,
19690     raise: raise_default,
19691     lower: lower_default,
19692     append: append_default,
19693     insert: insert_default,
19694     remove: remove_default,
19695     clone: clone_default,
19696     datum: datum_default,
19697     on: on_default,
19698     dispatch: dispatch_default2,
19699     [Symbol.iterator]: iterator_default
19700   };
19701   var selection_default = selection;
19702
19703   // node_modules/d3-selection/src/select.js
19704   function select_default2(selector) {
19705     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
19706   }
19707
19708   // node_modules/d3-selection/src/sourceEvent.js
19709   function sourceEvent_default(event) {
19710     let sourceEvent;
19711     while (sourceEvent = event.sourceEvent)
19712       event = sourceEvent;
19713     return event;
19714   }
19715
19716   // node_modules/d3-selection/src/pointer.js
19717   function pointer_default(event, node) {
19718     event = sourceEvent_default(event);
19719     if (node === void 0)
19720       node = event.currentTarget;
19721     if (node) {
19722       var svg2 = node.ownerSVGElement || node;
19723       if (svg2.createSVGPoint) {
19724         var point = svg2.createSVGPoint();
19725         point.x = event.clientX, point.y = event.clientY;
19726         point = point.matrixTransform(node.getScreenCTM().inverse());
19727         return [point.x, point.y];
19728       }
19729       if (node.getBoundingClientRect) {
19730         var rect = node.getBoundingClientRect();
19731         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
19732       }
19733     }
19734     return [event.pageX, event.pageY];
19735   }
19736
19737   // node_modules/d3-selection/src/selectAll.js
19738   function selectAll_default2(selector) {
19739     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
19740   }
19741
19742   // node_modules/d3-drag/src/noevent.js
19743   var nonpassive = { passive: false };
19744   var nonpassivecapture = { capture: true, passive: false };
19745   function nopropagation(event) {
19746     event.stopImmediatePropagation();
19747   }
19748   function noevent_default(event) {
19749     event.preventDefault();
19750     event.stopImmediatePropagation();
19751   }
19752
19753   // node_modules/d3-drag/src/nodrag.js
19754   function nodrag_default(view) {
19755     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
19756     if ("onselectstart" in root3) {
19757       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
19758     } else {
19759       root3.__noselect = root3.style.MozUserSelect;
19760       root3.style.MozUserSelect = "none";
19761     }
19762   }
19763   function yesdrag(view, noclick) {
19764     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
19765     if (noclick) {
19766       selection2.on("click.drag", noevent_default, nonpassivecapture);
19767       setTimeout(function() {
19768         selection2.on("click.drag", null);
19769       }, 0);
19770     }
19771     if ("onselectstart" in root3) {
19772       selection2.on("selectstart.drag", null);
19773     } else {
19774       root3.style.MozUserSelect = root3.__noselect;
19775       delete root3.__noselect;
19776     }
19777   }
19778
19779   // node_modules/d3-drag/src/constant.js
19780   var constant_default2 = (x) => () => x;
19781
19782   // node_modules/d3-drag/src/event.js
19783   function DragEvent(type3, {
19784     sourceEvent,
19785     subject,
19786     target,
19787     identifier,
19788     active,
19789     x,
19790     y,
19791     dx,
19792     dy,
19793     dispatch: dispatch10
19794   }) {
19795     Object.defineProperties(this, {
19796       type: { value: type3, enumerable: true, configurable: true },
19797       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19798       subject: { value: subject, enumerable: true, configurable: true },
19799       target: { value: target, enumerable: true, configurable: true },
19800       identifier: { value: identifier, enumerable: true, configurable: true },
19801       active: { value: active, enumerable: true, configurable: true },
19802       x: { value: x, enumerable: true, configurable: true },
19803       y: { value: y, enumerable: true, configurable: true },
19804       dx: { value: dx, enumerable: true, configurable: true },
19805       dy: { value: dy, enumerable: true, configurable: true },
19806       _: { value: dispatch10 }
19807     });
19808   }
19809   DragEvent.prototype.on = function() {
19810     var value = this._.on.apply(this._, arguments);
19811     return value === this._ ? this : value;
19812   };
19813
19814   // node_modules/d3-drag/src/drag.js
19815   function defaultFilter(event) {
19816     return !event.ctrlKey && !event.button;
19817   }
19818   function defaultContainer() {
19819     return this.parentNode;
19820   }
19821   function defaultSubject(event, d) {
19822     return d == null ? { x: event.x, y: event.y } : d;
19823   }
19824   function defaultTouchable() {
19825     return navigator.maxTouchPoints || "ontouchstart" in this;
19826   }
19827   function drag_default() {
19828     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
19829     function drag(selection2) {
19830       selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
19831     }
19832     function mousedowned(event, d) {
19833       if (touchending || !filter2.call(this, event, d))
19834         return;
19835       var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
19836       if (!gesture)
19837         return;
19838       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
19839       nodrag_default(event.view);
19840       nopropagation(event);
19841       mousemoving = false;
19842       mousedownx = event.clientX;
19843       mousedowny = event.clientY;
19844       gesture("start", event);
19845     }
19846     function mousemoved(event) {
19847       noevent_default(event);
19848       if (!mousemoving) {
19849         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
19850         mousemoving = dx * dx + dy * dy > clickDistance2;
19851       }
19852       gestures.mouse("drag", event);
19853     }
19854     function mouseupped(event) {
19855       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
19856       yesdrag(event.view, mousemoving);
19857       noevent_default(event);
19858       gestures.mouse("end", event);
19859     }
19860     function touchstarted(event, d) {
19861       if (!filter2.call(this, event, d))
19862         return;
19863       var touches = event.changedTouches, c = container.call(this, event, d), n2 = touches.length, i2, gesture;
19864       for (i2 = 0; i2 < n2; ++i2) {
19865         if (gesture = beforestart(this, c, event, d, touches[i2].identifier, touches[i2])) {
19866           nopropagation(event);
19867           gesture("start", event, touches[i2]);
19868         }
19869       }
19870     }
19871     function touchmoved(event) {
19872       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19873       for (i2 = 0; i2 < n2; ++i2) {
19874         if (gesture = gestures[touches[i2].identifier]) {
19875           noevent_default(event);
19876           gesture("drag", event, touches[i2]);
19877         }
19878       }
19879     }
19880     function touchended(event) {
19881       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19882       if (touchending)
19883         clearTimeout(touchending);
19884       touchending = setTimeout(function() {
19885         touchending = null;
19886       }, 500);
19887       for (i2 = 0; i2 < n2; ++i2) {
19888         if (gesture = gestures[touches[i2].identifier]) {
19889           nopropagation(event);
19890           gesture("end", event, touches[i2]);
19891         }
19892       }
19893     }
19894     function beforestart(that, container2, event, d, identifier, touch) {
19895       var dispatch10 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
19896       if ((s = subject.call(that, new DragEvent("beforestart", {
19897         sourceEvent: event,
19898         target: drag,
19899         identifier,
19900         active,
19901         x: p[0],
19902         y: p[1],
19903         dx: 0,
19904         dy: 0,
19905         dispatch: dispatch10
19906       }), d)) == null)
19907         return;
19908       dx = s.x - p[0] || 0;
19909       dy = s.y - p[1] || 0;
19910       return function gesture(type3, event2, touch2) {
19911         var p02 = p, n2;
19912         switch (type3) {
19913           case "start":
19914             gestures[identifier] = gesture, n2 = active++;
19915             break;
19916           case "end":
19917             delete gestures[identifier], --active;
19918           case "drag":
19919             p = pointer_default(touch2 || event2, container2), n2 = active;
19920             break;
19921         }
19922         dispatch10.call(type3, that, new DragEvent(type3, {
19923           sourceEvent: event2,
19924           subject: s,
19925           target: drag,
19926           identifier,
19927           active: n2,
19928           x: p[0] + dx,
19929           y: p[1] + dy,
19930           dx: p[0] - p02[0],
19931           dy: p[1] - p02[1],
19932           dispatch: dispatch10
19933         }), d);
19934       };
19935     }
19936     drag.filter = function(_) {
19937       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
19938     };
19939     drag.container = function(_) {
19940       return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
19941     };
19942     drag.subject = function(_) {
19943       return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
19944     };
19945     drag.touchable = function(_) {
19946       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
19947     };
19948     drag.on = function() {
19949       var value = listeners.on.apply(listeners, arguments);
19950       return value === listeners ? drag : value;
19951     };
19952     drag.clickDistance = function(_) {
19953       return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
19954     };
19955     return drag;
19956   }
19957
19958   // node_modules/d3-color/src/define.js
19959   function define_default(constructor, factory, prototype) {
19960     constructor.prototype = factory.prototype = prototype;
19961     prototype.constructor = constructor;
19962   }
19963   function extend(parent, definition) {
19964     var prototype = Object.create(parent.prototype);
19965     for (var key in definition)
19966       prototype[key] = definition[key];
19967     return prototype;
19968   }
19969
19970   // node_modules/d3-color/src/color.js
19971   function Color() {
19972   }
19973   var darker = 0.7;
19974   var brighter = 1 / darker;
19975   var reI = "\\s*([+-]?\\d+)\\s*";
19976   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
19977   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
19978   var reHex = /^#([0-9a-f]{3,8})$/;
19979   var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
19980   var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
19981   var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
19982   var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
19983   var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
19984   var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
19985   var named = {
19986     aliceblue: 15792383,
19987     antiquewhite: 16444375,
19988     aqua: 65535,
19989     aquamarine: 8388564,
19990     azure: 15794175,
19991     beige: 16119260,
19992     bisque: 16770244,
19993     black: 0,
19994     blanchedalmond: 16772045,
19995     blue: 255,
19996     blueviolet: 9055202,
19997     brown: 10824234,
19998     burlywood: 14596231,
19999     cadetblue: 6266528,
20000     chartreuse: 8388352,
20001     chocolate: 13789470,
20002     coral: 16744272,
20003     cornflowerblue: 6591981,
20004     cornsilk: 16775388,
20005     crimson: 14423100,
20006     cyan: 65535,
20007     darkblue: 139,
20008     darkcyan: 35723,
20009     darkgoldenrod: 12092939,
20010     darkgray: 11119017,
20011     darkgreen: 25600,
20012     darkgrey: 11119017,
20013     darkkhaki: 12433259,
20014     darkmagenta: 9109643,
20015     darkolivegreen: 5597999,
20016     darkorange: 16747520,
20017     darkorchid: 10040012,
20018     darkred: 9109504,
20019     darksalmon: 15308410,
20020     darkseagreen: 9419919,
20021     darkslateblue: 4734347,
20022     darkslategray: 3100495,
20023     darkslategrey: 3100495,
20024     darkturquoise: 52945,
20025     darkviolet: 9699539,
20026     deeppink: 16716947,
20027     deepskyblue: 49151,
20028     dimgray: 6908265,
20029     dimgrey: 6908265,
20030     dodgerblue: 2003199,
20031     firebrick: 11674146,
20032     floralwhite: 16775920,
20033     forestgreen: 2263842,
20034     fuchsia: 16711935,
20035     gainsboro: 14474460,
20036     ghostwhite: 16316671,
20037     gold: 16766720,
20038     goldenrod: 14329120,
20039     gray: 8421504,
20040     green: 32768,
20041     greenyellow: 11403055,
20042     grey: 8421504,
20043     honeydew: 15794160,
20044     hotpink: 16738740,
20045     indianred: 13458524,
20046     indigo: 4915330,
20047     ivory: 16777200,
20048     khaki: 15787660,
20049     lavender: 15132410,
20050     lavenderblush: 16773365,
20051     lawngreen: 8190976,
20052     lemonchiffon: 16775885,
20053     lightblue: 11393254,
20054     lightcoral: 15761536,
20055     lightcyan: 14745599,
20056     lightgoldenrodyellow: 16448210,
20057     lightgray: 13882323,
20058     lightgreen: 9498256,
20059     lightgrey: 13882323,
20060     lightpink: 16758465,
20061     lightsalmon: 16752762,
20062     lightseagreen: 2142890,
20063     lightskyblue: 8900346,
20064     lightslategray: 7833753,
20065     lightslategrey: 7833753,
20066     lightsteelblue: 11584734,
20067     lightyellow: 16777184,
20068     lime: 65280,
20069     limegreen: 3329330,
20070     linen: 16445670,
20071     magenta: 16711935,
20072     maroon: 8388608,
20073     mediumaquamarine: 6737322,
20074     mediumblue: 205,
20075     mediumorchid: 12211667,
20076     mediumpurple: 9662683,
20077     mediumseagreen: 3978097,
20078     mediumslateblue: 8087790,
20079     mediumspringgreen: 64154,
20080     mediumturquoise: 4772300,
20081     mediumvioletred: 13047173,
20082     midnightblue: 1644912,
20083     mintcream: 16121850,
20084     mistyrose: 16770273,
20085     moccasin: 16770229,
20086     navajowhite: 16768685,
20087     navy: 128,
20088     oldlace: 16643558,
20089     olive: 8421376,
20090     olivedrab: 7048739,
20091     orange: 16753920,
20092     orangered: 16729344,
20093     orchid: 14315734,
20094     palegoldenrod: 15657130,
20095     palegreen: 10025880,
20096     paleturquoise: 11529966,
20097     palevioletred: 14381203,
20098     papayawhip: 16773077,
20099     peachpuff: 16767673,
20100     peru: 13468991,
20101     pink: 16761035,
20102     plum: 14524637,
20103     powderblue: 11591910,
20104     purple: 8388736,
20105     rebeccapurple: 6697881,
20106     red: 16711680,
20107     rosybrown: 12357519,
20108     royalblue: 4286945,
20109     saddlebrown: 9127187,
20110     salmon: 16416882,
20111     sandybrown: 16032864,
20112     seagreen: 3050327,
20113     seashell: 16774638,
20114     sienna: 10506797,
20115     silver: 12632256,
20116     skyblue: 8900331,
20117     slateblue: 6970061,
20118     slategray: 7372944,
20119     slategrey: 7372944,
20120     snow: 16775930,
20121     springgreen: 65407,
20122     steelblue: 4620980,
20123     tan: 13808780,
20124     teal: 32896,
20125     thistle: 14204888,
20126     tomato: 16737095,
20127     turquoise: 4251856,
20128     violet: 15631086,
20129     wheat: 16113331,
20130     white: 16777215,
20131     whitesmoke: 16119285,
20132     yellow: 16776960,
20133     yellowgreen: 10145074
20134   };
20135   define_default(Color, color, {
20136     copy(channels) {
20137       return Object.assign(new this.constructor(), this, channels);
20138     },
20139     displayable() {
20140       return this.rgb().displayable();
20141     },
20142     hex: color_formatHex,
20143     formatHex: color_formatHex,
20144     formatHex8: color_formatHex8,
20145     formatHsl: color_formatHsl,
20146     formatRgb: color_formatRgb,
20147     toString: color_formatRgb
20148   });
20149   function color_formatHex() {
20150     return this.rgb().formatHex();
20151   }
20152   function color_formatHex8() {
20153     return this.rgb().formatHex8();
20154   }
20155   function color_formatHsl() {
20156     return hslConvert(this).formatHsl();
20157   }
20158   function color_formatRgb() {
20159     return this.rgb().formatRgb();
20160   }
20161   function color(format2) {
20162     var m, l;
20163     format2 = (format2 + "").trim().toLowerCase();
20164     return (m = reHex.exec(format2)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format2)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format2)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format2)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format2)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
20165   }
20166   function rgbn(n2) {
20167     return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
20168   }
20169   function rgba(r, g, b, a) {
20170     if (a <= 0)
20171       r = g = b = NaN;
20172     return new Rgb(r, g, b, a);
20173   }
20174   function rgbConvert(o) {
20175     if (!(o instanceof Color))
20176       o = color(o);
20177     if (!o)
20178       return new Rgb();
20179     o = o.rgb();
20180     return new Rgb(o.r, o.g, o.b, o.opacity);
20181   }
20182   function rgb(r, g, b, opacity) {
20183     return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
20184   }
20185   function Rgb(r, g, b, opacity) {
20186     this.r = +r;
20187     this.g = +g;
20188     this.b = +b;
20189     this.opacity = +opacity;
20190   }
20191   define_default(Rgb, rgb, extend(Color, {
20192     brighter(k) {
20193       k = k == null ? brighter : Math.pow(brighter, k);
20194       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20195     },
20196     darker(k) {
20197       k = k == null ? darker : Math.pow(darker, k);
20198       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20199     },
20200     rgb() {
20201       return this;
20202     },
20203     clamp() {
20204       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20205     },
20206     displayable() {
20207       return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
20208     },
20209     hex: rgb_formatHex,
20210     formatHex: rgb_formatHex,
20211     formatHex8: rgb_formatHex8,
20212     formatRgb: rgb_formatRgb,
20213     toString: rgb_formatRgb
20214   }));
20215   function rgb_formatHex() {
20216     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
20217   }
20218   function rgb_formatHex8() {
20219     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
20220   }
20221   function rgb_formatRgb() {
20222     const a = clampa(this.opacity);
20223     return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
20224   }
20225   function clampa(opacity) {
20226     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20227   }
20228   function clampi(value) {
20229     return Math.max(0, Math.min(255, Math.round(value) || 0));
20230   }
20231   function hex(value) {
20232     value = clampi(value);
20233     return (value < 16 ? "0" : "") + value.toString(16);
20234   }
20235   function hsla(h, s, l, a) {
20236     if (a <= 0)
20237       h = s = l = NaN;
20238     else if (l <= 0 || l >= 1)
20239       h = s = NaN;
20240     else if (s <= 0)
20241       h = NaN;
20242     return new Hsl(h, s, l, a);
20243   }
20244   function hslConvert(o) {
20245     if (o instanceof Hsl)
20246       return new Hsl(o.h, o.s, o.l, o.opacity);
20247     if (!(o instanceof Color))
20248       o = color(o);
20249     if (!o)
20250       return new Hsl();
20251     if (o instanceof Hsl)
20252       return o;
20253     o = o.rgb();
20254     var r = o.r / 255, g = o.g / 255, b = o.b / 255, min3 = Math.min(r, g, b), max3 = Math.max(r, g, b), h = NaN, s = max3 - min3, l = (max3 + min3) / 2;
20255     if (s) {
20256       if (r === max3)
20257         h = (g - b) / s + (g < b) * 6;
20258       else if (g === max3)
20259         h = (b - r) / s + 2;
20260       else
20261         h = (r - g) / s + 4;
20262       s /= l < 0.5 ? max3 + min3 : 2 - max3 - min3;
20263       h *= 60;
20264     } else {
20265       s = l > 0 && l < 1 ? 0 : h;
20266     }
20267     return new Hsl(h, s, l, o.opacity);
20268   }
20269   function hsl(h, s, l, opacity) {
20270     return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
20271   }
20272   function Hsl(h, s, l, opacity) {
20273     this.h = +h;
20274     this.s = +s;
20275     this.l = +l;
20276     this.opacity = +opacity;
20277   }
20278   define_default(Hsl, hsl, extend(Color, {
20279     brighter(k) {
20280       k = k == null ? brighter : Math.pow(brighter, k);
20281       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20282     },
20283     darker(k) {
20284       k = k == null ? darker : Math.pow(darker, k);
20285       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20286     },
20287     rgb() {
20288       var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
20289       return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
20290     },
20291     clamp() {
20292       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20293     },
20294     displayable() {
20295       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20296     },
20297     formatHsl() {
20298       const a = clampa(this.opacity);
20299       return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
20300     }
20301   }));
20302   function clamph(value) {
20303     value = (value || 0) % 360;
20304     return value < 0 ? value + 360 : value;
20305   }
20306   function clampt(value) {
20307     return Math.max(0, Math.min(1, value || 0));
20308   }
20309   function hsl2rgb(h, m1, m2) {
20310     return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
20311   }
20312
20313   // node_modules/d3-interpolate/src/basis.js
20314   function basis(t1, v0, v1, v2, v3) {
20315     var t2 = t1 * t1, t3 = t2 * t1;
20316     return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
20317   }
20318   function basis_default(values) {
20319     var n2 = values.length - 1;
20320     return function(t) {
20321       var i2 = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n2 - 1) : Math.floor(t * n2), v1 = values[i2], v2 = values[i2 + 1], v0 = i2 > 0 ? values[i2 - 1] : 2 * v1 - v2, v3 = i2 < n2 - 1 ? values[i2 + 2] : 2 * v2 - v1;
20322       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20323     };
20324   }
20325
20326   // node_modules/d3-interpolate/src/basisClosed.js
20327   function basisClosed_default(values) {
20328     var n2 = values.length;
20329     return function(t) {
20330       var i2 = Math.floor(((t %= 1) < 0 ? ++t : t) * n2), v0 = values[(i2 + n2 - 1) % n2], v1 = values[i2 % n2], v2 = values[(i2 + 1) % n2], v3 = values[(i2 + 2) % n2];
20331       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20332     };
20333   }
20334
20335   // node_modules/d3-interpolate/src/constant.js
20336   var constant_default3 = (x) => () => x;
20337
20338   // node_modules/d3-interpolate/src/color.js
20339   function linear(a, d) {
20340     return function(t) {
20341       return a + t * d;
20342     };
20343   }
20344   function exponential(a, b, y) {
20345     return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
20346       return Math.pow(a + t * b, y);
20347     };
20348   }
20349   function gamma(y) {
20350     return (y = +y) === 1 ? nogamma : function(a, b) {
20351       return b - a ? exponential(a, b, y) : constant_default3(isNaN(a) ? b : a);
20352     };
20353   }
20354   function nogamma(a, b) {
20355     var d = b - a;
20356     return d ? linear(a, d) : constant_default3(isNaN(a) ? b : a);
20357   }
20358
20359   // node_modules/d3-interpolate/src/rgb.js
20360   var rgb_default = function rgbGamma(y) {
20361     var color2 = gamma(y);
20362     function rgb2(start2, end) {
20363       var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
20364       return function(t) {
20365         start2.r = r(t);
20366         start2.g = g(t);
20367         start2.b = b(t);
20368         start2.opacity = opacity(t);
20369         return start2 + "";
20370       };
20371     }
20372     rgb2.gamma = rgbGamma;
20373     return rgb2;
20374   }(1);
20375   function rgbSpline(spline) {
20376     return function(colors) {
20377       var n2 = colors.length, r = new Array(n2), g = new Array(n2), b = new Array(n2), i2, color2;
20378       for (i2 = 0; i2 < n2; ++i2) {
20379         color2 = rgb(colors[i2]);
20380         r[i2] = color2.r || 0;
20381         g[i2] = color2.g || 0;
20382         b[i2] = color2.b || 0;
20383       }
20384       r = spline(r);
20385       g = spline(g);
20386       b = spline(b);
20387       color2.opacity = 1;
20388       return function(t) {
20389         color2.r = r(t);
20390         color2.g = g(t);
20391         color2.b = b(t);
20392         return color2 + "";
20393       };
20394     };
20395   }
20396   var rgbBasis = rgbSpline(basis_default);
20397   var rgbBasisClosed = rgbSpline(basisClosed_default);
20398
20399   // node_modules/d3-interpolate/src/numberArray.js
20400   function numberArray_default(a, b) {
20401     if (!b)
20402       b = [];
20403     var n2 = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i2;
20404     return function(t) {
20405       for (i2 = 0; i2 < n2; ++i2)
20406         c[i2] = a[i2] * (1 - t) + b[i2] * t;
20407       return c;
20408     };
20409   }
20410   function isNumberArray(x) {
20411     return ArrayBuffer.isView(x) && !(x instanceof DataView);
20412   }
20413
20414   // node_modules/d3-interpolate/src/array.js
20415   function genericArray(a, b) {
20416     var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i2;
20417     for (i2 = 0; i2 < na; ++i2)
20418       x[i2] = value_default(a[i2], b[i2]);
20419     for (; i2 < nb; ++i2)
20420       c[i2] = b[i2];
20421     return function(t) {
20422       for (i2 = 0; i2 < na; ++i2)
20423         c[i2] = x[i2](t);
20424       return c;
20425     };
20426   }
20427
20428   // node_modules/d3-interpolate/src/date.js
20429   function date_default(a, b) {
20430     var d = new Date();
20431     return a = +a, b = +b, function(t) {
20432       return d.setTime(a * (1 - t) + b * t), d;
20433     };
20434   }
20435
20436   // node_modules/d3-interpolate/src/number.js
20437   function number_default(a, b) {
20438     return a = +a, b = +b, function(t) {
20439       return a * (1 - t) + b * t;
20440     };
20441   }
20442
20443   // node_modules/d3-interpolate/src/object.js
20444   function object_default(a, b) {
20445     var i2 = {}, c = {}, k;
20446     if (a === null || typeof a !== "object")
20447       a = {};
20448     if (b === null || typeof b !== "object")
20449       b = {};
20450     for (k in b) {
20451       if (k in a) {
20452         i2[k] = value_default(a[k], b[k]);
20453       } else {
20454         c[k] = b[k];
20455       }
20456     }
20457     return function(t) {
20458       for (k in i2)
20459         c[k] = i2[k](t);
20460       return c;
20461     };
20462   }
20463
20464   // node_modules/d3-interpolate/src/string.js
20465   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20466   var reB = new RegExp(reA.source, "g");
20467   function zero2(b) {
20468     return function() {
20469       return b;
20470     };
20471   }
20472   function one(b) {
20473     return function(t) {
20474       return b(t) + "";
20475     };
20476   }
20477   function string_default(a, b) {
20478     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s = [], q = [];
20479     a = a + "", b = b + "";
20480     while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
20481       if ((bs = bm.index) > bi) {
20482         bs = b.slice(bi, bs);
20483         if (s[i2])
20484           s[i2] += bs;
20485         else
20486           s[++i2] = bs;
20487       }
20488       if ((am = am[0]) === (bm = bm[0])) {
20489         if (s[i2])
20490           s[i2] += bm;
20491         else
20492           s[++i2] = bm;
20493       } else {
20494         s[++i2] = null;
20495         q.push({ i: i2, x: number_default(am, bm) });
20496       }
20497       bi = reB.lastIndex;
20498     }
20499     if (bi < b.length) {
20500       bs = b.slice(bi);
20501       if (s[i2])
20502         s[i2] += bs;
20503       else
20504         s[++i2] = bs;
20505     }
20506     return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
20507       for (var i3 = 0, o; i3 < b; ++i3)
20508         s[(o = q[i3]).i] = o.x(t);
20509       return s.join("");
20510     });
20511   }
20512
20513   // node_modules/d3-interpolate/src/value.js
20514   function value_default(a, b) {
20515     var t = typeof b, c;
20516     return b == null || t === "boolean" ? constant_default3(b) : (t === "number" ? number_default : t === "string" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b);
20517   }
20518
20519   // node_modules/d3-interpolate/src/round.js
20520   function round_default(a, b) {
20521     return a = +a, b = +b, function(t) {
20522       return Math.round(a * (1 - t) + b * t);
20523     };
20524   }
20525
20526   // node_modules/d3-interpolate/src/transform/decompose.js
20527   var degrees2 = 180 / Math.PI;
20528   var identity = {
20529     translateX: 0,
20530     translateY: 0,
20531     rotate: 0,
20532     skewX: 0,
20533     scaleX: 1,
20534     scaleY: 1
20535   };
20536   function decompose_default(a, b, c, d, e, f2) {
20537     var scaleX, scaleY, skewX;
20538     if (scaleX = Math.sqrt(a * a + b * b))
20539       a /= scaleX, b /= scaleX;
20540     if (skewX = a * c + b * d)
20541       c -= a * skewX, d -= b * skewX;
20542     if (scaleY = Math.sqrt(c * c + d * d))
20543       c /= scaleY, d /= scaleY, skewX /= scaleY;
20544     if (a * d < b * c)
20545       a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
20546     return {
20547       translateX: e,
20548       translateY: f2,
20549       rotate: Math.atan2(b, a) * degrees2,
20550       skewX: Math.atan(skewX) * degrees2,
20551       scaleX,
20552       scaleY
20553     };
20554   }
20555
20556   // node_modules/d3-interpolate/src/transform/parse.js
20557   var svgNode;
20558   function parseCss(value) {
20559     const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
20560     return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
20561   }
20562   function parseSvg(value) {
20563     if (value == null)
20564       return identity;
20565     if (!svgNode)
20566       svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
20567     svgNode.setAttribute("transform", value);
20568     if (!(value = svgNode.transform.baseVal.consolidate()))
20569       return identity;
20570     value = value.matrix;
20571     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
20572   }
20573
20574   // node_modules/d3-interpolate/src/transform/index.js
20575   function interpolateTransform(parse, pxComma, pxParen, degParen) {
20576     function pop(s) {
20577       return s.length ? s.pop() + " " : "";
20578     }
20579     function translate(xa, ya, xb, yb, s, q) {
20580       if (xa !== xb || ya !== yb) {
20581         var i2 = s.push("translate(", null, pxComma, null, pxParen);
20582         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20583       } else if (xb || yb) {
20584         s.push("translate(" + xb + pxComma + yb + pxParen);
20585       }
20586     }
20587     function rotate(a, b, s, q) {
20588       if (a !== b) {
20589         if (a - b > 180)
20590           b += 360;
20591         else if (b - a > 180)
20592           a += 360;
20593         q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
20594       } else if (b) {
20595         s.push(pop(s) + "rotate(" + b + degParen);
20596       }
20597     }
20598     function skewX(a, b, s, q) {
20599       if (a !== b) {
20600         q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
20601       } else if (b) {
20602         s.push(pop(s) + "skewX(" + b + degParen);
20603       }
20604     }
20605     function scale(xa, ya, xb, yb, s, q) {
20606       if (xa !== xb || ya !== yb) {
20607         var i2 = s.push(pop(s) + "scale(", null, ",", null, ")");
20608         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20609       } else if (xb !== 1 || yb !== 1) {
20610         s.push(pop(s) + "scale(" + xb + "," + yb + ")");
20611       }
20612     }
20613     return function(a, b) {
20614       var s = [], q = [];
20615       a = parse(a), b = parse(b);
20616       translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
20617       rotate(a.rotate, b.rotate, s, q);
20618       skewX(a.skewX, b.skewX, s, q);
20619       scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
20620       a = b = null;
20621       return function(t) {
20622         var i2 = -1, n2 = q.length, o;
20623         while (++i2 < n2)
20624           s[(o = q[i2]).i] = o.x(t);
20625         return s.join("");
20626       };
20627     };
20628   }
20629   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
20630   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
20631
20632   // node_modules/d3-interpolate/src/zoom.js
20633   var epsilon22 = 1e-12;
20634   function cosh(x) {
20635     return ((x = Math.exp(x)) + 1 / x) / 2;
20636   }
20637   function sinh(x) {
20638     return ((x = Math.exp(x)) - 1 / x) / 2;
20639   }
20640   function tanh(x) {
20641     return ((x = Math.exp(2 * x)) - 1) / (x + 1);
20642   }
20643   var zoom_default = function zoomRho(rho, rho2, rho4) {
20644     function zoom(p02, p1) {
20645       var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i2, S;
20646       if (d2 < epsilon22) {
20647         S = Math.log(w1 / w0) / rho;
20648         i2 = function(t) {
20649           return [
20650             ux0 + t * dx,
20651             uy0 + t * dy,
20652             w0 * Math.exp(rho * t * S)
20653           ];
20654         };
20655       } else {
20656         var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
20657         S = (r1 - r0) / rho;
20658         i2 = function(t) {
20659           var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
20660           return [
20661             ux0 + u * dx,
20662             uy0 + u * dy,
20663             w0 * coshr0 / cosh(rho * s + r0)
20664           ];
20665         };
20666       }
20667       i2.duration = S * 1e3 * rho / Math.SQRT2;
20668       return i2;
20669     }
20670     zoom.rho = function(_) {
20671       var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
20672       return zoomRho(_1, _2, _4);
20673     };
20674     return zoom;
20675   }(Math.SQRT2, 2, 4);
20676
20677   // node_modules/d3-interpolate/src/quantize.js
20678   function quantize_default(interpolator, n2) {
20679     var samples = new Array(n2);
20680     for (var i2 = 0; i2 < n2; ++i2)
20681       samples[i2] = interpolator(i2 / (n2 - 1));
20682     return samples;
20683   }
20684
20685   // node_modules/d3-timer/src/timer.js
20686   var frame = 0;
20687   var timeout = 0;
20688   var interval = 0;
20689   var pokeDelay = 1e3;
20690   var taskHead;
20691   var taskTail;
20692   var clockLast = 0;
20693   var clockNow = 0;
20694   var clockSkew = 0;
20695   var clock = typeof performance === "object" && performance.now ? performance : Date;
20696   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
20697     setTimeout(f2, 17);
20698   };
20699   function now() {
20700     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
20701   }
20702   function clearNow() {
20703     clockNow = 0;
20704   }
20705   function Timer() {
20706     this._call = this._time = this._next = null;
20707   }
20708   Timer.prototype = timer.prototype = {
20709     constructor: Timer,
20710     restart: function(callback, delay, time) {
20711       if (typeof callback !== "function")
20712         throw new TypeError("callback is not a function");
20713       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
20714       if (!this._next && taskTail !== this) {
20715         if (taskTail)
20716           taskTail._next = this;
20717         else
20718           taskHead = this;
20719         taskTail = this;
20720       }
20721       this._call = callback;
20722       this._time = time;
20723       sleep();
20724     },
20725     stop: function() {
20726       if (this._call) {
20727         this._call = null;
20728         this._time = Infinity;
20729         sleep();
20730       }
20731     }
20732   };
20733   function timer(callback, delay, time) {
20734     var t = new Timer();
20735     t.restart(callback, delay, time);
20736     return t;
20737   }
20738   function timerFlush() {
20739     now();
20740     ++frame;
20741     var t = taskHead, e;
20742     while (t) {
20743       if ((e = clockNow - t._time) >= 0)
20744         t._call.call(void 0, e);
20745       t = t._next;
20746     }
20747     --frame;
20748   }
20749   function wake() {
20750     clockNow = (clockLast = clock.now()) + clockSkew;
20751     frame = timeout = 0;
20752     try {
20753       timerFlush();
20754     } finally {
20755       frame = 0;
20756       nap();
20757       clockNow = 0;
20758     }
20759   }
20760   function poke() {
20761     var now3 = clock.now(), delay = now3 - clockLast;
20762     if (delay > pokeDelay)
20763       clockSkew -= delay, clockLast = now3;
20764   }
20765   function nap() {
20766     var t0, t1 = taskHead, t2, time = Infinity;
20767     while (t1) {
20768       if (t1._call) {
20769         if (time > t1._time)
20770           time = t1._time;
20771         t0 = t1, t1 = t1._next;
20772       } else {
20773         t2 = t1._next, t1._next = null;
20774         t1 = t0 ? t0._next = t2 : taskHead = t2;
20775       }
20776     }
20777     taskTail = t0;
20778     sleep(time);
20779   }
20780   function sleep(time) {
20781     if (frame)
20782       return;
20783     if (timeout)
20784       timeout = clearTimeout(timeout);
20785     var delay = time - clockNow;
20786     if (delay > 24) {
20787       if (time < Infinity)
20788         timeout = setTimeout(wake, time - clock.now() - clockSkew);
20789       if (interval)
20790         interval = clearInterval(interval);
20791     } else {
20792       if (!interval)
20793         clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
20794       frame = 1, setFrame(wake);
20795     }
20796   }
20797
20798   // node_modules/d3-timer/src/timeout.js
20799   function timeout_default(callback, delay, time) {
20800     var t = new Timer();
20801     delay = delay == null ? 0 : +delay;
20802     t.restart((elapsed) => {
20803       t.stop();
20804       callback(elapsed + delay);
20805     }, delay, time);
20806     return t;
20807   }
20808
20809   // node_modules/d3-transition/src/transition/schedule.js
20810   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
20811   var emptyTween = [];
20812   var CREATED = 0;
20813   var SCHEDULED = 1;
20814   var STARTING = 2;
20815   var STARTED = 3;
20816   var RUNNING = 4;
20817   var ENDING = 5;
20818   var ENDED = 6;
20819   function schedule_default(node, name2, id2, index, group, timing) {
20820     var schedules = node.__transition;
20821     if (!schedules)
20822       node.__transition = {};
20823     else if (id2 in schedules)
20824       return;
20825     create(node, id2, {
20826       name: name2,
20827       index,
20828       group,
20829       on: emptyOn,
20830       tween: emptyTween,
20831       time: timing.time,
20832       delay: timing.delay,
20833       duration: timing.duration,
20834       ease: timing.ease,
20835       timer: null,
20836       state: CREATED
20837     });
20838   }
20839   function init(node, id2) {
20840     var schedule = get2(node, id2);
20841     if (schedule.state > CREATED)
20842       throw new Error("too late; already scheduled");
20843     return schedule;
20844   }
20845   function set2(node, id2) {
20846     var schedule = get2(node, id2);
20847     if (schedule.state > STARTED)
20848       throw new Error("too late; already running");
20849     return schedule;
20850   }
20851   function get2(node, id2) {
20852     var schedule = node.__transition;
20853     if (!schedule || !(schedule = schedule[id2]))
20854       throw new Error("transition not found");
20855     return schedule;
20856   }
20857   function create(node, id2, self2) {
20858     var schedules = node.__transition, tween;
20859     schedules[id2] = self2;
20860     self2.timer = timer(schedule, 0, self2.time);
20861     function schedule(elapsed) {
20862       self2.state = SCHEDULED;
20863       self2.timer.restart(start2, self2.delay, self2.time);
20864       if (self2.delay <= elapsed)
20865         start2(elapsed - self2.delay);
20866     }
20867     function start2(elapsed) {
20868       var i2, j2, n2, o;
20869       if (self2.state !== SCHEDULED)
20870         return stop();
20871       for (i2 in schedules) {
20872         o = schedules[i2];
20873         if (o.name !== self2.name)
20874           continue;
20875         if (o.state === STARTED)
20876           return timeout_default(start2);
20877         if (o.state === RUNNING) {
20878           o.state = ENDED;
20879           o.timer.stop();
20880           o.on.call("interrupt", node, node.__data__, o.index, o.group);
20881           delete schedules[i2];
20882         } else if (+i2 < id2) {
20883           o.state = ENDED;
20884           o.timer.stop();
20885           o.on.call("cancel", node, node.__data__, o.index, o.group);
20886           delete schedules[i2];
20887         }
20888       }
20889       timeout_default(function() {
20890         if (self2.state === STARTED) {
20891           self2.state = RUNNING;
20892           self2.timer.restart(tick, self2.delay, self2.time);
20893           tick(elapsed);
20894         }
20895       });
20896       self2.state = STARTING;
20897       self2.on.call("start", node, node.__data__, self2.index, self2.group);
20898       if (self2.state !== STARTING)
20899         return;
20900       self2.state = STARTED;
20901       tween = new Array(n2 = self2.tween.length);
20902       for (i2 = 0, j2 = -1; i2 < n2; ++i2) {
20903         if (o = self2.tween[i2].value.call(node, node.__data__, self2.index, self2.group)) {
20904           tween[++j2] = o;
20905         }
20906       }
20907       tween.length = j2 + 1;
20908     }
20909     function tick(elapsed) {
20910       var t = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i2 = -1, n2 = tween.length;
20911       while (++i2 < n2) {
20912         tween[i2].call(node, t);
20913       }
20914       if (self2.state === ENDING) {
20915         self2.on.call("end", node, node.__data__, self2.index, self2.group);
20916         stop();
20917       }
20918     }
20919     function stop() {
20920       self2.state = ENDED;
20921       self2.timer.stop();
20922       delete schedules[id2];
20923       for (var i2 in schedules)
20924         return;
20925       delete node.__transition;
20926     }
20927   }
20928
20929   // node_modules/d3-transition/src/interrupt.js
20930   function interrupt_default(node, name2) {
20931     var schedules = node.__transition, schedule, active, empty2 = true, i2;
20932     if (!schedules)
20933       return;
20934     name2 = name2 == null ? null : name2 + "";
20935     for (i2 in schedules) {
20936       if ((schedule = schedules[i2]).name !== name2) {
20937         empty2 = false;
20938         continue;
20939       }
20940       active = schedule.state > STARTING && schedule.state < ENDING;
20941       schedule.state = ENDED;
20942       schedule.timer.stop();
20943       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
20944       delete schedules[i2];
20945     }
20946     if (empty2)
20947       delete node.__transition;
20948   }
20949
20950   // node_modules/d3-transition/src/selection/interrupt.js
20951   function interrupt_default2(name2) {
20952     return this.each(function() {
20953       interrupt_default(this, name2);
20954     });
20955   }
20956
20957   // node_modules/d3-transition/src/transition/tween.js
20958   function tweenRemove(id2, name2) {
20959     var tween0, tween1;
20960     return function() {
20961       var schedule = set2(this, id2), tween = schedule.tween;
20962       if (tween !== tween0) {
20963         tween1 = tween0 = tween;
20964         for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
20965           if (tween1[i2].name === name2) {
20966             tween1 = tween1.slice();
20967             tween1.splice(i2, 1);
20968             break;
20969           }
20970         }
20971       }
20972       schedule.tween = tween1;
20973     };
20974   }
20975   function tweenFunction(id2, name2, value) {
20976     var tween0, tween1;
20977     if (typeof value !== "function")
20978       throw new Error();
20979     return function() {
20980       var schedule = set2(this, id2), tween = schedule.tween;
20981       if (tween !== tween0) {
20982         tween1 = (tween0 = tween).slice();
20983         for (var t = { name: name2, value }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
20984           if (tween1[i2].name === name2) {
20985             tween1[i2] = t;
20986             break;
20987           }
20988         }
20989         if (i2 === n2)
20990           tween1.push(t);
20991       }
20992       schedule.tween = tween1;
20993     };
20994   }
20995   function tween_default(name2, value) {
20996     var id2 = this._id;
20997     name2 += "";
20998     if (arguments.length < 2) {
20999       var tween = get2(this.node(), id2).tween;
21000       for (var i2 = 0, n2 = tween.length, t; i2 < n2; ++i2) {
21001         if ((t = tween[i2]).name === name2) {
21002           return t.value;
21003         }
21004       }
21005       return null;
21006     }
21007     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name2, value));
21008   }
21009   function tweenValue(transition2, name2, value) {
21010     var id2 = transition2._id;
21011     transition2.each(function() {
21012       var schedule = set2(this, id2);
21013       (schedule.value || (schedule.value = {}))[name2] = value.apply(this, arguments);
21014     });
21015     return function(node) {
21016       return get2(node, id2).value[name2];
21017     };
21018   }
21019
21020   // node_modules/d3-transition/src/transition/interpolate.js
21021   function interpolate_default(a, b) {
21022     var c;
21023     return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
21024   }
21025
21026   // node_modules/d3-transition/src/transition/attr.js
21027   function attrRemove2(name2) {
21028     return function() {
21029       this.removeAttribute(name2);
21030     };
21031   }
21032   function attrRemoveNS2(fullname) {
21033     return function() {
21034       this.removeAttributeNS(fullname.space, fullname.local);
21035     };
21036   }
21037   function attrConstant2(name2, interpolate, value1) {
21038     var string00, string1 = value1 + "", interpolate0;
21039     return function() {
21040       var string0 = this.getAttribute(name2);
21041       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21042     };
21043   }
21044   function attrConstantNS2(fullname, interpolate, value1) {
21045     var string00, string1 = value1 + "", interpolate0;
21046     return function() {
21047       var string0 = this.getAttributeNS(fullname.space, fullname.local);
21048       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21049     };
21050   }
21051   function attrFunction2(name2, interpolate, value) {
21052     var string00, string10, interpolate0;
21053     return function() {
21054       var string0, value1 = value(this), string1;
21055       if (value1 == null)
21056         return void this.removeAttribute(name2);
21057       string0 = this.getAttribute(name2);
21058       string1 = value1 + "";
21059       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21060     };
21061   }
21062   function attrFunctionNS2(fullname, interpolate, value) {
21063     var string00, string10, interpolate0;
21064     return function() {
21065       var string0, value1 = value(this), string1;
21066       if (value1 == null)
21067         return void this.removeAttributeNS(fullname.space, fullname.local);
21068       string0 = this.getAttributeNS(fullname.space, fullname.local);
21069       string1 = value1 + "";
21070       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21071     };
21072   }
21073   function attr_default2(name2, value) {
21074     var fullname = namespace_default(name2), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21075     return this.attrTween(name2, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i2, tweenValue(this, "attr." + name2, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i2, value));
21076   }
21077
21078   // node_modules/d3-transition/src/transition/attrTween.js
21079   function attrInterpolate(name2, i2) {
21080     return function(t) {
21081       this.setAttribute(name2, i2.call(this, t));
21082     };
21083   }
21084   function attrInterpolateNS(fullname, i2) {
21085     return function(t) {
21086       this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t));
21087     };
21088   }
21089   function attrTweenNS(fullname, value) {
21090     var t0, i0;
21091     function tween() {
21092       var i2 = value.apply(this, arguments);
21093       if (i2 !== i0)
21094         t0 = (i0 = i2) && attrInterpolateNS(fullname, i2);
21095       return t0;
21096     }
21097     tween._value = value;
21098     return tween;
21099   }
21100   function attrTween(name2, value) {
21101     var t0, i0;
21102     function tween() {
21103       var i2 = value.apply(this, arguments);
21104       if (i2 !== i0)
21105         t0 = (i0 = i2) && attrInterpolate(name2, i2);
21106       return t0;
21107     }
21108     tween._value = value;
21109     return tween;
21110   }
21111   function attrTween_default(name2, value) {
21112     var key = "attr." + name2;
21113     if (arguments.length < 2)
21114       return (key = this.tween(key)) && key._value;
21115     if (value == null)
21116       return this.tween(key, null);
21117     if (typeof value !== "function")
21118       throw new Error();
21119     var fullname = namespace_default(name2);
21120     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21121   }
21122
21123   // node_modules/d3-transition/src/transition/delay.js
21124   function delayFunction(id2, value) {
21125     return function() {
21126       init(this, id2).delay = +value.apply(this, arguments);
21127     };
21128   }
21129   function delayConstant(id2, value) {
21130     return value = +value, function() {
21131       init(this, id2).delay = value;
21132     };
21133   }
21134   function delay_default(value) {
21135     var id2 = this._id;
21136     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21137   }
21138
21139   // node_modules/d3-transition/src/transition/duration.js
21140   function durationFunction(id2, value) {
21141     return function() {
21142       set2(this, id2).duration = +value.apply(this, arguments);
21143     };
21144   }
21145   function durationConstant(id2, value) {
21146     return value = +value, function() {
21147       set2(this, id2).duration = value;
21148     };
21149   }
21150   function duration_default(value) {
21151     var id2 = this._id;
21152     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21153   }
21154
21155   // node_modules/d3-transition/src/transition/ease.js
21156   function easeConstant(id2, value) {
21157     if (typeof value !== "function")
21158       throw new Error();
21159     return function() {
21160       set2(this, id2).ease = value;
21161     };
21162   }
21163   function ease_default(value) {
21164     var id2 = this._id;
21165     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21166   }
21167
21168   // node_modules/d3-transition/src/transition/easeVarying.js
21169   function easeVarying(id2, value) {
21170     return function() {
21171       var v = value.apply(this, arguments);
21172       if (typeof v !== "function")
21173         throw new Error();
21174       set2(this, id2).ease = v;
21175     };
21176   }
21177   function easeVarying_default(value) {
21178     if (typeof value !== "function")
21179       throw new Error();
21180     return this.each(easeVarying(this._id, value));
21181   }
21182
21183   // node_modules/d3-transition/src/transition/filter.js
21184   function filter_default2(match) {
21185     if (typeof match !== "function")
21186       match = matcher_default(match);
21187     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21188       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
21189         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
21190           subgroup.push(node);
21191         }
21192       }
21193     }
21194     return new Transition(subgroups, this._parents, this._name, this._id);
21195   }
21196
21197   // node_modules/d3-transition/src/transition/merge.js
21198   function merge_default2(transition2) {
21199     if (transition2._id !== this._id)
21200       throw new Error();
21201     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
21202       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
21203         if (node = group0[i2] || group1[i2]) {
21204           merge3[i2] = node;
21205         }
21206       }
21207     }
21208     for (; j2 < m0; ++j2) {
21209       merges[j2] = groups0[j2];
21210     }
21211     return new Transition(merges, this._parents, this._name, this._id);
21212   }
21213
21214   // node_modules/d3-transition/src/transition/on.js
21215   function start(name2) {
21216     return (name2 + "").trim().split(/^|\s+/).every(function(t) {
21217       var i2 = t.indexOf(".");
21218       if (i2 >= 0)
21219         t = t.slice(0, i2);
21220       return !t || t === "start";
21221     });
21222   }
21223   function onFunction(id2, name2, listener) {
21224     var on0, on1, sit = start(name2) ? init : set2;
21225     return function() {
21226       var schedule = sit(this, id2), on = schedule.on;
21227       if (on !== on0)
21228         (on1 = (on0 = on).copy()).on(name2, listener);
21229       schedule.on = on1;
21230     };
21231   }
21232   function on_default2(name2, listener) {
21233     var id2 = this._id;
21234     return arguments.length < 2 ? get2(this.node(), id2).on.on(name2) : this.each(onFunction(id2, name2, listener));
21235   }
21236
21237   // node_modules/d3-transition/src/transition/remove.js
21238   function removeFunction(id2) {
21239     return function() {
21240       var parent = this.parentNode;
21241       for (var i2 in this.__transition)
21242         if (+i2 !== id2)
21243           return;
21244       if (parent)
21245         parent.removeChild(this);
21246     };
21247   }
21248   function remove_default2() {
21249     return this.on("end.remove", removeFunction(this._id));
21250   }
21251
21252   // node_modules/d3-transition/src/transition/select.js
21253   function select_default3(select) {
21254     var name2 = this._name, id2 = this._id;
21255     if (typeof select !== "function")
21256       select = selector_default(select);
21257     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21258       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
21259         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
21260           if ("__data__" in node)
21261             subnode.__data__ = node.__data__;
21262           subgroup[i2] = subnode;
21263           schedule_default(subgroup[i2], name2, id2, i2, subgroup, get2(node, id2));
21264         }
21265       }
21266     }
21267     return new Transition(subgroups, this._parents, name2, id2);
21268   }
21269
21270   // node_modules/d3-transition/src/transition/selectAll.js
21271   function selectAll_default3(select) {
21272     var name2 = this._name, id2 = this._id;
21273     if (typeof select !== "function")
21274       select = selectorAll_default(select);
21275     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
21276       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21277         if (node = group[i2]) {
21278           for (var children2 = select.call(node, node.__data__, i2, group), child, inherit2 = get2(node, id2), k = 0, l = children2.length; k < l; ++k) {
21279             if (child = children2[k]) {
21280               schedule_default(child, name2, id2, k, children2, inherit2);
21281             }
21282           }
21283           subgroups.push(children2);
21284           parents.push(node);
21285         }
21286       }
21287     }
21288     return new Transition(subgroups, parents, name2, id2);
21289   }
21290
21291   // node_modules/d3-transition/src/transition/selection.js
21292   var Selection2 = selection_default.prototype.constructor;
21293   function selection_default2() {
21294     return new Selection2(this._groups, this._parents);
21295   }
21296
21297   // node_modules/d3-transition/src/transition/style.js
21298   function styleNull(name2, interpolate) {
21299     var string00, string10, interpolate0;
21300     return function() {
21301       var string0 = styleValue(this, name2), string1 = (this.style.removeProperty(name2), styleValue(this, name2));
21302       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21303     };
21304   }
21305   function styleRemove2(name2) {
21306     return function() {
21307       this.style.removeProperty(name2);
21308     };
21309   }
21310   function styleConstant2(name2, interpolate, value1) {
21311     var string00, string1 = value1 + "", interpolate0;
21312     return function() {
21313       var string0 = styleValue(this, name2);
21314       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21315     };
21316   }
21317   function styleFunction2(name2, interpolate, value) {
21318     var string00, string10, interpolate0;
21319     return function() {
21320       var string0 = styleValue(this, name2), value1 = value(this), string1 = value1 + "";
21321       if (value1 == null)
21322         string1 = value1 = (this.style.removeProperty(name2), styleValue(this, name2));
21323       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21324     };
21325   }
21326   function styleMaybeRemove(id2, name2) {
21327     var on0, on1, listener0, key = "style." + name2, event = "end." + key, remove2;
21328     return function() {
21329       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name2)) : void 0;
21330       if (on !== on0 || listener0 !== listener)
21331         (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21332       schedule.on = on1;
21333     };
21334   }
21335   function style_default2(name2, value, priority) {
21336     var i2 = (name2 += "") === "transform" ? interpolateTransformCss : interpolate_default;
21337     return value == null ? this.styleTween(name2, styleNull(name2, i2)).on("end.style." + name2, styleRemove2(name2)) : typeof value === "function" ? this.styleTween(name2, styleFunction2(name2, i2, tweenValue(this, "style." + name2, value))).each(styleMaybeRemove(this._id, name2)) : this.styleTween(name2, styleConstant2(name2, i2, value), priority).on("end.style." + name2, null);
21338   }
21339
21340   // node_modules/d3-transition/src/transition/styleTween.js
21341   function styleInterpolate(name2, i2, priority) {
21342     return function(t) {
21343       this.style.setProperty(name2, i2.call(this, t), priority);
21344     };
21345   }
21346   function styleTween(name2, value, priority) {
21347     var t, i0;
21348     function tween() {
21349       var i2 = value.apply(this, arguments);
21350       if (i2 !== i0)
21351         t = (i0 = i2) && styleInterpolate(name2, i2, priority);
21352       return t;
21353     }
21354     tween._value = value;
21355     return tween;
21356   }
21357   function styleTween_default(name2, value, priority) {
21358     var key = "style." + (name2 += "");
21359     if (arguments.length < 2)
21360       return (key = this.tween(key)) && key._value;
21361     if (value == null)
21362       return this.tween(key, null);
21363     if (typeof value !== "function")
21364       throw new Error();
21365     return this.tween(key, styleTween(name2, value, priority == null ? "" : priority));
21366   }
21367
21368   // node_modules/d3-transition/src/transition/text.js
21369   function textConstant2(value) {
21370     return function() {
21371       this.textContent = value;
21372     };
21373   }
21374   function textFunction2(value) {
21375     return function() {
21376       var value1 = value(this);
21377       this.textContent = value1 == null ? "" : value1;
21378     };
21379   }
21380   function text_default2(value) {
21381     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21382   }
21383
21384   // node_modules/d3-transition/src/transition/textTween.js
21385   function textInterpolate(i2) {
21386     return function(t) {
21387       this.textContent = i2.call(this, t);
21388     };
21389   }
21390   function textTween(value) {
21391     var t0, i0;
21392     function tween() {
21393       var i2 = value.apply(this, arguments);
21394       if (i2 !== i0)
21395         t0 = (i0 = i2) && textInterpolate(i2);
21396       return t0;
21397     }
21398     tween._value = value;
21399     return tween;
21400   }
21401   function textTween_default(value) {
21402     var key = "text";
21403     if (arguments.length < 1)
21404       return (key = this.tween(key)) && key._value;
21405     if (value == null)
21406       return this.tween(key, null);
21407     if (typeof value !== "function")
21408       throw new Error();
21409     return this.tween(key, textTween(value));
21410   }
21411
21412   // node_modules/d3-transition/src/transition/transition.js
21413   function transition_default() {
21414     var name2 = this._name, id0 = this._id, id1 = newId();
21415     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21416       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21417         if (node = group[i2]) {
21418           var inherit2 = get2(node, id0);
21419           schedule_default(node, name2, id1, i2, group, {
21420             time: inherit2.time + inherit2.delay + inherit2.duration,
21421             delay: 0,
21422             duration: inherit2.duration,
21423             ease: inherit2.ease
21424           });
21425         }
21426       }
21427     }
21428     return new Transition(groups, this._parents, name2, id1);
21429   }
21430
21431   // node_modules/d3-transition/src/transition/end.js
21432   function end_default() {
21433     var on0, on1, that = this, id2 = that._id, size = that.size();
21434     return new Promise(function(resolve, reject) {
21435       var cancel = { value: reject }, end = { value: function() {
21436         if (--size === 0)
21437           resolve();
21438       } };
21439       that.each(function() {
21440         var schedule = set2(this, id2), on = schedule.on;
21441         if (on !== on0) {
21442           on1 = (on0 = on).copy();
21443           on1._.cancel.push(cancel);
21444           on1._.interrupt.push(cancel);
21445           on1._.end.push(end);
21446         }
21447         schedule.on = on1;
21448       });
21449       if (size === 0)
21450         resolve();
21451     });
21452   }
21453
21454   // node_modules/d3-transition/src/transition/index.js
21455   var id = 0;
21456   function Transition(groups, parents, name2, id2) {
21457     this._groups = groups;
21458     this._parents = parents;
21459     this._name = name2;
21460     this._id = id2;
21461   }
21462   function transition(name2) {
21463     return selection_default().transition(name2);
21464   }
21465   function newId() {
21466     return ++id;
21467   }
21468   var selection_prototype = selection_default.prototype;
21469   Transition.prototype = transition.prototype = {
21470     constructor: Transition,
21471     select: select_default3,
21472     selectAll: selectAll_default3,
21473     selectChild: selection_prototype.selectChild,
21474     selectChildren: selection_prototype.selectChildren,
21475     filter: filter_default2,
21476     merge: merge_default2,
21477     selection: selection_default2,
21478     transition: transition_default,
21479     call: selection_prototype.call,
21480     nodes: selection_prototype.nodes,
21481     node: selection_prototype.node,
21482     size: selection_prototype.size,
21483     empty: selection_prototype.empty,
21484     each: selection_prototype.each,
21485     on: on_default2,
21486     attr: attr_default2,
21487     attrTween: attrTween_default,
21488     style: style_default2,
21489     styleTween: styleTween_default,
21490     text: text_default2,
21491     textTween: textTween_default,
21492     remove: remove_default2,
21493     tween: tween_default,
21494     delay: delay_default,
21495     duration: duration_default,
21496     ease: ease_default,
21497     easeVarying: easeVarying_default,
21498     end: end_default,
21499     [Symbol.iterator]: selection_prototype[Symbol.iterator]
21500   };
21501
21502   // node_modules/d3-ease/src/linear.js
21503   var linear2 = (t) => +t;
21504
21505   // node_modules/d3-ease/src/cubic.js
21506   function cubicInOut(t) {
21507     return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
21508   }
21509
21510   // node_modules/d3-transition/src/selection/transition.js
21511   var defaultTiming = {
21512     time: null,
21513     delay: 0,
21514     duration: 250,
21515     ease: cubicInOut
21516   };
21517   function inherit(node, id2) {
21518     var timing;
21519     while (!(timing = node.__transition) || !(timing = timing[id2])) {
21520       if (!(node = node.parentNode)) {
21521         throw new Error(`transition ${id2} not found`);
21522       }
21523     }
21524     return timing;
21525   }
21526   function transition_default2(name2) {
21527     var id2, timing;
21528     if (name2 instanceof Transition) {
21529       id2 = name2._id, name2 = name2._name;
21530     } else {
21531       id2 = newId(), (timing = defaultTiming).time = now(), name2 = name2 == null ? null : name2 + "";
21532     }
21533     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21534       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21535         if (node = group[i2]) {
21536           schedule_default(node, name2, id2, i2, group, timing || inherit(node, id2));
21537         }
21538       }
21539     }
21540     return new Transition(groups, this._parents, name2, id2);
21541   }
21542
21543   // node_modules/d3-transition/src/selection/index.js
21544   selection_default.prototype.interrupt = interrupt_default2;
21545   selection_default.prototype.transition = transition_default2;
21546
21547   // node_modules/d3-zoom/src/constant.js
21548   var constant_default4 = (x) => () => x;
21549
21550   // node_modules/d3-zoom/src/event.js
21551   function ZoomEvent(type3, {
21552     sourceEvent,
21553     target,
21554     transform: transform2,
21555     dispatch: dispatch10
21556   }) {
21557     Object.defineProperties(this, {
21558       type: { value: type3, enumerable: true, configurable: true },
21559       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
21560       target: { value: target, enumerable: true, configurable: true },
21561       transform: { value: transform2, enumerable: true, configurable: true },
21562       _: { value: dispatch10 }
21563     });
21564   }
21565
21566   // node_modules/d3-zoom/src/transform.js
21567   function Transform(k, x, y) {
21568     this.k = k;
21569     this.x = x;
21570     this.y = y;
21571   }
21572   Transform.prototype = {
21573     constructor: Transform,
21574     scale: function(k) {
21575       return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
21576     },
21577     translate: function(x, y) {
21578       return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
21579     },
21580     apply: function(point) {
21581       return [point[0] * this.k + this.x, point[1] * this.k + this.y];
21582     },
21583     applyX: function(x) {
21584       return x * this.k + this.x;
21585     },
21586     applyY: function(y) {
21587       return y * this.k + this.y;
21588     },
21589     invert: function(location) {
21590       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
21591     },
21592     invertX: function(x) {
21593       return (x - this.x) / this.k;
21594     },
21595     invertY: function(y) {
21596       return (y - this.y) / this.k;
21597     },
21598     rescaleX: function(x) {
21599       return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
21600     },
21601     rescaleY: function(y) {
21602       return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
21603     },
21604     toString: function() {
21605       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
21606     }
21607   };
21608   var identity2 = new Transform(1, 0, 0);
21609   transform.prototype = Transform.prototype;
21610   function transform(node) {
21611     while (!node.__zoom)
21612       if (!(node = node.parentNode))
21613         return identity2;
21614     return node.__zoom;
21615   }
21616
21617   // node_modules/d3-zoom/src/noevent.js
21618   function nopropagation2(event) {
21619     event.stopImmediatePropagation();
21620   }
21621   function noevent_default2(event) {
21622     event.preventDefault();
21623     event.stopImmediatePropagation();
21624   }
21625
21626   // node_modules/d3-zoom/src/zoom.js
21627   function defaultFilter2(event) {
21628     return (!event.ctrlKey || event.type === "wheel") && !event.button;
21629   }
21630   function defaultExtent() {
21631     var e = this;
21632     if (e instanceof SVGElement) {
21633       e = e.ownerSVGElement || e;
21634       if (e.hasAttribute("viewBox")) {
21635         e = e.viewBox.baseVal;
21636         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
21637       }
21638       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
21639     }
21640     return [[0, 0], [e.clientWidth, e.clientHeight]];
21641   }
21642   function defaultTransform() {
21643     return this.__zoom || identity2;
21644   }
21645   function defaultWheelDelta(event) {
21646     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
21647   }
21648   function defaultTouchable2() {
21649     return navigator.maxTouchPoints || "ontouchstart" in this;
21650   }
21651   function defaultConstrain(transform2, extent, translateExtent) {
21652     var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
21653     return transform2.translate(dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1));
21654   }
21655   function zoom_default2() {
21656     var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
21657     function zoom(selection2) {
21658       selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
21659     }
21660     zoom.transform = function(collection, transform2, point, event) {
21661       var selection2 = collection.selection ? collection.selection() : collection;
21662       selection2.property("__zoom", defaultTransform);
21663       if (collection !== selection2) {
21664         schedule(collection, transform2, point, event);
21665       } else {
21666         selection2.interrupt().each(function() {
21667           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
21668         });
21669       }
21670     };
21671     zoom.scaleBy = function(selection2, k, p, event) {
21672       zoom.scaleTo(selection2, function() {
21673         var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
21674         return k0 * k1;
21675       }, p, event);
21676     };
21677     zoom.scaleTo = function(selection2, k, p, event) {
21678       zoom.transform(selection2, function() {
21679         var e = extent.apply(this, arguments), t0 = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p02), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
21680         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
21681       }, p, event);
21682     };
21683     zoom.translateBy = function(selection2, x, y, event) {
21684       zoom.transform(selection2, function() {
21685         return constrain(this.__zoom.translate(typeof x === "function" ? x.apply(this, arguments) : x, typeof y === "function" ? y.apply(this, arguments) : y), extent.apply(this, arguments), translateExtent);
21686       }, null, event);
21687     };
21688     zoom.translateTo = function(selection2, x, y, p, event) {
21689       zoom.transform(selection2, function() {
21690         var e = extent.apply(this, arguments), t = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
21691         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
21692       }, p, event);
21693     };
21694     function scale(transform2, k) {
21695       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
21696       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
21697     }
21698     function translate(transform2, p02, p1) {
21699       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
21700       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
21701     }
21702     function centroid(extent2) {
21703       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
21704     }
21705     function schedule(transition2, transform2, point, event) {
21706       transition2.on("start.zoom", function() {
21707         gesture(this, arguments).event(event).start();
21708       }).on("interrupt.zoom end.zoom", function() {
21709         gesture(this, arguments).event(event).end();
21710       }).tween("zoom", function() {
21711         var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i2 = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
21712         return function(t) {
21713           if (t === 1)
21714             t = b;
21715           else {
21716             var l = i2(t), k = w / l[2];
21717             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
21718           }
21719           g.zoom(null, t);
21720         };
21721       });
21722     }
21723     function gesture(that, args, clean2) {
21724       return !clean2 && that.__zooming || new Gesture(that, args);
21725     }
21726     function Gesture(that, args) {
21727       this.that = that;
21728       this.args = args;
21729       this.active = 0;
21730       this.sourceEvent = null;
21731       this.extent = extent.apply(that, args);
21732       this.taps = 0;
21733     }
21734     Gesture.prototype = {
21735       event: function(event) {
21736         if (event)
21737           this.sourceEvent = event;
21738         return this;
21739       },
21740       start: function() {
21741         if (++this.active === 1) {
21742           this.that.__zooming = this;
21743           this.emit("start");
21744         }
21745         return this;
21746       },
21747       zoom: function(key, transform2) {
21748         if (this.mouse && key !== "mouse")
21749           this.mouse[1] = transform2.invert(this.mouse[0]);
21750         if (this.touch0 && key !== "touch")
21751           this.touch0[1] = transform2.invert(this.touch0[0]);
21752         if (this.touch1 && key !== "touch")
21753           this.touch1[1] = transform2.invert(this.touch1[0]);
21754         this.that.__zoom = transform2;
21755         this.emit("zoom");
21756         return this;
21757       },
21758       end: function() {
21759         if (--this.active === 0) {
21760           delete this.that.__zooming;
21761           this.emit("end");
21762         }
21763         return this;
21764       },
21765       emit: function(type3) {
21766         var d = select_default2(this.that).datum();
21767         listeners.call(type3, this.that, new ZoomEvent(type3, {
21768           sourceEvent: this.sourceEvent,
21769           target: zoom,
21770           type: type3,
21771           transform: this.that.__zoom,
21772           dispatch: listeners
21773         }), d);
21774       }
21775     };
21776     function wheeled(event, ...args) {
21777       if (!filter2.apply(this, arguments))
21778         return;
21779       var g = gesture(this, args).event(event), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer_default(event);
21780       if (g.wheel) {
21781         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
21782           g.mouse[1] = t.invert(g.mouse[0] = p);
21783         }
21784         clearTimeout(g.wheel);
21785       } else if (t.k === k)
21786         return;
21787       else {
21788         g.mouse = [p, t.invert(p)];
21789         interrupt_default(this);
21790         g.start();
21791       }
21792       noevent_default2(event);
21793       g.wheel = setTimeout(wheelidled, wheelDelay);
21794       g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
21795       function wheelidled() {
21796         g.wheel = null;
21797         g.end();
21798       }
21799     }
21800     function mousedowned(event, ...args) {
21801       if (touchending || !filter2.apply(this, arguments))
21802         return;
21803       var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
21804       nodrag_default(event.view);
21805       nopropagation2(event);
21806       g.mouse = [p, this.__zoom.invert(p)];
21807       interrupt_default(this);
21808       g.start();
21809       function mousemoved(event2) {
21810         noevent_default2(event2);
21811         if (!g.moved) {
21812           var dx = event2.clientX - x05, dy = event2.clientY - y05;
21813           g.moved = dx * dx + dy * dy > clickDistance2;
21814         }
21815         g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
21816       }
21817       function mouseupped(event2) {
21818         v.on("mousemove.zoom mouseup.zoom", null);
21819         yesdrag(event2.view, g.moved);
21820         noevent_default2(event2);
21821         g.event(event2).end();
21822       }
21823     }
21824     function dblclicked(event, ...args) {
21825       if (!filter2.apply(this, arguments))
21826         return;
21827       var t0 = this.__zoom, p02 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p02), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p02, p1), extent.apply(this, args), translateExtent);
21828       noevent_default2(event);
21829       if (duration > 0)
21830         select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
21831       else
21832         select_default2(this).call(zoom.transform, t1, p02, event);
21833     }
21834     function touchstarted(event, ...args) {
21835       if (!filter2.apply(this, arguments))
21836         return;
21837       var touches = event.touches, n2 = touches.length, g = gesture(this, args, event.changedTouches.length === n2).event(event), started, i2, t, p;
21838       nopropagation2(event);
21839       for (i2 = 0; i2 < n2; ++i2) {
21840         t = touches[i2], p = pointer_default(t, this);
21841         p = [p, this.__zoom.invert(p), t.identifier];
21842         if (!g.touch0)
21843           g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
21844         else if (!g.touch1 && g.touch0[2] !== p[2])
21845           g.touch1 = p, g.taps = 0;
21846       }
21847       if (touchstarting)
21848         touchstarting = clearTimeout(touchstarting);
21849       if (started) {
21850         if (g.taps < 2)
21851           touchfirst = p[0], touchstarting = setTimeout(function() {
21852             touchstarting = null;
21853           }, touchDelay);
21854         interrupt_default(this);
21855         g.start();
21856       }
21857     }
21858     function touchmoved(event, ...args) {
21859       if (!this.__zooming)
21860         return;
21861       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t, p, l;
21862       noevent_default2(event);
21863       for (i2 = 0; i2 < n2; ++i2) {
21864         t = touches[i2], p = pointer_default(t, this);
21865         if (g.touch0 && g.touch0[2] === t.identifier)
21866           g.touch0[0] = p;
21867         else if (g.touch1 && g.touch1[2] === t.identifier)
21868           g.touch1[0] = p;
21869       }
21870       t = g.that.__zoom;
21871       if (g.touch1) {
21872         var p02 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
21873         t = scale(t, Math.sqrt(dp / dl));
21874         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
21875         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
21876       } else if (g.touch0)
21877         p = g.touch0[0], l = g.touch0[1];
21878       else
21879         return;
21880       g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
21881     }
21882     function touchended(event, ...args) {
21883       if (!this.__zooming)
21884         return;
21885       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t;
21886       nopropagation2(event);
21887       if (touchending)
21888         clearTimeout(touchending);
21889       touchending = setTimeout(function() {
21890         touchending = null;
21891       }, touchDelay);
21892       for (i2 = 0; i2 < n2; ++i2) {
21893         t = touches[i2];
21894         if (g.touch0 && g.touch0[2] === t.identifier)
21895           delete g.touch0;
21896         else if (g.touch1 && g.touch1[2] === t.identifier)
21897           delete g.touch1;
21898       }
21899       if (g.touch1 && !g.touch0)
21900         g.touch0 = g.touch1, delete g.touch1;
21901       if (g.touch0)
21902         g.touch0[1] = this.__zoom.invert(g.touch0[0]);
21903       else {
21904         g.end();
21905         if (g.taps === 2) {
21906           t = pointer_default(t, this);
21907           if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
21908             var p = select_default2(this).on("dblclick.zoom");
21909             if (p)
21910               p.apply(this, arguments);
21911           }
21912         }
21913       }
21914     }
21915     zoom.wheelDelta = function(_) {
21916       return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default4(+_), zoom) : wheelDelta;
21917     };
21918     zoom.filter = function(_) {
21919       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : filter2;
21920     };
21921     zoom.touchable = function(_) {
21922       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : touchable;
21923     };
21924     zoom.extent = function(_) {
21925       return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
21926     };
21927     zoom.scaleExtent = function(_) {
21928       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
21929     };
21930     zoom.translateExtent = function(_) {
21931       return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
21932     };
21933     zoom.constrain = function(_) {
21934       return arguments.length ? (constrain = _, zoom) : constrain;
21935     };
21936     zoom.duration = function(_) {
21937       return arguments.length ? (duration = +_, zoom) : duration;
21938     };
21939     zoom.interpolate = function(_) {
21940       return arguments.length ? (interpolate = _, zoom) : interpolate;
21941     };
21942     zoom.on = function() {
21943       var value = listeners.on.apply(listeners, arguments);
21944       return value === listeners ? zoom : value;
21945     };
21946     zoom.clickDistance = function(_) {
21947       return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
21948     };
21949     zoom.tapDistance = function(_) {
21950       return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
21951     };
21952     return zoom;
21953   }
21954
21955   // modules/geo/raw_mercator.js
21956   function geoRawMercator() {
21957     var project = mercatorRaw;
21958     var k = 512 / Math.PI;
21959     var x = 0;
21960     var y = 0;
21961     var clipExtent = [[0, 0], [0, 0]];
21962     function projection2(point) {
21963       point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
21964       return [point[0] * k + x, y - point[1] * k];
21965     }
21966     projection2.invert = function(point) {
21967       point = project.invert((point[0] - x) / k, (y - point[1]) / k);
21968       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
21969     };
21970     projection2.scale = function(_) {
21971       if (!arguments.length)
21972         return k;
21973       k = +_;
21974       return projection2;
21975     };
21976     projection2.translate = function(_) {
21977       if (!arguments.length)
21978         return [x, y];
21979       x = +_[0];
21980       y = +_[1];
21981       return projection2;
21982     };
21983     projection2.clipExtent = function(_) {
21984       if (!arguments.length)
21985         return clipExtent;
21986       clipExtent = _;
21987       return projection2;
21988     };
21989     projection2.transform = function(obj) {
21990       if (!arguments.length)
21991         return identity2.translate(x, y).scale(k);
21992       x = +obj.x;
21993       y = +obj.y;
21994       k = +obj.k;
21995       return projection2;
21996     };
21997     projection2.stream = transform_default({
21998       point: function(x2, y2) {
21999         var vec = projection2([x2, y2]);
22000         this.stream.point(vec[0], vec[1]);
22001       }
22002     }).stream;
22003     return projection2;
22004   }
22005
22006   // modules/geo/ortho.js
22007   function geoOrthoNormalizedDotProduct(a, b, origin) {
22008     if (geoVecEqual(origin, a) || geoVecEqual(origin, b)) {
22009       return 1;
22010     }
22011     return geoVecNormalizedDot(a, b, origin);
22012   }
22013   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22014     var val = Math.abs(dotp);
22015     if (val < epsilon3) {
22016       return 0;
22017     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22018       return 0;
22019     } else if (val < lowerThreshold || val > upperThreshold) {
22020       return dotp;
22021     } else {
22022       return null;
22023     }
22024   }
22025   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22026     var score = 0;
22027     var first = isClosed ? 0 : 1;
22028     var last = isClosed ? points.length : points.length - 1;
22029     var coords = points.map(function(p) {
22030       return p.coord;
22031     });
22032     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22033     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22034     for (var i2 = first; i2 < last; i2++) {
22035       var a = coords[(i2 - 1 + coords.length) % coords.length];
22036       var origin = coords[i2];
22037       var b = coords[(i2 + 1) % coords.length];
22038       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold);
22039       if (dotp === null)
22040         continue;
22041       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22042     }
22043     return score;
22044   }
22045   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22046     var max3 = -Infinity;
22047     var first = isClosed ? 0 : 1;
22048     var last = isClosed ? coords.length : coords.length - 1;
22049     for (var i2 = first; i2 < last; i2++) {
22050       var a = coords[(i2 - 1 + coords.length) % coords.length];
22051       var origin = coords[i2];
22052       var b = coords[(i2 + 1) % coords.length];
22053       var normalizedDotP = geoOrthoNormalizedDotProduct(a, b, origin);
22054       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22055       if (angle2 > 45)
22056         angle2 = 90 - angle2;
22057       if (angle2 >= lessThan)
22058         continue;
22059       if (angle2 > max3)
22060         max3 = angle2;
22061     }
22062     if (max3 === -Infinity)
22063       return null;
22064     return max3;
22065   }
22066   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22067     var score = null;
22068     var first = isClosed ? 0 : 1;
22069     var last = isClosed ? coords.length : coords.length - 1;
22070     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22071     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22072     for (var i2 = first; i2 < last; i2++) {
22073       var a = coords[(i2 - 1 + coords.length) % coords.length];
22074       var origin = coords[i2];
22075       var b = coords[(i2 + 1) % coords.length];
22076       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22077       if (dotp === null)
22078         continue;
22079       if (Math.abs(dotp) > 0)
22080         return 1;
22081       score = 0;
22082     }
22083     return score;
22084   }
22085
22086   // modules/util/array.js
22087   function utilArrayIdentical(a, b) {
22088     if (a === b)
22089       return true;
22090     var i2 = a.length;
22091     if (i2 !== b.length)
22092       return false;
22093     while (i2--) {
22094       if (a[i2] !== b[i2])
22095         return false;
22096     }
22097     return true;
22098   }
22099   function utilArrayDifference(a, b) {
22100     var other = new Set(b);
22101     return Array.from(new Set(a)).filter(function(v) {
22102       return !other.has(v);
22103     });
22104   }
22105   function utilArrayIntersection(a, b) {
22106     var other = new Set(b);
22107     return Array.from(new Set(a)).filter(function(v) {
22108       return other.has(v);
22109     });
22110   }
22111   function utilArrayUnion(a, b) {
22112     var result = new Set(a);
22113     b.forEach(function(v) {
22114       result.add(v);
22115     });
22116     return Array.from(result);
22117   }
22118   function utilArrayUniq(a) {
22119     return Array.from(new Set(a));
22120   }
22121   function utilArrayChunk(a, chunkSize) {
22122     if (!chunkSize || chunkSize < 0)
22123       return [a.slice()];
22124     var result = new Array(Math.ceil(a.length / chunkSize));
22125     return Array.from(result, function(item, i2) {
22126       return a.slice(i2 * chunkSize, i2 * chunkSize + chunkSize);
22127     });
22128   }
22129   function utilArrayFlatten(a) {
22130     return a.reduce(function(acc, val) {
22131       return acc.concat(val);
22132     }, []);
22133   }
22134   function utilArrayGroupBy(a, key) {
22135     return a.reduce(function(acc, item) {
22136       var group = typeof key === "function" ? key(item) : item[key];
22137       (acc[group] = acc[group] || []).push(item);
22138       return acc;
22139     }, {});
22140   }
22141   function utilArrayUniqBy(a, key) {
22142     var seen = /* @__PURE__ */ new Set();
22143     return a.reduce(function(acc, item) {
22144       var val = typeof key === "function" ? key(item) : item[key];
22145       if (val && !seen.has(val)) {
22146         seen.add(val);
22147         acc.push(item);
22148       }
22149       return acc;
22150     }, []);
22151   }
22152
22153   // modules/util/util.js
22154   var import_diacritics = __toESM(require_diacritics());
22155
22156   // modules/util/svg_paths_rtl_fix.js
22157   var import_alif_toolkit = __toESM(require_lib());
22158   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22159   function fixRTLTextForSvg(inputText) {
22160     var ret = "", rtlBuffer = [];
22161     var arabicRegex = /[\u0600-\u06FF]/g;
22162     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22163     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22164     var thaanaVowel = /[\u07A6-\u07B0]/;
22165     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22166     if (arabicRegex.test(inputText)) {
22167       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22168     }
22169     for (var n2 = 0; n2 < inputText.length; n2++) {
22170       var c = inputText[n2];
22171       if (arabicMath.test(c)) {
22172         ret += rtlBuffer.reverse().join("");
22173         rtlBuffer = [c];
22174       } else {
22175         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22176           ret += rtlBuffer.reverse().join("");
22177           rtlBuffer = [];
22178         }
22179         if ((thaanaVowel.test(c) || hebrewSign.test(c) || arabicDiacritics.test(c)) && rtlBuffer.length) {
22180           rtlBuffer[rtlBuffer.length - 1] += c;
22181         } else if (rtlRegex.test(c) || c.charCodeAt(0) >= 64336 && c.charCodeAt(0) <= 65023 || c.charCodeAt(0) >= 65136 && c.charCodeAt(0) <= 65279) {
22182           rtlBuffer.push(c);
22183         } else if (c === " " && rtlBuffer.length) {
22184           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22185         } else {
22186           ret += rtlBuffer.reverse().join("") + c;
22187           rtlBuffer = [];
22188         }
22189       }
22190     }
22191     ret += rtlBuffer.reverse().join("");
22192     return ret;
22193   }
22194
22195   // modules/core/preferences.js
22196   var _storage;
22197   try {
22198     _storage = localStorage;
22199   } catch (e) {
22200   }
22201   _storage = _storage || (() => {
22202     let s = {};
22203     return {
22204       getItem: (k) => s[k],
22205       setItem: (k, v) => s[k] = v,
22206       removeItem: (k) => delete s[k]
22207     };
22208   })();
22209   var _listeners = {};
22210   function corePreferences(k, v) {
22211     try {
22212       if (v === void 0)
22213         return _storage.getItem(k);
22214       else if (v === null)
22215         _storage.removeItem(k);
22216       else
22217         _storage.setItem(k, v);
22218       if (_listeners[k]) {
22219         _listeners[k].forEach((handler) => handler(v));
22220       }
22221       return true;
22222     } catch (e) {
22223       if (typeof console !== "undefined") {
22224         console.error("localStorage quota exceeded");
22225       }
22226       return false;
22227     }
22228   }
22229   corePreferences.onChange = function(k, handler) {
22230     _listeners[k] = _listeners[k] || [];
22231     _listeners[k].push(handler);
22232   };
22233
22234   // modules/core/file_fetcher.js
22235   var import_vparse = __toESM(require_vparse());
22236
22237   // package.json
22238   var name = "iD";
22239   var version = "2.21.1";
22240   var description = "A friendly editor for OpenStreetMap";
22241   var main = "dist/iD.min.js";
22242   var repository = "github:openstreetmap/iD";
22243   var homepage = "https://github.com/openstreetmap/iD";
22244   var bugs = "https://github.com/openstreetmap/iD/issues";
22245   var keywords = [
22246     "editor",
22247     "openstreetmap"
22248   ];
22249   var license = "ISC";
22250   var scripts = {
22251     all: "run-s clean build dist",
22252     build: "run-s build:css build:data build:js",
22253     "build:css": "node scripts/build_css.js",
22254     "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22255     "build:stats": "esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html",
22256     "build:js": "node config/esbuild.config.mjs",
22257     "build:js:watch": "node config/esbuild.config.mjs --watch",
22258     clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22259     dist: "run-p dist:**",
22260     "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22261     "dist:pannellum": "shx mkdir -p dist/pannellum-streetside && shx cp -R node_modules/pannellum/build/* dist/pannellum-streetside/",
22262     "dist:min": "node config/esbuild.config.min.mjs",
22263     "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22264     "dist:svg:community": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "community-%s" --symbol-sprite dist/img/community-sprite.svg node_modules/osm-community-index/dist/img/*.svg',
22265     "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22266     "dist:svg:maki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "maki-%s" --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg',
22267     "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22268     "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/mapillary_sprite_source/package_objects/*.svg",
22269     "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@ideditor/temaki/icons/*.svg',
22270     imagery: "node scripts/update_imagery.js",
22271     lint: "eslint scripts test/spec modules",
22272     "lint:fix": "eslint scripts test/spec modules --fix",
22273     start: "run-s build:js start:server",
22274     "start:watch": "run-p build:js:watch start:server",
22275     "start:server": "node scripts/server.js",
22276     test: "npm-run-all -s lint build test:spec",
22277     "test:spec": "karma start karma.conf.js",
22278     translations: "node scripts/update_locales.js"
22279   };
22280   var dependencies = {
22281     "@ideditor/country-coder": "~5.0.3",
22282     "@ideditor/location-conflation": "~1.0.2",
22283     "@mapbox/geojson-area": "^0.2.2",
22284     "@mapbox/sexagesimal": "1.2.0",
22285     "@mapbox/vector-tile": "^1.3.1",
22286     "@tmcw/togeojson": "^4.5.0",
22287     "@turf/bbox-clip": "^6.0.0",
22288     "abortcontroller-polyfill": "^1.4.0",
22289     "aes-js": "^3.1.2",
22290     "alif-toolkit": "^1.2.9",
22291     "core-js-bundle": "^3.19.0",
22292     diacritics: "1.3.0",
22293     "fast-deep-equal": "~3.1.1",
22294     "fast-json-stable-stringify": "2.1.0",
22295     "lodash-es": "~4.17.15",
22296     marked: "~4.0.12",
22297     "node-diff3": "~3.1.0",
22298     "osm-auth": "~2.0.0",
22299     pannellum: "2.5.6",
22300     pbf: "^3.2.1",
22301     "polygon-clipping": "~0.15.1",
22302     rbush: "3.0.1",
22303     "whatwg-fetch": "^3.4.1",
22304     "which-polygon": "2.2.0"
22305   };
22306   var devDependencies = {
22307     "@fortawesome/fontawesome-svg-core": "~6.1.0",
22308     "@fortawesome/free-brands-svg-icons": "~6.1.0",
22309     "@fortawesome/free-regular-svg-icons": "~6.1.0",
22310     "@fortawesome/free-solid-svg-icons": "~6.1.0",
22311     "@ideditor/temaki": "~5.1.0",
22312     "@mapbox/maki": "^7.1.0",
22313     autoprefixer: "^10.0.1",
22314     btoa: "^1.2.1",
22315     chai: "^4.3.4",
22316     "cldr-core": "37.0.0",
22317     "cldr-localenames-full": "37.0.0",
22318     chalk: "^4.1.2",
22319     "concat-files": "^0.1.1",
22320     d3: "~7.4.4",
22321     "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22322     esbuild: "^0.14.17",
22323     "esbuild-visualizer": "^0.3.1",
22324     eslint: "^8.8.0",
22325     "fetch-mock": "^9.11.0",
22326     gaze: "^1.1.3",
22327     glob: "^8.0.3",
22328     happen: "^0.3.2",
22329     "js-yaml": "^4.0.0",
22330     "json-stringify-pretty-compact": "^3.0.0",
22331     karma: "^6.3.5",
22332     "karma-chrome-launcher": "^3.1.0",
22333     "karma-coverage": "2.1.1",
22334     "karma-mocha": "^2.0.1",
22335     "karma-remap-istanbul": "^0.6.0",
22336     "mapillary-js": "4.1.0",
22337     mapillary_sprite_source: "^1.8.0",
22338     minimist: "^1.2.3",
22339     mocha: "^9.2.0",
22340     "name-suggestion-index": "~6.0",
22341     "node-fetch": "^2.6.1",
22342     "npm-run-all": "^4.0.0",
22343     "osm-community-index": "~5.1.0",
22344     postcss: "^8.1.1",
22345     "postcss-selector-prepend": "^0.5.0",
22346     shelljs: "^0.8.0",
22347     shx: "^0.3.0",
22348     sinon: "^11.1.2",
22349     "sinon-chai": "^3.7.0",
22350     smash: "0.0",
22351     "static-server": "^2.2.1",
22352     "svg-sprite": "1.5.4",
22353     vparse: "~1.1.0"
22354   };
22355   var engines = {
22356     node: ">=12"
22357   };
22358   var browserslist = [
22359     "> 0.2%, last 6 major versions, Firefox ESR, maintained node versions"
22360   ];
22361   var package_default = {
22362     name,
22363     version,
22364     description,
22365     main,
22366     repository,
22367     homepage,
22368     bugs,
22369     keywords,
22370     license,
22371     scripts,
22372     dependencies,
22373     devDependencies,
22374     engines,
22375     browserslist
22376   };
22377
22378   // modules/core/file_fetcher.js
22379   var _mainFileFetcher = coreFileFetcher();
22380   function coreFileFetcher() {
22381     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22382     const v = (0, import_vparse.default)(ociVersion);
22383     const vMinor = `${v.major}.${v.minor}`;
22384     let _this = {};
22385     let _inflight4 = {};
22386     let _fileMap = {
22387       "address_formats": "data/address_formats.min.json",
22388       "deprecated": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/deprecated.min.json",
22389       "discarded": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/discarded.min.json",
22390       "imagery": "data/imagery.min.json",
22391       "intro_graph": "data/intro_graph.min.json",
22392       "keepRight": "data/keepRight.min.json",
22393       "languages": "data/languages.min.json",
22394       "locales": "locales/index.min.json",
22395       "oci_defaults": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/defaults.min.json`,
22396       "oci_features": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/featureCollection.min.json`,
22397       "oci_resources": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/resources.min.json`,
22398       "preset_categories": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/preset_categories.min.json",
22399       "preset_defaults": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/preset_defaults.min.json",
22400       "preset_fields": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/fields.min.json",
22401       "preset_presets": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/presets.min.json",
22402       "phone_formats": "data/phone_formats.min.json",
22403       "qa_data": "data/qa_data.min.json",
22404       "shortcuts": "data/shortcuts.min.json",
22405       "territory_languages": "data/territory_languages.min.json",
22406       "wmf_sitematrix": "https://cdn.jsdelivr.net/npm/wmf-sitematrix@0.1/wikipedia.min.json"
22407     };
22408     let _cachedData = {};
22409     _this.cache = () => _cachedData;
22410     _this.get = (which) => {
22411       if (_cachedData[which]) {
22412         return Promise.resolve(_cachedData[which]);
22413       }
22414       const file = _fileMap[which];
22415       const url = file && _this.asset(file);
22416       if (!url) {
22417         return Promise.reject(`Unknown data file for "${which}"`);
22418       }
22419       let prom = _inflight4[url];
22420       if (!prom) {
22421         _inflight4[url] = prom = fetch(url).then((response) => {
22422           if (!response.ok || !response.json) {
22423             throw new Error(response.status + " " + response.statusText);
22424           }
22425           if (response.status === 204 || response.status === 205)
22426             return;
22427           return response.json();
22428         }).then((result) => {
22429           delete _inflight4[url];
22430           if (!result) {
22431             throw new Error(`No data loaded for "${which}"`);
22432           }
22433           _cachedData[which] = result;
22434           return result;
22435         }).catch((err) => {
22436           delete _inflight4[url];
22437           throw err;
22438         });
22439       }
22440       return prom;
22441     };
22442     _this.fileMap = function(val) {
22443       if (!arguments.length)
22444         return _fileMap;
22445       _fileMap = val;
22446       return _this;
22447     };
22448     let _assetPath = "";
22449     _this.assetPath = function(val) {
22450       if (!arguments.length)
22451         return _assetPath;
22452       _assetPath = val;
22453       return _this;
22454     };
22455     let _assetMap = {};
22456     _this.assetMap = function(val) {
22457       if (!arguments.length)
22458         return _assetMap;
22459       _assetMap = val;
22460       return _this;
22461     };
22462     _this.asset = (val) => {
22463       if (/^http(s)?:\/\//i.test(val))
22464         return val;
22465       const filename = _assetPath + val;
22466       return _assetMap[filename] || filename;
22467     };
22468     return _this;
22469   }
22470
22471   // node_modules/@ideditor/country-coder/dist/country-coder.mjs
22472   var import_which_polygon = __toESM(require_which_polygon(), 1);
22473   var type = "FeatureCollection";
22474   var features = [
22475     { type: "Feature", properties: { wikidata: "Q21", nameEn: "England", aliases: ["GB-ENG"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.03913, 51.13217], [-7.74976, 48.64773], [1.17405, 50.74239], [2.18458, 51.52087], [2.56575, 51.85301], [0.792, 57.56437], [-2.30613, 55.62698], [-2.17058, 55.45916], [-2.6095, 55.28488], [-2.63532, 55.19452], [-3.02906, 55.04606], [-3.09361, 54.94924], [-3.38407, 54.94278], [-4.1819, 54.57861], [-3.5082, 53.54318], [-3.08228, 53.25526], [-3.03675, 53.25092], [-2.92329, 53.19383], [-2.92022, 53.17685], [-2.98598, 53.15589], [-2.90649, 53.10964], [-2.87469, 53.12337], [-2.89131, 53.09374], [-2.83133, 52.99184], [-2.7251, 52.98389], [-2.72221, 52.92969], [-2.80549, 52.89428], [-2.85897, 52.94487], [-2.92401, 52.93836], [-2.97243, 52.9651], [-3.13576, 52.895], [-3.15744, 52.84947], [-3.16105, 52.79599], [-3.08734, 52.77504], [-3.01001, 52.76636], [-2.95581, 52.71794], [-3.01724, 52.72083], [-3.04398, 52.65435], [-3.13648, 52.58208], [-3.12926, 52.5286], [-3.09746, 52.53077], [-3.08662, 52.54811], [-3.00929, 52.57774], [-2.99701, 52.551], [-3.03603, 52.49969], [-3.13359, 52.49174], [-3.22971, 52.45344], [-3.22754, 52.42526], [-3.04687, 52.34504], [-2.95364, 52.3501], [-2.99701, 52.323], [-3.00785, 52.2753], [-3.09289, 52.20546], [-3.12638, 52.08114], [-2.97111, 51.90456], [-2.8818, 51.93196], [-2.78742, 51.88833], [-2.74277, 51.84367], [-2.66234, 51.83555], [-2.66336, 51.59504], [-3.20563, 51.31615], [-6.03913, 51.13217]]]] } },
22476     { type: "Feature", properties: { wikidata: "Q22", nameEn: "Scotland", aliases: ["GB-SCT"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.792, 57.56437], [-0.3751, 61.32236], [-14.78497, 57.60709], [-6.82333, 55.83103], [-4.69044, 54.3629], [-3.38407, 54.94278], [-3.09361, 54.94924], [-3.02906, 55.04606], [-2.63532, 55.19452], [-2.6095, 55.28488], [-2.17058, 55.45916], [-2.30613, 55.62698], [0.792, 57.56437]]]] } },
22477     { type: "Feature", properties: { wikidata: "Q25", nameEn: "Wales", aliases: ["GB-WLS"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.5082, 53.54318], [-5.37267, 53.63269], [-6.03913, 51.13217], [-3.20563, 51.31615], [-2.66336, 51.59504], [-2.66234, 51.83555], [-2.74277, 51.84367], [-2.78742, 51.88833], [-2.8818, 51.93196], [-2.97111, 51.90456], [-3.12638, 52.08114], [-3.09289, 52.20546], [-3.00785, 52.2753], [-2.99701, 52.323], [-2.95364, 52.3501], [-3.04687, 52.34504], [-3.22754, 52.42526], [-3.22971, 52.45344], [-3.13359, 52.49174], [-3.03603, 52.49969], [-2.99701, 52.551], [-3.00929, 52.57774], [-3.08662, 52.54811], [-3.09746, 52.53077], [-3.12926, 52.5286], [-3.13648, 52.58208], [-3.04398, 52.65435], [-3.01724, 52.72083], [-2.95581, 52.71794], [-3.01001, 52.76636], [-3.08734, 52.77504], [-3.16105, 52.79599], [-3.15744, 52.84947], [-3.13576, 52.895], [-2.97243, 52.9651], [-2.92401, 52.93836], [-2.85897, 52.94487], [-2.80549, 52.89428], [-2.72221, 52.92969], [-2.7251, 52.98389], [-2.83133, 52.99184], [-2.89131, 53.09374], [-2.87469, 53.12337], [-2.90649, 53.10964], [-2.98598, 53.15589], [-2.92022, 53.17685], [-2.92329, 53.19383], [-3.03675, 53.25092], [-3.08228, 53.25526], [-3.5082, 53.54318]]]] } },
22478     { type: "Feature", properties: { wikidata: "Q26", nameEn: "Northern Ireland", aliases: ["GB-NIR"], country: "GB", groups: ["Q22890", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.34755, 55.49206], [-7.2471, 55.06933], [-7.34464, 55.04688], [-7.4033, 55.00391], [-7.40004, 54.94498], [-7.44404, 54.9403], [-7.4473, 54.87003], [-7.47626, 54.83084], [-7.54508, 54.79401], [-7.54671, 54.74606], [-7.64449, 54.75265], [-7.75041, 54.7103], [-7.83352, 54.73854], [-7.93293, 54.66603], [-7.70315, 54.62077], [-7.8596, 54.53671], [-7.99812, 54.54427], [-8.04538, 54.48941], [-8.179, 54.46763], [-8.04555, 54.36292], [-7.87101, 54.29299], [-7.8596, 54.21779], [-7.81397, 54.20159], [-7.69501, 54.20731], [-7.55812, 54.12239], [-7.4799, 54.12239], [-7.44567, 54.1539], [-7.32834, 54.11475], [-7.30553, 54.11869], [-7.34005, 54.14698], [-7.29157, 54.17191], [-7.28017, 54.16714], [-7.29687, 54.1354], [-7.29493, 54.12013], [-7.26316, 54.13863], [-7.25012, 54.20063], [-7.14908, 54.22732], [-7.19145, 54.31296], [-7.02034, 54.4212], [-6.87775, 54.34682], [-6.85179, 54.29176], [-6.81583, 54.22791], [-6.74575, 54.18788], [-6.70175, 54.20218], [-6.6382, 54.17071], [-6.66264, 54.0666], [-6.62842, 54.03503], [-6.47849, 54.06947], [-6.36605, 54.07234], [-6.36279, 54.11248], [-6.32694, 54.09337], [-6.29003, 54.11278], [-6.26218, 54.09785], [-5.83481, 53.87749], [-4.69044, 54.3629], [-6.34755, 55.49206]]]] } },
22479     { type: "Feature", properties: { wikidata: "Q35", nameEn: "Denmark", country: "DK", groups: ["EU", "154", "150", "UN"], callingCodes: ["45"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.16597, 56.60205], [10.40861, 58.38489], [7.28637, 57.35913], [8.02459, 55.09613], [8.45719, 55.06747], [8.55769, 54.91837], [8.63979, 54.91069], [8.76387, 54.8948], [8.81178, 54.90518], [8.92795, 54.90452], [9.04629, 54.87249], [9.14275, 54.87421], [9.20571, 54.85841], [9.24631, 54.84726], [9.23445, 54.83432], [9.2474, 54.8112], [9.32771, 54.80602], [9.33849, 54.80233], [9.36496, 54.81749], [9.38532, 54.83968], [9.41213, 54.84254], [9.43155, 54.82586], [9.4659, 54.83131], [9.58937, 54.88785], [9.62734, 54.88057], [9.61187, 54.85548], [9.73563, 54.8247], [9.89314, 54.84171], [10.16755, 54.73883], [10.31111, 54.65968], [11.00303, 54.63689], [11.90309, 54.38543], [12.85844, 54.82438], [13.93395, 54.84044], [15.36991, 54.73263], [15.79951, 55.54655], [14.89259, 55.5623], [14.28399, 55.1553], [12.84405, 55.13257], [12.60345, 55.42675], [12.88472, 55.63369], [12.6372, 55.91371], [12.65312, 56.04345], [12.07466, 56.29488], [12.16597, 56.60205]]]] } },
22480     { type: "Feature", properties: { wikidata: "Q55", nameEn: "Netherlands", country: "NL", groups: ["EU", "155", "150", "UN"], callingCodes: ["31"] }, geometry: { type: "MultiPolygon", coordinates: [[[[5.45168, 54.20039], [2.56575, 51.85301], [3.36263, 51.37112], [3.38696, 51.33436], [3.35847, 51.31572], [3.38289, 51.27331], [3.41704, 51.25933], [3.43488, 51.24135], [3.52698, 51.2458], [3.51502, 51.28697], [3.58939, 51.30064], [3.78999, 51.25766], [3.78783, 51.2151], [3.90125, 51.20371], [3.97889, 51.22537], [4.01957, 51.24504], [4.05165, 51.24171], [4.16721, 51.29348], [4.24024, 51.35371], [4.21923, 51.37443], [4.33265, 51.37687], [4.34086, 51.35738], [4.39292, 51.35547], [4.43777, 51.36989], [4.38064, 51.41965], [4.39747, 51.43316], [4.38122, 51.44905], [4.47736, 51.4778], [4.5388, 51.48184], [4.54675, 51.47265], [4.52846, 51.45002], [4.53521, 51.4243], [4.57489, 51.4324], [4.65442, 51.42352], [4.72935, 51.48424], [4.74578, 51.48937], [4.77321, 51.50529], [4.78803, 51.50284], [4.84139, 51.4799], [4.82409, 51.44736], [4.82946, 51.4213], [4.78314, 51.43319], [4.76577, 51.43046], [4.77229, 51.41337], [4.78941, 51.41102], [4.84988, 51.41502], [4.90016, 51.41404], [4.92152, 51.39487], [5.00393, 51.44406], [5.0106, 51.47167], [5.03281, 51.48679], [5.04774, 51.47022], [5.07891, 51.4715], [5.10456, 51.43163], [5.07102, 51.39469], [5.13105, 51.34791], [5.13377, 51.31592], [5.16222, 51.31035], [5.2002, 51.32243], [5.24244, 51.30495], [5.22542, 51.26888], [5.23814, 51.26064], [5.26461, 51.26693], [5.29716, 51.26104], [5.33886, 51.26314], [5.347, 51.27502], [5.41672, 51.26248], [5.4407, 51.28169], [5.46519, 51.2849], [5.48476, 51.30053], [5.515, 51.29462], [5.5569, 51.26544], [5.5603, 51.22249], [5.65145, 51.19788], [5.65528, 51.18736], [5.70344, 51.1829], [5.74617, 51.18928], [5.77735, 51.17845], [5.77697, 51.1522], [5.82564, 51.16753], [5.85508, 51.14445], [5.80798, 51.11661], [5.8109, 51.10861], [5.83226, 51.10585], [5.82921, 51.09328], [5.79903, 51.09371], [5.79835, 51.05834], [5.77258, 51.06196], [5.75961, 51.03113], [5.77688, 51.02483], [5.76242, 50.99703], [5.71864, 50.96092], [5.72875, 50.95428], [5.74752, 50.96202], [5.75927, 50.95601], [5.74644, 50.94723], [5.72545, 50.92312], [5.72644, 50.91167], [5.71626, 50.90796], [5.69858, 50.91046], [5.67886, 50.88142], [5.64504, 50.87107], [5.64009, 50.84742], [5.65259, 50.82309], [5.70118, 50.80764], [5.68995, 50.79641], [5.70107, 50.7827], [5.68091, 50.75804], [5.69469, 50.75529], [5.72216, 50.76398], [5.73904, 50.75674], [5.74356, 50.7691], [5.76533, 50.78159], [5.77513, 50.78308], [5.80673, 50.7558], [5.84548, 50.76542], [5.84888, 50.75448], [5.88734, 50.77092], [5.89129, 50.75125], [5.89132, 50.75124], [5.95942, 50.7622], [5.97545, 50.75441], [6.01976, 50.75398], [6.02624, 50.77453], [5.97497, 50.79992], [5.98404, 50.80988], [6.00462, 50.80065], [6.02328, 50.81694], [6.01921, 50.84435], [6.05623, 50.8572], [6.05702, 50.85179], [6.07431, 50.84674], [6.07693, 50.86025], [6.08805, 50.87223], [6.07486, 50.89307], [6.09297, 50.92066], [6.01615, 50.93367], [6.02697, 50.98303], [5.95282, 50.98728], [5.90296, 50.97356], [5.90493, 51.00198], [5.87849, 51.01969], [5.86735, 51.05182], [5.9134, 51.06736], [5.9541, 51.03496], [5.98292, 51.07469], [6.16706, 51.15677], [6.17384, 51.19589], [6.07889, 51.17038], [6.07889, 51.24432], [6.16977, 51.33169], [6.22674, 51.36135], [6.22641, 51.39948], [6.20654, 51.40049], [6.21724, 51.48568], [6.18017, 51.54096], [6.09055, 51.60564], [6.11759, 51.65609], [6.02767, 51.6742], [6.04091, 51.71821], [5.95003, 51.7493], [5.98665, 51.76944], [5.94568, 51.82786], [5.99848, 51.83195], [6.06705, 51.86136], [6.10337, 51.84829], [6.16902, 51.84094], [6.11551, 51.89769], [6.15349, 51.90439], [6.21443, 51.86801], [6.29872, 51.86801], [6.30593, 51.84998], [6.40704, 51.82771], [6.38815, 51.87257], [6.47179, 51.85395], [6.50231, 51.86313], [6.58556, 51.89386], [6.68386, 51.91861], [6.72319, 51.89518], [6.82357, 51.96711], [6.83035, 51.9905], [6.68128, 52.05052], [6.76117, 52.11895], [6.83984, 52.11728], [6.97189, 52.20329], [6.9897, 52.2271], [7.03729, 52.22695], [7.06365, 52.23789], [7.02703, 52.27941], [7.07044, 52.37805], [7.03417, 52.40237], [6.99041, 52.47235], [6.94293, 52.43597], [6.69507, 52.488], [6.71641, 52.62905], [6.77307, 52.65375], [7.04557, 52.63318], [7.07253, 52.81083], [7.21694, 53.00742], [7.17898, 53.13817], [7.22681, 53.18165], [7.21679, 53.20058], [7.19052, 53.31866], [7.00198, 53.32672], [6.91025, 53.44221], [5.45168, 54.20039]], [[4.93295, 51.44945], [4.95244, 51.45207], [4.9524, 51.45014], [4.93909, 51.44632], [4.93295, 51.44945]], [[4.91493, 51.4353], [4.91935, 51.43634], [4.92227, 51.44252], [4.91811, 51.44621], [4.92287, 51.44741], [4.92811, 51.4437], [4.92566, 51.44273], [4.92815, 51.43856], [4.92879, 51.44161], [4.93544, 51.44634], [4.94025, 51.44193], [4.93416, 51.44185], [4.93471, 51.43861], [4.94265, 51.44003], [4.93986, 51.43064], [4.92952, 51.42984], [4.92652, 51.43329], [4.91493, 51.4353]]]] } },
22481     { type: "Feature", properties: { wikidata: "Q782", nameEn: "Hawaii", aliases: ["US-HI"], country: "US", groups: ["Q35657", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.8563, 29.18961], [-179.49839, 27.86265], [-151.6784, 9.55515], [-154.05867, 45.51124], [-177.5224, 27.7635], [-177.8563, 29.18961]]]] } },
22482     { type: "Feature", properties: { wikidata: "Q797", nameEn: "Alaska", aliases: ["US-AK"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.34848, 52.47228], [180, 51.0171], [179.84401, 55.10087], [169.34848, 52.47228]]], [[[-168.95635, 65.98512], [-169.03888, 65.48473], [-172.76104, 63.77445], [-179.55295, 57.62081], [-179.55295, 50.81807], [-133.92876, 54.62289], [-130.61931, 54.70835], [-130.64499, 54.76912], [-130.44184, 54.85377], [-130.27203, 54.97174], [-130.18765, 55.07744], [-130.08035, 55.21556], [-129.97513, 55.28029], [-130.15373, 55.74895], [-130.00857, 55.91344], [-130.00093, 56.00325], [-130.10173, 56.12178], [-130.33965, 56.10849], [-130.77769, 56.36185], [-131.8271, 56.62247], [-133.38523, 58.42773], [-133.84645, 58.73543], [-134.27175, 58.8634], [-134.48059, 59.13231], [-134.55699, 59.1297], [-134.7047, 59.2458], [-135.00267, 59.28745], [-135.03069, 59.56208], [-135.48007, 59.79937], [-136.31566, 59.59083], [-136.22381, 59.55526], [-136.33727, 59.44466], [-136.47323, 59.46617], [-136.52365, 59.16752], [-136.82619, 59.16198], [-137.4925, 58.89415], [-137.60623, 59.24465], [-138.62145, 59.76431], [-138.71149, 59.90728], [-139.05365, 59.99655], [-139.20603, 60.08896], [-139.05831, 60.35205], [-139.68991, 60.33693], [-139.98024, 60.18027], [-140.45648, 60.30919], [-140.5227, 60.22077], [-141.00116, 60.30648], [-140.97446, 84.39275], [-168.25765, 71.99091], [-168.95635, 65.98512]]]] } },
22483     { type: "Feature", properties: { wikidata: "Q3492", nameEn: "Sumatra", aliases: ["ID-SM"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.82788, 2.86812], [110.90339, 7.52694], [105.01437, 3.24936], [104.56723, 1.44271], [104.34728, 1.33529], [104.12282, 1.27714], [104.03085, 1.26954], [103.74084, 1.12902], [103.66049, 1.18825], [103.56591, 1.19719], [103.03657, 1.30383], [96.11174, 6.69841], [74.28481, -3.17525], [102.92489, -8.17146], [106.32259, -5.50116], [106.38511, -5.16715], [109.17017, -4.07401], [109.3962, -2.07276], [108.50935, -2.01066], [107.94791, 1.06924], [109.82788, 2.86812]]]] } },
22484     { type: "Feature", properties: { wikidata: "Q3757", nameEn: "Java", aliases: ["ID-JW"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.17017, -4.07401], [106.38511, -5.16715], [106.32259, -5.50116], [102.92489, -8.17146], [116.22542, -10.49172], [114.39575, -8.2889], [114.42235, -8.09762], [114.92859, -7.49253], [116.33992, -7.56171], [116.58433, -5.30385], [109.17017, -4.07401]]]] } },
22485     { type: "Feature", properties: { wikidata: "Q3795", nameEn: "Kalimantan", aliases: ["ID-KA"], country: "ID", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[120.02464, 2.83703], [118.06469, 4.16638], [117.67641, 4.16535], [117.47313, 4.18857], [117.25801, 4.35108], [115.90217, 4.37708], [115.58276, 3.93499], [115.53713, 3.14776], [115.11343, 2.82879], [115.1721, 2.49671], [114.80706, 2.21665], [114.80706, 1.92351], [114.57892, 1.5], [114.03788, 1.44787], [113.64677, 1.23933], [113.01448, 1.42832], [113.021, 1.57819], [112.48648, 1.56516], [112.2127, 1.44135], [112.15679, 1.17004], [111.94553, 1.12016], [111.82846, 0.99349], [111.55434, 0.97864], [111.22979, 1.08326], [110.62374, 0.873], [110.49182, 0.88088], [110.35354, 0.98869], [109.66397, 1.60425], [109.66397, 1.79972], [109.57923, 1.80624], [109.53794, 1.91771], [109.62558, 1.99182], [109.82788, 2.86812], [107.94791, 1.06924], [108.50935, -2.01066], [109.3962, -2.07276], [109.17017, -4.07401], [116.58433, -5.30385], [120.02464, 2.83703]]]] } },
22486     { type: "Feature", properties: { wikidata: "Q3803", nameEn: "Lesser Sunda Islands", aliases: ["ID-NU"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[116.96967, -8.01483], [114.92859, -7.49253], [114.42235, -8.09762], [114.39575, -8.2889], [116.22542, -10.49172], [122.14954, -11.52517], [125.68138, -9.85176], [125.09025, -9.46406], [124.97892, -9.19281], [125.04044, -9.17093], [125.09434, -9.19669], [125.18907, -9.16434], [125.18632, -9.03142], [125.11764, -8.96359], [124.97742, -9.08128], [124.94011, -8.85617], [124.46701, -9.13002], [124.45971, -9.30263], [124.38554, -9.3582], [124.35258, -9.43002], [124.3535, -9.48493], [124.28115, -9.50453], [124.28115, -9.42189], [124.21247, -9.36904], [124.14517, -9.42324], [124.10539, -9.41206], [124.04286, -9.34243], [124.04628, -9.22671], [124.33472, -9.11416], [124.92337, -8.75859], [125.87688, -7.49892], [116.96967, -8.01483]]]] } },
22487     { type: "Feature", properties: { wikidata: "Q3812", nameEn: "Sulawesi", aliases: ["ID-SL"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.34321, 3.90322], [126.69413, 6.02692], [119.56457, 0.90759], [116.58433, -5.30385], [116.33992, -7.56171], [116.96967, -8.01483], [125.87688, -7.49892], [123.78965, -0.86805], [128.34321, 3.90322]]]] } },
22488     { type: "Feature", properties: { wikidata: "Q3827", nameEn: "Maluku Islands", aliases: ["ID-ML"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.63187, 2.21409], [128.34321, 3.90322], [123.78965, -0.86805], [125.87688, -7.49892], [125.58506, -7.95311], [125.87691, -8.31789], [127.42116, -8.22471], [127.55165, -9.05052], [135.49042, -9.2276], [135.35517, -5.01442], [132.8312, -4.70282], [130.8468, -2.61103], [128.40647, -2.30349], [129.71519, -0.24692], [129.63187, 2.21409]]]] } },
22489     { type: "Feature", properties: { wikidata: "Q3845", nameEn: "Western New Guinea", aliases: ["ID-PP"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.49042, -9.2276], [141.01842, -9.35091], [141.01763, -6.90181], [140.90448, -6.85033], [140.85295, -6.72996], [140.99813, -6.3233], [141.02352, 0.08993], [129.63187, 2.21409], [129.71519, -0.24692], [128.40647, -2.30349], [130.8468, -2.61103], [132.8312, -4.70282], [135.35517, -5.01442], [135.49042, -9.2276]]]] } },
22490     { type: "Feature", properties: { wikidata: "Q5765", nameEn: "Balearic Islands", aliases: ["ES-IB"], country: "ES", groups: ["EU", "039", "150", "UN"], callingCodes: ["34 971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [5.10072, 39.89531], [3.75438, 42.33445], [-2.27707, 35.35051]]]] } },
22491     { type: "Feature", properties: { wikidata: "Q5823", nameEn: "Ceuta", aliases: ["ES-CE"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.38491, 35.92591], [-5.37338, 35.88417], [-5.35844, 35.87375], [-5.34379, 35.8711], [-5.21179, 35.90091], [-5.38491, 35.92591]]]] } },
22492     { type: "Feature", properties: { wikidata: "Q5831", nameEn: "Melilla", aliases: ["ES-ML"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.91909, 35.33927], [-2.96038, 35.31609], [-2.96648, 35.30475], [-2.96978, 35.29459], [-2.97035, 35.28852], [-2.96507, 35.28801], [-2.96826, 35.28296], [-2.96516, 35.27967], [-2.95431, 35.2728], [-2.95065, 35.26576], [-2.93893, 35.26737], [-2.92272, 35.27509], [-2.91909, 35.33927]]]] } },
22493     { type: "Feature", properties: { wikidata: "Q7835", nameEn: "Crimea", country: "RU", groups: ["151", "150", "UN"], level: "subterritory", callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.5, 44], [36.4883, 45.0488], [36.475, 45.2411], [36.5049, 45.3136], [36.6545, 45.3417], [36.6645, 45.4514], [35.0498, 45.7683], [34.9601, 45.7563], [34.7991, 45.8101], [34.8015, 45.9005], [34.7548, 45.907], [34.6668, 45.9714], [34.6086, 45.9935], [34.5589, 45.9935], [34.5201, 45.951], [34.4873, 45.9427], [34.4415, 45.9599], [34.4122, 46.0025], [34.3391, 46.0611], [34.2511, 46.0532], [34.181, 46.068], [34.1293, 46.1049], [34.0731, 46.1177], [34.0527, 46.1084], [33.9155, 46.1594], [33.8523, 46.1986], [33.7972, 46.2048], [33.7405, 46.1855], [33.646, 46.2303], [33.6152, 46.2261], [33.6385, 46.1415], [33.6147, 46.1356], [33.5732, 46.1032], [33.5909, 46.0601], [33.5597, 46.0307], [31.5, 45.5], [33.5, 44]]]] } },
22494     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
22495     { type: "Feature", properties: { wikidata: "Q14056", nameEn: "Jan Mayen", aliases: ["NO-22"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-9.18243, 72.23144], [-10.71459, 70.09565], [-5.93364, 70.76368], [-9.18243, 72.23144]]]] } },
22496     { type: "Feature", properties: { wikidata: "Q19188", nameEn: "Mainland China", country: "CN", groups: ["030", "142", "UN"], callingCodes: ["86"] }, geometry: { type: "MultiPolygon", coordinates: [[[[125.6131, 53.07229], [125.17522, 53.20225], [124.46078, 53.21881], [123.86158, 53.49391], [123.26989, 53.54843], [122.85966, 53.47395], [122.35063, 53.49565], [121.39213, 53.31888], [120.85633, 53.28499], [120.0451, 52.7359], [120.04049, 52.58773], [120.46454, 52.63811], [120.71673, 52.54099], [120.61346, 52.32447], [120.77337, 52.20805], [120.65907, 51.93544], [120.10963, 51.671], [119.13553, 50.37412], [119.38598, 50.35162], [119.27996, 50.13348], [119.11003, 50.00276], [118.61623, 49.93809], [117.82343, 49.52696], [117.48208, 49.62324], [117.27597, 49.62544], [116.71193, 49.83813], [116.03781, 48.87014], [116.06565, 48.81716], [115.78876, 48.51781], [115.811, 48.25699], [115.52082, 48.15367], [115.57128, 47.91988], [115.94296, 47.67741], [116.21879, 47.88505], [116.4465, 47.83662], [116.67405, 47.89039], [116.9723, 47.87285], [117.37875, 47.63627], [117.50181, 47.77216], [117.80196, 48.01661], [118.03676, 48.00982], [118.11009, 48.04], [118.22677, 48.03853], [118.29654, 48.00246], [118.55766, 47.99277], [118.7564, 47.76947], [119.12343, 47.66458], [119.13995, 47.53997], [119.35892, 47.48104], [119.31964, 47.42617], [119.54918, 47.29505], [119.56019, 47.24874], [119.62403, 47.24575], [119.71209, 47.19192], [119.85518, 46.92196], [119.91242, 46.90091], [119.89261, 46.66423], [119.80455, 46.67631], [119.77373, 46.62947], [119.68127, 46.59015], [119.65265, 46.62342], [119.42827, 46.63783], [119.32827, 46.61433], [119.24978, 46.64761], [119.10448, 46.65516], [119.00541, 46.74273], [118.92616, 46.72765], [118.89974, 46.77139], [118.8337, 46.77742], [118.78747, 46.68689], [118.30534, 46.73519], [117.69554, 46.50991], [117.60748, 46.59771], [117.41782, 46.57862], [117.36609, 46.36335], [116.83166, 46.38637], [116.75551, 46.33083], [116.58612, 46.30211], [116.26678, 45.96479], [116.24012, 45.8778], [116.27366, 45.78637], [116.16989, 45.68603], [115.60329, 45.44717], [114.94546, 45.37377], [114.74612, 45.43585], [114.54801, 45.38337], [114.5166, 45.27189], [113.70918, 44.72891], [112.74662, 44.86297], [112.4164, 45.06858], [111.98695, 45.09074], [111.76275, 44.98032], [111.40498, 44.3461], [111.96289, 43.81596], [111.93776, 43.68709], [111.79758, 43.6637], [111.59087, 43.51207], [111.0149, 43.3289], [110.4327, 42.78293], [110.08401, 42.6411], [109.89402, 42.63111], [109.452, 42.44842], [109.00679, 42.45302], [108.84489, 42.40246], [107.57258, 42.40898], [107.49681, 42.46221], [107.29755, 42.41395], [107.24774, 42.36107], [106.76517, 42.28741], [105.0123, 41.63188], [104.51667, 41.66113], [104.52258, 41.8706], [103.92804, 41.78246], [102.72403, 42.14675], [102.07645, 42.22519], [101.80515, 42.50074], [100.84979, 42.67087], [100.33297, 42.68231], [99.50671, 42.56535], [97.1777, 42.7964], [96.37926, 42.72055], [96.35658, 42.90363], [95.89543, 43.2528], [95.52594, 43.99353], [95.32891, 44.02407], [95.39772, 44.2805], [95.01191, 44.25274], [94.71959, 44.35284], [94.10003, 44.71016], [93.51161, 44.95964], [91.64048, 45.07408], [90.89169, 45.19667], [90.65114, 45.49314], [90.70907, 45.73437], [91.03026, 46.04194], [90.99672, 46.14207], [90.89639, 46.30711], [91.07696, 46.57315], [91.0147, 46.58171], [91.03649, 46.72916], [90.84035, 46.99525], [90.76108, 46.99399], [90.48542, 47.30438], [90.48854, 47.41826], [90.33598, 47.68303], [90.10871, 47.7375], [90.06512, 47.88177], [89.76624, 47.82745], [89.55453, 48.0423], [89.0711, 47.98528], [88.93186, 48.10263], [88.8011, 48.11302], [88.58316, 48.21893], [88.58939, 48.34531], [87.96361, 48.58478], [88.0788, 48.71436], [87.73822, 48.89582], [87.88171, 48.95853], [87.81333, 49.17354], [87.48983, 49.13794], [87.478, 49.07403], [87.28386, 49.11626], [86.87238, 49.12432], [86.73568, 48.99918], [86.75343, 48.70331], [86.38069, 48.46064], [85.73581, 48.3939], [85.5169, 48.05493], [85.61067, 47.49753], [85.69696, 47.2898], [85.54294, 47.06171], [85.22443, 47.04816], [84.93995, 46.87399], [84.73077, 47.01394], [83.92184, 46.98912], [83.04622, 47.19053], [82.21792, 45.56619], [82.58474, 45.40027], [82.51374, 45.1755], [81.73278, 45.3504], [80.11169, 45.03352], [79.8987, 44.89957], [80.38384, 44.63073], [80.40229, 44.23319], [80.40031, 44.10986], [80.75156, 43.44948], [80.69718, 43.32589], [80.77771, 43.30065], [80.78817, 43.14235], [80.62913, 43.141], [80.3735, 43.01557], [80.58999, 42.9011], [80.38169, 42.83142], [80.26886, 42.8366], [80.16892, 42.61137], [80.26841, 42.23797], [80.17807, 42.21166], [80.17842, 42.03211], [79.92977, 42.04113], [78.3732, 41.39603], [78.15757, 41.38565], [78.12873, 41.23091], [77.81287, 41.14307], [77.76206, 41.01574], [77.52723, 41.00227], [77.3693, 41.0375], [77.28004, 41.0033], [76.99302, 41.0696], [76.75681, 40.95354], [76.5261, 40.46114], [76.33659, 40.3482], [75.96168, 40.38064], [75.91361, 40.2948], [75.69663, 40.28642], [75.5854, 40.66874], [75.22834, 40.45382], [75.08243, 40.43945], [74.82013, 40.52197], [74.78168, 40.44886], [74.85996, 40.32857], [74.69875, 40.34668], [74.35063, 40.09742], [74.25533, 40.13191], [73.97049, 40.04378], [73.83006, 39.76136], [73.9051, 39.75073], [73.92354, 39.69565], [73.94683, 39.60733], [73.87018, 39.47879], [73.59831, 39.46425], [73.59241, 39.40843], [73.5004, 39.38402], [73.55396, 39.3543], [73.54572, 39.27567], [73.60638, 39.24534], [73.75823, 39.023], [73.81728, 39.04007], [73.82964, 38.91517], [73.7445, 38.93867], [73.7033, 38.84782], [73.80656, 38.66449], [73.79806, 38.61106], [73.97933, 38.52945], [74.17022, 38.65504], [74.51217, 38.47034], [74.69619, 38.42947], [74.69894, 38.22155], [74.80331, 38.19889], [74.82665, 38.07359], [74.9063, 38.03033], [74.92416, 37.83428], [75.00935, 37.77486], [74.8912, 37.67576], [74.94338, 37.55501], [75.06011, 37.52779], [75.15899, 37.41443], [75.09719, 37.37297], [75.12328, 37.31839], [74.88887, 37.23275], [74.80605, 37.21565], [74.49981, 37.24518], [74.56453, 37.03023], [75.13839, 37.02622], [75.40481, 36.95382], [75.45562, 36.71971], [75.72737, 36.7529], [75.92391, 36.56986], [76.0324, 36.41198], [76.00906, 36.17511], [75.93028, 36.13136], [76.15325, 35.9264], [76.14913, 35.82848], [76.33453, 35.84296], [76.50961, 35.8908], [76.77323, 35.66062], [76.84539, 35.67356], [76.96624, 35.5932], [77.44277, 35.46132], [77.70232, 35.46244], [77.80532, 35.52058], [78.11664, 35.48022], [78.03466, 35.3785], [78.00033, 35.23954], [78.22692, 34.88771], [78.18435, 34.7998], [78.27781, 34.61484], [78.54964, 34.57283], [78.56475, 34.50835], [78.74465, 34.45174], [79.05364, 34.32482], [78.99802, 34.3027], [78.91769, 34.15452], [78.66225, 34.08858], [78.65657, 34.03195], [78.73367, 34.01121], [78.77349, 33.73871], [78.67599, 33.66445], [78.73636, 33.56521], [79.15252, 33.17156], [79.14016, 33.02545], [79.46562, 32.69668], [79.26768, 32.53277], [79.13174, 32.47766], [79.0979, 32.38051], [78.99322, 32.37948], [78.96713, 32.33655], [78.7831, 32.46873], [78.73916, 32.69438], [78.38897, 32.53938], [78.4645, 32.45367], [78.49609, 32.2762], [78.68754, 32.10256], [78.74404, 32.00384], [78.78036, 31.99478], [78.69933, 31.78723], [78.84516, 31.60631], [78.71032, 31.50197], [78.77898, 31.31209], [78.89344, 31.30481], [79.01931, 31.42817], [79.14016, 31.43403], [79.30694, 31.17357], [79.59884, 30.93943], [79.93255, 30.88288], [80.20721, 30.58541], [80.54504, 30.44936], [80.83343, 30.32023], [81.03953, 30.20059], [81.12842, 30.01395], [81.24362, 30.0126], [81.29032, 30.08806], [81.2623, 30.14596], [81.33355, 30.15303], [81.39928, 30.21862], [81.41018, 30.42153], [81.5459, 30.37688], [81.62033, 30.44703], [81.99082, 30.33423], [82.10135, 30.35439], [82.10757, 30.23745], [82.19475, 30.16884], [82.16984, 30.0692], [82.38622, 30.02608], [82.5341, 29.9735], [82.73024, 29.81695], [83.07116, 29.61957], [83.28131, 29.56813], [83.44787, 29.30513], [83.63156, 29.16249], [83.82303, 29.30513], [83.97559, 29.33091], [84.18107, 29.23451], [84.24801, 29.02783], [84.2231, 28.89571], [84.47528, 28.74023], [84.62317, 28.73887], [84.85511, 28.58041], [85.06059, 28.68562], [85.19135, 28.62825], [85.18668, 28.54076], [85.10729, 28.34092], [85.38127, 28.28336], [85.4233, 28.32996], [85.59765, 28.30529], [85.60854, 28.25045], [85.69105, 28.38475], [85.71907, 28.38064], [85.74864, 28.23126], [85.84672, 28.18187], [85.90743, 28.05144], [85.97813, 27.99023], [85.94946, 27.9401], [86.06309, 27.90021], [86.12069, 27.93047], [86.08333, 28.02121], [86.088, 28.09264], [86.18607, 28.17364], [86.22966, 27.9786], [86.42736, 27.91122], [86.51609, 27.96623], [86.56265, 28.09569], [86.74181, 28.10638], [86.75582, 28.04182], [87.03757, 27.94835], [87.11696, 27.84104], [87.56996, 27.84517], [87.72718, 27.80938], [87.82681, 27.95248], [88.13378, 27.88015], [88.1278, 27.95417], [88.25332, 27.9478], [88.54858, 28.06057], [88.63235, 28.12356], [88.83559, 28.01936], [88.88091, 27.85192], [88.77517, 27.45415], [88.82981, 27.38814], [88.91901, 27.32483], [88.93678, 27.33777], [88.96947, 27.30319], [89.00216, 27.32532], [88.95355, 27.4106], [88.97213, 27.51671], [89.0582, 27.60985], [89.12825, 27.62502], [89.59525, 28.16433], [89.79762, 28.23979], [90.13387, 28.19178], [90.58842, 28.02838], [90.69894, 28.07784], [91.20019, 27.98715], [91.25779, 28.07509], [91.46327, 28.0064], [91.48973, 27.93903], [91.5629, 27.84823], [91.6469, 27.76358], [91.84722, 27.76325], [91.87057, 27.7195], [92.27432, 27.89077], [92.32101, 27.79363], [92.42538, 27.80092], [92.7275, 27.98662], [92.73025, 28.05814], [92.65472, 28.07632], [92.67486, 28.15018], [92.93075, 28.25671], [93.14635, 28.37035], [93.18069, 28.50319], [93.44621, 28.67189], [93.72797, 28.68821], [94.35897, 29.01965], [94.2752, 29.11687], [94.69318, 29.31739], [94.81353, 29.17804], [95.0978, 29.14446], [95.11291, 29.09527], [95.2214, 29.10727], [95.26122, 29.07727], [95.3038, 29.13847], [95.41091, 29.13007], [95.50842, 29.13487], [95.72086, 29.20797], [95.75149, 29.32063], [95.84899, 29.31464], [96.05361, 29.38167], [96.31316, 29.18643], [96.18682, 29.11087], [96.20467, 29.02325], [96.3626, 29.10607], [96.61391, 28.72742], [96.40929, 28.51526], [96.48895, 28.42955], [96.6455, 28.61657], [96.85561, 28.4875], [96.88445, 28.39452], [96.98882, 28.32564], [97.1289, 28.3619], [97.34547, 28.21385], [97.41729, 28.29783], [97.47085, 28.2688], [97.50518, 28.49716], [97.56835, 28.55628], [97.70705, 28.5056], [97.79632, 28.33168], [97.90069, 28.3776], [98.15337, 28.12114], [98.13964, 27.9478], [98.32641, 27.51385], [98.42529, 27.55404], [98.43353, 27.67086], [98.69582, 27.56499], [98.7333, 26.85615], [98.77547, 26.61994], [98.72741, 26.36183], [98.67797, 26.24487], [98.7329, 26.17218], [98.66884, 26.09165], [98.63128, 26.15492], [98.57085, 26.11547], [98.60763, 26.01512], [98.70818, 25.86241], [98.63128, 25.79937], [98.54064, 25.85129], [98.40606, 25.61129], [98.31268, 25.55307], [98.25774, 25.6051], [98.16848, 25.62739], [98.18084, 25.56298], [98.12591, 25.50722], [98.14925, 25.41547], [97.92541, 25.20815], [97.83614, 25.2715], [97.77023, 25.11492], [97.72216, 25.08508], [97.72903, 24.91332], [97.79949, 24.85655], [97.76481, 24.8289], [97.73127, 24.83015], [97.70181, 24.84557], [97.64354, 24.79171], [97.56648, 24.76475], [97.56383, 24.75535], [97.5542, 24.74943], [97.54675, 24.74202], [97.56525, 24.72838], [97.56286, 24.54535], [97.52757, 24.43748], [97.60029, 24.4401], [97.66998, 24.45288], [97.7098, 24.35658], [97.65624, 24.33781], [97.66723, 24.30027], [97.71941, 24.29652], [97.76799, 24.26365], [97.72998, 24.2302], [97.72799, 24.18883], [97.75305, 24.16902], [97.72903, 24.12606], [97.62363, 24.00506], [97.5247, 23.94032], [97.64667, 23.84574], [97.72302, 23.89288], [97.79456, 23.94836], [97.79416, 23.95663], [97.84328, 23.97603], [97.86545, 23.97723], [97.88811, 23.97446], [97.8955, 23.97758], [97.89676, 23.97931], [97.89683, 23.98389], [97.88814, 23.98605], [97.88414, 23.99405], [97.88616, 24.00463], [97.90998, 24.02094], [97.93951, 24.01953], [97.98691, 24.03897], [97.99583, 24.04932], [98.04709, 24.07616], [98.05302, 24.07408], [98.05671, 24.07961], [98.0607, 24.07812], [98.06703, 24.08028], [98.07806, 24.07988], [98.20666, 24.11406], [98.54476, 24.13119], [98.59256, 24.08371], [98.85319, 24.13042], [98.87998, 24.15624], [98.89632, 24.10612], [98.67797, 23.9644], [98.68209, 23.80492], [98.79607, 23.77947], [98.82933, 23.72921], [98.81775, 23.694], [98.88396, 23.59555], [98.80294, 23.5345], [98.82877, 23.47908], [98.87683, 23.48995], [98.92104, 23.36946], [98.87573, 23.33038], [98.93958, 23.31414], [98.92515, 23.29535], [98.88597, 23.18656], [99.05975, 23.16382], [99.04601, 23.12215], [99.25741, 23.09025], [99.34127, 23.13099], [99.52214, 23.08218], [99.54218, 22.90014], [99.43537, 22.94086], [99.45654, 22.85726], [99.31243, 22.73893], [99.38247, 22.57544], [99.37972, 22.50188], [99.28771, 22.4105], [99.17318, 22.18025], [99.19176, 22.16983], [99.1552, 22.15874], [99.33166, 22.09656], [99.47585, 22.13345], [99.85351, 22.04183], [99.96612, 22.05965], [99.99084, 21.97053], [99.94003, 21.82782], [99.98654, 21.71064], [100.04956, 21.66843], [100.12679, 21.70539], [100.17486, 21.65306], [100.10757, 21.59945], [100.12542, 21.50365], [100.1625, 21.48704], [100.18447, 21.51898], [100.25863, 21.47043], [100.35201, 21.53176], [100.42892, 21.54325], [100.4811, 21.46148], [100.57861, 21.45637], [100.72143, 21.51898], [100.87265, 21.67396], [101.11744, 21.77659], [101.15156, 21.56129], [101.2124, 21.56422], [101.19349, 21.41959], [101.26912, 21.36482], [101.2229, 21.23271], [101.29326, 21.17254], [101.54563, 21.25668], [101.6068, 21.23329], [101.59491, 21.18621], [101.60886, 21.17947], [101.66977, 21.20004], [101.70548, 21.14911], [101.7622, 21.14813], [101.79266, 21.19025], [101.76745, 21.21571], [101.83887, 21.20983], [101.84412, 21.25291], [101.74014, 21.30967], [101.74224, 21.48276], [101.7727, 21.51794], [101.7475, 21.5873], [101.80001, 21.57461], [101.83257, 21.61562], [101.74555, 21.72852], [101.7791, 21.83019], [101.62566, 21.96574], [101.57525, 22.13026], [101.60675, 22.13513], [101.53638, 22.24794], [101.56789, 22.28876], [101.61306, 22.27515], [101.68973, 22.46843], [101.7685, 22.50337], [101.86828, 22.38397], [101.90714, 22.38688], [101.91344, 22.44417], [101.98487, 22.42766], [102.03633, 22.46164], [102.1245, 22.43372], [102.14099, 22.40092], [102.16621, 22.43336], [102.26428, 22.41321], [102.25339, 22.4607], [102.41061, 22.64184], [102.38415, 22.67919], [102.42618, 22.69212], [102.46665, 22.77108], [102.51802, 22.77969], [102.57095, 22.7036], [102.60675, 22.73376], [102.8636, 22.60735], [102.9321, 22.48659], [103.0722, 22.44775], [103.07843, 22.50097], [103.17961, 22.55705], [103.15782, 22.59873], [103.18895, 22.64471], [103.28079, 22.68063], [103.32282, 22.8127], [103.43179, 22.75816], [103.43646, 22.70648], [103.52675, 22.59155], [103.57812, 22.65764], [103.56255, 22.69499], [103.64506, 22.79979], [103.87904, 22.56683], [103.93286, 22.52703], [103.94513, 22.52553], [103.95191, 22.5134], [103.96352, 22.50584], [103.96783, 22.51173], [103.97384, 22.50634], [103.99247, 22.51958], [104.01088, 22.51823], [104.03734, 22.72945], [104.11384, 22.80363], [104.27084, 22.8457], [104.25683, 22.76534], [104.35593, 22.69353], [104.47225, 22.75813], [104.58122, 22.85571], [104.60457, 22.81841], [104.65283, 22.83419], [104.72755, 22.81984], [104.77114, 22.90017], [104.84942, 22.93631], [104.86765, 22.95178], [104.8334, 23.01484], [104.79478, 23.12934], [104.87382, 23.12854], [104.87992, 23.17141], [104.91435, 23.18666], [104.9486, 23.17235], [104.96532, 23.20463], [104.98712, 23.19176], [105.07002, 23.26248], [105.11672, 23.25247], [105.17276, 23.28679], [105.22569, 23.27249], [105.32376, 23.39684], [105.40782, 23.28107], [105.42805, 23.30824], [105.49966, 23.20669], [105.56037, 23.16806], [105.57594, 23.075], [105.72382, 23.06641], [105.8726, 22.92756], [105.90119, 22.94168], [105.99568, 22.94178], [106.00179, 22.99049], [106.19705, 22.98475], [106.27022, 22.87722], [106.34961, 22.86718], [106.49749, 22.91164], [106.51306, 22.94891], [106.55976, 22.92311], [106.60179, 22.92884], [106.6516, 22.86862], [106.6734, 22.89587], [106.71387, 22.88296], [106.71128, 22.85982], [106.78422, 22.81532], [106.81271, 22.8226], [106.83685, 22.8098], [106.82404, 22.7881], [106.76293, 22.73491], [106.72321, 22.63606], [106.71698, 22.58432], [106.65316, 22.5757], [106.61269, 22.60301], [106.58395, 22.474], [106.55665, 22.46498], [106.57221, 22.37], [106.55976, 22.34841], [106.6516, 22.33977], [106.69986, 22.22309], [106.67495, 22.1885], [106.6983, 22.15102], [106.70142, 22.02409], [106.68274, 21.99811], [106.69276, 21.96013], [106.72551, 21.97923], [106.74345, 22.00965], [106.81038, 21.97934], [106.9178, 21.97357], [106.92714, 21.93459], [106.97228, 21.92592], [106.99252, 21.95191], [107.05634, 21.92303], [107.06101, 21.88982], [107.00964, 21.85948], [107.02615, 21.81981], [107.10771, 21.79879], [107.20734, 21.71493], [107.24625, 21.7077], [107.29296, 21.74674], [107.35834, 21.6672], [107.35989, 21.60063], [107.38636, 21.59774], [107.41593, 21.64839], [107.47197, 21.6672], [107.49532, 21.62958], [107.49065, 21.59774], [107.54047, 21.5934], [107.56537, 21.61945], [107.66967, 21.60787], [107.80355, 21.66141], [107.86114, 21.65128], [107.90006, 21.5905], [107.92652, 21.58906], [107.95232, 21.5388], [107.96774, 21.53601], [107.97074, 21.54072], [107.97383, 21.53961], [107.97932, 21.54503], [108.02926, 21.54997], [108.0569, 21.53604], [108.10003, 21.47338], [108.00365, 17.98159], [111.60491, 13.57105], [118.41371, 24.06775], [118.11703, 24.39734], [118.28244, 24.51231], [118.35291, 24.51645], [118.42453, 24.54644], [118.56434, 24.49266], [120.49232, 25.22863], [121.03532, 26.8787], [123.5458, 31.01942], [122.29378, 31.76513], [122.80525, 33.30571], [123.85601, 37.49093], [123.90497, 38.79949], [124.17532, 39.8232], [124.23201, 39.9248], [124.35029, 39.95639], [124.37089, 40.03004], [124.3322, 40.05573], [124.38556, 40.11047], [124.40719, 40.13655], [124.86913, 40.45387], [125.71172, 40.85223], [125.76869, 40.87908], [126.00335, 40.92835], [126.242, 41.15454], [126.53189, 41.35206], [126.60631, 41.65565], [126.90729, 41.79955], [127.17841, 41.59714], [127.29712, 41.49473], [127.92943, 41.44291], [128.02633, 41.42103], [128.03311, 41.39232], [128.12967, 41.37931], [128.18546, 41.41279], [128.20061, 41.40895], [128.30716, 41.60322], [128.15119, 41.74568], [128.04487, 42.01769], [128.94007, 42.03537], [128.96068, 42.06657], [129.15178, 42.17224], [129.22285, 42.26491], [129.22423, 42.3553], [129.28541, 42.41574], [129.42882, 42.44702], [129.54701, 42.37254], [129.60482, 42.44461], [129.72541, 42.43739], [129.75294, 42.59409], [129.77183, 42.69435], [129.7835, 42.76521], [129.80719, 42.79218], [129.83277, 42.86746], [129.85261, 42.96494], [129.8865, 43.00395], [129.95082, 43.01051], [129.96409, 42.97306], [130.12957, 42.98361], [130.09764, 42.91425], [130.26095, 42.9027], [130.23068, 42.80125], [130.2385, 42.71127], [130.41826, 42.6011], [130.44361, 42.54849], [130.50123, 42.61636], [130.55143, 42.52158], [130.62107, 42.58413], [130.56576, 42.68925], [130.40213, 42.70788], [130.44361, 42.76205], [130.66524, 42.84753], [131.02438, 42.86518], [131.02668, 42.91246], [131.135, 42.94114], [131.10274, 43.04734], [131.20414, 43.13654], [131.19031, 43.21385], [131.30324, 43.39498], [131.29402, 43.46695], [131.19492, 43.53047], [131.21105, 43.82383], [131.26176, 43.94011], [131.23583, 43.96085], [131.25484, 44.03131], [131.30365, 44.04262], [131.1108, 44.70266], [130.95639, 44.85154], [131.48415, 44.99513], [131.68466, 45.12374], [131.66852, 45.2196], [131.76532, 45.22609], [131.86903, 45.33636], [131.99417, 45.2567], [132.83978, 45.05916], [132.96373, 45.0212], [133.12293, 45.1332], [133.09279, 45.25693], [133.19419, 45.51913], [133.41083, 45.57723], [133.48457, 45.86203], [133.60442, 45.90053], [133.67569, 45.9759], [133.72695, 46.05576], [133.68047, 46.14697], [133.88097, 46.25066], [133.91496, 46.4274], [133.84104, 46.46681], [134.03538, 46.75668], [134.20016, 47.33458], [134.50898, 47.4812], [134.7671, 47.72051], [134.55508, 47.98651], [134.67098, 48.1564], [134.75328, 48.36763], [134.49516, 48.42884], [132.66989, 47.96491], [132.57309, 47.71741], [131.90448, 47.68011], [131.2635, 47.73325], [131.09871, 47.6852], [130.95985, 47.6957], [130.90915, 47.90623], [130.65103, 48.10052], [130.84462, 48.30942], [130.52147, 48.61745], [130.66946, 48.88251], [130.43232, 48.90844], [130.2355, 48.86741], [129.85416, 49.11067], [129.67598, 49.29596], [129.50685, 49.42398], [129.40398, 49.44194], [129.35317, 49.3481], [129.23232, 49.40353], [129.11153, 49.36813], [128.72896, 49.58676], [127.83476, 49.5748], [127.53516, 49.84306], [127.49299, 50.01251], [127.60515, 50.23503], [127.37384, 50.28393], [127.36009, 50.43787], [127.28765, 50.46585], [127.36335, 50.58306], [127.28165, 50.72075], [127.14586, 50.91152], [126.93135, 51.0841], [126.90369, 51.3238], [126.68349, 51.70607], [126.44606, 51.98254], [126.558, 52.13738], [125.6131, 53.07229]], [[113.56865, 22.20973], [113.57123, 22.20416], [113.60504, 22.20464], [113.63011, 22.10782], [113.57191, 22.07696], [113.54839, 22.10909], [113.54942, 22.14519], [113.54093, 22.15497], [113.52659, 22.18271], [113.53552, 22.20607], [113.53301, 22.21235], [113.53591, 22.21369], [113.54093, 22.21314], [113.54333, 22.21688], [113.5508, 22.21672], [113.56865, 22.20973]], [[114.50148, 22.15017], [113.92195, 22.13873], [113.83338, 22.1826], [113.81621, 22.2163], [113.86771, 22.42972], [114.03113, 22.5065], [114.05438, 22.5026], [114.05729, 22.51104], [114.06272, 22.51617], [114.07267, 22.51855], [114.07817, 22.52997], [114.08606, 22.53276], [114.09048, 22.53716], [114.09692, 22.53435], [114.1034, 22.5352], [114.11181, 22.52878], [114.11656, 22.53415], [114.12665, 22.54003], [114.13823, 22.54319], [114.1482, 22.54091], [114.15123, 22.55163], [114.1597, 22.56041], [114.17247, 22.55944], [114.18338, 22.55444], [114.20655, 22.55706], [114.22185, 22.55343], [114.22888, 22.5436], [114.25154, 22.55977], [114.44998, 22.55977], [114.50148, 22.15017]]]] } },
22497     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
22498     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
22499     { type: "Feature", properties: { wikidata: "Q23681", nameEn: "Northern Cyprus", groups: ["Q644636", "145", "142"], driveSide: "left", callingCodes: ["90 392"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.67678, 35.03866], [33.67742, 35.05963], [33.68474, 35.06602], [33.69095, 35.06237], [33.70861, 35.07644], [33.7161, 35.07279], [33.70209, 35.04882], [33.71482, 35.03722], [33.73824, 35.05321], [33.76106, 35.04253], [33.78581, 35.05104], [33.82067, 35.07826], [33.84168, 35.06823], [33.8541, 35.07201], [33.87479, 35.08881], [33.87097, 35.09389], [33.87622, 35.10457], [33.87224, 35.12293], [33.88561, 35.12449], [33.88943, 35.12007], [33.88737, 35.11408], [33.89853, 35.11377], [33.91789, 35.08688], [33.91299, 35.07579], [33.90247, 35.07686], [33.89485, 35.06873], [33.88367, 35.07877], [33.85261, 35.0574], [33.8355, 35.05777], [33.82051, 35.0667], [33.8012, 35.04786], [33.81524, 35.04192], [33.83055, 35.02865], [33.82875, 35.01685], [33.84045, 35.00616], [33.85216, 35.00579], [33.85891, 35.001], [33.85621, 34.98956], [33.83505, 34.98108], [33.84811, 34.97075], [33.86432, 34.97592], [33.90075, 34.96623], [33.98684, 34.76642], [35.48515, 34.70851], [35.51152, 36.10954], [32.82353, 35.70297], [32.46489, 35.48584], [32.60361, 35.16647], [32.64864, 35.19967], [32.70947, 35.18328], [32.70779, 35.14127], [32.85733, 35.07742], [32.86406, 35.1043], [32.94471, 35.09422], [33.01192, 35.15639], [33.08249, 35.17319], [33.11105, 35.15639], [33.15138, 35.19504], [33.27068, 35.16815], [33.3072, 35.16816], [33.31955, 35.18096], [33.35056, 35.18328], [33.34964, 35.17803], [33.35596, 35.17942], [33.35612, 35.17402], [33.36569, 35.17479], [33.3717, 35.1788], [33.37248, 35.18698], [33.38575, 35.2018], [33.4076, 35.20062], [33.41675, 35.16325], [33.46813, 35.10564], [33.48136, 35.0636], [33.47825, 35.04103], [33.45178, 35.02078], [33.45256, 35.00288], [33.47666, 35.00701], [33.48915, 35.06594], [33.53975, 35.08151], [33.57478, 35.06049], [33.567, 35.04803], [33.59658, 35.03635], [33.61215, 35.0527], [33.63765, 35.03869], [33.67678, 35.03866]]]] } },
22500     { type: "Feature", properties: { wikidata: "Q25231", nameEn: "Svalbard", aliases: ["NO-21"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory", callingCodes: ["47 79"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.49892, 77.24208], [32.07813, 72.01005], [36.85549, 84.09565], [-7.49892, 77.24208]]]] } },
22501     { type: "Feature", properties: { wikidata: "Q25263", nameEn: "Azores", aliases: ["PT-20"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-23.12984, 40.26428], [-36.43765, 41.39418], [-22.54767, 33.34416], [-23.12984, 40.26428]]]] } },
22502     { type: "Feature", properties: { wikidata: "Q25359", nameEn: "Navassa Island", aliases: ["UM-76"], country: "US", groups: ["UM", "Q1352230", "029", "003", "419", "019", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.7289, 18.71009], [-75.71816, 18.46438], [-74.76465, 18.06252], [-74.7289, 18.71009]]]] } },
22503     { type: "Feature", properties: { wikidata: "Q25396", nameEn: "Bonaire", aliases: ["BQ-BO", "NL-BQ1"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.89186, 12.4116], [-68.90012, 12.62309], [-68.33524, 11.78151], [-68.01417, 11.77722], [-67.89186, 12.4116]]]] } },
22504     { type: "Feature", properties: { wikidata: "Q25528", nameEn: "Saba", aliases: ["BQ-SA", "NL-BQ2"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 4"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.81314, 17.95045], [-63.22932, 17.32592], [-63.07669, 17.79659]]]] } },
22505     { type: "Feature", properties: { wikidata: "Q26180", nameEn: "Sint Eustatius", aliases: ["BQ-SE", "NL-BQ3"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.34999, 16.94218], [-62.76692, 17.64353], [-63.07669, 17.79659]]]] } },
22506     { type: "Feature", properties: { wikidata: "Q26253", nameEn: "Madeira", aliases: ["PT-30"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-19.30302, 33.65304], [-16.04789, 29.65076], [-11.68307, 33.12333], [-19.30302, 33.65304]]]] } },
22507     { type: "Feature", properties: { wikidata: "Q26927", nameEn: "Lakshadweep", aliases: ["IN-LD"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[67.64074, 11.57295], [76.59015, 5.591], [72.67494, 13.58102], [67.64074, 11.57295]]]] } },
22508     { type: "Feature", properties: { wikidata: "Q27329", nameEn: "Asian Russia", country: "RU", groups: ["142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.99933, 64.74703], [-172.76104, 63.77445], [-169.03888, 65.48473], [-168.95635, 65.98512], [-168.25765, 71.99091], [-179.9843, 71.90735], [-179.99933, 64.74703]]], [[[59.99809, 51.98263], [60.19925, 51.99173], [60.48915, 52.15175], [60.72581, 52.15538], [60.78201, 52.22067], [61.05417, 52.35096], [60.98021, 52.50068], [60.84709, 52.52228], [60.84118, 52.63912], [60.71693, 52.66245], [60.71989, 52.75923], [61.05842, 52.92217], [61.23462, 53.03227], [62.0422, 52.96105], [62.12799, 52.99133], [62.14574, 53.09626], [61.19024, 53.30536], [61.14291, 53.41481], [61.29082, 53.50992], [61.37957, 53.45887], [61.57185, 53.50112], [61.55706, 53.57144], [60.90626, 53.62937], [61.22574, 53.80268], [61.14283, 53.90063], [60.99796, 53.93699], [61.26863, 53.92797], [61.3706, 54.08464], [61.47603, 54.08048], [61.56941, 53.95703], [61.65318, 54.02445], [62.03913, 53.94768], [62.00966, 54.04134], [62.38535, 54.03961], [62.45931, 53.90737], [62.56876, 53.94047], [62.58651, 54.05871], [63.80604, 54.27079], [63.91224, 54.20013], [64.02715, 54.22679], [63.97686, 54.29763], [64.97216, 54.4212], [65.11033, 54.33028], [65.24663, 54.35721], [65.20174, 54.55216], [68.21308, 54.98645], [68.26661, 55.09226], [68.19206, 55.18823], [68.90865, 55.38148], [69.34224, 55.36344], [69.74917, 55.35545], [70.19179, 55.1476], [70.76493, 55.3027], [70.96009, 55.10558], [71.08288, 54.71253], [71.24185, 54.64965], [71.08706, 54.33376], [71.10379, 54.13326], [71.96141, 54.17736], [72.17477, 54.36303], [72.43415, 53.92685], [72.71026, 54.1161], [73.37963, 53.96132], [73.74778, 54.07194], [73.68921, 53.86522], [73.25412, 53.61532], [73.39218, 53.44623], [75.07405, 53.80831], [75.43398, 53.98652], [75.3668, 54.07439], [76.91052, 54.4677], [76.82266, 54.1798], [76.44076, 54.16017], [76.54243, 53.99329], [77.90383, 53.29807], [79.11255, 52.01171], [80.08138, 50.77658], [80.4127, 50.95581], [80.44819, 51.20855], [80.80318, 51.28262], [81.16999, 51.15662], [81.06091, 50.94833], [81.41248, 50.97524], [81.46581, 50.77658], [81.94999, 50.79307], [82.55443, 50.75412], [83.14607, 51.00796], [83.8442, 50.87375], [84.29385, 50.27257], [84.99198, 50.06793], [85.24047, 49.60239], [86.18709, 49.50259], [86.63674, 49.80136], [86.79056, 49.74787], [86.61307, 49.60239], [86.82606, 49.51796], [87.03071, 49.25142], [87.31465, 49.23603], [87.28386, 49.11626], [87.478, 49.07403], [87.48983, 49.13794], [87.81333, 49.17354], [87.98977, 49.18147], [88.15543, 49.30314], [88.17223, 49.46934], [88.42449, 49.48821], [88.82499, 49.44808], [89.70687, 49.72535], [89.59711, 49.90851], [91.86048, 50.73734], [92.07173, 50.69585], [92.44714, 50.78762], [93.01109, 50.79001], [92.99595, 50.63183], [94.30823, 50.57498], [94.39258, 50.22193], [94.49477, 50.17832], [94.6121, 50.04239], [94.97166, 50.04725], [95.02465, 49.96941], [95.74757, 49.97915], [95.80056, 50.04239], [96.97388, 49.88413], [97.24639, 49.74737], [97.56811, 49.84265], [97.56432, 49.92801], [97.76871, 49.99861], [97.85197, 49.91339], [98.29481, 50.33561], [98.31373, 50.4996], [98.06393, 50.61262], [97.9693, 50.78044], [98.01472, 50.86652], [97.83305, 51.00248], [98.05257, 51.46696], [98.22053, 51.46579], [98.33222, 51.71832], [98.74142, 51.8637], [98.87768, 52.14563], [99.27888, 51.96876], [99.75578, 51.90108], [99.89203, 51.74903], [100.61116, 51.73028], [101.39085, 51.45753], [101.5044, 51.50467], [102.14032, 51.35566], [102.32194, 50.67982], [102.71178, 50.38873], [103.70343, 50.13952], [105.32528, 50.4648], [106.05562, 50.40582], [106.07865, 50.33474], [106.47156, 50.31909], [106.49628, 50.32436], [106.51122, 50.34408], [106.58373, 50.34044], [106.80326, 50.30177], [107.00007, 50.1977], [107.1174, 50.04239], [107.36407, 49.97612], [107.96116, 49.93191], [107.95387, 49.66659], [108.27937, 49.53167], [108.53969, 49.32325], [109.18017, 49.34709], [109.51325, 49.22859], [110.24373, 49.16676], [110.39891, 49.25083], [110.64493, 49.1816], [113.02647, 49.60772], [113.20216, 49.83356], [114.325, 50.28098], [114.9703, 50.19254], [115.26068, 49.97367], [115.73602, 49.87688], [116.22402, 50.04477], [116.62502, 49.92919], [116.71193, 49.83813], [117.27597, 49.62544], [117.48208, 49.62324], [117.82343, 49.52696], [118.61623, 49.93809], [119.11003, 50.00276], [119.27996, 50.13348], [119.38598, 50.35162], [119.13553, 50.37412], [120.10963, 51.671], [120.65907, 51.93544], [120.77337, 52.20805], [120.61346, 52.32447], [120.71673, 52.54099], [120.46454, 52.63811], [120.04049, 52.58773], [120.0451, 52.7359], [120.85633, 53.28499], [121.39213, 53.31888], [122.35063, 53.49565], [122.85966, 53.47395], [123.26989, 53.54843], [123.86158, 53.49391], [124.46078, 53.21881], [125.17522, 53.20225], [125.6131, 53.07229], [126.558, 52.13738], [126.44606, 51.98254], [126.68349, 51.70607], [126.90369, 51.3238], [126.93135, 51.0841], [127.14586, 50.91152], [127.28165, 50.72075], [127.36335, 50.58306], [127.28765, 50.46585], [127.36009, 50.43787], [127.37384, 50.28393], [127.60515, 50.23503], [127.49299, 50.01251], [127.53516, 49.84306], [127.83476, 49.5748], [128.72896, 49.58676], [129.11153, 49.36813], [129.23232, 49.40353], [129.35317, 49.3481], [129.40398, 49.44194], [129.50685, 49.42398], [129.67598, 49.29596], [129.85416, 49.11067], [130.2355, 48.86741], [130.43232, 48.90844], [130.66946, 48.88251], [130.52147, 48.61745], [130.84462, 48.30942], [130.65103, 48.10052], [130.90915, 47.90623], [130.95985, 47.6957], [131.09871, 47.6852], [131.2635, 47.73325], [131.90448, 47.68011], [132.57309, 47.71741], [132.66989, 47.96491], [134.49516, 48.42884], [134.75328, 48.36763], [134.67098, 48.1564], [134.55508, 47.98651], [134.7671, 47.72051], [134.50898, 47.4812], [134.20016, 47.33458], [134.03538, 46.75668], [133.84104, 46.46681], [133.91496, 46.4274], [133.88097, 46.25066], [133.68047, 46.14697], [133.72695, 46.05576], [133.67569, 45.9759], [133.60442, 45.90053], [133.48457, 45.86203], [133.41083, 45.57723], [133.19419, 45.51913], [133.09279, 45.25693], [133.12293, 45.1332], [132.96373, 45.0212], [132.83978, 45.05916], [131.99417, 45.2567], [131.86903, 45.33636], [131.76532, 45.22609], [131.66852, 45.2196], [131.68466, 45.12374], [131.48415, 44.99513], [130.95639, 44.85154], [131.1108, 44.70266], [131.30365, 44.04262], [131.25484, 44.03131], [131.23583, 43.96085], [131.26176, 43.94011], [131.21105, 43.82383], [131.19492, 43.53047], [131.29402, 43.46695], [131.30324, 43.39498], [131.19031, 43.21385], [131.20414, 43.13654], [131.10274, 43.04734], [131.135, 42.94114], [131.02668, 42.91246], [131.02438, 42.86518], [130.66524, 42.84753], [130.44361, 42.76205], [130.40213, 42.70788], [130.56576, 42.68925], [130.62107, 42.58413], [130.55143, 42.52158], [130.56835, 42.43281], [130.60805, 42.4317], [130.64181, 42.41422], [130.66367, 42.38024], [130.65022, 42.32281], [131.95041, 41.5445], [140.9182, 45.92937], [145.82343, 44.571], [145.23667, 43.76813], [153.94307, 38.42848], [180, 62.52334], [180, 71.53642], [155.31937, 81.93282], [76.13964, 83.37843], [64.18965, 69.94255], [66.1708, 67.61252], [61.98014, 65.72191], [60.74386, 64.95767], [59.63945, 64.78384], [59.80579, 64.13948], [59.24834, 63.01859], [59.61398, 62.44915], [59.36223, 61.3882], [59.50685, 60.91162], [58.3853, 59.487], [59.15636, 59.14682], [59.40376, 58.45822], [58.71104, 58.07475], [58.81412, 57.71602], [58.13789, 57.68097], [58.07604, 57.08308], [57.28024, 56.87898], [57.51527, 56.08729], [59.28419, 56.15739], [59.49035, 55.60486], [58.81825, 55.03378], [57.25137, 55.26262], [57.14829, 54.84204], [57.95234, 54.39672], [59.95217, 54.85853], [59.70487, 54.14846], [58.94336, 53.953], [58.79644, 52.43392], [59.22409, 52.28437], [59.25033, 52.46803], [60.17516, 52.39457], [60.17253, 52.25814], [59.91279, 52.06924], [59.99809, 51.98263]]]] } },
22509     { type: "Feature", properties: { wikidata: "Q34366", nameEn: "Tasmania", aliases: ["AU-TAS"], country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.64533, -39.13605], [159.69067, -56.28945], [159.74028, -39.1978], [123.64533, -39.13605]]]] } },
22510     { type: "Feature", properties: { wikidata: "Q34497", nameEn: "Saint Helena", aliases: ["SH-HL"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.3824, -13.9131], [-6.17428, -19.07236], [-3.29308, -15.22647], [-8.3824, -13.9131]]]] } },
22511     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
22512     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
22513     { type: "Feature", properties: { wikidata: "Q36678", nameEn: "West Bank", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.47672, 31.49578], [35.55941, 31.76535], [35.52758, 31.9131], [35.54375, 31.96587], [35.52012, 32.04076], [35.57111, 32.21877], [35.55807, 32.38674], [35.42078, 32.41562], [35.41048, 32.43706], [35.41598, 32.45593], [35.42034, 32.46009], [35.40224, 32.50136], [35.35212, 32.52047], [35.30685, 32.51024], [35.29306, 32.50947], [35.25049, 32.52453], [35.2244, 32.55289], [35.15937, 32.50466], [35.10882, 32.4757], [35.10024, 32.47856], [35.09236, 32.47614], [35.08564, 32.46948], [35.07059, 32.4585], [35.05423, 32.41754], [35.05311, 32.4024], [35.0421, 32.38242], [35.05142, 32.3667], [35.04243, 32.35008], [35.01772, 32.33863], [35.01119, 32.28684], [35.02939, 32.2671], [35.01841, 32.23981], [34.98885, 32.20758], [34.95703, 32.19522], [34.96009, 32.17503], [34.99039, 32.14626], [34.98507, 32.12606], [34.99437, 32.10962], [34.9863, 32.09551], [35.00261, 32.027], [34.98682, 31.96935], [35.00124, 31.93264], [35.03489, 31.92448], [35.03978, 31.89276], [35.03489, 31.85919], [34.99712, 31.85569], [34.9724, 31.83352], [35.01978, 31.82944], [35.05617, 31.85685], [35.07677, 31.85627], [35.14174, 31.81325], [35.18603, 31.80901], [35.18169, 31.82542], [35.19461, 31.82687], [35.21469, 31.81835], [35.216, 31.83894], [35.21128, 31.863], [35.20381, 31.86716], [35.20673, 31.88151], [35.20791, 31.8821], [35.20945, 31.8815], [35.21016, 31.88237], [35.21276, 31.88153], [35.2136, 31.88241], [35.22014, 31.88264], [35.22294, 31.87889], [35.22567, 31.86745], [35.22817, 31.8638], [35.2249, 31.85433], [35.2304, 31.84222], [35.24816, 31.8458], [35.25753, 31.8387], [35.251, 31.83085], [35.26404, 31.82567], [35.25573, 31.81362], [35.26058, 31.79064], [35.25225, 31.7678], [35.26319, 31.74846], [35.25182, 31.73945], [35.24981, 31.72543], [35.2438, 31.7201], [35.24315, 31.71244], [35.23972, 31.70896], [35.22392, 31.71899], [35.21937, 31.71578], [35.20538, 31.72388], [35.18023, 31.72067], [35.16478, 31.73242], [35.15474, 31.73352], [35.15119, 31.73634], [35.13931, 31.73012], [35.12933, 31.7325], [35.11895, 31.71454], [35.10782, 31.71594], [35.08226, 31.69107], [35.00879, 31.65426], [34.95249, 31.59813], [34.9415, 31.55601], [34.94356, 31.50743], [34.93258, 31.47816], [34.89756, 31.43891], [34.87833, 31.39321], [34.88932, 31.37093], [34.92571, 31.34337], [35.02459, 31.35979], [35.13033, 31.3551], [35.22921, 31.37445], [35.39675, 31.49572], [35.47672, 31.49578]]]] } },
22514     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
22515     { type: "Feature", properties: { wikidata: "Q38095", nameEn: "Gal\xE1pagos Islands", aliases: ["EC-W"], country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-93.12365, 2.64343], [-92.46744, -2.52874], [-87.07749, -0.8849], [-93.12365, 2.64343]]]] } },
22516     { type: "Feature", properties: { wikidata: "Q39760", nameEn: "Gaza Strip", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.21853, 31.32363], [34.23572, 31.2966], [34.24012, 31.29591], [34.26742, 31.21998], [34.29417, 31.24194], [34.36523, 31.28963], [34.37381, 31.30598], [34.36505, 31.36404], [34.40077, 31.40926], [34.48892, 31.48365], [34.56797, 31.54197], [34.48681, 31.59711], [34.29262, 31.70393], [34.052, 31.46619]]]] } },
22517     { type: "Feature", properties: { wikidata: "Q40888", nameEn: "Andaman and Nicobar Islands", aliases: ["IN-AN"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[94.42132, 5.96581], [94.6371, 13.81803], [86.7822, 13.41052], [94.42132, 5.96581]]]] } },
22518     { type: "Feature", properties: { wikidata: "Q41684", nameEn: "Stewart Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.59185, -47.61313], [169.70504, -47.56021], [167.52103, -46.41337], [166.59185, -47.61313]]]] } },
22519     { type: "Feature", properties: { wikidata: "Q43296", nameEn: "Wake Island", aliases: ["WK", "WAK", "WKUM", "872", "UM-79"], country: "US", groups: ["UM", "Q1352230", "057", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[167.34779, 18.97692], [166.67967, 20.14834], [165.82549, 18.97692], [167.34779, 18.97692]]]] } },
22520     { type: "Feature", properties: { wikidata: "Q46275", nameEn: "New Zealand Subantarctic Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[164.30551, -47.88072], [161.96603, -56.07661], [179.49541, -50.04657], [179.49541, -47.2902], [169.91032, -47.66283], [164.30551, -47.88072]]]] } },
22521     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
22522     { type: "Feature", properties: { wikidata: "Q46772", nameEn: "Kerguelen Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[61.9216, -49.39746], [70.67507, -51.14192], [74.25129, -45.45074], [61.9216, -49.39746]]]] } },
22523     { type: "Feature", properties: { wikidata: "Q46879", nameEn: "Baker Island", aliases: ["UM-81"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-175.33482, -1.40631], [-175.31323, 0.5442], [-177.91421, 0.39582], [-175.33482, -1.40631]]]] } },
22524     { type: "Feature", properties: { wikidata: "Q47863", nameEn: "Midway Atoll", aliases: ["MI", "MID", "MIUM", "488", "UM-71"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.29741, 29.09786], [-177.77531, 29.29793], [-177.5224, 27.7635], [-176.29741, 29.09786]]]] } },
22525     { type: "Feature", properties: { wikidata: "Q62218", nameEn: "Jarvis Island", aliases: ["UM-86"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-160.42921, -1.4364], [-159.12443, 0.19975], [-160.38779, 0.30331], [-160.42921, -1.4364]]]] } },
22526     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
22527     { type: "Feature", properties: { wikidata: "Q114935", nameEn: "Kermadec Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-174.40891, -29.09438], [-180, -24.21376], [-179.96512, -35.00791], [-174.40891, -29.09438]]]] } },
22528     { type: "Feature", properties: { wikidata: "Q115459", nameEn: "Chatham Islands", aliases: ["NZ-CIT"], country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.93224, -45.18423], [-172.47015, -45.17912], [-176.30998, -41.38382], [-179.93224, -45.18423]]]] } },
22529     { type: "Feature", properties: { wikidata: "Q118863", nameEn: "North Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[179.49541, -47.2902], [179.49541, -36.79303], [174.17679, -32.62487], [170.27492, -36.38133], [174.58663, -40.80446], [174.46634, -41.55028], [179.49541, -47.2902]]]] } },
22530     { type: "Feature", properties: { wikidata: "Q120755", nameEn: "South Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.70504, -47.56021], [179.49541, -47.2902], [174.46634, -41.55028], [174.58663, -40.80446], [170.27492, -36.38133], [166.56976, -39.94841], [164.8365, -46.0205], [167.52103, -46.41337], [169.70504, -47.56021]]]] } },
22531     { type: "Feature", properties: { wikidata: "Q123076", nameEn: "Palmyra Atoll", aliases: ["UM-95"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.06795, 5.2462], [-161.0731, 7.1291], [-163.24478, 5.24198], [-161.06795, 5.2462]]]] } },
22532     { type: "Feature", properties: { wikidata: "Q130574", nameEn: "Chafarinas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.40316, 35.16893], [-2.43262, 35.20652], [-2.45965, 35.16527], [-2.40316, 35.16893]]]] } },
22533     { type: "Feature", properties: { wikidata: "Q130895", nameEn: "Kingman Reef", aliases: ["UM-89"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.0731, 7.1291], [-163.16627, 7.15036], [-163.24478, 5.24198], [-161.0731, 7.1291]]]] } },
22534     { type: "Feature", properties: { wikidata: "Q131008", nameEn: "Johnston Atoll", aliases: ["JT", "JTN", "JTUM", "396", "UM-67"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.65691, 16.57199], [-168.87689, 16.01159], [-169.2329, 17.4933], [-170.65691, 16.57199]]]] } },
22535     { type: "Feature", properties: { wikidata: "Q131305", nameEn: "Howland Island", aliases: ["UM-84"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.91421, 0.39582], [-175.31323, 0.5442], [-176.74464, 2.28109], [-177.91421, 0.39582]]]] } },
22536     { type: "Feature", properties: { wikidata: "Q133888", nameEn: "Ashmore and Cartier Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.7463, -11.1783], [120.6877, -13.59408], [125.29076, -12.33139], [123.7463, -11.1783]]]] } },
22537     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
22538     { type: "Feature", properties: { wikidata: "Q172216", nameEn: "Coral Sea Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [156.73836, -14.50464], [145.2855, -9.62524], [147.69992, -17.5933], [152.93188, -20.92631], [154.02855, -24.43238], [159.77159, -28.41151]]]] } },
22539     { type: "Feature", properties: { wikidata: "Q179313", nameEn: "Alderney", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.09454, 49.46288], [-2.02963, 49.91866], [-2.49556, 49.79012], [-2.36485, 49.48223]]]] } },
22540     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
22541     { type: "Feature", properties: { wikidata: "Q190571", nameEn: "Scattered Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[53.53458, -16.36909], [54.96649, -16.28353], [54.61476, -15.02273], [53.53458, -16.36909]]], [[[38.55969, -20.75596], [40.68027, -23.38889], [43.52893, -15.62903], [38.55969, -20.75596]]], [[[47.03092, -11.05648], [47.11593, -12.08552], [47.96702, -11.46447], [47.03092, -11.05648]]]] } },
22542     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
22543     { type: "Feature", properties: { wikidata: "Q191146", nameEn: "Pe\xF1\xF3n de V\xE9lez de la Gomera", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.30191, 35.17419], [-4.30112, 35.17058], [-4.29436, 35.17149], [-4.30191, 35.17419]]]] } },
22544     { type: "Feature", properties: { wikidata: "Q201698", nameEn: "Crozet Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[55.03425, -43.65017], [46.31615, -46.28749], [54.5587, -47.93013], [55.03425, -43.65017]]]] } },
22545     { type: "Feature", properties: { wikidata: "Q578170", nameEn: "Contiguous United States", aliases: ["CONUS"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-97.13927, 25.96583], [-96.92418, 25.97377], [-80.57035, 24.0565], [-78.91214, 27.76553], [-61.98255, 37.34815], [-67.16117, 44.20069], [-66.93432, 44.82597], [-66.96824, 44.83078], [-66.98249, 44.87071], [-66.96824, 44.90965], [-67.0216, 44.95333], [-67.11316, 45.11176], [-67.15965, 45.16179], [-67.19603, 45.16771], [-67.20349, 45.1722], [-67.22751, 45.16344], [-67.27039, 45.1934], [-67.29748, 45.18173], [-67.29754, 45.14865], [-67.34927, 45.122], [-67.48201, 45.27351], [-67.42394, 45.37969], [-67.50578, 45.48971], [-67.42144, 45.50584], [-67.43815, 45.59162], [-67.6049, 45.60725], [-67.80705, 45.69528], [-67.80653, 45.80022], [-67.75654, 45.82324], [-67.80961, 45.87531], [-67.75196, 45.91814], [-67.78111, 45.9392], [-67.78578, 47.06473], [-67.87993, 47.10377], [-67.94843, 47.1925], [-68.23244, 47.35712], [-68.37458, 47.35851], [-68.38332, 47.28723], [-68.57914, 47.28431], [-68.60575, 47.24659], [-68.70125, 47.24399], [-68.89222, 47.1807], [-69.05039, 47.2456], [-69.05073, 47.30076], [-69.05148, 47.42012], [-69.22119, 47.46461], [-69.99966, 46.69543], [-70.05812, 46.41768], [-70.18547, 46.35357], [-70.29078, 46.18832], [-70.23855, 46.1453], [-70.31025, 45.96424], [-70.24694, 45.95138], [-70.25976, 45.89675], [-70.41523, 45.79497], [-70.38934, 45.73215], [-70.54019, 45.67291], [-70.68516, 45.56964], [-70.72651, 45.49771], [-70.62518, 45.42286], [-70.65383, 45.37592], [-70.78372, 45.43269], [-70.82638, 45.39828], [-70.80236, 45.37444], [-70.84816, 45.22698], [-70.89864, 45.2398], [-70.91169, 45.29849], [-70.95193, 45.33895], [-71.0107, 45.34819], [-71.01866, 45.31573], [-71.08364, 45.30623], [-71.14568, 45.24128], [-71.19723, 45.25438], [-71.22338, 45.25184], [-71.29371, 45.29996], [-71.37133, 45.24624], [-71.44252, 45.2361], [-71.40364, 45.21382], [-71.42778, 45.12624], [-71.48735, 45.07784], [-71.50067, 45.01357], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.66689, 45.00646], [-74.8447, 45.00606], [-74.99101, 44.98051], [-75.01363, 44.95608], [-75.2193, 44.87821], [-75.41441, 44.76614], [-75.76813, 44.51537], [-75.8217, 44.43176], [-75.95947, 44.34463], [-76.00018, 44.34896], [-76.16285, 44.28262], [-76.1664, 44.23051], [-76.244, 44.19643], [-76.31222, 44.19894], [-76.35324, 44.13493], [-76.43859, 44.09393], [-76.79706, 43.63099], [-79.25796, 43.54052], [-79.06921, 43.26183], [-79.05512, 43.25375], [-79.05544, 43.21224], [-79.05002, 43.20133], [-79.05384, 43.17418], [-79.04652, 43.16396], [-79.0427, 43.13934], [-79.06881, 43.12029], [-79.05671, 43.10937], [-79.07486, 43.07845], [-79.01055, 43.06659], [-78.99941, 43.05612], [-79.02424, 43.01983], [-79.02074, 42.98444], [-78.98126, 42.97], [-78.96312, 42.95509], [-78.93224, 42.95229], [-78.90905, 42.93022], [-78.90712, 42.89733], [-78.93684, 42.82887], [-82.67862, 41.67615], [-83.11184, 41.95671], [-83.14962, 42.04089], [-83.12724, 42.2376], [-83.09837, 42.28877], [-83.07837, 42.30978], [-83.02253, 42.33045], [-82.82964, 42.37355], [-82.64242, 42.55594], [-82.58873, 42.54984], [-82.57583, 42.5718], [-82.51858, 42.611], [-82.51063, 42.66025], [-82.46613, 42.76615], [-82.4826, 42.8068], [-82.45331, 42.93139], [-82.4253, 42.95423], [-82.4146, 42.97626], [-82.42469, 42.992], [-82.48419, 45.30225], [-83.59589, 45.82131], [-83.43746, 45.99749], [-83.57017, 46.105], [-83.83329, 46.12169], [-83.90453, 46.05922], [-83.95399, 46.05634], [-84.1096, 46.23987], [-84.09756, 46.25512], [-84.11615, 46.2681], [-84.11254, 46.32329], [-84.13451, 46.39218], [-84.11196, 46.50248], [-84.12885, 46.53068], [-84.17723, 46.52753], [-84.1945, 46.54061], [-84.2264, 46.53337], [-84.26351, 46.49508], [-84.29893, 46.49127], [-84.34174, 46.50683], [-84.42101, 46.49853], [-84.4481, 46.48972], [-84.47607, 46.45225], [-84.55635, 46.45974], [-84.85871, 46.88881], [-88.37033, 48.30586], [-89.48837, 48.01412], [-89.57972, 48.00023], [-89.77248, 48.02607], [-89.89974, 47.98109], [-90.07418, 48.11043], [-90.56312, 48.09488], [-90.56444, 48.12184], [-90.75045, 48.09143], [-90.87588, 48.2484], [-91.08016, 48.18096], [-91.25025, 48.08522], [-91.43248, 48.04912], [-91.45829, 48.07454], [-91.58025, 48.04339], [-91.55649, 48.10611], [-91.70451, 48.11805], [-91.71231, 48.19875], [-91.86125, 48.21278], [-91.98929, 48.25409], [-92.05339, 48.35958], [-92.14732, 48.36578], [-92.202, 48.35252], [-92.26662, 48.35651], [-92.30939, 48.31251], [-92.27167, 48.25046], [-92.37185, 48.22259], [-92.48147, 48.36609], [-92.45588, 48.40624], [-92.50712, 48.44921], [-92.65606, 48.43471], [-92.71323, 48.46081], [-92.69927, 48.49573], [-92.62747, 48.50278], [-92.6342, 48.54133], [-92.7287, 48.54005], [-92.94973, 48.60866], [-93.25391, 48.64266], [-93.33946, 48.62787], [-93.3712, 48.60599], [-93.39758, 48.60364], [-93.40693, 48.60948], [-93.44472, 48.59147], [-93.47022, 48.54357], [-93.66382, 48.51845], [-93.79267, 48.51631], [-93.80939, 48.52439], [-93.80676, 48.58232], [-93.83288, 48.62745], [-93.85769, 48.63284], [-94.23215, 48.65202], [-94.25104, 48.65729], [-94.25172, 48.68404], [-94.27153, 48.70232], [-94.4174, 48.71049], [-94.44258, 48.69223], [-94.53826, 48.70216], [-94.54885, 48.71543], [-94.58903, 48.71803], [-94.69335, 48.77883], [-94.69669, 48.80918], [-94.70486, 48.82365], [-94.70087, 48.8339], [-94.687, 48.84077], [-94.75017, 49.09931], [-94.77355, 49.11998], [-94.82487, 49.29483], [-94.8159, 49.32299], [-94.85381, 49.32492], [-94.95681, 49.37035], [-94.99532, 49.36579], [-95.01419, 49.35647], [-95.05825, 49.35311], [-95.12903, 49.37056], [-95.15357, 49.384], [-95.15355, 48.9996], [-123.32163, 49.00419], [-123.0093, 48.83186], [-123.0093, 48.76586], [-123.26565, 48.6959], [-123.15614, 48.35395], [-123.50039, 48.21223], [-125.03842, 48.53282], [-133.98258, 38.06389], [-118.48109, 32.5991], [-117.1243, 32.53427], [-115.88053, 32.63624], [-114.71871, 32.71894], [-114.76736, 32.64094], [-114.80584, 32.62028], [-114.81141, 32.55543], [-114.79524, 32.55731], [-114.82011, 32.49609], [-111.07523, 31.33232], [-108.20979, 31.33316], [-108.20899, 31.78534], [-106.529, 31.784], [-106.52266, 31.77509], [-106.51251, 31.76922], [-106.50962, 31.76155], [-106.50111, 31.75714], [-106.48815, 31.74769], [-106.47298, 31.75054], [-106.46726, 31.75998], [-106.45244, 31.76523], [-106.43419, 31.75478], [-106.41773, 31.75196], [-106.38003, 31.73151], [-106.3718, 31.71165], [-106.34864, 31.69663], [-106.33419, 31.66303], [-106.30305, 31.62154], [-106.28084, 31.56173], [-106.24612, 31.54193], [-106.23711, 31.51262], [-106.20346, 31.46305], [-106.09025, 31.40569], [-106.00363, 31.39181], [-104.77674, 30.4236], [-104.5171, 29.64671], [-104.3969, 29.57105], [-104.39363, 29.55396], [-104.37752, 29.54255], [-103.15787, 28.93865], [-102.60596, 29.8192], [-101.47277, 29.7744], [-101.05686, 29.44738], [-101.01128, 29.36947], [-100.96725, 29.3477], [-100.94579, 29.34523], [-100.94056, 29.33371], [-100.87982, 29.296], [-100.79696, 29.24688], [-100.67294, 29.09744], [-100.63689, 28.90812], [-100.59809, 28.88197], [-100.52313, 28.75598], [-100.5075, 28.74066], [-100.51222, 28.70679], [-100.50029, 28.66117], [-99.55409, 27.61314], [-99.51478, 27.55836], [-99.52955, 27.49747], [-99.50208, 27.50021], [-99.48045, 27.49016], [-99.482, 27.47128], [-99.49744, 27.43746], [-99.53573, 27.30926], [-99.08477, 26.39849], [-99.03053, 26.41249], [-99.00546, 26.3925], [-98.35126, 26.15129], [-98.30491, 26.10475], [-98.27075, 26.09457], [-98.24603, 26.07191], [-97.97017, 26.05232], [-97.95155, 26.0625], [-97.66511, 26.01708], [-97.52025, 25.88518], [-97.49828, 25.89877], [-97.45669, 25.86874], [-97.42511, 25.83969], [-97.37332, 25.83854], [-97.35946, 25.92189], [-97.13927, 25.96583]]]] } },
22546     { type: "Feature", properties: { wikidata: "Q620634", nameEn: "Bir Tawil", groups: ["015", "002"], level: "territory" }, geometry: { type: "MultiPolygon", coordinates: [[[[33.17563, 22.00405], [33.57251, 21.72406], [33.99686, 21.76784], [34.0765, 22.00501], [33.17563, 22.00405]]]] } },
22547     { type: "Feature", properties: { wikidata: "Q639185", nameEn: "Peros Banhos", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.12587, -4.02588], [70.1848, -6.37445], [72.09518, -5.61768], [72.12587, -4.02588]]]] } },
22548     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
22549     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
22550     { type: "Feature", properties: { wikidata: "Q875134", nameEn: "European Russia", country: "RU", groups: ["151", "150", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [19.64312, 54.45423], [19.8038, 54.44203], [20.63871, 54.3706], [21.41123, 54.32395], [22.79705, 54.36264], [22.7253, 54.41732], [22.70208, 54.45312], [22.67788, 54.532], [22.71293, 54.56454], [22.68021, 54.58486], [22.7522, 54.63525], [22.74225, 54.64339], [22.75467, 54.6483], [22.73397, 54.66604], [22.73631, 54.72952], [22.87317, 54.79492], [22.85083, 54.88711], [22.76422, 54.92521], [22.68723, 54.9811], [22.65451, 54.97037], [22.60075, 55.01863], [22.58907, 55.07085], [22.47688, 55.04408], [22.31562, 55.0655], [22.14267, 55.05345], [22.11697, 55.02131], [22.06087, 55.02935], [22.02582, 55.05078], [22.03984, 55.07888], [21.99543, 55.08691], [21.96505, 55.07353], [21.85521, 55.09493], [21.64954, 55.1791], [21.55605, 55.20311], [21.51095, 55.18507], [21.46766, 55.21115], [21.38446, 55.29348], [21.35465, 55.28427], [21.26425, 55.24456], [20.95181, 55.27994], [20.60454, 55.40986], [18.57853, 55.25302]]], [[[26.32936, 60.00121], [26.90044, 59.63819], [27.85643, 59.58538], [28.04187, 59.47017], [28.19061, 59.39962], [28.21137, 59.38058], [28.20537, 59.36491], [28.19284, 59.35791], [28.14215, 59.28934], [28.00689, 59.28351], [27.90911, 59.24353], [27.87978, 59.18097], [27.80482, 59.1116], [27.74429, 58.98351], [27.36366, 58.78381], [27.55489, 58.39525], [27.48541, 58.22615], [27.62393, 58.09462], [27.67282, 57.92627], [27.81841, 57.89244], [27.78526, 57.83963], [27.56689, 57.83356], [27.50171, 57.78842], [27.52615, 57.72843], [27.3746, 57.66834], [27.40393, 57.62125], [27.31919, 57.57672], [27.34698, 57.52242], [27.56832, 57.53728], [27.52453, 57.42826], [27.86101, 57.29402], [27.66511, 56.83921], [27.86101, 56.88204], [28.04768, 56.59004], [28.13526, 56.57989], [28.10069, 56.524], [28.19057, 56.44637], [28.16599, 56.37806], [28.23716, 56.27588], [28.15217, 56.16964], [28.30571, 56.06035], [28.36888, 56.05805], [28.37987, 56.11399], [28.43068, 56.09407], [28.5529, 56.11705], [28.68337, 56.10173], [28.63668, 56.07262], [28.73418, 55.97131], [29.08299, 56.03427], [29.21717, 55.98971], [29.44692, 55.95978], [29.3604, 55.75862], [29.51283, 55.70294], [29.61446, 55.77716], [29.80672, 55.79569], [29.97975, 55.87281], [30.12136, 55.8358], [30.27776, 55.86819], [30.30987, 55.83592], [30.48257, 55.81066], [30.51346, 55.78982], [30.51037, 55.76568], [30.63344, 55.73079], [30.67464, 55.64176], [30.72957, 55.66268], [30.7845, 55.58514], [30.86003, 55.63169], [30.93419, 55.6185], [30.95204, 55.50667], [30.90123, 55.46621], [30.93144, 55.3914], [30.8257, 55.3313], [30.81946, 55.27931], [30.87944, 55.28223], [30.97369, 55.17134], [31.02071, 55.06167], [31.00972, 55.02783], [30.94243, 55.03964], [30.9081, 55.02232], [30.95754, 54.98609], [30.93144, 54.9585], [30.81759, 54.94064], [30.8264, 54.90062], [30.75165, 54.80699], [30.95479, 54.74346], [30.97127, 54.71967], [31.0262, 54.70698], [30.98226, 54.68872], [30.99187, 54.67046], [31.19339, 54.66947], [31.21399, 54.63113], [31.08543, 54.50361], [31.22945, 54.46585], [31.3177, 54.34067], [31.30791, 54.25315], [31.57002, 54.14535], [31.89599, 54.0837], [31.88744, 54.03653], [31.85019, 53.91801], [31.77028, 53.80015], [31.89137, 53.78099], [32.12621, 53.81586], [32.36663, 53.7166], [32.45717, 53.74039], [32.50112, 53.68594], [32.40499, 53.6656], [32.47777, 53.5548], [32.74968, 53.45597], [32.73257, 53.33494], [32.51725, 53.28431], [32.40773, 53.18856], [32.15368, 53.07594], [31.82373, 53.10042], [31.787, 53.18033], [31.62496, 53.22886], [31.56316, 53.19432], [31.40523, 53.21406], [31.36403, 53.13504], [31.3915, 53.09712], [31.33519, 53.08805], [31.32283, 53.04101], [31.24147, 53.031], [31.35667, 52.97854], [31.592, 52.79011], [31.57277, 52.71613], [31.50406, 52.69707], [31.63869, 52.55361], [31.56316, 52.51518], [31.61397, 52.48843], [31.62084, 52.33849], [31.57971, 52.32146], [31.70735, 52.26711], [31.6895, 52.1973], [31.77877, 52.18636], [31.7822, 52.11406], [31.81722, 52.09955], [31.85018, 52.11305], [31.96141, 52.08015], [31.92159, 52.05144], [32.08813, 52.03319], [32.23331, 52.08085], [32.2777, 52.10266], [32.34044, 52.1434], [32.33083, 52.23685], [32.38988, 52.24946], [32.3528, 52.32842], [32.54781, 52.32423], [32.69475, 52.25535], [32.85405, 52.27888], [32.89937, 52.2461], [33.18913, 52.3754], [33.51323, 52.35779], [33.48027, 52.31499], [33.55718, 52.30324], [33.78789, 52.37204], [34.05239, 52.20132], [34.11199, 52.14087], [34.09413, 52.00835], [34.41136, 51.82793], [34.42922, 51.72852], [34.07765, 51.67065], [34.17599, 51.63253], [34.30562, 51.5205], [34.22048, 51.4187], [34.33446, 51.363], [34.23009, 51.26429], [34.31661, 51.23936], [34.38802, 51.2746], [34.6613, 51.25053], [34.6874, 51.18], [34.82472, 51.17483], [34.97304, 51.2342], [35.14058, 51.23162], [35.12685, 51.16191], [35.20375, 51.04723], [35.31774, 51.08434], [35.40837, 51.04119], [35.32598, 50.94524], [35.39307, 50.92145], [35.41367, 50.80227], [35.47704, 50.77274], [35.48116, 50.66405], [35.39464, 50.64751], [35.47463, 50.49247], [35.58003, 50.45117], [35.61711, 50.35707], [35.73659, 50.35489], [35.80388, 50.41356], [35.8926, 50.43829], [36.06893, 50.45205], [36.20763, 50.3943], [36.30101, 50.29088], [36.47817, 50.31457], [36.58371, 50.28563], [36.56655, 50.2413], [36.64571, 50.218], [36.69377, 50.26982], [36.91762, 50.34963], [37.08468, 50.34935], [37.48204, 50.46079], [37.47243, 50.36277], [37.62486, 50.29966], [37.62879, 50.24481], [37.61113, 50.21976], [37.75807, 50.07896], [37.79515, 50.08425], [37.90776, 50.04194], [38.02999, 49.94482], [38.02999, 49.90592], [38.21675, 49.98104], [38.18517, 50.08161], [38.32524, 50.08866], [38.35408, 50.00664], [38.65688, 49.97176], [38.68677, 50.00904], [38.73311, 49.90238], [38.90477, 49.86787], [38.9391, 49.79524], [39.1808, 49.88911], [39.27968, 49.75976], [39.44496, 49.76067], [39.59142, 49.73758], [39.65047, 49.61761], [39.84548, 49.56064], [40.13249, 49.61672], [40.16683, 49.56865], [40.03636, 49.52321], [40.03087, 49.45452], [40.1141, 49.38798], [40.14912, 49.37681], [40.18331, 49.34996], [40.22176, 49.25683], [40.01988, 49.1761], [39.93437, 49.05709], [39.6836, 49.05121], [39.6683, 48.99454], [39.71353, 48.98959], [39.72649, 48.9754], [39.74874, 48.98675], [39.78368, 48.91596], [39.98967, 48.86901], [40.03636, 48.91957], [40.08168, 48.87443], [39.97182, 48.79398], [39.79466, 48.83739], [39.73104, 48.7325], [39.71765, 48.68673], [39.67226, 48.59368], [39.79764, 48.58668], [39.84548, 48.57821], [39.86196, 48.46633], [39.88794, 48.44226], [39.94847, 48.35055], [39.84136, 48.33321], [39.84273, 48.30947], [39.90041, 48.3049], [39.91465, 48.26743], [39.95248, 48.29972], [39.9693, 48.29904], [39.97325, 48.31399], [39.99241, 48.31768], [40.00752, 48.22445], [39.94847, 48.22811], [39.83724, 48.06501], [39.88256, 48.04482], [39.77544, 48.04206], [39.82213, 47.96396], [39.73935, 47.82876], [38.87979, 47.87719], [38.79628, 47.81109], [38.76379, 47.69346], [38.35062, 47.61631], [38.28679, 47.53552], [38.28954, 47.39255], [38.22225, 47.30788], [38.33074, 47.30508], [38.32112, 47.2585], [38.23049, 47.2324], [38.22955, 47.12069], [38.3384, 46.98085], [38.12112, 46.86078], [37.62608, 46.82615], [35.23066, 45.79231], [35.04991, 45.76827], [36.6645, 45.4514], [36.6545, 45.3417], [36.5049, 45.3136], [36.475, 45.2411], [36.4883, 45.0488], [33.5943, 44.03313], [39.81147, 43.06294], [40.0078, 43.38551], [40.00853, 43.40578], [40.01552, 43.42025], [40.01007, 43.42411], [40.03312, 43.44262], [40.04445, 43.47776], [40.10657, 43.57344], [40.65957, 43.56212], [41.64935, 43.22331], [42.40563, 43.23226], [42.66667, 43.13917], [42.75889, 43.19651], [43.03322, 43.08883], [43.0419, 43.02413], [43.81453, 42.74297], [43.73119, 42.62043], [43.95517, 42.55396], [44.54202, 42.75699], [44.70002, 42.74679], [44.80941, 42.61277], [44.88754, 42.74934], [45.15318, 42.70598], [45.36501, 42.55268], [45.78692, 42.48358], [45.61676, 42.20768], [46.42738, 41.91323], [46.5332, 41.87389], [46.58924, 41.80547], [46.75269, 41.8623], [46.8134, 41.76252], [47.00955, 41.63583], [46.99554, 41.59743], [47.03757, 41.55434], [47.10762, 41.59044], [47.34579, 41.27884], [47.49004, 41.26366], [47.54504, 41.20275], [47.62288, 41.22969], [47.75831, 41.19455], [47.87973, 41.21798], [48.07587, 41.49957], [48.22064, 41.51472], [48.2878, 41.56221], [48.40277, 41.60441], [48.42301, 41.65444], [48.55078, 41.77917], [48.5867, 41.84306], [48.80971, 41.95365], [49.2134, 44.84989], [49.88945, 46.04554], [49.32259, 46.26944], [49.16518, 46.38542], [48.54988, 46.56267], [48.51142, 46.69268], [49.01136, 46.72716], [48.52326, 47.4102], [48.45173, 47.40818], [48.15348, 47.74545], [47.64973, 47.76559], [47.41689, 47.83687], [47.38731, 47.68176], [47.12107, 47.83687], [47.11516, 48.27188], [46.49011, 48.43019], [46.78392, 48.95352], [47.00857, 49.04921], [47.04658, 49.19834], [46.78398, 49.34026], [46.9078, 49.86707], [47.18319, 49.93721], [47.34589, 50.09308], [47.30448, 50.30894], [47.58551, 50.47867], [48.10044, 50.09242], [48.24519, 49.86099], [48.42564, 49.82283], [48.68352, 49.89546], [48.90782, 50.02281], [48.57946, 50.63278], [48.86936, 50.61589], [49.12673, 50.78639], [49.41959, 50.85927], [49.39001, 51.09396], [49.76866, 51.11067], [49.97277, 51.2405], [50.26859, 51.28677], [50.59695, 51.61859], [51.26254, 51.68466], [51.301, 51.48799], [51.77431, 51.49536], [51.8246, 51.67916], [52.36119, 51.74161], [52.54329, 51.48444], [53.46165, 51.49445], [53.69299, 51.23466], [54.12248, 51.11542], [54.46331, 50.85554], [54.41894, 50.61214], [54.55797, 50.52006], [54.71476, 50.61214], [54.56685, 51.01958], [54.72067, 51.03261], [55.67774, 50.54508], [56.11398, 50.7471], [56.17906, 50.93204], [57.17302, 51.11253], [57.44221, 50.88354], [57.74986, 50.93017], [57.75578, 51.13852], [58.3208, 51.15151], [58.87974, 50.70852], [59.48928, 50.64216], [59.51886, 50.49937], [59.81172, 50.54451], [60.01288, 50.8163], [60.17262, 50.83312], [60.31914, 50.67705], [60.81833, 50.6629], [61.4431, 50.80679], [61.56889, 51.23679], [61.6813, 51.25716], [61.55114, 51.32746], [61.50677, 51.40687], [60.95655, 51.48615], [60.92401, 51.61124], [60.5424, 51.61675], [60.36787, 51.66815], [60.50986, 51.7964], [60.09867, 51.87135], [59.99809, 51.98263], [59.91279, 52.06924], [60.17253, 52.25814], [60.17516, 52.39457], [59.25033, 52.46803], [59.22409, 52.28437], [58.79644, 52.43392], [58.94336, 53.953], [59.70487, 54.14846], [59.95217, 54.85853], [57.95234, 54.39672], [57.14829, 54.84204], [57.25137, 55.26262], [58.81825, 55.03378], [59.49035, 55.60486], [59.28419, 56.15739], [57.51527, 56.08729], [57.28024, 56.87898], [58.07604, 57.08308], [58.13789, 57.68097], [58.81412, 57.71602], [58.71104, 58.07475], [59.40376, 58.45822], [59.15636, 59.14682], [58.3853, 59.487], [59.50685, 60.91162], [59.36223, 61.3882], [59.61398, 62.44915], [59.24834, 63.01859], [59.80579, 64.13948], [59.63945, 64.78384], [60.74386, 64.95767], [61.98014, 65.72191], [66.1708, 67.61252], [64.18965, 69.94255], [76.13964, 83.37843], [36.85549, 84.09565], [32.07813, 72.01005], [31.59909, 70.16571], [30.84095, 69.80584], [30.95011, 69.54699], [30.52662, 69.54699], [30.16363, 69.65244], [29.97205, 69.41623], [29.27631, 69.2811], [29.26623, 69.13794], [29.0444, 69.0119], [28.91738, 69.04774], [28.45957, 68.91417], [28.78224, 68.86696], [28.43941, 68.53366], [28.62982, 68.19816], [29.34179, 68.06655], [29.66955, 67.79872], [30.02041, 67.67523], [29.91155, 67.51507], [28.9839, 66.94139], [29.91155, 66.13863], [30.16363, 65.66935], [29.97205, 65.70256], [29.74013, 65.64025], [29.84096, 65.56945], [29.68972, 65.31803], [29.61914, 65.23791], [29.8813, 65.22101], [29.84096, 65.1109], [29.61914, 65.05993], [29.68972, 64.80789], [30.05271, 64.79072], [30.12329, 64.64862], [30.01238, 64.57513], [30.06279, 64.35782], [30.4762, 64.25728], [30.55687, 64.09036], [30.25437, 63.83364], [29.98213, 63.75795], [30.49637, 63.46666], [31.23244, 63.22239], [31.29294, 63.09035], [31.58535, 62.91642], [31.38369, 62.66284], [31.10136, 62.43042], [29.01829, 61.17448], [28.82816, 61.1233], [28.47974, 60.93365], [27.77352, 60.52722], [27.71177, 60.3893], [27.44953, 60.22766], [26.32936, 60.00121]]]] } },
22551     { type: "Feature", properties: { wikidata: "Q1083368", nameEn: "Mainland Finland", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.12697, 69.69193], [28.36883, 69.81658], [28.32849, 69.88605], [27.97558, 69.99671], [27.95542, 70.0965], [27.57226, 70.06215], [27.05802, 69.92069], [26.64461, 69.96565], [26.40261, 69.91377], [25.96904, 69.68397], [25.69679, 69.27039], [25.75729, 68.99383], [25.61613, 68.89602], [25.42455, 68.90328], [25.12206, 68.78684], [25.10189, 68.63307], [24.93048, 68.61102], [24.90023, 68.55579], [24.74898, 68.65143], [24.18432, 68.73936], [24.02299, 68.81601], [23.781, 68.84514], [23.68017, 68.70276], [23.13064, 68.64684], [22.53321, 68.74393], [22.38367, 68.71561], [22.27276, 68.89514], [21.63833, 69.27485], [21.27827, 69.31281], [21.00732, 69.22755], [20.98641, 69.18809], [21.11099, 69.10291], [21.05775, 69.0356], [20.72171, 69.11874], [20.55258, 69.06069], [20.78802, 69.03087], [20.91658, 68.96764], [20.85104, 68.93142], [20.90649, 68.89696], [21.03001, 68.88969], [22.00429, 68.50692], [22.73028, 68.40881], [23.10336, 68.26551], [23.15377, 68.14759], [23.26469, 68.15134], [23.40081, 68.05545], [23.65793, 67.9497], [23.45627, 67.85297], [23.54701, 67.59306], [23.39577, 67.46974], [23.75372, 67.43688], [23.75372, 67.29914], [23.54701, 67.25435], [23.58735, 67.20752], [23.56214, 67.17038], [23.98563, 66.84149], [23.98059, 66.79585], [23.89488, 66.772], [23.85959, 66.56434], [23.63776, 66.43568], [23.67591, 66.3862], [23.64982, 66.30603], [23.71339, 66.21299], [23.90497, 66.15802], [24.15791, 65.85385], [24.14798, 65.83466], [24.15107, 65.81427], [24.14112, 65.39731], [20.15877, 63.06556], [19.23413, 60.61414], [20.96741, 60.71528], [21.15143, 60.54555], [21.08159, 60.20167], [21.02509, 60.12142], [21.35468, 59.67511], [20.5104, 59.15546], [26.32936, 60.00121], [27.44953, 60.22766], [27.71177, 60.3893], [27.77352, 60.52722], [28.47974, 60.93365], [28.82816, 61.1233], [29.01829, 61.17448], [31.10136, 62.43042], [31.38369, 62.66284], [31.58535, 62.91642], [31.29294, 63.09035], [31.23244, 63.22239], [30.49637, 63.46666], [29.98213, 63.75795], [30.25437, 63.83364], [30.55687, 64.09036], [30.4762, 64.25728], [30.06279, 64.35782], [30.01238, 64.57513], [30.12329, 64.64862], [30.05271, 64.79072], [29.68972, 64.80789], [29.61914, 65.05993], [29.84096, 65.1109], [29.8813, 65.22101], [29.61914, 65.23791], [29.68972, 65.31803], [29.84096, 65.56945], [29.74013, 65.64025], [29.97205, 65.70256], [30.16363, 65.66935], [29.91155, 66.13863], [28.9839, 66.94139], [29.91155, 67.51507], [30.02041, 67.67523], [29.66955, 67.79872], [29.34179, 68.06655], [28.62982, 68.19816], [28.43941, 68.53366], [28.78224, 68.86696], [28.45957, 68.91417], [28.91738, 69.04774], [28.81248, 69.11997], [28.8629, 69.22395], [29.31664, 69.47994], [29.12697, 69.69193]]]] } },
22552     { type: "Feature", properties: { wikidata: "Q1184963", nameEn: "Alhucemas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.90602, 35.21494], [-3.88372, 35.20767], [-3.89343, 35.22728], [-3.90602, 35.21494]]]] } },
22553     { type: "Feature", properties: { wikidata: "Q1298289", nameEn: "Egmont Islands", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [70.67958, -8.2663], [72.17991, -6.68509], [70.1848, -6.37445]]]] } },
22554     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
22555     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
22556     { type: "Feature", properties: { wikidata: "Q1544253", nameEn: "Great Chagos Bank", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [72.17991, -6.68509], [73.20573, -5.20727], [70.1848, -6.37445]]]] } },
22557     { type: "Feature", properties: { wikidata: "Q1585511", nameEn: "Salomon Atoll", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.09518, -5.61768], [73.20573, -5.20727], [72.12587, -4.02588], [72.09518, -5.61768]]]] } },
22558     { type: "Feature", properties: { wikidata: "Q1681727", nameEn: "Saint-Paul and Amsterdam", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[76.31747, -42.16264], [80.15867, -36.04977], [71.22311, -38.75287], [76.31747, -42.16264]]]] } },
22559     { type: "Feature", properties: { wikidata: "Q1901211", nameEn: "East Malaysia", country: "MY", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[110.90339, 7.52694], [109.82788, 2.86812], [109.62558, 1.99182], [109.53794, 1.91771], [109.57923, 1.80624], [109.66397, 1.79972], [109.66397, 1.60425], [110.35354, 0.98869], [110.49182, 0.88088], [110.62374, 0.873], [111.22979, 1.08326], [111.55434, 0.97864], [111.82846, 0.99349], [111.94553, 1.12016], [112.15679, 1.17004], [112.2127, 1.44135], [112.48648, 1.56516], [113.021, 1.57819], [113.01448, 1.42832], [113.64677, 1.23933], [114.03788, 1.44787], [114.57892, 1.5], [114.80706, 1.92351], [114.80706, 2.21665], [115.1721, 2.49671], [115.11343, 2.82879], [115.53713, 3.14776], [115.58276, 3.93499], [115.90217, 4.37708], [117.25801, 4.35108], [117.47313, 4.18857], [117.67641, 4.16535], [118.06469, 4.16638], [118.93936, 4.09009], [119.52945, 5.35672], [117.98544, 6.27477], [117.93857, 6.89845], [117.17735, 7.52841], [116.79524, 7.43869], [115.02521, 5.35005], [115.16236, 5.01011], [115.15092, 4.87604], [115.20737, 4.8256], [115.27819, 4.63661], [115.2851, 4.42295], [115.36346, 4.33563], [115.31275, 4.30806], [115.09978, 4.39123], [115.07737, 4.53418], [115.04064, 4.63706], [115.02278, 4.74137], [115.02955, 4.82087], [115.05038, 4.90275], [114.99417, 4.88201], [114.96982, 4.81146], [114.88841, 4.81905], [114.8266, 4.75062], [114.77303, 4.72871], [114.83189, 4.42387], [114.88039, 4.4257], [114.78539, 4.12205], [114.64211, 4.00694], [114.49922, 4.13108], [114.4416, 4.27588], [114.32176, 4.2552], [114.32176, 4.34942], [114.26876, 4.49878], [114.15813, 4.57], [114.07448, 4.58441], [114.10166, 4.76112], [110.90339, 7.52694]]]] } },
22560     { type: "Feature", properties: { wikidata: "Q1973345", nameEn: "Peninsular Malaysia", country: "MY", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.46318, 7.22462], [102.09086, 6.23546], [102.08127, 6.22679], [102.07732, 6.193], [102.09182, 6.14161], [102.01835, 6.05407], [101.99209, 6.04075], [101.97114, 6.01992], [101.9714, 6.00575], [101.94712, 5.98421], [101.92819, 5.85511], [101.91776, 5.84269], [101.89188, 5.8386], [101.80144, 5.74505], [101.75074, 5.79091], [101.69773, 5.75881], [101.58019, 5.93534], [101.25524, 5.78633], [101.25755, 5.71065], [101.14062, 5.61613], [100.98815, 5.79464], [101.02708, 5.91013], [101.087, 5.9193], [101.12388, 6.11411], [101.06165, 6.14161], [101.12618, 6.19431], [101.10313, 6.25617], [100.85884, 6.24929], [100.81045, 6.45086], [100.74822, 6.46231], [100.74361, 6.50811], [100.66986, 6.45086], [100.43027, 6.52389], [100.42351, 6.51762], [100.41791, 6.5189], [100.41152, 6.52299], [100.35413, 6.54932], [100.31929, 6.65413], [100.32607, 6.65933], [100.32671, 6.66526], [100.31884, 6.66423], [100.31618, 6.66781], [100.30828, 6.66462], [100.29651, 6.68439], [100.19511, 6.72559], [100.12, 6.42105], [100.0756, 6.4045], [99.91873, 6.50233], [99.50117, 6.44501], [99.31854, 5.99868], [99.75778, 3.86466], [103.03657, 1.30383], [103.56591, 1.19719], [103.62738, 1.35255], [103.67468, 1.43166], [103.7219, 1.46108], [103.74161, 1.4502], [103.76395, 1.45183], [103.81181, 1.47953], [103.86383, 1.46288], [103.89565, 1.42841], [103.93384, 1.42926], [104.00131, 1.42405], [104.02277, 1.4438], [104.04622, 1.44691], [104.07348, 1.43322], [104.08871, 1.42015], [104.09162, 1.39694], [104.08072, 1.35998], [104.12282, 1.27714], [104.34728, 1.33529], [104.56723, 1.44271], [105.01437, 3.24936], [102.46318, 7.22462]]]] } },
22561     { type: "Feature", properties: { wikidata: "Q2093907", nameEn: "Three Kings Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[174.17679, -32.62487], [170.93268, -32.97889], [171.97383, -34.64644], [174.17679, -32.62487]]]] } },
22562     { type: "Feature", properties: { wikidata: "Q2298216", nameEn: "Solander Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[167.39068, -46.49187], [166.5534, -46.39484], [166.84561, -46.84889], [167.39068, -46.49187]]]] } },
22563     { type: "Feature", properties: { wikidata: "Q2872203", nameEn: "Mainland Australia", country: "AU", groups: ["053", "009", "UN"], level: "subcountryGroup", driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.16419, -23.49578], [123.64533, -39.13605], [159.74028, -39.1978], [159.76765, -29.76946], [154.02855, -24.43238], [152.93188, -20.92631], [147.69992, -17.5933], [145.2855, -9.62524], [143.87386, -9.02382], [143.29772, -9.33993], [142.48658, -9.36754], [142.19246, -9.15378], [141.88934, -9.36111], [141.01842, -9.35091], [135.49042, -9.2276], [127.55165, -9.05052], [125.29076, -12.33139], [88.16419, -23.49578]]]] } },
22564     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
22565     { type: "Feature", properties: { wikidata: "Q2915956", nameEn: "Mainland Portugal", country: "PT", groups: ["Q12837", "EU", "039", "150", "UN"], level: "subcountryGroup", callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.39881, 36.12218], [-7.37282, 36.96896], [-7.39769, 37.16868], [-7.41133, 37.20314], [-7.41854, 37.23813], [-7.43227, 37.25152], [-7.43974, 37.38913], [-7.46878, 37.47127], [-7.51759, 37.56119], [-7.41981, 37.75729], [-7.33441, 37.81193], [-7.27314, 37.90145], [-7.24544, 37.98884], [-7.12648, 38.00296], [-7.10366, 38.04404], [-7.05966, 38.01966], [-7.00375, 38.01914], [-6.93418, 38.21454], [-7.09389, 38.17227], [-7.15581, 38.27597], [-7.32529, 38.44336], [-7.265, 38.61674], [-7.26174, 38.72107], [-7.03848, 38.87221], [-7.051, 38.907], [-6.95211, 39.0243], [-6.97004, 39.07619], [-7.04011, 39.11919], [-7.10692, 39.10275], [-7.14929, 39.11287], [-7.12811, 39.17101], [-7.23566, 39.20132], [-7.23403, 39.27579], [-7.3149, 39.34857], [-7.2927, 39.45847], [-7.49477, 39.58794], [-7.54121, 39.66717], [-7.33507, 39.64569], [-7.24707, 39.66576], [-7.01613, 39.66877], [-6.97492, 39.81488], [-6.91463, 39.86618], [-6.86737, 40.01986], [-6.94233, 40.10716], [-7.00589, 40.12087], [-7.02544, 40.18564], [-7.00426, 40.23169], [-6.86085, 40.26776], [-6.86085, 40.2976], [-6.80218, 40.33239], [-6.78426, 40.36468], [-6.84618, 40.42177], [-6.84944, 40.46394], [-6.7973, 40.51723], [-6.80218, 40.55067], [-6.84292, 40.56801], [-6.79567, 40.65955], [-6.82826, 40.74603], [-6.82337, 40.84472], [-6.79892, 40.84842], [-6.80707, 40.88047], [-6.84292, 40.89771], [-6.8527, 40.93958], [-6.9357, 41.02888], [-6.913, 41.03922], [-6.88843, 41.03027], [-6.84781, 41.02692], [-6.80942, 41.03629], [-6.79241, 41.05397], [-6.75655, 41.10187], [-6.77319, 41.13049], [-6.69711, 41.1858], [-6.68286, 41.21641], [-6.65046, 41.24725], [-6.55937, 41.24417], [-6.38551, 41.35274], [-6.38553, 41.38655], [-6.3306, 41.37677], [-6.26777, 41.48796], [-6.19128, 41.57638], [-6.29863, 41.66432], [-6.44204, 41.68258], [-6.49907, 41.65823], [-6.54633, 41.68623], [-6.56426, 41.74219], [-6.51374, 41.8758], [-6.56752, 41.88429], [-6.5447, 41.94371], [-6.58544, 41.96674], [-6.61967, 41.94008], [-6.75004, 41.94129], [-6.76959, 41.98734], [-6.81196, 41.99097], [-6.82174, 41.94493], [-6.94396, 41.94403], [-6.95537, 41.96553], [-6.98144, 41.9728], [-7.01078, 41.94977], [-7.07596, 41.94977], [-7.08574, 41.97401], [-7.14115, 41.98855], [-7.18549, 41.97515], [-7.18677, 41.88793], [-7.32366, 41.8406], [-7.37092, 41.85031], [-7.42864, 41.80589], [-7.42854, 41.83262], [-7.44759, 41.84451], [-7.45566, 41.86488], [-7.49803, 41.87095], [-7.52737, 41.83939], [-7.62188, 41.83089], [-7.58603, 41.87944], [-7.65774, 41.88308], [-7.69848, 41.90977], [-7.84188, 41.88065], [-7.88055, 41.84571], [-7.88751, 41.92553], [-7.90707, 41.92432], [-7.92336, 41.8758], [-7.9804, 41.87337], [-8.01136, 41.83453], [-8.0961, 41.81024], [-8.16455, 41.81753], [-8.16944, 41.87944], [-8.19551, 41.87459], [-8.2185, 41.91237], [-8.16232, 41.9828], [-8.08796, 42.01398], [-8.08847, 42.05767], [-8.11729, 42.08537], [-8.18178, 42.06436], [-8.19406, 42.12141], [-8.18947, 42.13853], [-8.1986, 42.15402], [-8.22406, 42.1328], [-8.24681, 42.13993], [-8.2732, 42.12396], [-8.29809, 42.106], [-8.32161, 42.10218], [-8.33912, 42.08358], [-8.36353, 42.09065], [-8.38323, 42.07683], [-8.40143, 42.08052], [-8.42512, 42.07199], [-8.44123, 42.08218], [-8.48185, 42.0811], [-8.52837, 42.07658], [-8.5252, 42.06264], [-8.54563, 42.0537], [-8.58086, 42.05147], [-8.59493, 42.05708], [-8.63791, 42.04691], [-8.64626, 42.03668], [-8.65832, 42.02972], [-8.6681, 41.99703], [-8.69071, 41.98862], [-8.7478, 41.96282], [-8.74606, 41.9469], [-8.75712, 41.92833], [-8.81794, 41.90375], [-8.87157, 41.86488], [-11.19304, 41.83075], [-10.39881, 36.12218]]]] } },
22566     { type: "Feature", properties: { wikidata: "Q3311985", nameEn: "Guernsey", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.49556, 49.79012], [-3.28154, 49.57329], [-2.65349, 49.15373], [-2.36485, 49.48223], [-2.49556, 49.79012]]]] } },
22567     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
22568     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
22569     { type: "Feature", properties: { wikidata: "Q6736667", nameEn: "Mainland India", country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.08044, 21.41871], [89.07114, 22.15335], [88.9367, 22.58527], [88.94614, 22.66941], [88.9151, 22.75228], [88.96713, 22.83346], [88.87063, 22.95235], [88.88327, 23.03885], [88.86377, 23.08759], [88.99148, 23.21134], [88.71133, 23.2492], [88.79254, 23.46028], [88.79351, 23.50535], [88.74841, 23.47361], [88.56507, 23.64044], [88.58087, 23.87105], [88.66189, 23.87607], [88.73743, 23.91751], [88.6976, 24.14703], [88.74841, 24.1959], [88.68801, 24.31464], [88.50934, 24.32474], [88.12296, 24.51301], [88.08786, 24.63232], [88.00683, 24.66477], [88.15515, 24.85806], [88.14004, 24.93529], [88.21832, 24.96642], [88.27325, 24.88796], [88.33917, 24.86803], [88.46277, 25.07468], [88.44766, 25.20149], [88.94067, 25.18534], [89.00463, 25.26583], [89.01105, 25.30303], [88.85278, 25.34679], [88.81296, 25.51546], [88.677, 25.46959], [88.4559, 25.59227], [88.45103, 25.66245], [88.242, 25.80811], [88.13138, 25.78773], [88.08804, 25.91334], [88.16581, 26.0238], [88.1844, 26.14417], [88.34757, 26.22216], [88.35153, 26.29123], [88.51649, 26.35923], [88.48749, 26.45855], [88.36938, 26.48683], [88.35153, 26.45241], [88.33093, 26.48929], [88.41196, 26.63837], [88.4298, 26.54489], [88.62144, 26.46783], [88.69485, 26.38353], [88.67837, 26.26291], [88.78961, 26.31093], [88.85004, 26.23211], [89.05328, 26.2469], [88.91321, 26.37984], [88.92357, 26.40711], [88.95612, 26.4564], [89.08899, 26.38845], [89.15869, 26.13708], [89.35953, 26.0077], [89.53515, 26.00382], [89.57101, 25.9682], [89.63968, 26.22595], [89.70201, 26.15138], [89.73581, 26.15818], [89.77865, 26.08387], [89.77728, 26.04254], [89.86592, 25.93115], [89.80585, 25.82489], [89.84388, 25.70042], [89.86129, 25.61714], [89.81208, 25.37244], [89.84086, 25.31854], [89.83371, 25.29548], [89.87629, 25.28337], [89.90478, 25.31038], [90.1155, 25.22686], [90.40034, 25.1534], [90.65042, 25.17788], [90.87427, 25.15799], [91.25517, 25.20677], [91.63648, 25.12846], [92.0316, 25.1834], [92.33957, 25.07593], [92.39147, 25.01471], [92.49887, 24.88796], [92.38626, 24.86055], [92.25854, 24.9191], [92.15796, 24.54435], [92.11662, 24.38997], [91.96603, 24.3799], [91.89258, 24.14674], [91.82596, 24.22345], [91.76004, 24.23848], [91.73257, 24.14703], [91.65292, 24.22095], [91.63782, 24.1132], [91.55542, 24.08687], [91.37414, 24.10693], [91.35741, 23.99072], [91.29587, 24.0041], [91.22308, 23.89616], [91.25192, 23.83463], [91.15579, 23.6599], [91.28293, 23.37538], [91.36453, 23.06612], [91.40848, 23.07117], [91.4035, 23.27522], [91.46615, 23.2328], [91.54993, 23.01051], [91.61571, 22.93929], [91.7324, 23.00043], [91.81634, 23.08001], [91.76417, 23.26619], [91.84789, 23.42235], [91.95642, 23.47361], [91.95093, 23.73284], [92.04706, 23.64229], [92.15417, 23.73409], [92.26541, 23.70392], [92.38214, 23.28705], [92.37665, 22.9435], [92.5181, 22.71441], [92.60029, 22.1522], [92.56616, 22.13554], [92.60949, 21.97638], [92.67532, 22.03547], [92.70416, 22.16017], [92.86208, 22.05456], [92.89504, 21.95143], [92.93899, 22.02656], [92.99804, 21.98964], [92.99255, 22.05965], [93.04885, 22.20595], [93.15734, 22.18687], [93.14224, 22.24535], [93.19991, 22.25425], [93.18206, 22.43716], [93.13537, 22.45873], [93.11477, 22.54374], [93.134, 22.59573], [93.09417, 22.69459], [93.134, 22.92498], [93.12988, 23.05772], [93.2878, 23.00464], [93.38478, 23.13698], [93.36862, 23.35426], [93.38781, 23.36139], [93.39981, 23.38828], [93.38805, 23.4728], [93.43475, 23.68299], [93.3908, 23.7622], [93.3908, 23.92925], [93.36059, 23.93176], [93.32351, 24.04468], [93.34735, 24.10151], [93.41415, 24.07854], [93.46633, 23.97067], [93.50616, 23.94432], [93.62871, 24.00922], [93.75952, 24.0003], [93.80279, 23.92549], [93.92089, 23.95812], [94.14081, 23.83333], [94.30215, 24.23752], [94.32362, 24.27692], [94.45279, 24.56656], [94.50729, 24.59281], [94.5526, 24.70764], [94.60204, 24.70889], [94.73937, 25.00545], [94.74212, 25.13606], [94.57458, 25.20318], [94.68032, 25.47003], [94.80117, 25.49359], [95.18556, 26.07338], [95.11428, 26.1019], [95.12801, 26.38397], [95.05798, 26.45408], [95.23513, 26.68499], [95.30339, 26.65372], [95.437, 26.7083], [95.81603, 27.01335], [95.93002, 27.04149], [96.04949, 27.19428], [96.15591, 27.24572], [96.40779, 27.29818], [96.55761, 27.29928], [96.73888, 27.36638], [96.88445, 27.25046], [96.85287, 27.2065], [96.89132, 27.17474], [97.14675, 27.09041], [97.17422, 27.14052], [96.91431, 27.45752], [96.90112, 27.62149], [97.29919, 27.92233], [97.35824, 27.87256], [97.38845, 28.01329], [97.35412, 28.06663], [97.31292, 28.06784], [97.34547, 28.21385], [97.1289, 28.3619], [96.98882, 28.32564], [96.88445, 28.39452], [96.85561, 28.4875], [96.6455, 28.61657], [96.48895, 28.42955], [96.40929, 28.51526], [96.61391, 28.72742], [96.3626, 29.10607], [96.20467, 29.02325], [96.18682, 29.11087], [96.31316, 29.18643], [96.05361, 29.38167], [95.84899, 29.31464], [95.75149, 29.32063], [95.72086, 29.20797], [95.50842, 29.13487], [95.41091, 29.13007], [95.3038, 29.13847], [95.26122, 29.07727], [95.2214, 29.10727], [95.11291, 29.09527], [95.0978, 29.14446], [94.81353, 29.17804], [94.69318, 29.31739], [94.2752, 29.11687], [94.35897, 29.01965], [93.72797, 28.68821], [93.44621, 28.67189], [93.18069, 28.50319], [93.14635, 28.37035], [92.93075, 28.25671], [92.67486, 28.15018], [92.65472, 28.07632], [92.73025, 28.05814], [92.7275, 27.98662], [92.42538, 27.80092], [92.32101, 27.79363], [92.27432, 27.89077], [91.87057, 27.7195], [91.84722, 27.76325], [91.6469, 27.76358], [91.55819, 27.6144], [91.65007, 27.48287], [92.01132, 27.47352], [92.12019, 27.27829], [92.04702, 27.26861], [92.03457, 27.07334], [92.11863, 26.893], [92.05523, 26.8692], [91.83181, 26.87318], [91.50067, 26.79223], [90.67715, 26.77215], [90.48504, 26.8594], [90.39271, 26.90704], [90.30402, 26.85098], [90.04535, 26.72422], [89.86124, 26.73307], [89.63369, 26.74402], [89.42349, 26.83727], [89.3901, 26.84225], [89.38319, 26.85963], [89.37913, 26.86224], [89.1926, 26.81329], [89.12825, 26.81661], [89.09554, 26.89089], [88.95807, 26.92668], [88.92301, 26.99286], [88.8714, 26.97488], [88.86984, 27.10937], [88.74219, 27.144], [88.91901, 27.32483], [88.82981, 27.38814], [88.77517, 27.45415], [88.88091, 27.85192], [88.83559, 28.01936], [88.63235, 28.12356], [88.54858, 28.06057], [88.25332, 27.9478], [88.1278, 27.95417], [88.13378, 27.88015], [88.1973, 27.85067], [88.19107, 27.79285], [88.04008, 27.49223], [88.07277, 27.43007], [88.01646, 27.21612], [88.01587, 27.21388], [87.9887, 27.11045], [88.11719, 26.98758], [88.13422, 26.98705], [88.12302, 26.95324], [88.19107, 26.75516], [88.1659, 26.68177], [88.16452, 26.64111], [88.09963, 26.54195], [88.09414, 26.43732], [88.00895, 26.36029], [87.90115, 26.44923], [87.89085, 26.48565], [87.84193, 26.43663], [87.7918, 26.46737], [87.76004, 26.40711], [87.67893, 26.43501], [87.66803, 26.40294], [87.59175, 26.38342], [87.55274, 26.40596], [87.51571, 26.43106], [87.46566, 26.44058], [87.37314, 26.40815], [87.34568, 26.34787], [87.26568, 26.37294], [87.26587, 26.40592], [87.24682, 26.4143], [87.18863, 26.40558], [87.14751, 26.40542], [87.09147, 26.45039], [87.0707, 26.58571], [87.04691, 26.58685], [87.01559, 26.53228], [86.95912, 26.52076], [86.94543, 26.52076], [86.82898, 26.43919], [86.76797, 26.45892], [86.74025, 26.42386], [86.69124, 26.45169], [86.62686, 26.46891], [86.61313, 26.48658], [86.57073, 26.49825], [86.54258, 26.53819], [86.49726, 26.54218], [86.31564, 26.61925], [86.26235, 26.61886], [86.22513, 26.58863], [86.13596, 26.60651], [86.02729, 26.66756], [85.8492, 26.56667], [85.85126, 26.60866], [85.83126, 26.61134], [85.76907, 26.63076], [85.72315, 26.67471], [85.73483, 26.79613], [85.66239, 26.84822], [85.61621, 26.86721], [85.59461, 26.85161], [85.5757, 26.85955], [85.56471, 26.84133], [85.47752, 26.79292], [85.34302, 26.74954], [85.21159, 26.75933], [85.18046, 26.80519], [85.19291, 26.86909], [85.15883, 26.86966], [85.02635, 26.85381], [85.05592, 26.88991], [85.00536, 26.89523], [84.97186, 26.9149], [84.96687, 26.95599], [84.85754, 26.98984], [84.82913, 27.01989], [84.793, 26.9968], [84.64496, 27.04669], [84.69166, 27.21294], [84.62161, 27.33885], [84.29315, 27.39], [84.25735, 27.44941], [84.21376, 27.45218], [84.10791, 27.52399], [84.02229, 27.43836], [83.93306, 27.44939], [83.86182, 27.4241], [83.85595, 27.35797], [83.61288, 27.47013], [83.39495, 27.4798], [83.38872, 27.39276], [83.35136, 27.33885], [83.29999, 27.32778], [83.2673, 27.36235], [83.27197, 27.38309], [83.19413, 27.45632], [82.94938, 27.46036], [82.93261, 27.50328], [82.74119, 27.49838], [82.70378, 27.72122], [82.46405, 27.6716], [82.06554, 27.92222], [81.97214, 27.93322], [81.91223, 27.84995], [81.47867, 28.08303], [81.48179, 28.12148], [81.38683, 28.17638], [81.32923, 28.13521], [81.19847, 28.36284], [81.03471, 28.40054], [80.55142, 28.69182], [80.50575, 28.6706], [80.52443, 28.54897], [80.44504, 28.63098], [80.37188, 28.63371], [80.12125, 28.82346], [80.06957, 28.82763], [80.05743, 28.91479], [80.18085, 29.13649], [80.23178, 29.11626], [80.26602, 29.13938], [80.24112, 29.21414], [80.28626, 29.20327], [80.31428, 29.30784], [80.24322, 29.44299], [80.37939, 29.57098], [80.41858, 29.63581], [80.38428, 29.68513], [80.36803, 29.73865], [80.41554, 29.79451], [80.43458, 29.80466], [80.48997, 29.79566], [80.56247, 29.86661], [80.57179, 29.91422], [80.60226, 29.95732], [80.67076, 29.95732], [80.8778, 30.13384], [80.86673, 30.17321], [80.91143, 30.22173], [80.92547, 30.17193], [81.03953, 30.20059], [80.83343, 30.32023], [80.54504, 30.44936], [80.20721, 30.58541], [79.93255, 30.88288], [79.59884, 30.93943], [79.30694, 31.17357], [79.14016, 31.43403], [79.01931, 31.42817], [78.89344, 31.30481], [78.77898, 31.31209], [78.71032, 31.50197], [78.84516, 31.60631], [78.69933, 31.78723], [78.78036, 31.99478], [78.74404, 32.00384], [78.68754, 32.10256], [78.49609, 32.2762], [78.4645, 32.45367], [78.38897, 32.53938], [78.73916, 32.69438], [78.7831, 32.46873], [78.96713, 32.33655], [78.99322, 32.37948], [79.0979, 32.38051], [79.13174, 32.47766], [79.26768, 32.53277], [79.46562, 32.69668], [79.14016, 33.02545], [79.15252, 33.17156], [78.73636, 33.56521], [78.67599, 33.66445], [78.77349, 33.73871], [78.73367, 34.01121], [78.65657, 34.03195], [78.66225, 34.08858], [78.91769, 34.15452], [78.99802, 34.3027], [79.05364, 34.32482], [78.74465, 34.45174], [78.56475, 34.50835], [78.54964, 34.57283], [78.27781, 34.61484], [78.18435, 34.7998], [78.22692, 34.88771], [78.00033, 35.23954], [78.03466, 35.3785], [78.11664, 35.48022], [77.80532, 35.52058], [77.70232, 35.46244], [77.44277, 35.46132], [76.96624, 35.5932], [76.84539, 35.67356], [76.77323, 35.66062], [76.75475, 35.52617], [76.85088, 35.39754], [76.93465, 35.39866], [77.11796, 35.05419], [76.99251, 34.93349], [76.87193, 34.96906], [76.74514, 34.92488], [76.74377, 34.84039], [76.67648, 34.76371], [76.47186, 34.78965], [76.15463, 34.6429], [76.04614, 34.67566], [75.75438, 34.51827], [75.38009, 34.55021], [75.01479, 34.64629], [74.6663, 34.703], [74.58083, 34.77386], [74.31239, 34.79626], [74.12897, 34.70073], [73.96423, 34.68244], [73.93401, 34.63386], [73.93951, 34.57169], [73.89419, 34.54568], [73.88732, 34.48911], [73.74999, 34.3781], [73.74862, 34.34183], [73.8475, 34.32935], [73.90517, 34.35317], [73.98208, 34.2522], [73.90677, 34.10504], [73.88732, 34.05105], [73.91341, 34.01235], [74.21554, 34.03853], [74.25262, 34.01577], [74.26086, 33.92237], [74.14001, 33.83002], [74.05898, 33.82089], [74.00891, 33.75437], [73.96423, 33.73071], [73.98968, 33.66155], [73.97367, 33.64061], [74.03576, 33.56718], [74.10115, 33.56392], [74.18121, 33.4745], [74.17983, 33.3679], [74.08782, 33.26232], [74.01366, 33.25199], [74.02144, 33.18908], [74.15374, 33.13477], [74.17571, 33.07495], [74.31854, 33.02891], [74.34875, 32.97823], [74.31227, 32.92795], [74.41467, 32.90563], [74.45312, 32.77755], [74.6289, 32.75561], [74.64675, 32.82604], [74.7113, 32.84219], [74.65345, 32.71225], [74.69542, 32.66792], [74.64424, 32.60985], [74.65251, 32.56416], [74.67431, 32.56676], [74.68362, 32.49298], [74.84725, 32.49075], [74.97634, 32.45367], [75.03265, 32.49538], [75.28259, 32.36556], [75.38046, 32.26836], [75.25649, 32.10187], [75.00793, 32.03786], [74.9269, 32.0658], [74.86236, 32.04485], [74.79919, 31.95983], [74.58907, 31.87824], [74.47771, 31.72227], [74.57498, 31.60382], [74.61517, 31.55698], [74.59319, 31.50197], [74.64713, 31.45605], [74.59773, 31.4136], [74.53223, 31.30321], [74.51629, 31.13829], [74.56023, 31.08303], [74.60281, 31.10419], [74.60006, 31.13711], [74.6852, 31.12771], [74.67971, 31.05479], [74.5616, 31.04153], [73.88993, 30.36305], [73.95736, 30.28466], [73.97225, 30.19829], [73.80299, 30.06969], [73.58665, 30.01848], [73.3962, 29.94707], [73.28094, 29.56646], [73.05886, 29.1878], [73.01337, 29.16422], [72.94272, 29.02487], [72.40402, 28.78283], [72.29495, 28.66367], [72.20329, 28.3869], [71.9244, 28.11555], [71.89921, 27.96035], [70.79054, 27.68423], [70.60927, 28.02178], [70.37307, 28.01208], [70.12502, 27.8057], [70.03136, 27.56627], [69.58519, 27.18109], [69.50904, 26.74892], [69.88555, 26.56836], [70.05584, 26.60398], [70.17532, 26.55362], [70.17532, 26.24118], [70.08193, 26.08094], [70.0985, 25.93238], [70.2687, 25.71156], [70.37444, 25.67443], [70.53649, 25.68928], [70.60378, 25.71898], [70.67382, 25.68186], [70.66695, 25.39314], [70.89148, 25.15064], [70.94002, 24.92843], [71.09405, 24.69017], [70.97594, 24.60904], [71.00341, 24.46038], [71.12838, 24.42662], [71.04461, 24.34657], [70.94985, 24.3791], [70.85784, 24.30903], [70.88393, 24.27398], [70.71502, 24.23517], [70.57906, 24.27774], [70.5667, 24.43787], [70.11712, 24.30915], [70.03428, 24.172], [69.73335, 24.17007], [69.59579, 24.29777], [69.29778, 24.28712], [69.19341, 24.25646], [69.07806, 24.29777], [68.97781, 24.26021], [68.90914, 24.33156], [68.7416, 24.31904], [68.74643, 23.97027], [68.39339, 23.96838], [68.20763, 23.85849], [68.11329, 23.53945], [76.59015, 5.591], [79.50447, 8.91876], [79.42124, 9.80115], [80.48418, 10.20786], [89.08044, 21.41871]]]] } },
22570     { type: "Feature", properties: { wikidata: "Q9143535", nameEn: "Akrotiri", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.86014, 34.70585], [32.82717, 34.70622], [32.79433, 34.67883], [32.76136, 34.68318], [32.75515, 34.64985], [32.74412, 34.43926], [33.26744, 34.49942], [33.0138, 34.64424], [32.96968, 34.64046], [32.96718, 34.63446], [32.95891, 34.62919], [32.95323, 34.64075], [32.95471, 34.64528], [32.94976, 34.65204], [32.94796, 34.6587], [32.95325, 34.66462], [32.97079, 34.66112], [32.97736, 34.65277], [32.99014, 34.65518], [32.98668, 34.67268], [32.99135, 34.68061], [32.95539, 34.68471], [32.94683, 34.67907], [32.94379, 34.67111], [32.93693, 34.67027], [32.93449, 34.66241], [32.92807, 34.66736], [32.93043, 34.67091], [32.91398, 34.67343], [32.9068, 34.66102], [32.86167, 34.68734], [32.86014, 34.70585]]]] } },
22571     { type: "Feature", properties: { wikidata: "Q9206745", nameEn: "Dhekelia", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.70575, 34.97947], [33.83531, 34.73974], [33.98684, 34.76642], [33.90075, 34.96623], [33.86432, 34.97592], [33.84811, 34.97075], [33.83505, 34.98108], [33.85621, 34.98956], [33.85891, 35.001], [33.85216, 35.00579], [33.84045, 35.00616], [33.82875, 35.01685], [33.83055, 35.02865], [33.81524, 35.04192], [33.8012, 35.04786], [33.82051, 35.0667], [33.8355, 35.05777], [33.85261, 35.0574], [33.88367, 35.07877], [33.89485, 35.06873], [33.90247, 35.07686], [33.91299, 35.07579], [33.91789, 35.08688], [33.89853, 35.11377], [33.88737, 35.11408], [33.88943, 35.12007], [33.88561, 35.12449], [33.87224, 35.12293], [33.87622, 35.10457], [33.87097, 35.09389], [33.87479, 35.08881], [33.8541, 35.07201], [33.84168, 35.06823], [33.82067, 35.07826], [33.78581, 35.05104], [33.76106, 35.04253], [33.73824, 35.05321], [33.71482, 35.03722], [33.70209, 35.04882], [33.7161, 35.07279], [33.70861, 35.07644], [33.69095, 35.06237], [33.68474, 35.06602], [33.67742, 35.05963], [33.67678, 35.03866], [33.69938, 35.03123], [33.69731, 35.01754], [33.71514, 35.00294], [33.70639, 34.99303], [33.70575, 34.97947]], [[33.77312, 34.9976], [33.77553, 34.99518], [33.78516, 34.99582], [33.79191, 34.98914], [33.78917, 34.98854], [33.78571, 34.98951], [33.78318, 34.98699], [33.78149, 34.98854], [33.77843, 34.988], [33.7778, 34.98981], [33.76738, 34.99188], [33.76605, 34.99543], [33.75682, 34.99916], [33.75994, 35.00113], [33.77312, 34.9976]], [[33.74144, 35.01053], [33.7343, 35.01178], [33.73781, 35.02181], [33.74265, 35.02329], [33.74983, 35.02274], [33.7492, 35.01319], [33.74144, 35.01053]]]] } },
22572     { type: "Feature", properties: { wikidata: "Q16390686", nameEn: "Peninsular Spain", country: "ES", groups: ["Q12837", "EU", "039", "150", "UN"], callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.75438, 42.33445], [3.17156, 42.43545], [3.11379, 42.43646], [3.10027, 42.42621], [3.08167, 42.42748], [3.03734, 42.47363], [2.96518, 42.46692], [2.94283, 42.48174], [2.92107, 42.4573], [2.88413, 42.45938], [2.86983, 42.46843], [2.85675, 42.45444], [2.84335, 42.45724], [2.77464, 42.41046], [2.75497, 42.42578], [2.72056, 42.42298], [2.65311, 42.38771], [2.6747, 42.33974], [2.57934, 42.35808], [2.55516, 42.35351], [2.54382, 42.33406], [2.48457, 42.33933], [2.43508, 42.37568], [2.43299, 42.39423], [2.38504, 42.39977], [2.25551, 42.43757], [2.20578, 42.41633], [2.16599, 42.42314], [2.12789, 42.41291], [2.11621, 42.38393], [2.06241, 42.35906], [2.00488, 42.35399], [1.96482, 42.37787], [1.9574, 42.42401], [1.94084, 42.43039], [1.94061, 42.43333], [1.94292, 42.44316], [1.93663, 42.45439], [1.88853, 42.4501], [1.83037, 42.48395], [1.76335, 42.48863], [1.72515, 42.50338], [1.70571, 42.48867], [1.66826, 42.50779], [1.65674, 42.47125], [1.58933, 42.46275], [1.57953, 42.44957], [1.55937, 42.45808], [1.55073, 42.43299], [1.5127, 42.42959], [1.44529, 42.43724], [1.43838, 42.47848], [1.41648, 42.48315], [1.46661, 42.50949], [1.44759, 42.54431], [1.41245, 42.53539], [1.4234, 42.55959], [1.44529, 42.56722], [1.42512, 42.58292], [1.44197, 42.60217], [1.35562, 42.71944], [1.15928, 42.71407], [1.0804, 42.78569], [0.98292, 42.78754], [0.96166, 42.80629], [0.93089, 42.79154], [0.711, 42.86372], [0.66121, 42.84021], [0.65421, 42.75872], [0.67873, 42.69458], [0.40214, 42.69779], [0.36251, 42.72282], [0.29407, 42.67431], [0.25336, 42.7174], [0.17569, 42.73424], [-0.02468, 42.68513], [-0.10519, 42.72761], [-0.16141, 42.79535], [-0.17939, 42.78974], [-0.3122, 42.84788], [-0.38833, 42.80132], [-0.41319, 42.80776], [-0.44334, 42.79939], [-0.50863, 42.82713], [-0.55497, 42.77846], [-0.67637, 42.88303], [-0.69837, 42.87945], [-0.72608, 42.89318], [-0.73422, 42.91228], [-0.72037, 42.92541], [-0.75478, 42.96916], [-0.81652, 42.95166], [-0.97133, 42.96239], [-1.00963, 42.99279], [-1.10333, 43.0059], [-1.22881, 43.05534], [-1.25244, 43.04164], [-1.30531, 43.06859], [-1.30052, 43.09581], [-1.27118, 43.11961], [-1.32209, 43.1127], [-1.34419, 43.09665], [-1.35272, 43.02658], [-1.44067, 43.047], [-1.47555, 43.08372], [-1.41562, 43.12815], [-1.3758, 43.24511], [-1.40942, 43.27272], [-1.45289, 43.27049], [-1.50992, 43.29481], [-1.55963, 43.28828], [-1.57674, 43.25269], [-1.61341, 43.25269], [-1.63052, 43.28591], [-1.62481, 43.30726], [-1.69407, 43.31378], [-1.73074, 43.29481], [-1.7397, 43.32979], [-1.75079, 43.3317], [-1.75334, 43.34107], [-1.77068, 43.34396], [-1.78714, 43.35476], [-1.78332, 43.36399], [-1.79319, 43.37497], [-1.77289, 43.38957], [-1.81005, 43.59738], [-10.14298, 44.17365], [-11.19304, 41.83075], [-8.87157, 41.86488], [-8.81794, 41.90375], [-8.75712, 41.92833], [-8.74606, 41.9469], [-8.7478, 41.96282], [-8.69071, 41.98862], [-8.6681, 41.99703], [-8.65832, 42.02972], [-8.64626, 42.03668], [-8.63791, 42.04691], [-8.59493, 42.05708], [-8.58086, 42.05147], [-8.54563, 42.0537], [-8.5252, 42.06264], [-8.52837, 42.07658], [-8.48185, 42.0811], [-8.44123, 42.08218], [-8.42512, 42.07199], [-8.40143, 42.08052], [-8.38323, 42.07683], [-8.36353, 42.09065], [-8.33912, 42.08358], [-8.32161, 42.10218], [-8.29809, 42.106], [-8.2732, 42.12396], [-8.24681, 42.13993], [-8.22406, 42.1328], [-8.1986, 42.15402], [-8.18947, 42.13853], [-8.19406, 42.12141], [-8.18178, 42.06436], [-8.11729, 42.08537], [-8.08847, 42.05767], [-8.08796, 42.01398], [-8.16232, 41.9828], [-8.2185, 41.91237], [-8.19551, 41.87459], [-8.16944, 41.87944], [-8.16455, 41.81753], [-8.0961, 41.81024], [-8.01136, 41.83453], [-7.9804, 41.87337], [-7.92336, 41.8758], [-7.90707, 41.92432], [-7.88751, 41.92553], [-7.88055, 41.84571], [-7.84188, 41.88065], [-7.69848, 41.90977], [-7.65774, 41.88308], [-7.58603, 41.87944], [-7.62188, 41.83089], [-7.52737, 41.83939], [-7.49803, 41.87095], [-7.45566, 41.86488], [-7.44759, 41.84451], [-7.42854, 41.83262], [-7.42864, 41.80589], [-7.37092, 41.85031], [-7.32366, 41.8406], [-7.18677, 41.88793], [-7.18549, 41.97515], [-7.14115, 41.98855], [-7.08574, 41.97401], [-7.07596, 41.94977], [-7.01078, 41.94977], [-6.98144, 41.9728], [-6.95537, 41.96553], [-6.94396, 41.94403], [-6.82174, 41.94493], [-6.81196, 41.99097], [-6.76959, 41.98734], [-6.75004, 41.94129], [-6.61967, 41.94008], [-6.58544, 41.96674], [-6.5447, 41.94371], [-6.56752, 41.88429], [-6.51374, 41.8758], [-6.56426, 41.74219], [-6.54633, 41.68623], [-6.49907, 41.65823], [-6.44204, 41.68258], [-6.29863, 41.66432], [-6.19128, 41.57638], [-6.26777, 41.48796], [-6.3306, 41.37677], [-6.38553, 41.38655], [-6.38551, 41.35274], [-6.55937, 41.24417], [-6.65046, 41.24725], [-6.68286, 41.21641], [-6.69711, 41.1858], [-6.77319, 41.13049], [-6.75655, 41.10187], [-6.79241, 41.05397], [-6.80942, 41.03629], [-6.84781, 41.02692], [-6.88843, 41.03027], [-6.913, 41.03922], [-6.9357, 41.02888], [-6.8527, 40.93958], [-6.84292, 40.89771], [-6.80707, 40.88047], [-6.79892, 40.84842], [-6.82337, 40.84472], [-6.82826, 40.74603], [-6.79567, 40.65955], [-6.84292, 40.56801], [-6.80218, 40.55067], [-6.7973, 40.51723], [-6.84944, 40.46394], [-6.84618, 40.42177], [-6.78426, 40.36468], [-6.80218, 40.33239], [-6.86085, 40.2976], [-6.86085, 40.26776], [-7.00426, 40.23169], [-7.02544, 40.18564], [-7.00589, 40.12087], [-6.94233, 40.10716], [-6.86737, 40.01986], [-6.91463, 39.86618], [-6.97492, 39.81488], [-7.01613, 39.66877], [-7.24707, 39.66576], [-7.33507, 39.64569], [-7.54121, 39.66717], [-7.49477, 39.58794], [-7.2927, 39.45847], [-7.3149, 39.34857], [-7.23403, 39.27579], [-7.23566, 39.20132], [-7.12811, 39.17101], [-7.14929, 39.11287], [-7.10692, 39.10275], [-7.04011, 39.11919], [-6.97004, 39.07619], [-6.95211, 39.0243], [-7.051, 38.907], [-7.03848, 38.87221], [-7.26174, 38.72107], [-7.265, 38.61674], [-7.32529, 38.44336], [-7.15581, 38.27597], [-7.09389, 38.17227], [-6.93418, 38.21454], [-7.00375, 38.01914], [-7.05966, 38.01966], [-7.10366, 38.04404], [-7.12648, 38.00296], [-7.24544, 37.98884], [-7.27314, 37.90145], [-7.33441, 37.81193], [-7.41981, 37.75729], [-7.51759, 37.56119], [-7.46878, 37.47127], [-7.43974, 37.38913], [-7.43227, 37.25152], [-7.41854, 37.23813], [-7.41133, 37.20314], [-7.39769, 37.16868], [-7.37282, 36.96896], [-7.2725, 35.73269], [-5.10878, 36.05227], [-2.27707, 35.35051], [3.75438, 42.33445]], [[-5.27801, 36.14942], [-5.34064, 36.03744], [-5.40526, 36.15488], [-5.34536, 36.15501], [-5.33822, 36.15272], [-5.27801, 36.14942]]], [[[1.99838, 42.44682], [2.01564, 42.45171], [1.99216, 42.46208], [1.98579, 42.47486], [1.99766, 42.4858], [1.98916, 42.49351], [1.98022, 42.49569], [1.97697, 42.48568], [1.97227, 42.48487], [1.97003, 42.48081], [1.96215, 42.47854], [1.95606, 42.45785], [1.96125, 42.45364], [1.98378, 42.44697], [1.99838, 42.44682]]]] } },
22573     { type: "Feature", properties: { wikidata: "Q98059339", nameEn: "Mainland Norway", country: "NO", groups: ["154", "150", "UN"], callingCodes: ["47"] }, geometry: { type: "MultiPolygon", coordinates: [[[[10.40861, 58.38489], [10.64958, 58.89391], [11.08911, 58.98745], [11.15367, 59.07862], [11.34459, 59.11672], [11.4601, 58.99022], [11.45199, 58.89604], [11.65732, 58.90177], [11.8213, 59.24985], [11.69297, 59.59442], [11.92112, 59.69531], [11.87121, 59.86039], [12.15641, 59.8926], [12.36317, 59.99259], [12.52003, 60.13846], [12.59133, 60.50559], [12.2277, 61.02442], [12.69115, 61.06584], [12.86939, 61.35427], [12.57707, 61.56547], [12.40595, 61.57226], [12.14746, 61.7147], [12.29187, 62.25699], [12.07085, 62.6297], [12.19919, 63.00104], [11.98529, 63.27487], [12.19919, 63.47935], [12.14928, 63.59373], [12.74105, 64.02171], [13.23411, 64.09087], [13.98222, 64.00953], [14.16051, 64.18725], [14.11117, 64.46674], [13.64276, 64.58402], [14.50926, 65.31786], [14.53778, 66.12399], [15.05113, 66.15572], [15.49318, 66.28509], [15.37197, 66.48217], [16.35589, 67.06419], [16.39154, 67.21653], [16.09922, 67.4364], [16.12774, 67.52106], [16.38441, 67.52923], [16.7409, 67.91037], [17.30416, 68.11591], [17.90787, 67.96537], [18.13836, 68.20874], [18.1241, 68.53721], [18.39503, 68.58672], [18.63032, 68.50849], [18.97255, 68.52416], [19.93508, 68.35911], [20.22027, 68.48759], [19.95647, 68.55546], [20.22027, 68.67246], [20.33435, 68.80174], [20.28444, 68.93283], [20.0695, 69.04469], [20.55258, 69.06069], [20.72171, 69.11874], [21.05775, 69.0356], [21.11099, 69.10291], [20.98641, 69.18809], [21.00732, 69.22755], [21.27827, 69.31281], [21.63833, 69.27485], [22.27276, 68.89514], [22.38367, 68.71561], [22.53321, 68.74393], [23.13064, 68.64684], [23.68017, 68.70276], [23.781, 68.84514], [24.02299, 68.81601], [24.18432, 68.73936], [24.74898, 68.65143], [24.90023, 68.55579], [24.93048, 68.61102], [25.10189, 68.63307], [25.12206, 68.78684], [25.42455, 68.90328], [25.61613, 68.89602], [25.75729, 68.99383], [25.69679, 69.27039], [25.96904, 69.68397], [26.40261, 69.91377], [26.64461, 69.96565], [27.05802, 69.92069], [27.57226, 70.06215], [27.95542, 70.0965], [27.97558, 69.99671], [28.32849, 69.88605], [28.36883, 69.81658], [29.12697, 69.69193], [29.31664, 69.47994], [28.8629, 69.22395], [28.81248, 69.11997], [28.91738, 69.04774], [29.0444, 69.0119], [29.26623, 69.13794], [29.27631, 69.2811], [29.97205, 69.41623], [30.16363, 69.65244], [30.52662, 69.54699], [30.95011, 69.54699], [30.84095, 69.80584], [31.59909, 70.16571], [32.07813, 72.01005], [-11.60274, 67.73467], [7.28637, 57.35913], [10.40861, 58.38489]]]] } },
22574     { type: "Feature", properties: { wikidata: "Q98543636", nameEn: "Mainland Ecuador", country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-84.52388, -3.36941], [-80.30602, -3.39149], [-80.20647, -3.431], [-80.24123, -3.46124], [-80.24586, -3.48677], [-80.23651, -3.48652], [-80.22629, -3.501], [-80.20535, -3.51667], [-80.21642, -3.5888], [-80.19848, -3.59249], [-80.18741, -3.63994], [-80.19926, -3.68894], [-80.13232, -3.90317], [-80.46386, -4.01342], [-80.4822, -4.05477], [-80.45023, -4.20938], [-80.32114, -4.21323], [-80.46386, -4.41516], [-80.39256, -4.48269], [-80.13945, -4.29786], [-79.79722, -4.47558], [-79.59402, -4.46848], [-79.26248, -4.95167], [-79.1162, -4.97774], [-79.01659, -5.01481], [-78.85149, -4.66795], [-78.68394, -4.60754], [-78.34362, -3.38633], [-78.24589, -3.39907], [-78.22642, -3.51113], [-78.14324, -3.47653], [-78.19369, -3.36431], [-77.94147, -3.05454], [-76.6324, -2.58397], [-76.05203, -2.12179], [-75.57429, -1.55961], [-75.3872, -0.9374], [-75.22862, -0.95588], [-75.22862, -0.60048], [-75.53615, -0.19213], [-75.60169, -0.18708], [-75.61997, -0.10012], [-75.40192, -0.17196], [-75.25764, -0.11943], [-75.82927, 0.09578], [-76.23441, 0.42294], [-76.41215, 0.38228], [-76.4094, 0.24015], [-76.89177, 0.24736], [-77.52001, 0.40782], [-77.49984, 0.64476], [-77.67815, 0.73863], [-77.66416, 0.81604], [-77.68613, 0.83029], [-77.7148, 0.85003], [-77.85677, 0.80197], [-78.42749, 1.15389], [-78.87137, 1.47457], [-82.12561, 4.00341], [-84.52388, -3.36941]]]] } },
22575     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
22576     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
22577     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
22578     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
22579     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
22580     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
22581     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
22582     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
22583     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
22584     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
22585     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
22586     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
22587     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
22588     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
22589     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
22590     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
22591     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
22592     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
22593     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
22594     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
22595     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
22596     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
22597     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
22598     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
22599     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
22600     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
22601     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
22602     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
22603     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
22604     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
22605     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
22606     { type: "Feature", properties: { m49: "680", wikidata: "Q3405693", nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
22607     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
22608     { type: "Feature", properties: { iso1A2: "AC", iso1A3: "ASC", wikidata: "Q46197", nameEn: "Ascension Island", aliases: ["SH-AC"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["247"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.82771, -8.70814], [-13.33271, -8.07391], [-14.91926, -6.63386], [-14.82771, -8.70814]]]] } },
22609     { type: "Feature", properties: { iso1A2: "AD", iso1A3: "AND", iso1N3: "020", wikidata: "Q228", nameEn: "Andorra", groups: ["Q12837", "039", "150", "UN"], callingCodes: ["376"] }, geometry: { type: "MultiPolygon", coordinates: [[[[1.72515, 42.50338], [1.73683, 42.55492], [1.7858, 42.57698], [1.72588, 42.59098], [1.73452, 42.61515], [1.68267, 42.62533], [1.6625, 42.61982], [1.63485, 42.62957], [1.60085, 42.62703], [1.55418, 42.65669], [1.50867, 42.64483], [1.48043, 42.65203], [1.46718, 42.63296], [1.47986, 42.61346], [1.44197, 42.60217], [1.42512, 42.58292], [1.44529, 42.56722], [1.4234, 42.55959], [1.41245, 42.53539], [1.44759, 42.54431], [1.46661, 42.50949], [1.41648, 42.48315], [1.43838, 42.47848], [1.44529, 42.43724], [1.5127, 42.42959], [1.55073, 42.43299], [1.55937, 42.45808], [1.57953, 42.44957], [1.58933, 42.46275], [1.65674, 42.47125], [1.66826, 42.50779], [1.70571, 42.48867], [1.72515, 42.50338]]]] } },
22610     { type: "Feature", properties: { iso1A2: "AE", iso1A3: "ARE", iso1N3: "784", wikidata: "Q878", nameEn: "United Arab Emirates", groups: ["145", "142", "UN"], callingCodes: ["971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.26534, 25.62825], [56.25341, 25.61443], [56.26636, 25.60643], [56.25365, 25.60211], [56.20473, 25.61119], [56.18363, 25.65508], [56.14826, 25.66351], [56.13579, 25.73524], [56.17416, 25.77239], [56.13963, 25.82765], [56.19334, 25.9795], [56.15498, 26.06828], [56.08666, 26.05038], [55.81777, 26.18798], [55.14145, 25.62624], [53.97892, 24.64436], [52.82259, 25.51697], [52.35509, 25.00368], [52.02277, 24.75635], [51.83108, 24.71675], [51.58834, 24.66608], [51.41644, 24.39615], [51.58871, 24.27256], [51.59617, 24.12041], [52.56622, 22.94341], [55.13599, 22.63334], [55.2137, 22.71065], [55.22634, 23.10378], [55.57358, 23.669], [55.48677, 23.94946], [55.73301, 24.05994], [55.8308, 24.01633], [56.01799, 24.07426], [55.95472, 24.2172], [55.83367, 24.20193], [55.77658, 24.23476], [55.76558, 24.23227], [55.75257, 24.23466], [55.75382, 24.2466], [55.75939, 24.26114], [55.76781, 24.26209], [55.79145, 24.27914], [55.80747, 24.31069], [55.83395, 24.32776], [55.83271, 24.41521], [55.76461, 24.5287], [55.83271, 24.68567], [55.83408, 24.77858], [55.81348, 24.80102], [55.81116, 24.9116], [55.85094, 24.96858], [55.90849, 24.96771], [55.96316, 25.00857], [56.05715, 24.95727], [56.05106, 24.87461], [55.97467, 24.89639], [55.97836, 24.87673], [56.03535, 24.81161], [56.06128, 24.74457], [56.13684, 24.73699], [56.20062, 24.78565], [56.20568, 24.85063], [56.30269, 24.88334], [56.34873, 24.93205], [56.3227, 24.97284], [56.86325, 25.03856], [56.82555, 25.7713], [56.26534, 25.62825]], [[56.26062, 25.33108], [56.3005, 25.31815], [56.3111, 25.30107], [56.35172, 25.30681], [56.34438, 25.26653], [56.27628, 25.23404], [56.24341, 25.22867], [56.20872, 25.24104], [56.20838, 25.25668], [56.24465, 25.27505], [56.25008, 25.28843], [56.23362, 25.31253], [56.26062, 25.33108]]], [[[56.28423, 25.26344], [56.29379, 25.2754], [56.28102, 25.28486], [56.2716, 25.27916], [56.27086, 25.26128], [56.28423, 25.26344]]]] } },
22611     { type: "Feature", properties: { iso1A2: "AF", iso1A3: "AFG", iso1N3: "004", wikidata: "Q889", nameEn: "Afghanistan", groups: ["034", "142", "UN"], callingCodes: ["93"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.61526, 38.34774], [70.60407, 38.28046], [70.54673, 38.24541], [70.4898, 38.12546], [70.17206, 37.93276], [70.1863, 37.84296], [70.27694, 37.81258], [70.28243, 37.66706], [70.15015, 37.52519], [69.95971, 37.5659], [69.93362, 37.61378], [69.84435, 37.60616], [69.80041, 37.5746], [69.51888, 37.5844], [69.44954, 37.4869], [69.36645, 37.40462], [69.45022, 37.23315], [69.39529, 37.16752], [69.25152, 37.09426], [69.03274, 37.25174], [68.96407, 37.32603], [68.88168, 37.33368], [68.91189, 37.26704], [68.80889, 37.32494], [68.81438, 37.23862], [68.6798, 37.27906], [68.61851, 37.19815], [68.41888, 37.13906], [68.41201, 37.10402], [68.29253, 37.10621], [68.27605, 37.00977], [68.18542, 37.02074], [68.02194, 36.91923], [67.87917, 37.0591], [67.7803, 37.08978], [67.78329, 37.1834], [67.51868, 37.26102], [67.2581, 37.17216], [67.2224, 37.24545], [67.13039, 37.27168], [67.08232, 37.35469], [66.95598, 37.40162], [66.64699, 37.32958], [66.55743, 37.35409], [66.30993, 37.32409], [65.72274, 37.55438], [65.64137, 37.45061], [65.64263, 37.34388], [65.51778, 37.23881], [64.97945, 37.21913], [64.61141, 36.6351], [64.62514, 36.44311], [64.57295, 36.34362], [64.43288, 36.24401], [64.05385, 36.10433], [63.98519, 36.03773], [63.56496, 35.95106], [63.53475, 35.90881], [63.29579, 35.85985], [63.12276, 35.86208], [63.10318, 35.81782], [63.23262, 35.67487], [63.10079, 35.63024], [63.12276, 35.53196], [63.0898, 35.43131], [62.90853, 35.37086], [62.74098, 35.25432], [62.62288, 35.22067], [62.48006, 35.28796], [62.29878, 35.13312], [62.29191, 35.25964], [62.15871, 35.33278], [62.05709, 35.43803], [61.97743, 35.4604], [61.77693, 35.41341], [61.58742, 35.43803], [61.27371, 35.61482], [61.18187, 35.30249], [61.0991, 35.27845], [61.12831, 35.09938], [61.06926, 34.82139], [61.00197, 34.70631], [60.99922, 34.63064], [60.72316, 34.52857], [60.91321, 34.30411], [60.66502, 34.31539], [60.50209, 34.13992], [60.5838, 33.80793], [60.5485, 33.73422], [60.57762, 33.59772], [60.69573, 33.56054], [60.91133, 33.55596], [60.88908, 33.50219], [60.56485, 33.12944], [60.86191, 32.22565], [60.84541, 31.49561], [61.70929, 31.37391], [61.80569, 31.16167], [61.80957, 31.12576], [61.83257, 31.0452], [61.8335, 30.97669], [61.78268, 30.92724], [61.80829, 30.84224], [60.87231, 29.86514], [62.47751, 29.40782], [63.5876, 29.50456], [64.12966, 29.39157], [64.19796, 29.50407], [64.62116, 29.58903], [65.04005, 29.53957], [66.24175, 29.85181], [66.36042, 29.9583], [66.23609, 30.06321], [66.34869, 30.404], [66.28413, 30.57001], [66.39194, 30.9408], [66.42645, 30.95309], [66.58175, 30.97532], [66.68166, 31.07597], [66.72561, 31.20526], [66.83273, 31.26867], [67.04147, 31.31561], [67.03323, 31.24519], [67.29964, 31.19586], [67.78854, 31.33203], [67.7748, 31.4188], [67.62374, 31.40473], [67.58323, 31.52772], [67.72056, 31.52304], [67.86887, 31.63536], [68.00071, 31.6564], [68.1655, 31.82691], [68.25614, 31.80357], [68.27605, 31.75863], [68.44222, 31.76446], [68.57475, 31.83158], [68.6956, 31.75687], [68.79997, 31.61665], [68.91078, 31.59687], [68.95995, 31.64822], [69.00939, 31.62249], [69.11514, 31.70782], [69.20577, 31.85957], [69.3225, 31.93186], [69.27032, 32.14141], [69.27932, 32.29119], [69.23599, 32.45946], [69.2868, 32.53938], [69.38155, 32.56601], [69.44747, 32.6678], [69.43649, 32.7302], [69.38018, 32.76601], [69.47082, 32.85834], [69.5436, 32.8768], [69.49854, 32.88843], [69.49004, 33.01509], [69.57656, 33.09911], [69.71526, 33.09911], [69.79766, 33.13247], [69.85259, 33.09451], [70.02563, 33.14282], [70.07369, 33.22557], [70.13686, 33.21064], [70.32775, 33.34496], [70.17062, 33.53535], [70.20141, 33.64387], [70.14785, 33.6553], [70.14236, 33.71701], [70.00503, 33.73528], [69.85671, 33.93719], [69.87307, 33.9689], [69.90203, 34.04194], [70.54336, 33.9463], [70.88119, 33.97933], [71.07345, 34.06242], [71.06933, 34.10564], [71.09307, 34.11961], [71.09453, 34.13524], [71.13078, 34.16503], [71.12815, 34.26619], [71.17662, 34.36769], [71.02401, 34.44835], [71.0089, 34.54568], [71.11602, 34.63047], [71.08718, 34.69034], [71.28356, 34.80882], [71.29472, 34.87728], [71.50329, 34.97328], [71.49917, 35.00478], [71.55273, 35.02615], [71.52938, 35.09023], [71.67495, 35.21262], [71.5541, 35.28776], [71.54294, 35.31037], [71.65435, 35.4479], [71.49917, 35.6267], [71.55273, 35.71483], [71.37969, 35.95865], [71.19505, 36.04134], [71.60491, 36.39429], [71.80267, 36.49924], [72.18135, 36.71838], [72.6323, 36.84601], [73.82685, 36.91421], [74.04856, 36.82648], [74.43389, 37.00977], [74.53739, 36.96224], [74.56453, 37.03023], [74.49981, 37.24518], [74.80605, 37.21565], [74.88887, 37.23275], [74.8294, 37.3435], [74.68383, 37.3948], [74.56161, 37.37734], [74.41055, 37.3948], [74.23339, 37.41116], [74.20308, 37.34208], [73.8564, 37.26158], [73.82552, 37.22659], [73.64974, 37.23643], [73.61129, 37.27469], [73.76647, 37.33913], [73.77197, 37.4417], [73.29633, 37.46495], [73.06884, 37.31729], [72.79693, 37.22222], [72.66381, 37.02014], [72.54095, 37.00007], [72.31676, 36.98115], [71.83229, 36.68084], [71.67083, 36.67346], [71.57195, 36.74943], [71.51502, 36.89128], [71.48481, 36.93218], [71.46923, 36.99925], [71.45578, 37.03094], [71.43097, 37.05855], [71.44127, 37.11856], [71.4494, 37.18137], [71.4555, 37.21418], [71.47386, 37.2269], [71.48339, 37.23937], [71.4824, 37.24921], [71.48536, 37.26017], [71.50674, 37.31502], [71.49821, 37.31975], [71.4862, 37.33405], [71.47685, 37.40281], [71.49612, 37.4279], [71.5256, 37.47971], [71.50616, 37.50733], [71.49693, 37.53527], [71.5065, 37.60912], [71.51972, 37.61945], [71.54186, 37.69691], [71.55234, 37.73209], [71.53053, 37.76534], [71.54324, 37.77104], [71.55752, 37.78677], [71.59255, 37.79956], [71.58843, 37.92425], [71.51565, 37.95349], [71.32871, 37.88564], [71.296, 37.93403], [71.2809, 37.91995], [71.24969, 37.93031], [71.27278, 37.96496], [71.27622, 37.99946], [71.28922, 38.01272], [71.29878, 38.04429], [71.36444, 38.15358], [71.37803, 38.25641], [71.33869, 38.27335], [71.33114, 38.30339], [71.21291, 38.32797], [71.1451, 38.40106], [71.10957, 38.40671], [71.10592, 38.42077], [71.09542, 38.42517], [71.0556, 38.40176], [71.03545, 38.44779], [70.98693, 38.48862], [70.92728, 38.43021], [70.88719, 38.46826], [70.84376, 38.44688], [70.82538, 38.45394], [70.81697, 38.44507], [70.80521, 38.44447], [70.79766, 38.44944], [70.78702, 38.45031], [70.78581, 38.45502], [70.77132, 38.45548], [70.75455, 38.4252], [70.72485, 38.4131], [70.69807, 38.41861], [70.67438, 38.40597], [70.6761, 38.39144], [70.69189, 38.37031], [70.64966, 38.34999], [70.61526, 38.34774]]]] } },
22612     { type: "Feature", properties: { iso1A2: "AG", iso1A3: "ATG", iso1N3: "028", wikidata: "Q781", nameEn: "Antigua and Barbuda", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.66959, 18.6782], [-62.58307, 16.68909], [-62.1023, 16.97277], [-61.23098, 16.62484], [-61.66959, 18.6782]]]] } },
22613     { type: "Feature", properties: { iso1A2: "AI", iso1A3: "AIA", iso1N3: "660", wikidata: "Q25228", nameEn: "Anguilla", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.79029, 19.11219], [-63.35989, 18.06012], [-62.62718, 18.26185], [-63.79029, 19.11219]]]] } },
22614     { type: "Feature", properties: { iso1A2: "AL", iso1A3: "ALB", iso1N3: "008", wikidata: "Q222", nameEn: "Albania", groups: ["039", "150", "UN"], callingCodes: ["355"] }, geometry: { type: "MultiPolygon", coordinates: [[[[20.07761, 42.55582], [20.01834, 42.54622], [20.00842, 42.5109], [19.9324, 42.51699], [19.82333, 42.46581], [19.76549, 42.50237], [19.74731, 42.57422], [19.77375, 42.58517], [19.73244, 42.66299], [19.65972, 42.62774], [19.4836, 42.40831], [19.42352, 42.36546], [19.42, 42.33019], [19.28623, 42.17745], [19.40687, 42.10024], [19.37548, 42.06835], [19.36867, 42.02564], [19.37691, 41.96977], [19.34601, 41.95675], [19.33812, 41.90669], [19.37451, 41.8842], [19.37597, 41.84849], [19.26406, 41.74971], [19.0384, 40.35325], [19.95905, 39.82857], [19.97622, 39.78684], [19.92466, 39.69533], [19.98042, 39.6504], [20.00957, 39.69227], [20.05189, 39.69112], [20.12956, 39.65805], [20.15988, 39.652], [20.22376, 39.64532], [20.22707, 39.67459], [20.27412, 39.69884], [20.31961, 39.72799], [20.29152, 39.80421], [20.30804, 39.81563], [20.38572, 39.78516], [20.41475, 39.81437], [20.41546, 39.82832], [20.31135, 39.99438], [20.37911, 39.99058], [20.42373, 40.06777], [20.48487, 40.06271], [20.51297, 40.08168], [20.55593, 40.06524], [20.61081, 40.07866], [20.62566, 40.0897], [20.67162, 40.09433], [20.71789, 40.27739], [20.78234, 40.35803], [20.7906, 40.42726], [20.83688, 40.47882], [20.94925, 40.46625], [20.96908, 40.51526], [21.03932, 40.56299], [21.05833, 40.66586], [20.98134, 40.76046], [20.95752, 40.76982], [20.98396, 40.79109], [20.97887, 40.85475], [20.97693, 40.90103], [20.94305, 40.92399], [20.83671, 40.92752], [20.81567, 40.89662], [20.73504, 40.9081], [20.71634, 40.91781], [20.65558, 41.08009], [20.63454, 41.0889], [20.59832, 41.09066], [20.58546, 41.11179], [20.59715, 41.13644], [20.51068, 41.2323], [20.49432, 41.33679], [20.52119, 41.34381], [20.55976, 41.4087], [20.51301, 41.442], [20.49039, 41.49277], [20.45331, 41.51436], [20.45809, 41.5549], [20.52103, 41.56473], [20.55508, 41.58113], [20.51769, 41.65975], [20.52937, 41.69292], [20.51301, 41.72433], [20.53405, 41.78099], [20.57144, 41.7897], [20.55976, 41.87068], [20.59524, 41.8818], [20.57946, 41.91593], [20.63069, 41.94913], [20.59434, 42.03879], [20.55633, 42.08173], [20.56955, 42.12097], [20.48857, 42.25444], [20.3819, 42.3029], [20.34479, 42.32656], [20.24399, 42.32168], [20.21797, 42.41237], [20.17127, 42.50469], [20.07761, 42.55582]]]] } },
22615     { type: "Feature", properties: { iso1A2: "AM", iso1A3: "ARM", iso1N3: "051", wikidata: "Q399", nameEn: "Armenia", groups: ["145", "142", "UN"], callingCodes: ["374"] }, geometry: { type: "MultiPolygon", coordinates: [[[[45.0133, 41.29747], [44.93493, 41.25685], [44.81437, 41.30371], [44.80053, 41.25949], [44.81749, 41.23488], [44.84358, 41.23088], [44.89911, 41.21366], [44.87887, 41.20195], [44.82084, 41.21513], [44.72814, 41.20338], [44.61462, 41.24018], [44.59322, 41.1933], [44.46791, 41.18204], [44.34417, 41.2382], [44.34337, 41.20312], [44.32139, 41.2079], [44.18148, 41.24644], [44.16591, 41.19141], [43.84835, 41.16329], [43.74717, 41.1117], [43.67712, 41.13398], [43.4717, 41.12611], [43.44984, 41.0988], [43.47319, 41.02251], [43.58683, 40.98961], [43.67712, 40.93084], [43.67712, 40.84846], [43.74872, 40.7365], [43.7425, 40.66805], [43.63664, 40.54159], [43.54791, 40.47413], [43.60862, 40.43267], [43.59928, 40.34019], [43.71136, 40.16673], [43.65221, 40.14889], [43.65688, 40.11199], [43.92307, 40.01787], [44.1057, 40.03555], [44.1778, 40.02845], [44.26973, 40.04866], [44.46635, 39.97733], [44.61845, 39.8281], [44.75779, 39.7148], [44.88354, 39.74432], [44.92869, 39.72157], [45.06604, 39.79277], [45.18554, 39.67846], [45.17464, 39.58614], [45.21784, 39.58074], [45.23535, 39.61373], [45.30385, 39.61373], [45.29606, 39.57654], [45.46992, 39.49888], [45.70547, 39.60174], [45.80804, 39.56716], [45.83, 39.46487], [45.79225, 39.3695], [45.99774, 39.28931], [46.02303, 39.09978], [46.06973, 39.0744], [46.14785, 38.84206], [46.20601, 38.85262], [46.34059, 38.92076], [46.53497, 38.86548], [46.51805, 38.94982], [46.54296, 39.07078], [46.44022, 39.19636], [46.52584, 39.18912], [46.54141, 39.15895], [46.58032, 39.21204], [46.63481, 39.23013], [46.56476, 39.24942], [46.50093, 39.33736], [46.43244, 39.35181], [46.37795, 39.42039], [46.4013, 39.45405], [46.53051, 39.47809], [46.51027, 39.52373], [46.57721, 39.54414], [46.57098, 39.56694], [46.52117, 39.58734], [46.42465, 39.57534], [46.40286, 39.63651], [46.18493, 39.60533], [45.96543, 39.78859], [45.82533, 39.82925], [45.7833, 39.9475], [45.60895, 39.97733], [45.59806, 40.0131], [45.78642, 40.03218], [45.83779, 39.98925], [45.97944, 40.181], [45.95609, 40.27846], [45.65098, 40.37696], [45.42994, 40.53804], [45.45484, 40.57707], [45.35366, 40.65979], [45.4206, 40.7424], [45.55914, 40.78366], [45.60584, 40.87436], [45.40814, 40.97904], [45.44083, 41.01663], [45.39725, 41.02603], [45.35677, 40.99784], [45.28859, 41.03757], [45.26162, 41.0228], [45.25897, 41.0027], [45.1994, 41.04518], [45.16493, 41.05068], [45.1634, 41.08082], [45.1313, 41.09369], [45.12923, 41.06059], [45.06784, 41.05379], [45.08028, 41.10917], [45.19942, 41.13299], [45.1969, 41.168], [45.11811, 41.19967], [45.05201, 41.19211], [45.02932, 41.2101], [45.05497, 41.2464], [45.0133, 41.29747]], [[45.21324, 40.9817], [45.21219, 40.99001], [45.20518, 40.99348], [45.19312, 40.98998], [45.18382, 41.0066], [45.20625, 41.01484], [45.23487, 41.00226], [45.23095, 40.97828], [45.21324, 40.9817]], [[45.00864, 41.03411], [44.9903, 41.05657], [44.96031, 41.06345], [44.95383, 41.07553], [44.97169, 41.09176], [45.00864, 41.09407], [45.03406, 41.07931], [45.04517, 41.06653], [45.03792, 41.03938], [45.00864, 41.03411]]], [[[45.50279, 40.58424], [45.56071, 40.64765], [45.51825, 40.67382], [45.47927, 40.65023], [45.50279, 40.58424]]]] } },
22616     { type: "Feature", properties: { iso1A2: "AO", iso1A3: "AGO", iso1N3: "024", wikidata: "Q916", nameEn: "Angola", groups: ["017", "202", "002", "UN"], callingCodes: ["244"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.55507, -5.85631], [13.04371, -5.87078], [12.42245, -6.07585], [11.95767, -5.94705], [12.20376, -5.76338], [12.26557, -5.74031], [12.52318, -5.74353], [12.52301, -5.17481], [12.53599, -5.1618], [12.53586, -5.14658], [12.51589, -5.1332], [12.49815, -5.14058], [12.46297, -5.09408], [12.60251, -5.01715], [12.63465, -4.94632], [12.70868, -4.95505], [12.8733, -4.74346], [13.11195, -4.67745], [13.09648, -4.63739], [12.91489, -4.47907], [12.87096, -4.40315], [12.76844, -4.38709], [12.64835, -4.55937], [12.40964, -4.60609], [12.32324, -4.78415], [12.25587, -4.79437], [12.20901, -4.75642], [12.16068, -4.90089], [12.00924, -5.02627], [11.50888, -5.33417], [10.5065, -17.25284], [11.75063, -17.25013], [12.07076, -17.15165], [12.52111, -17.24495], [12.97145, -16.98567], [13.36212, -16.98048], [13.95896, -17.43141], [14.28743, -17.38814], [18.39229, -17.38927], [18.84226, -17.80375], [21.14283, -17.94318], [21.42741, -18.02787], [23.47474, -17.62877], [23.20038, -17.47563], [22.17217, -16.50269], [22.00323, -16.18028], [21.97988, -13.00148], [24.03339, -12.99091], [23.90937, -12.844], [24.06672, -12.29058], [23.98804, -12.13149], [24.02603, -11.15368], [24.00027, -10.89356], [23.86868, -11.02856], [23.45631, -10.946], [23.16602, -11.10577], [22.54205, -11.05784], [22.25951, -11.24911], [22.17954, -10.85884], [22.32604, -10.76291], [22.19039, -9.94628], [21.84856, -9.59871], [21.79824, -7.29628], [20.56263, -7.28566], [20.61689, -6.90876], [20.31846, -6.91953], [20.30218, -6.98955], [19.5469, -7.00195], [19.33698, -7.99743], [18.33635, -8.00126], [17.5828, -8.13784], [16.96282, -7.21787], [16.55507, -5.85631]]]] } },
22617     { type: "Feature", properties: { iso1A2: "AQ", iso1A3: "ATA", iso1N3: "010", wikidata: "Q51", nameEn: "Antarctica", level: "region", callingCodes: ["672"] }, geometry: { type: "MultiPolygon", coordinates: [[[[180, -60], [-180, -60], [-180, -90], [180, -90], [180, -60]]]] } },
22618     { type: "Feature", properties: { iso1A2: "AR", iso1A3: "ARG", iso1N3: "032", wikidata: "Q414", nameEn: "Argentina", aliases: ["RA"], groups: ["005", "419", "019", "UN"], callingCodes: ["54"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.31343, -50.58411], [-72.33873, -51.59954], [-71.99889, -51.98018], [-69.97824, -52.00845], [-68.41683, -52.33516], [-68.60702, -52.65781], [-68.60733, -54.9125], [-68.01394, -54.8753], [-67.46182, -54.92205], [-67.11046, -54.94199], [-66.07313, -55.19618], [-63.67376, -55.11859], [-54.78916, -36.21945], [-57.83001, -34.69099], [-58.34425, -34.15035], [-58.44442, -33.84033], [-58.40475, -33.11777], [-58.1224, -32.98842], [-58.22362, -32.52416], [-58.10036, -32.25338], [-58.20252, -31.86966], [-58.00076, -31.65016], [-58.0023, -31.53084], [-58.07569, -31.44916], [-57.98127, -31.3872], [-57.9908, -31.34924], [-57.86729, -31.06352], [-57.89476, -30.95994], [-57.8024, -30.77193], [-57.89115, -30.49572], [-57.64859, -30.35095], [-57.61478, -30.25165], [-57.65132, -30.19229], [-57.09386, -29.74211], [-56.81251, -29.48154], [-56.62789, -29.18073], [-56.57295, -29.11357], [-56.54171, -29.11447], [-56.05265, -28.62651], [-56.00458, -28.60421], [-56.01729, -28.51223], [-55.65418, -28.18304], [-55.6262, -28.17124], [-55.33303, -27.94661], [-55.16872, -27.86224], [-55.1349, -27.89759], [-54.90805, -27.73149], [-54.90159, -27.63132], [-54.67657, -27.57214], [-54.50416, -27.48232], [-54.41888, -27.40882], [-54.19268, -27.30751], [-54.19062, -27.27639], [-54.15978, -27.2889], [-53.80144, -27.09844], [-53.73372, -26.6131], [-53.68269, -26.33359], [-53.64505, -26.28089], [-53.64186, -26.25976], [-53.64632, -26.24798], [-53.63881, -26.25075], [-53.63739, -26.2496], [-53.65237, -26.23289], [-53.65018, -26.19501], [-53.73968, -26.10012], [-53.73391, -26.07006], [-53.7264, -26.0664], [-53.73086, -26.05842], [-53.73511, -26.04211], [-53.83691, -25.94849], [-53.90831, -25.55513], [-54.52926, -25.62846], [-54.5502, -25.58915], [-54.59398, -25.59224], [-54.62063, -25.91213], [-54.60664, -25.9691], [-54.67359, -25.98607], [-54.69333, -26.37705], [-54.70732, -26.45099], [-54.80868, -26.55669], [-55.00584, -26.78754], [-55.06351, -26.80195], [-55.16948, -26.96068], [-55.25243, -26.93808], [-55.39611, -26.97679], [-55.62322, -27.1941], [-55.59094, -27.32444], [-55.74475, -27.44485], [-55.89195, -27.3467], [-56.18313, -27.29851], [-56.85337, -27.5165], [-58.04205, -27.2387], [-58.59549, -27.29973], [-58.65321, -27.14028], [-58.3198, -26.83443], [-58.1188, -26.16704], [-57.87176, -25.93604], [-57.57431, -25.47269], [-57.80821, -25.13863], [-58.25492, -24.92528], [-58.33055, -24.97099], [-59.33886, -24.49935], [-59.45482, -24.34787], [-60.03367, -24.00701], [-60.28163, -24.04436], [-60.99754, -23.80934], [-61.0782, -23.62932], [-61.9756, -23.0507], [-62.22768, -22.55807], [-62.51761, -22.37684], [-62.64455, -22.25091], [-62.8078, -22.12534], [-62.81124, -21.9987], [-63.66482, -21.99918], [-63.68113, -22.0544], [-63.70963, -21.99934], [-63.93287, -21.99934], [-64.22918, -22.55807], [-64.31489, -22.88824], [-64.35108, -22.73282], [-64.4176, -22.67692], [-64.58888, -22.25035], [-64.67174, -22.18957], [-64.90014, -22.12136], [-64.99524, -22.08255], [-65.47435, -22.08908], [-65.57743, -22.07675], [-65.58694, -22.09794], [-65.61166, -22.09504], [-65.7467, -22.10105], [-65.9261, -21.93335], [-66.04832, -21.9187], [-66.03836, -21.84829], [-66.24077, -21.77837], [-66.29714, -22.08741], [-66.7298, -22.23644], [-67.18382, -22.81525], [-66.99632, -22.99839], [-67.33563, -24.04237], [-68.24825, -24.42596], [-68.56909, -24.69831], [-68.38372, -25.08636], [-68.57622, -25.32505], [-68.38372, -26.15353], [-68.56909, -26.28146], [-68.59048, -26.49861], [-68.27677, -26.90626], [-68.43363, -27.08414], [-68.77586, -27.16029], [-69.22504, -27.95042], [-69.66709, -28.44055], [-69.80969, -29.07185], [-69.99507, -29.28351], [-69.8596, -30.26131], [-70.14479, -30.36595], [-70.55832, -31.51559], [-69.88099, -33.34489], [-69.87386, -34.13344], [-70.49416, -35.24145], [-70.38008, -36.02375], [-70.95047, -36.4321], [-71.24279, -37.20264], [-70.89532, -38.6923], [-71.37826, -38.91474], [-71.92726, -40.72714], [-71.74901, -42.11711], [-72.15541, -42.15941], [-72.14828, -42.85321], [-71.64206, -43.64774], [-71.81318, -44.38097], [-71.16436, -44.46244], [-71.26418, -44.75684], [-72.06985, -44.81756], [-71.35687, -45.22075], [-71.75614, -45.61611], [-71.68577, -46.55385], [-71.94152, -47.13595], [-72.50478, -47.80586], [-72.27662, -48.28727], [-72.54042, -48.52392], [-72.56894, -48.81116], [-73.09655, -49.14342], [-73.45156, -49.79461], [-73.55259, -49.92488], [-73.15765, -50.78337], [-72.31343, -50.58411]]]] } },
22619     { type: "Feature", properties: { iso1A2: "AS", iso1A3: "ASM", iso1N3: "016", wikidata: "Q16641", nameEn: "American Samoa", aliases: ["US-AS"], country: "US", groups: ["Q1352230", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 684"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-171.39864, -10.21587], [-170.99605, -15.1275], [-166.32598, -15.26169], [-171.39864, -10.21587]]]] } },
22620     { type: "Feature", properties: { iso1A2: "AT", iso1A3: "AUT", iso1N3: "040", wikidata: "Q40", nameEn: "Austria", groups: ["EU", "155", "150", "UN"], callingCodes: ["43"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.34823, 48.98444], [15.28305, 48.98831], [15.26177, 48.95766], [15.16358, 48.94278], [15.15534, 48.99056], [14.99878, 49.01444], [14.97612, 48.96983], [14.98917, 48.90082], [14.95072, 48.79101], [14.98032, 48.77959], [14.9782, 48.7766], [14.98112, 48.77524], [14.9758, 48.76857], [14.95641, 48.75915], [14.94773, 48.76268], [14.81545, 48.7874], [14.80821, 48.77711], [14.80584, 48.73489], [14.72756, 48.69502], [14.71794, 48.59794], [14.66762, 48.58215], [14.60808, 48.62881], [14.56139, 48.60429], [14.4587, 48.64695], [14.43076, 48.58855], [14.33909, 48.55852], [14.20691, 48.5898], [14.09104, 48.5943], [14.01482, 48.63788], [14.06151, 48.66873], [13.84023, 48.76988], [13.82266, 48.75544], [13.81863, 48.73257], [13.79337, 48.71375], [13.81791, 48.69832], [13.81283, 48.68426], [13.81901, 48.6761], [13.82609, 48.62345], [13.80038, 48.59487], [13.80519, 48.58026], [13.76921, 48.55324], [13.7513, 48.5624], [13.74816, 48.53058], [13.72802, 48.51208], [13.66113, 48.53558], [13.65186, 48.55092], [13.62508, 48.55501], [13.59705, 48.57013], [13.57535, 48.55912], [13.51291, 48.59023], [13.50131, 48.58091], [13.50663, 48.57506], [13.46967, 48.55157], [13.45214, 48.56472], [13.43695, 48.55776], [13.45727, 48.51092], [13.42527, 48.45711], [13.43929, 48.43386], [13.40709, 48.37292], [13.30897, 48.31575], [13.26039, 48.29422], [13.18093, 48.29577], [13.126, 48.27867], [13.0851, 48.27711], [13.02083, 48.25689], [12.95306, 48.20629], [12.87126, 48.20318], [12.84475, 48.16556], [12.836, 48.1647], [12.8362, 48.15876], [12.82673, 48.15245], [12.80676, 48.14979], [12.78595, 48.12445], [12.7617, 48.12796], [12.74973, 48.10885], [12.76141, 48.07373], [12.8549, 48.01122], [12.87476, 47.96195], [12.91683, 47.95647], [12.9211, 47.95135], [12.91985, 47.94069], [12.92668, 47.93879], [12.93419, 47.94063], [12.93642, 47.94436], [12.93886, 47.94046], [12.94163, 47.92927], [13.00588, 47.84374], [12.98543, 47.82896], [12.96311, 47.79957], [12.93202, 47.77302], [12.94371, 47.76281], [12.9353, 47.74788], [12.91711, 47.74026], [12.90274, 47.72513], [12.91333, 47.7178], [12.92969, 47.71094], [12.98578, 47.7078], [13.01382, 47.72116], [13.07692, 47.68814], [13.09562, 47.63304], [13.06407, 47.60075], [13.06641, 47.58577], [13.04537, 47.58183], [13.05355, 47.56291], [13.03252, 47.53373], [13.04537, 47.49426], [12.9998, 47.46267], [12.98344, 47.48716], [12.9624, 47.47452], [12.85256, 47.52741], [12.84672, 47.54556], [12.80699, 47.54477], [12.77427, 47.58025], [12.82101, 47.61493], [12.76492, 47.64485], [12.77777, 47.66689], [12.7357, 47.6787], [12.6071, 47.6741], [12.57438, 47.63238], [12.53816, 47.63553], [12.50076, 47.62293], [12.44117, 47.6741], [12.43883, 47.6977], [12.37222, 47.68433], [12.336, 47.69534], [12.27991, 47.68827], [12.26004, 47.67725], [12.24017, 47.69534], [12.26238, 47.73544], [12.2542, 47.7433], [12.22571, 47.71776], [12.18303, 47.70065], [12.16217, 47.70105], [12.16769, 47.68167], [12.18347, 47.66663], [12.18507, 47.65984], [12.19895, 47.64085], [12.20801, 47.61082], [12.20398, 47.60667], [12.18568, 47.6049], [12.17737, 47.60121], [12.18145, 47.61019], [12.17824, 47.61506], [12.13734, 47.60639], [12.05788, 47.61742], [12.02282, 47.61033], [12.0088, 47.62451], [11.85572, 47.60166], [11.84052, 47.58354], [11.63934, 47.59202], [11.60681, 47.57881], [11.58811, 47.55515], [11.58578, 47.52281], [11.52618, 47.50939], [11.4362, 47.51413], [11.38128, 47.47465], [11.4175, 47.44621], [11.33804, 47.44937], [11.29597, 47.42566], [11.27844, 47.39956], [11.22002, 47.3964], [11.25157, 47.43277], [11.20482, 47.43198], [11.12536, 47.41222], [11.11835, 47.39719], [10.97111, 47.39561], [10.97111, 47.41617], [10.98513, 47.42882], [10.92437, 47.46991], [10.93839, 47.48018], [10.90918, 47.48571], [10.87061, 47.4786], [10.86945, 47.5015], [10.91268, 47.51334], [10.88814, 47.53701], [10.77596, 47.51729], [10.7596, 47.53228], [10.6965, 47.54253], [10.68832, 47.55752], [10.63456, 47.5591], [10.60337, 47.56755], [10.56912, 47.53584], [10.48849, 47.54057], [10.47329, 47.58552], [10.43473, 47.58394], [10.44992, 47.5524], [10.4324, 47.50111], [10.44291, 47.48453], [10.46278, 47.47901], [10.47446, 47.43318], [10.4359, 47.41183], [10.4324, 47.38494], [10.39851, 47.37623], [10.33424, 47.30813], [10.23257, 47.27088], [10.17531, 47.27167], [10.17648, 47.29149], [10.2147, 47.31014], [10.19998, 47.32832], [10.23757, 47.37609], [10.22774, 47.38904], [10.2127, 47.38019], [10.17648, 47.38889], [10.16362, 47.36674], [10.11805, 47.37228], [10.09819, 47.35724], [10.06897, 47.40709], [10.1052, 47.4316], [10.09001, 47.46005], [10.07131, 47.45531], [10.03859, 47.48927], [10.00003, 47.48216], [9.96029, 47.53899], [9.92407, 47.53111], [9.87733, 47.54688], [9.87499, 47.52953], [9.8189, 47.54688], [9.82591, 47.58158], [9.80254, 47.59419], [9.76748, 47.5934], [9.72736, 47.53457], [9.55125, 47.53629], [9.56312, 47.49495], [9.58208, 47.48344], [9.59482, 47.46305], [9.60205, 47.46165], [9.60484, 47.46358], [9.60841, 47.47178], [9.62158, 47.45858], [9.62475, 47.45685], [9.6423, 47.45599], [9.65728, 47.45383], [9.65863, 47.44847], [9.64483, 47.43842], [9.6446, 47.43233], [9.65043, 47.41937], [9.65136, 47.40504], [9.6629, 47.39591], [9.67334, 47.39191], [9.67445, 47.38429], [9.6711, 47.37824], [9.66243, 47.37136], [9.65427, 47.36824], [9.62476, 47.36639], [9.59978, 47.34671], [9.58513, 47.31334], [9.55857, 47.29919], [9.54773, 47.2809], [9.53116, 47.27029], [9.56766, 47.24281], [9.55176, 47.22585], [9.56981, 47.21926], [9.58264, 47.20673], [9.56539, 47.17124], [9.62623, 47.14685], [9.63395, 47.08443], [9.61216, 47.07732], [9.60717, 47.06091], [9.87935, 47.01337], [9.88266, 46.93343], [9.98058, 46.91434], [10.10715, 46.84296], [10.22675, 46.86942], [10.24128, 46.93147], [10.30031, 46.92093], [10.36933, 47.00212], [10.48376, 46.93891], [10.47197, 46.85698], [10.54783, 46.84505], [10.66405, 46.87614], [10.75753, 46.82258], [10.72974, 46.78972], [11.00764, 46.76896], [11.10618, 46.92966], [11.33355, 46.99862], [11.50739, 47.00644], [11.74789, 46.98484], [12.19254, 47.09331], [12.21781, 47.03996], [12.11675, 47.01241], [12.2006, 46.88854], [12.27591, 46.88651], [12.38708, 46.71529], [12.59992, 46.6595], [12.94445, 46.60401], [13.27627, 46.56059], [13.64088, 46.53438], [13.7148, 46.5222], [13.89837, 46.52331], [14.00422, 46.48474], [14.04002, 46.49117], [14.12097, 46.47724], [14.15989, 46.43327], [14.28326, 46.44315], [14.314, 46.43327], [14.42608, 46.44614], [14.45877, 46.41717], [14.52176, 46.42617], [14.56463, 46.37208], [14.5942, 46.43434], [14.66892, 46.44936], [14.72185, 46.49974], [14.81836, 46.51046], [14.83549, 46.56614], [14.86419, 46.59411], [14.87129, 46.61], [14.92283, 46.60848], [14.96002, 46.63459], [14.98024, 46.6009], [15.01451, 46.641], [15.14215, 46.66131], [15.23711, 46.63994], [15.41235, 46.65556], [15.45514, 46.63697], [15.46906, 46.61321], [15.54431, 46.6312], [15.55333, 46.64988], [15.54533, 46.66985], [15.59826, 46.68908], [15.62317, 46.67947], [15.63255, 46.68069], [15.6365, 46.6894], [15.6543, 46.69228], [15.6543, 46.70616], [15.67411, 46.70735], [15.69523, 46.69823], [15.72279, 46.69548], [15.73823, 46.70011], [15.76771, 46.69863], [15.78518, 46.70712], [15.8162, 46.71897], [15.87691, 46.7211], [15.94864, 46.68769], [15.98512, 46.68463], [15.99988, 46.67947], [16.04036, 46.6549], [16.04347, 46.68694], [16.02808, 46.71094], [15.99769, 46.7266], [15.98432, 46.74991], [15.99126, 46.78199], [15.99054, 46.82772], [16.05786, 46.83927], [16.10983, 46.867], [16.19904, 46.94134], [16.22403, 46.939], [16.27594, 46.9643], [16.28202, 47.00159], [16.51369, 47.00084], [16.43936, 47.03548], [16.52176, 47.05747], [16.46134, 47.09395], [16.52863, 47.13974], [16.44932, 47.14418], [16.46442, 47.16845], [16.4523, 47.18812], [16.42801, 47.18422], [16.41739, 47.20649], [16.43663, 47.21127], [16.44142, 47.25079], [16.47782, 47.25918], [16.45104, 47.41181], [16.49908, 47.39416], [16.52414, 47.41007], [16.57152, 47.40868], [16.6718, 47.46139], [16.64821, 47.50155], [16.71059, 47.52692], [16.64193, 47.63114], [16.58699, 47.61772], [16.4222, 47.66537], [16.55129, 47.72268], [16.53514, 47.73837], [16.54779, 47.75074], [16.61183, 47.76171], [16.65679, 47.74197], [16.72089, 47.73469], [16.7511, 47.67878], [16.82938, 47.68432], [16.86509, 47.72268], [16.87538, 47.68895], [17.08893, 47.70928], [17.05048, 47.79377], [17.07039, 47.81129], [17.00997, 47.86245], [17.08275, 47.87719], [17.11022, 47.92461], [17.09786, 47.97336], [17.16001, 48.00636], [17.07039, 48.0317], [17.09168, 48.09366], [17.05735, 48.14179], [17.02919, 48.13996], [16.97701, 48.17385], [16.89461, 48.31332], [16.90903, 48.32519], [16.84243, 48.35258], [16.83317, 48.38138], [16.83588, 48.3844], [16.8497, 48.38321], [16.85204, 48.44968], [16.94611, 48.53614], [16.93955, 48.60371], [16.90354, 48.71541], [16.79779, 48.70998], [16.71883, 48.73806], [16.68518, 48.7281], [16.67008, 48.77699], [16.46134, 48.80865], [16.40915, 48.74576], [16.37345, 48.729], [16.06034, 48.75436], [15.84404, 48.86921], [15.78087, 48.87644], [15.75341, 48.8516], [15.6921, 48.85973], [15.61622, 48.89541], [15.51357, 48.91549], [15.48027, 48.94481], [15.34823, 48.98444]]]] } },
22621     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
22622     { type: "Feature", properties: { iso1A2: "AW", iso1A3: "ABW", iso1N3: "533", wikidata: "Q21203", nameEn: "Aruba", aliases: ["NL-AW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["297"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-70.00823, 12.98375], [-70.35625, 12.58277], [-69.60231, 12.17], [-70.00823, 12.98375]]]] } },
22623     { type: "Feature", properties: { iso1A2: "AX", iso1A3: "ALA", iso1N3: "248", wikidata: "Q5689", nameEn: "\xC5land Islands", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358 18", "358 457"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.08191, 60.19152], [20.5104, 59.15546], [21.35468, 59.67511], [21.02509, 60.12142], [21.08159, 60.20167], [21.15143, 60.54555], [20.96741, 60.71528], [19.23413, 60.61414], [19.08191, 60.19152]]]] } },
22624     { type: "Feature", properties: { iso1A2: "AZ", iso1A3: "AZE", iso1N3: "031", wikidata: "Q227", nameEn: "Azerbaijan", groups: ["145", "142", "UN"], callingCodes: ["994"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [46.3984, 41.84399], [46.30863, 41.79133], [46.23962, 41.75811], [46.20538, 41.77205], [46.17891, 41.72094], [46.19759, 41.62327], [46.24429, 41.59883], [46.26531, 41.63339], [46.28182, 41.60089], [46.3253, 41.60912], [46.34039, 41.5947], [46.34126, 41.57454], [46.29794, 41.5724], [46.33925, 41.4963], [46.40307, 41.48464], [46.4669, 41.43331], [46.63658, 41.37727], [46.72375, 41.28609], [46.66148, 41.20533], [46.63969, 41.09515], [46.55096, 41.1104], [46.48558, 41.0576], [46.456, 41.09984], [46.37661, 41.10805], [46.27698, 41.19011], [46.13221, 41.19479], [45.95786, 41.17956], [45.80842, 41.2229], [45.69946, 41.29545], [45.75705, 41.35157], [45.71035, 41.36208], [45.68389, 41.3539], [45.45973, 41.45898], [45.4006, 41.42402], [45.31352, 41.47168], [45.26285, 41.46433], [45.1797, 41.42231], [45.09867, 41.34065], [45.0133, 41.29747], [45.05497, 41.2464], [45.02932, 41.2101], [45.05201, 41.19211], [45.11811, 41.19967], [45.1969, 41.168], [45.19942, 41.13299], [45.08028, 41.10917], [45.06784, 41.05379], [45.12923, 41.06059], [45.1313, 41.09369], [45.1634, 41.08082], [45.16493, 41.05068], [45.1994, 41.04518], [45.25897, 41.0027], [45.26162, 41.0228], [45.28859, 41.03757], [45.35677, 40.99784], [45.39725, 41.02603], [45.44083, 41.01663], [45.40814, 40.97904], [45.60584, 40.87436], [45.55914, 40.78366], [45.4206, 40.7424], [45.35366, 40.65979], [45.45484, 40.57707], [45.42994, 40.53804], [45.65098, 40.37696], [45.95609, 40.27846], [45.97944, 40.181], [45.83779, 39.98925], [45.78642, 40.03218], [45.59806, 40.0131], [45.60895, 39.97733], [45.7833, 39.9475], [45.82533, 39.82925], [45.96543, 39.78859], [46.18493, 39.60533], [46.40286, 39.63651], [46.42465, 39.57534], [46.52117, 39.58734], [46.57098, 39.56694], [46.57721, 39.54414], [46.51027, 39.52373], [46.53051, 39.47809], [46.4013, 39.45405], [46.37795, 39.42039], [46.43244, 39.35181], [46.50093, 39.33736], [46.56476, 39.24942], [46.63481, 39.23013], [46.58032, 39.21204], [46.54141, 39.15895], [46.52584, 39.18912], [46.44022, 39.19636], [46.54296, 39.07078], [46.51805, 38.94982], [46.53497, 38.86548], [46.75752, 39.03231], [46.83822, 39.13143], [46.92539, 39.16644], [46.95341, 39.13505], [47.05771, 39.20143], [47.05927, 39.24846], [47.31301, 39.37492], [47.38978, 39.45999], [47.50099, 39.49615], [47.84774, 39.66285], [47.98977, 39.70999], [48.34264, 39.42935], [48.37385, 39.37584], [48.15984, 39.30028], [48.12404, 39.25208], [48.15361, 39.19419], [48.31239, 39.09278], [48.33884, 39.03022], [48.28437, 38.97186], [48.08627, 38.94434], [48.07734, 38.91616], [48.01409, 38.90333], [48.02581, 38.82705], [48.24773, 38.71883], [48.3146, 38.59958], [48.45084, 38.61013], [48.58793, 38.45076], [48.62217, 38.40198], [48.70001, 38.40564], [48.78979, 38.45026], [48.81072, 38.44853], [48.84969, 38.45015], [48.88288, 38.43975], [52.39847, 39.43556], [48.80971, 41.95365], [48.5867, 41.84306], [48.55078, 41.77917], [48.42301, 41.65444], [48.40277, 41.60441], [48.2878, 41.56221], [48.22064, 41.51472], [48.07587, 41.49957], [47.87973, 41.21798], [47.75831, 41.19455], [47.62288, 41.22969], [47.54504, 41.20275], [47.49004, 41.26366], [47.34579, 41.27884], [47.10762, 41.59044], [47.03757, 41.55434], [46.99554, 41.59743], [47.00955, 41.63583], [46.8134, 41.76252], [46.75269, 41.8623], [46.58924, 41.80547], [46.5332, 41.87389], [46.42738, 41.91323]], [[45.50279, 40.58424], [45.47927, 40.65023], [45.51825, 40.67382], [45.56071, 40.64765], [45.50279, 40.58424]]], [[[45.00864, 41.03411], [45.03792, 41.03938], [45.04517, 41.06653], [45.03406, 41.07931], [45.00864, 41.09407], [44.97169, 41.09176], [44.95383, 41.07553], [44.96031, 41.06345], [44.9903, 41.05657], [45.00864, 41.03411]]], [[[45.21324, 40.9817], [45.23095, 40.97828], [45.23487, 41.00226], [45.20625, 41.01484], [45.18382, 41.0066], [45.19312, 40.98998], [45.20518, 40.99348], [45.21219, 40.99001], [45.21324, 40.9817]]], [[[45.46992, 39.49888], [45.29606, 39.57654], [45.30385, 39.61373], [45.23535, 39.61373], [45.21784, 39.58074], [45.17464, 39.58614], [45.18554, 39.67846], [45.06604, 39.79277], [44.92869, 39.72157], [44.88354, 39.74432], [44.75779, 39.7148], [44.80977, 39.65768], [44.81043, 39.62677], [44.88916, 39.59653], [44.96746, 39.42998], [45.05932, 39.36435], [45.08751, 39.35052], [45.16168, 39.21952], [45.30489, 39.18333], [45.40148, 39.09007], [45.40452, 39.07224], [45.44811, 39.04927], [45.44966, 38.99243], [45.6131, 38.964], [45.6155, 38.94304], [45.65172, 38.95199], [45.83883, 38.90768], [45.90266, 38.87739], [45.94624, 38.89072], [46.00228, 38.87376], [46.06766, 38.87861], [46.14785, 38.84206], [46.06973, 39.0744], [46.02303, 39.09978], [45.99774, 39.28931], [45.79225, 39.3695], [45.83, 39.46487], [45.80804, 39.56716], [45.70547, 39.60174], [45.46992, 39.49888]]]] } },
22625     { type: "Feature", properties: { iso1A2: "BA", iso1A3: "BIH", iso1N3: "070", wikidata: "Q225", nameEn: "Bosnia and Herzegovina", groups: ["039", "150", "UN"], callingCodes: ["387"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.84826, 45.04489], [17.66571, 45.13408], [17.59104, 45.10816], [17.51469, 45.10791], [17.47589, 45.12656], [17.45615, 45.12523], [17.4498, 45.16119], [17.41229, 45.13335], [17.33573, 45.14521], [17.32092, 45.16246], [17.26815, 45.18444], [17.25131, 45.14957], [17.24325, 45.146], [17.18438, 45.14764], [17.0415, 45.20759], [16.9385, 45.22742], [16.92405, 45.27607], [16.83804, 45.18951], [16.81137, 45.18434], [16.78219, 45.19002], [16.74845, 45.20393], [16.64962, 45.20714], [16.60194, 45.23042], [16.56559, 45.22307], [16.5501, 45.2212], [16.52982, 45.22713], [16.49155, 45.21153], [16.4634, 45.14522], [16.40023, 45.1147], [16.38309, 45.05955], [16.38219, 45.05139], [16.3749, 45.05206], [16.35863, 45.03529], [16.35404, 45.00241], [16.29036, 44.99732], [16.12153, 45.09616], [15.98412, 45.23088], [15.83512, 45.22459], [15.76371, 45.16508], [15.78842, 45.11519], [15.74585, 45.0638], [15.78568, 44.97401], [15.74723, 44.96818], [15.76096, 44.87045], [15.79472, 44.8455], [15.72584, 44.82334], [15.8255, 44.71501], [15.89348, 44.74964], [16.05828, 44.61538], [16.00884, 44.58605], [16.03012, 44.55572], [16.10566, 44.52586], [16.16814, 44.40679], [16.12969, 44.38275], [16.21346, 44.35231], [16.18688, 44.27012], [16.36864, 44.08263], [16.43662, 44.07523], [16.43629, 44.02826], [16.50528, 44.0244], [16.55472, 43.95326], [16.70922, 43.84887], [16.75316, 43.77157], [16.80736, 43.76011], [17.00585, 43.58037], [17.15828, 43.49376], [17.24411, 43.49376], [17.29699, 43.44542], [17.25579, 43.40353], [17.286, 43.33065], [17.46986, 43.16559], [17.64268, 43.08595], [17.70879, 42.97223], [17.5392, 42.92787], [17.6444, 42.88641], [17.68151, 42.92725], [17.7948, 42.89556], [17.80854, 42.9182], [17.88201, 42.83668], [18.24318, 42.6112], [18.36197, 42.61423], [18.43735, 42.55921], [18.49778, 42.58409], [18.53751, 42.57376], [18.55504, 42.58409], [18.52232, 42.62279], [18.57373, 42.64429], [18.54841, 42.68328], [18.54603, 42.69171], [18.55221, 42.69045], [18.56789, 42.72074], [18.47324, 42.74992], [18.45921, 42.81682], [18.47633, 42.85829], [18.4935, 42.86433], [18.49661, 42.89306], [18.49076, 42.95553], [18.52232, 43.01451], [18.66254, 43.03928], [18.64735, 43.14766], [18.66605, 43.2056], [18.71747, 43.2286], [18.6976, 43.25243], [18.76538, 43.29838], [18.85342, 43.32426], [18.84794, 43.33735], [18.83912, 43.34795], [18.90911, 43.36383], [18.95819, 43.32899], [18.95001, 43.29327], [19.00844, 43.24988], [19.04233, 43.30008], [19.08206, 43.29668], [19.08673, 43.31453], [19.04071, 43.397], [19.01078, 43.43854], [18.96053, 43.45042], [18.95469, 43.49367], [18.91379, 43.50299], [19.01078, 43.55806], [19.04934, 43.50384], [19.13933, 43.5282], [19.15685, 43.53943], [19.22807, 43.5264], [19.24774, 43.53061], [19.2553, 43.5938], [19.33426, 43.58833], [19.36653, 43.60921], [19.41941, 43.54056], [19.42696, 43.57987], [19.50455, 43.58385], [19.5176, 43.71403], [19.3986, 43.79668], [19.23465, 43.98764], [19.24363, 44.01502], [19.38439, 43.96611], [19.52515, 43.95573], [19.56498, 43.99922], [19.61836, 44.01464], [19.61991, 44.05254], [19.57467, 44.04716], [19.55999, 44.06894], [19.51167, 44.08158], [19.47321, 44.1193], [19.48386, 44.14332], [19.47338, 44.15034], [19.43905, 44.13088], [19.40927, 44.16722], [19.3588, 44.18353], [19.34773, 44.23244], [19.32464, 44.27185], [19.26945, 44.26957], [19.23306, 44.26097], [19.20508, 44.2917], [19.18328, 44.28383], [19.16741, 44.28648], [19.13332, 44.31492], [19.13556, 44.338], [19.11547, 44.34218], [19.1083, 44.3558], [19.11865, 44.36712], [19.10298, 44.36924], [19.10365, 44.37795], [19.10704, 44.38249], [19.10749, 44.39421], [19.11785, 44.40313], [19.14681, 44.41463], [19.14837, 44.45253], [19.12278, 44.50132], [19.13369, 44.52521], [19.16699, 44.52197], [19.26388, 44.65412], [19.32543, 44.74058], [19.36722, 44.88164], [19.18183, 44.92055], [19.01994, 44.85493], [18.8704, 44.85097], [18.76347, 44.90669], [18.76369, 44.93707], [18.80661, 44.93561], [18.78357, 44.97741], [18.65723, 45.07544], [18.47939, 45.05871], [18.41896, 45.11083], [18.32077, 45.1021], [18.24387, 45.13699], [18.1624, 45.07654], [18.03121, 45.12632], [18.01594, 45.15163], [17.99479, 45.14958], [17.97834, 45.13831], [17.97336, 45.12245], [17.93706, 45.08016], [17.87148, 45.04645], [17.84826, 45.04489]]]] } },
22626     { type: "Feature", properties: { iso1A2: "BB", iso1A3: "BRB", iso1N3: "052", wikidata: "Q244", nameEn: "Barbados", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.56442, 13.24471], [-59.80731, 13.87556], [-59.82929, 12.70644], [-58.56442, 13.24471]]]] } },
22627     { type: "Feature", properties: { iso1A2: "BD", iso1A3: "BGD", iso1N3: "050", wikidata: "Q902", nameEn: "Bangladesh", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["880"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.15869, 26.13708], [89.08899, 26.38845], [88.95612, 26.4564], [88.92357, 26.40711], [88.91321, 26.37984], [89.05328, 26.2469], [88.85004, 26.23211], [88.78961, 26.31093], [88.67837, 26.26291], [88.69485, 26.38353], [88.62144, 26.46783], [88.4298, 26.54489], [88.41196, 26.63837], [88.33093, 26.48929], [88.35153, 26.45241], [88.36938, 26.48683], [88.48749, 26.45855], [88.51649, 26.35923], [88.35153, 26.29123], [88.34757, 26.22216], [88.1844, 26.14417], [88.16581, 26.0238], [88.08804, 25.91334], [88.13138, 25.78773], [88.242, 25.80811], [88.45103, 25.66245], [88.4559, 25.59227], [88.677, 25.46959], [88.81296, 25.51546], [88.85278, 25.34679], [89.01105, 25.30303], [89.00463, 25.26583], [88.94067, 25.18534], [88.44766, 25.20149], [88.46277, 25.07468], [88.33917, 24.86803], [88.27325, 24.88796], [88.21832, 24.96642], [88.14004, 24.93529], [88.15515, 24.85806], [88.00683, 24.66477], [88.08786, 24.63232], [88.12296, 24.51301], [88.50934, 24.32474], [88.68801, 24.31464], [88.74841, 24.1959], [88.6976, 24.14703], [88.73743, 23.91751], [88.66189, 23.87607], [88.58087, 23.87105], [88.56507, 23.64044], [88.74841, 23.47361], [88.79351, 23.50535], [88.79254, 23.46028], [88.71133, 23.2492], [88.99148, 23.21134], [88.86377, 23.08759], [88.88327, 23.03885], [88.87063, 22.95235], [88.96713, 22.83346], [88.9151, 22.75228], [88.94614, 22.66941], [88.9367, 22.58527], [89.07114, 22.15335], [89.08044, 21.41871], [92.47409, 20.38654], [92.26071, 21.05697], [92.17752, 21.17445], [92.20087, 21.337], [92.37939, 21.47764], [92.43158, 21.37025], [92.55105, 21.3856], [92.60187, 21.24615], [92.68152, 21.28454], [92.59775, 21.6092], [92.62187, 21.87037], [92.60949, 21.97638], [92.56616, 22.13554], [92.60029, 22.1522], [92.5181, 22.71441], [92.37665, 22.9435], [92.38214, 23.28705], [92.26541, 23.70392], [92.15417, 23.73409], [92.04706, 23.64229], [91.95093, 23.73284], [91.95642, 23.47361], [91.84789, 23.42235], [91.76417, 23.26619], [91.81634, 23.08001], [91.7324, 23.00043], [91.61571, 22.93929], [91.54993, 23.01051], [91.46615, 23.2328], [91.4035, 23.27522], [91.40848, 23.07117], [91.36453, 23.06612], [91.28293, 23.37538], [91.15579, 23.6599], [91.25192, 23.83463], [91.22308, 23.89616], [91.29587, 24.0041], [91.35741, 23.99072], [91.37414, 24.10693], [91.55542, 24.08687], [91.63782, 24.1132], [91.65292, 24.22095], [91.73257, 24.14703], [91.76004, 24.23848], [91.82596, 24.22345], [91.89258, 24.14674], [91.96603, 24.3799], [92.11662, 24.38997], [92.15796, 24.54435], [92.25854, 24.9191], [92.38626, 24.86055], [92.49887, 24.88796], [92.39147, 25.01471], [92.33957, 25.07593], [92.0316, 25.1834], [91.63648, 25.12846], [91.25517, 25.20677], [90.87427, 25.15799], [90.65042, 25.17788], [90.40034, 25.1534], [90.1155, 25.22686], [89.90478, 25.31038], [89.87629, 25.28337], [89.83371, 25.29548], [89.84086, 25.31854], [89.81208, 25.37244], [89.86129, 25.61714], [89.84388, 25.70042], [89.80585, 25.82489], [89.86592, 25.93115], [89.77728, 26.04254], [89.77865, 26.08387], [89.73581, 26.15818], [89.70201, 26.15138], [89.63968, 26.22595], [89.57101, 25.9682], [89.53515, 26.00382], [89.35953, 26.0077], [89.15869, 26.13708]]]] } },
22628     { type: "Feature", properties: { iso1A2: "BE", iso1A3: "BEL", iso1N3: "056", wikidata: "Q31", nameEn: "Belgium", groups: ["EU", "155", "150", "UN"], callingCodes: ["32"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.93295, 51.44945], [4.93909, 51.44632], [4.9524, 51.45014], [4.95244, 51.45207], [4.93295, 51.44945]]], [[[4.91493, 51.4353], [4.92652, 51.43329], [4.92952, 51.42984], [4.93986, 51.43064], [4.94265, 51.44003], [4.93471, 51.43861], [4.93416, 51.44185], [4.94025, 51.44193], [4.93544, 51.44634], [4.92879, 51.44161], [4.92815, 51.43856], [4.92566, 51.44273], [4.92811, 51.4437], [4.92287, 51.44741], [4.91811, 51.44621], [4.92227, 51.44252], [4.91935, 51.43634], [4.91493, 51.4353]]], [[[4.82946, 51.4213], [4.82409, 51.44736], [4.84139, 51.4799], [4.78803, 51.50284], [4.77321, 51.50529], [4.74578, 51.48937], [4.72935, 51.48424], [4.65442, 51.42352], [4.57489, 51.4324], [4.53521, 51.4243], [4.52846, 51.45002], [4.54675, 51.47265], [4.5388, 51.48184], [4.47736, 51.4778], [4.38122, 51.44905], [4.39747, 51.43316], [4.38064, 51.41965], [4.43777, 51.36989], [4.39292, 51.35547], [4.34086, 51.35738], [4.33265, 51.37687], [4.21923, 51.37443], [4.24024, 51.35371], [4.16721, 51.29348], [4.05165, 51.24171], [4.01957, 51.24504], [3.97889, 51.22537], [3.90125, 51.20371], [3.78783, 51.2151], [3.78999, 51.25766], [3.58939, 51.30064], [3.51502, 51.28697], [3.52698, 51.2458], [3.43488, 51.24135], [3.41704, 51.25933], [3.38289, 51.27331], [3.35847, 51.31572], [3.38696, 51.33436], [3.36263, 51.37112], [2.56575, 51.85301], [2.18458, 51.52087], [2.55904, 51.07014], [2.57551, 51.00326], [2.63074, 50.94746], [2.59093, 50.91751], [2.63331, 50.81457], [2.71165, 50.81295], [2.81056, 50.71773], [2.8483, 50.72276], [2.86985, 50.7033], [2.87937, 50.70298], [2.88504, 50.70656], [2.90069, 50.69263], [2.91036, 50.6939], [2.90873, 50.702], [2.95019, 50.75138], [2.96778, 50.75242], [3.00537, 50.76588], [3.04314, 50.77674], [3.09163, 50.77717], [3.10614, 50.78303], [3.11206, 50.79416], [3.11987, 50.79188], [3.1257, 50.78603], [3.15017, 50.79031], [3.16476, 50.76843], [3.18339, 50.74981], [3.18811, 50.74025], [3.20064, 50.73547], [3.19017, 50.72569], [3.20845, 50.71662], [3.22042, 50.71019], [3.24593, 50.71389], [3.26063, 50.70086], [3.26141, 50.69151], [3.2536, 50.68977], [3.264, 50.67668], [3.23951, 50.6585], [3.2729, 50.60718], [3.28575, 50.52724], [3.37693, 50.49538], [3.44629, 50.51009], [3.47385, 50.53397], [3.51564, 50.5256], [3.49509, 50.48885], [3.5683, 50.50192], [3.58361, 50.49049], [3.61014, 50.49568], [3.64426, 50.46275], [3.66153, 50.45165], [3.67494, 50.40239], [3.67262, 50.38663], [3.65709, 50.36873], [3.66976, 50.34563], [3.71009, 50.30305], [3.70987, 50.3191], [3.73911, 50.34809], [3.84314, 50.35219], [3.90781, 50.32814], [3.96771, 50.34989], [4.0268, 50.35793], [4.0689, 50.3254], [4.10237, 50.31247], [4.10957, 50.30234], [4.11954, 50.30425], [4.13665, 50.25609], [4.16808, 50.25786], [4.15524, 50.2833], [4.17347, 50.28838], [4.17861, 50.27443], [4.20651, 50.27333], [4.21945, 50.25539], [4.15524, 50.21103], [4.16014, 50.19239], [4.13561, 50.13078], [4.20147, 50.13535], [4.23101, 50.06945], [4.16294, 50.04719], [4.13508, 50.01976], [4.14239, 49.98034], [4.20532, 49.95803], [4.31963, 49.97043], [4.35051, 49.95315], [4.43488, 49.94122], [4.51098, 49.94659], [4.5414, 49.96911], [4.68695, 49.99685], [4.70064, 50.09384], [4.75237, 50.11314], [4.82438, 50.16878], [4.83279, 50.15331], [4.88602, 50.15182], [4.8382, 50.06738], [4.78827, 49.95609], [4.88529, 49.9236], [4.85134, 49.86457], [4.86965, 49.82271], [4.85464, 49.78995], [4.96714, 49.79872], [5.09249, 49.76193], [5.14545, 49.70287], [5.26232, 49.69456], [5.31465, 49.66846], [5.33039, 49.6555], [5.30214, 49.63055], [5.3137, 49.61225], [5.33851, 49.61599], [5.34837, 49.62889], [5.3974, 49.61596], [5.43713, 49.5707], [5.46734, 49.52648], [5.46541, 49.49825], [5.55001, 49.52729], [5.60909, 49.51228], [5.64505, 49.55146], [5.75649, 49.54321], [5.7577, 49.55915], [5.77435, 49.56298], [5.79195, 49.55228], [5.81838, 49.54777], [5.84143, 49.5533], [5.84692, 49.55663], [5.8424, 49.56082], [5.87256, 49.57539], [5.86986, 49.58756], [5.84971, 49.58674], [5.84826, 49.5969], [5.8762, 49.60898], [5.87609, 49.62047], [5.88393, 49.62802], [5.88552, 49.63507], [5.90599, 49.63853], [5.90164, 49.6511], [5.9069, 49.66377], [5.86175, 49.67862], [5.86527, 49.69291], [5.88677, 49.70951], [5.86503, 49.72739], [5.84193, 49.72161], [5.82562, 49.72395], [5.83149, 49.74729], [5.82245, 49.75048], [5.78871, 49.7962], [5.75409, 49.79239], [5.74953, 49.81428], [5.74364, 49.82058], [5.74844, 49.82435], [5.7404, 49.83452], [5.74076, 49.83823], [5.74975, 49.83933], [5.74953, 49.84709], [5.75884, 49.84811], [5.74567, 49.85368], [5.75861, 49.85631], [5.75269, 49.8711], [5.78415, 49.87922], [5.73621, 49.89796], [5.77314, 49.93646], [5.77291, 49.96056], [5.80833, 49.96451], [5.81163, 49.97142], [5.83467, 49.97823], [5.83968, 49.9892], [5.82331, 49.99662], [5.81866, 50.01286], [5.8551, 50.02683], [5.86904, 50.04614], [5.85474, 50.06342], [5.8857, 50.07824], [5.89488, 50.11476], [5.95929, 50.13295], [5.96453, 50.17259], [6.02488, 50.18283], [6.03093, 50.16362], [6.06406, 50.15344], [6.08577, 50.17246], [6.12028, 50.16374], [6.1137, 50.13668], [6.1379, 50.12964], [6.15298, 50.14126], [6.14132, 50.14971], [6.14588, 50.17106], [6.18739, 50.1822], [6.18364, 50.20815], [6.16853, 50.2234], [6.208, 50.25179], [6.28797, 50.27458], [6.29949, 50.30887], [6.32488, 50.32333], [6.35701, 50.31139], [6.40641, 50.32425], [6.40785, 50.33557], [6.3688, 50.35898], [6.34406, 50.37994], [6.36852, 50.40776], [6.37219, 50.45397], [6.34005, 50.46083], [6.3465, 50.48833], [6.30809, 50.50058], [6.26637, 50.50272], [6.22335, 50.49578], [6.20599, 50.52089], [6.19193, 50.5212], [6.18716, 50.52653], [6.19579, 50.5313], [6.19735, 50.53576], [6.17802, 50.54179], [6.17739, 50.55875], [6.20281, 50.56952], [6.22581, 50.5907], [6.24005, 50.58732], [6.24888, 50.59869], [6.2476, 50.60392], [6.26957, 50.62444], [6.17852, 50.6245], [6.11707, 50.72231], [6.04428, 50.72861], [6.0406, 50.71848], [6.0326, 50.72647], [6.03889, 50.74618], [6.01976, 50.75398], [5.97545, 50.75441], [5.95942, 50.7622], [5.89132, 50.75124], [5.89129, 50.75125], [5.88734, 50.77092], [5.84888, 50.75448], [5.84548, 50.76542], [5.80673, 50.7558], [5.77513, 50.78308], [5.76533, 50.78159], [5.74356, 50.7691], [5.73904, 50.75674], [5.72216, 50.76398], [5.69469, 50.75529], [5.68091, 50.75804], [5.70107, 50.7827], [5.68995, 50.79641], [5.70118, 50.80764], [5.65259, 50.82309], [5.64009, 50.84742], [5.64504, 50.87107], [5.67886, 50.88142], [5.69858, 50.91046], [5.71626, 50.90796], [5.72644, 50.91167], [5.72545, 50.92312], [5.74644, 50.94723], [5.75927, 50.95601], [5.74752, 50.96202], [5.72875, 50.95428], [5.71864, 50.96092], [5.76242, 50.99703], [5.77688, 51.02483], [5.75961, 51.03113], [5.77258, 51.06196], [5.79835, 51.05834], [5.79903, 51.09371], [5.82921, 51.09328], [5.83226, 51.10585], [5.8109, 51.10861], [5.80798, 51.11661], [5.85508, 51.14445], [5.82564, 51.16753], [5.77697, 51.1522], [5.77735, 51.17845], [5.74617, 51.18928], [5.70344, 51.1829], [5.65528, 51.18736], [5.65145, 51.19788], [5.5603, 51.22249], [5.5569, 51.26544], [5.515, 51.29462], [5.48476, 51.30053], [5.46519, 51.2849], [5.4407, 51.28169], [5.41672, 51.26248], [5.347, 51.27502], [5.33886, 51.26314], [5.29716, 51.26104], [5.26461, 51.26693], [5.23814, 51.26064], [5.22542, 51.26888], [5.24244, 51.30495], [5.2002, 51.32243], [5.16222, 51.31035], [5.13377, 51.31592], [5.13105, 51.34791], [5.07102, 51.39469], [5.10456, 51.43163], [5.07891, 51.4715], [5.04774, 51.47022], [5.03281, 51.48679], [5.0106, 51.47167], [5.00393, 51.44406], [4.92152, 51.39487], [4.90016, 51.41404], [4.84988, 51.41502], [4.78941, 51.41102], [4.77229, 51.41337], [4.76577, 51.43046], [4.78314, 51.43319], [4.82946, 51.4213]]]] } },
22629     { type: "Feature", properties: { iso1A2: "BF", iso1A3: "BFA", iso1N3: "854", wikidata: "Q965", nameEn: "Burkina Faso", groups: ["011", "202", "002", "UN"], callingCodes: ["226"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.23859, 15.00135], [0.06588, 14.96961], [-0.24673, 15.07805], [-0.72004, 15.08655], [-1.05875, 14.7921], [-1.32166, 14.72774], [-1.68083, 14.50023], [-1.97945, 14.47709], [-1.9992, 14.19011], [-2.10223, 14.14878], [-2.47587, 14.29671], [-2.66175, 14.14713], [-2.84667, 14.05532], [-2.90831, 13.81174], [-2.88189, 13.64921], [-3.26407, 13.70699], [-3.28396, 13.5422], [-3.23599, 13.29035], [-3.43507, 13.27272], [-3.4313, 13.1588], [-3.54454, 13.1781], [-3.7911, 13.36665], [-3.96282, 13.38164], [-3.90558, 13.44375], [-3.96501, 13.49778], [-4.34477, 13.12927], [-4.21819, 12.95722], [-4.238, 12.71467], [-4.47356, 12.71252], [-4.41412, 12.31922], [-4.57703, 12.19875], [-4.54841, 12.1385], [-4.62546, 12.13204], [-4.62987, 12.06531], [-4.70692, 12.06746], [-4.72893, 12.01579], [-5.07897, 11.97918], [-5.26389, 11.84778], [-5.40258, 11.8327], [-5.26389, 11.75728], [-5.29251, 11.61715], [-5.22867, 11.60421], [-5.20665, 11.43811], [-5.25509, 11.36905], [-5.25949, 11.24816], [-5.32553, 11.21578], [-5.32994, 11.13371], [-5.49284, 11.07538], [-5.41579, 10.84628], [-5.47083, 10.75329], [-5.46643, 10.56074], [-5.51058, 10.43177], [-5.39602, 10.2929], [-5.12465, 10.29788], [-4.96453, 9.99923], [-4.96621, 9.89132], [-4.6426, 9.70696], [-4.31392, 9.60062], [-4.25999, 9.76012], [-3.69703, 9.94279], [-3.31779, 9.91125], [-3.27228, 9.84981], [-3.19306, 9.93781], [-3.16609, 9.85147], [-3.00765, 9.74019], [-2.93012, 9.57403], [-2.76494, 9.40778], [-2.68802, 9.49343], [-2.76534, 9.56589], [-2.74174, 9.83172], [-2.83108, 10.40252], [-2.94232, 10.64281], [-2.83373, 11.0067], [-0.67143, 10.99811], [-0.61937, 10.91305], [-0.44298, 11.04292], [-0.42391, 11.11661], [-0.38219, 11.12596], [-0.35955, 11.07801], [-0.28566, 11.12713], [-0.27374, 11.17157], [-0.13493, 11.14075], [0.50388, 11.01011], [0.48852, 10.98561], [0.50521, 10.98035], [0.4958, 10.93269], [0.66104, 10.99964], [0.91245, 10.99597], [0.9813, 11.08876], [1.03409, 11.04719], [1.42823, 11.46822], [2.00988, 11.42227], [2.29983, 11.68254], [2.39723, 11.89473], [2.05785, 12.35539], [2.26349, 12.41915], [0.99167, 13.10727], [0.99253, 13.37515], [1.18873, 13.31771], [1.21217, 13.37853], [1.24516, 13.33968], [1.28509, 13.35488], [1.24429, 13.39373], [1.20088, 13.38951], [1.02813, 13.46635], [0.99514, 13.5668], [0.77637, 13.64442], [0.77377, 13.6866], [0.61924, 13.68491], [0.38051, 14.05575], [0.16936, 14.51654], [0.23859, 15.00135]]]] } },
22630     { type: "Feature", properties: { iso1A2: "BG", iso1A3: "BGR", iso1N3: "100", wikidata: "Q219", nameEn: "Bulgaria", groups: ["EU", "151", "150", "UN"], callingCodes: ["359"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.05288, 43.79494], [22.85314, 43.84452], [22.83753, 43.88055], [22.87873, 43.9844], [23.01674, 44.01946], [23.04988, 44.07694], [22.67173, 44.21564], [22.61711, 44.16938], [22.61688, 44.06534], [22.41449, 44.00514], [22.35558, 43.81281], [22.41043, 43.69566], [22.47582, 43.6558], [22.53397, 43.47225], [22.82036, 43.33665], [22.89727, 43.22417], [23.00806, 43.19279], [22.98104, 43.11199], [22.89521, 43.03625], [22.78397, 42.98253], [22.74826, 42.88701], [22.54302, 42.87774], [22.43309, 42.82057], [22.4997, 42.74144], [22.43983, 42.56851], [22.55669, 42.50144], [22.51961, 42.3991], [22.47498, 42.3915], [22.45919, 42.33822], [22.34773, 42.31725], [22.38136, 42.30339], [22.47251, 42.20393], [22.50289, 42.19527], [22.51224, 42.15457], [22.67701, 42.06614], [22.86749, 42.02275], [22.90254, 41.87587], [22.96682, 41.77137], [23.01239, 41.76527], [23.03342, 41.71034], [22.95513, 41.63265], [22.96331, 41.35782], [22.93334, 41.34104], [23.1833, 41.31755], [23.21953, 41.33773], [23.22771, 41.37106], [23.31301, 41.40525], [23.33639, 41.36317], [23.40416, 41.39999], [23.52453, 41.40262], [23.63203, 41.37632], [23.67644, 41.41139], [23.76525, 41.40175], [23.80148, 41.43943], [23.89613, 41.45257], [23.91483, 41.47971], [23.96975, 41.44118], [24.06908, 41.46132], [24.06323, 41.53222], [24.10063, 41.54796], [24.18126, 41.51735], [24.27124, 41.57682], [24.30513, 41.51297], [24.52599, 41.56808], [24.61129, 41.42278], [24.71529, 41.41928], [24.8041, 41.34913], [24.82514, 41.4035], [24.86136, 41.39298], [24.90928, 41.40876], [24.942, 41.38685], [25.11611, 41.34212], [25.28322, 41.23411], [25.48187, 41.28506], [25.52394, 41.2798], [25.55082, 41.31667], [25.61042, 41.30614], [25.66183, 41.31316], [25.70507, 41.29209], [25.8266, 41.34563], [25.87919, 41.30526], [26.12926, 41.35878], [26.16548, 41.42278], [26.20288, 41.43943], [26.14796, 41.47533], [26.176, 41.50072], [26.17951, 41.55409], [26.14328, 41.55496], [26.15146, 41.60828], [26.07083, 41.64584], [26.06148, 41.70345], [26.16841, 41.74858], [26.21325, 41.73223], [26.22888, 41.74139], [26.2654, 41.71544], [26.30255, 41.70925], [26.35957, 41.71149], [26.32952, 41.73637], [26.33589, 41.76802], [26.36952, 41.82265], [26.53968, 41.82653], [26.57961, 41.90024], [26.56051, 41.92995], [26.62996, 41.97644], [26.79143, 41.97386], [26.95638, 42.00741], [27.03277, 42.0809], [27.08486, 42.08735], [27.19251, 42.06028], [27.22376, 42.10152], [27.27411, 42.10409], [27.45478, 41.96591], [27.52379, 41.93756], [27.55191, 41.90928], [27.69949, 41.97515], [27.81235, 41.94803], [27.83492, 41.99709], [27.91479, 41.97902], [28.02971, 41.98066], [28.32297, 41.98371], [29.24336, 43.70874], [28.23293, 43.76], [27.99558, 43.84193], [27.92008, 44.00761], [27.73468, 43.95326], [27.64542, 44.04958], [27.60834, 44.01206], [27.39757, 44.0141], [27.26845, 44.12602], [26.95141, 44.13555], [26.62712, 44.05698], [26.38764, 44.04356], [26.10115, 43.96908], [26.05584, 43.90925], [25.94911, 43.85745], [25.72792, 43.69263], [25.39528, 43.61866], [25.17144, 43.70261], [25.10718, 43.6831], [24.96682, 43.72693], [24.73542, 43.68523], [24.62281, 43.74082], [24.50264, 43.76314], [24.35364, 43.70211], [24.18149, 43.68218], [23.73978, 43.80627], [23.61687, 43.79289], [23.4507, 43.84936], [23.26772, 43.84843], [23.05288, 43.79494]]]] } },
22631     { type: "Feature", properties: { iso1A2: "BH", iso1A3: "BHR", iso1N3: "048", wikidata: "Q398", nameEn: "Bahrain", groups: ["145", "142", "UN"], callingCodes: ["973"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.93865, 26.30758], [50.71771, 26.73086], [50.38162, 26.53976], [50.26923, 26.08243], [50.302, 25.87592], [50.57069, 25.57887], [50.80824, 25.54641], [50.7801, 25.595], [50.86149, 25.6965], [50.81266, 25.88946], [50.93865, 26.30758]]]] } },
22632     { type: "Feature", properties: { iso1A2: "BI", iso1A3: "BDI", iso1N3: "108", wikidata: "Q967", nameEn: "Burundi", groups: ["014", "202", "002", "UN"], callingCodes: ["257"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.54501, -2.41404], [30.42933, -2.31064], [30.14034, -2.43626], [29.95911, -2.33348], [29.88237, -2.75105], [29.36805, -2.82933], [29.32234, -2.6483], [29.0562, -2.58632], [29.04081, -2.7416], [29.00167, -2.78523], [29.00404, -2.81978], [29.0505, -2.81774], [29.09119, -2.87871], [29.09797, -2.91935], [29.16037, -2.95457], [29.17258, -2.99385], [29.25633, -3.05471], [29.21463, -3.3514], [29.23708, -3.75856], [29.43673, -4.44845], [29.63827, -4.44681], [29.75109, -4.45836], [29.77289, -4.41733], [29.82885, -4.36153], [29.88172, -4.35743], [30.03323, -4.26631], [30.22042, -4.01738], [30.45915, -3.56532], [30.84165, -3.25152], [30.83823, -2.97837], [30.6675, -2.98987], [30.57926, -2.89791], [30.4987, -2.9573], [30.40662, -2.86151], [30.52747, -2.65841], [30.41789, -2.66266], [30.54501, -2.41404]]]] } },
22633     { type: "Feature", properties: { iso1A2: "BJ", iso1A3: "BEN", iso1N3: "204", wikidata: "Q962", nameEn: "Benin", aliases: ["DY"], groups: ["011", "202", "002", "UN"], callingCodes: ["229"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.59375, 11.70269], [3.48187, 11.86092], [3.31613, 11.88495], [3.25352, 12.01467], [2.83978, 12.40585], [2.6593, 12.30631], [2.37783, 12.24804], [2.39657, 12.10952], [2.45824, 11.98672], [2.39723, 11.89473], [2.29983, 11.68254], [2.00988, 11.42227], [1.42823, 11.46822], [1.03409, 11.04719], [0.9813, 11.08876], [0.91245, 10.99597], [0.8804, 10.803], [0.80358, 10.71459], [0.77666, 10.37665], [1.35507, 9.99525], [1.36624, 9.5951], [1.33675, 9.54765], [1.41746, 9.3226], [1.5649, 9.16941], [1.61838, 9.0527], [1.64249, 6.99562], [1.55877, 6.99737], [1.61812, 6.74843], [1.58105, 6.68619], [1.76906, 6.43189], [1.79826, 6.28221], [1.62913, 6.24075], [1.67336, 6.02702], [2.74181, 6.13349], [2.70566, 6.38038], [2.70464, 6.50831], [2.74334, 6.57291], [2.7325, 6.64057], [2.78204, 6.70514], [2.78823, 6.76356], [2.73405, 6.78508], [2.74024, 6.92802], [2.71702, 6.95722], [2.76965, 7.13543], [2.74489, 7.42565], [2.79442, 7.43486], [2.78668, 7.5116], [2.73405, 7.5423], [2.73095, 7.7755], [2.67523, 7.87825], [2.77907, 9.06924], [3.08017, 9.10006], [3.14147, 9.28375], [3.13928, 9.47167], [3.25093, 9.61632], [3.34726, 9.70696], [3.32099, 9.78032], [3.35383, 9.83641], [3.54429, 9.87739], [3.66908, 10.18136], [3.57275, 10.27185], [3.6844, 10.46351], [3.78292, 10.40538], [3.84243, 10.59316], [3.71505, 11.13015], [3.49175, 11.29765], [3.59375, 11.70269]]]] } },
22634     { type: "Feature", properties: { iso1A2: "BL", iso1A3: "BLM", iso1N3: "652", wikidata: "Q25362", nameEn: "Saint-Barth\xE9lemy", country: "FR", groups: ["EU", "Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.62718, 18.26185], [-63.1055, 17.86651], [-62.34423, 17.49165], [-62.62718, 18.26185]]]] } },
22635     { type: "Feature", properties: { iso1A2: "BM", iso1A3: "BMU", iso1N3: "060", wikidata: "Q23635", nameEn: "Bermuda", country: "GB", groups: ["BOTS", "021", "003", "019", "UN"], driveSide: "left", callingCodes: ["1 441"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.20987, 32.6953], [-65.31453, 32.68437], [-65.63955, 31.43417], [-63.20987, 32.6953]]]] } },
22636     { type: "Feature", properties: { iso1A2: "BN", iso1A3: "BRN", iso1N3: "096", wikidata: "Q921", nameEn: "Brunei", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["673"] }, geometry: { type: "MultiPolygon", coordinates: [[[[115.16236, 5.01011], [115.02521, 5.35005], [114.10166, 4.76112], [114.07448, 4.58441], [114.15813, 4.57], [114.26876, 4.49878], [114.32176, 4.34942], [114.32176, 4.2552], [114.4416, 4.27588], [114.49922, 4.13108], [114.64211, 4.00694], [114.78539, 4.12205], [114.88039, 4.4257], [114.83189, 4.42387], [114.77303, 4.72871], [114.8266, 4.75062], [114.88841, 4.81905], [114.96982, 4.81146], [114.99417, 4.88201], [115.05038, 4.90275], [115.02955, 4.82087], [115.02278, 4.74137], [115.04064, 4.63706], [115.07737, 4.53418], [115.09978, 4.39123], [115.31275, 4.30806], [115.36346, 4.33563], [115.2851, 4.42295], [115.27819, 4.63661], [115.20737, 4.8256], [115.15092, 4.87604], [115.16236, 5.01011]]]] } },
22637     { type: "Feature", properties: { iso1A2: "BO", iso1A3: "BOL", iso1N3: "068", wikidata: "Q750", nameEn: "Bolivia", groups: ["005", "419", "019", "UN"], callingCodes: ["591"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.90248, -12.52544], [-64.22539, -12.45267], [-64.30708, -12.46398], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-67.17784, -10.34016], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-69.42792, -10.93451], [-69.47839, -10.95254], [-69.57156, -10.94555], [-68.98115, -11.8979], [-68.65044, -12.50689], [-68.85615, -12.87769], [-68.8864, -13.40792], [-69.05265, -13.68546], [-68.88135, -14.18639], [-69.36254, -14.94634], [-69.14856, -15.23478], [-69.40336, -15.61358], [-69.20291, -16.16668], [-69.09986, -16.22693], [-68.96238, -16.194], [-68.79464, -16.33272], [-68.98358, -16.42165], [-69.04027, -16.57214], [-69.00853, -16.66769], [-69.16896, -16.72233], [-69.62883, -17.28142], [-69.46863, -17.37466], [-69.46897, -17.4988], [-69.46623, -17.60518], [-69.34126, -17.72753], [-69.28671, -17.94844], [-69.07496, -18.03715], [-69.14807, -18.16893], [-69.07432, -18.28259], [-68.94987, -18.93302], [-68.87082, -19.06003], [-68.80602, -19.08355], [-68.61989, -19.27584], [-68.41218, -19.40499], [-68.66761, -19.72118], [-68.54611, -19.84651], [-68.57132, -20.03134], [-68.74273, -20.08817], [-68.7276, -20.46178], [-68.44023, -20.62701], [-68.55383, -20.7355], [-68.53957, -20.91542], [-68.40403, -20.94562], [-68.18816, -21.28614], [-67.85114, -22.87076], [-67.54284, -22.89771], [-67.18382, -22.81525], [-66.7298, -22.23644], [-66.29714, -22.08741], [-66.24077, -21.77837], [-66.03836, -21.84829], [-66.04832, -21.9187], [-65.9261, -21.93335], [-65.7467, -22.10105], [-65.61166, -22.09504], [-65.58694, -22.09794], [-65.57743, -22.07675], [-65.47435, -22.08908], [-64.99524, -22.08255], [-64.90014, -22.12136], [-64.67174, -22.18957], [-64.58888, -22.25035], [-64.4176, -22.67692], [-64.35108, -22.73282], [-64.31489, -22.88824], [-64.22918, -22.55807], [-63.93287, -21.99934], [-63.70963, -21.99934], [-63.68113, -22.0544], [-63.66482, -21.99918], [-62.81124, -21.9987], [-62.8078, -22.12534], [-62.64455, -22.25091], [-62.2757, -21.06657], [-62.26883, -20.55311], [-61.93912, -20.10053], [-61.73723, -19.63958], [-60.00638, -19.2981], [-59.06965, -19.29148], [-58.23216, -19.80058], [-58.16225, -20.16193], [-57.8496, -19.98346], [-58.14215, -19.76276], [-57.78463, -19.03259], [-57.71113, -19.03161], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71995, -18.89573], [-57.76764, -18.90087], [-57.56807, -18.25655], [-57.48237, -18.24219], [-57.69877, -17.8431], [-57.73949, -17.56095], [-57.90082, -17.44555], [-57.99661, -17.5273], [-58.32935, -17.28195], [-58.5058, -16.80958], [-58.30918, -16.3699], [-58.32431, -16.25861], [-58.41506, -16.32636], [-60.16069, -16.26479], [-60.23797, -15.50267], [-60.58224, -15.09887], [-60.23968, -15.09515], [-60.27887, -14.63021], [-60.46037, -14.22496], [-60.48053, -13.77981], [-61.05527, -13.50054], [-61.81151, -13.49564], [-63.76259, -12.42952], [-63.90248, -12.52544]]]] } },
22638     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
22639     { type: "Feature", properties: { iso1A2: "BR", iso1A3: "BRA", iso1N3: "076", wikidata: "Q155", nameEn: "Brazil", groups: ["005", "419", "019", "UN"], callingCodes: ["55"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.69361, 4.34069], [-59.78878, 4.45637], [-60.15953, 4.53456], [-60.04189, 4.69801], [-59.98129, 5.07097], [-60.20944, 5.28754], [-60.32352, 5.21299], [-60.73204, 5.20931], [-60.5802, 4.94312], [-60.86539, 4.70512], [-60.98303, 4.54167], [-61.15703, 4.49839], [-61.31457, 4.54167], [-61.29675, 4.44216], [-61.48569, 4.43149], [-61.54629, 4.2822], [-62.13094, 4.08309], [-62.44822, 4.18621], [-62.57656, 4.04754], [-62.74411, 4.03331], [-62.7655, 3.73099], [-62.98296, 3.59935], [-63.21111, 3.96219], [-63.4464, 3.9693], [-63.42233, 3.89995], [-63.50611, 3.83592], [-63.67099, 4.01731], [-63.70218, 3.91417], [-63.86082, 3.94796], [-63.99183, 3.90172], [-64.14512, 4.12932], [-64.57648, 4.12576], [-64.72977, 4.28931], [-64.84028, 4.24665], [-64.48379, 3.7879], [-64.02908, 2.79797], [-64.0257, 2.48156], [-63.39114, 2.4317], [-63.39827, 2.16098], [-64.06135, 1.94722], [-64.08274, 1.64792], [-64.34654, 1.35569], [-64.38932, 1.5125], [-65.11657, 1.12046], [-65.57288, 0.62856], [-65.50158, 0.92086], [-65.6727, 1.01353], [-66.28507, 0.74585], [-66.85795, 1.22998], [-67.08222, 1.17441], [-67.15784, 1.80439], [-67.299, 1.87494], [-67.40488, 2.22258], [-67.9292, 1.82455], [-68.18632, 2.00091], [-68.26699, 1.83463], [-68.18128, 1.72881], [-69.38621, 1.70865], [-69.53746, 1.76408], [-69.83491, 1.69353], [-69.82987, 1.07864], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-70.04162, 0.55437], [-70.03658, -0.19681], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.94708, -4.2431], [-70.00888, -4.37833], [-70.11305, -4.27281], [-70.19582, -4.3607], [-70.33236, -4.15214], [-70.77601, -4.15717], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-73.24579, -6.05764], [-73.12983, -6.43852], [-73.73986, -6.87919], [-73.77011, -7.28944], [-73.96938, -7.58465], [-73.65485, -7.77897], [-73.76576, -7.89884], [-72.92886, -9.04074], [-73.21498, -9.40904], [-72.72216, -9.41397], [-72.31883, -9.5184], [-72.14742, -9.98049], [-71.23394, -9.9668], [-70.53373, -9.42628], [-70.58453, -9.58303], [-70.55429, -9.76692], [-70.62487, -9.80666], [-70.64134, -11.0108], [-70.51395, -10.92249], [-70.38791, -11.07096], [-69.90896, -10.92744], [-69.57835, -10.94051], [-69.57156, -10.94555], [-69.47839, -10.95254], [-69.42792, -10.93451], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.17784, -10.34016], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.30708, -12.46398], [-64.22539, -12.45267], [-63.90248, -12.52544], [-63.76259, -12.42952], [-61.81151, -13.49564], [-61.05527, -13.50054], [-60.48053, -13.77981], [-60.46037, -14.22496], [-60.27887, -14.63021], [-60.23968, -15.09515], [-60.58224, -15.09887], [-60.23797, -15.50267], [-60.16069, -16.26479], [-58.41506, -16.32636], [-58.32431, -16.25861], [-58.30918, -16.3699], [-58.5058, -16.80958], [-58.32935, -17.28195], [-57.99661, -17.5273], [-57.90082, -17.44555], [-57.73949, -17.56095], [-57.69877, -17.8431], [-57.48237, -18.24219], [-57.56807, -18.25655], [-57.76764, -18.90087], [-57.71995, -18.89573], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.71113, -19.03161], [-57.78463, -19.03259], [-58.14215, -19.76276], [-57.8496, -19.98346], [-58.16225, -20.16193], [-57.84536, -20.93155], [-57.93492, -21.65505], [-57.88239, -21.6868], [-57.94642, -21.73799], [-57.98625, -22.09157], [-56.6508, -22.28387], [-56.5212, -22.11556], [-56.45893, -22.08072], [-56.23206, -22.25347], [-55.8331, -22.29008], [-55.74941, -22.46436], [-55.741, -22.52018], [-55.72366, -22.5519], [-55.6986, -22.56268], [-55.68742, -22.58407], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.5446, -23.22811], [-55.52288, -23.2595], [-55.5555, -23.28237], [-55.43585, -23.87157], [-55.44117, -23.9185], [-55.41784, -23.9657], [-55.12292, -23.99669], [-55.0518, -23.98666], [-55.02691, -23.97317], [-54.6238, -23.83078], [-54.32807, -24.01865], [-54.28207, -24.07305], [-54.4423, -25.13381], [-54.62033, -25.46026], [-54.60196, -25.48397], [-54.59509, -25.53696], [-54.59398, -25.59224], [-54.5502, -25.58915], [-54.52926, -25.62846], [-53.90831, -25.55513], [-53.83691, -25.94849], [-53.73511, -26.04211], [-53.73086, -26.05842], [-53.7264, -26.0664], [-53.73391, -26.07006], [-53.73968, -26.10012], [-53.65018, -26.19501], [-53.65237, -26.23289], [-53.63739, -26.2496], [-53.63881, -26.25075], [-53.64632, -26.24798], [-53.64186, -26.25976], [-53.64505, -26.28089], [-53.68269, -26.33359], [-53.73372, -26.6131], [-53.80144, -27.09844], [-54.15978, -27.2889], [-54.19062, -27.27639], [-54.19268, -27.30751], [-54.41888, -27.40882], [-54.50416, -27.48232], [-54.67657, -27.57214], [-54.90159, -27.63132], [-54.90805, -27.73149], [-55.1349, -27.89759], [-55.16872, -27.86224], [-55.33303, -27.94661], [-55.6262, -28.17124], [-55.65418, -28.18304], [-56.01729, -28.51223], [-56.00458, -28.60421], [-56.05265, -28.62651], [-56.54171, -29.11447], [-56.57295, -29.11357], [-56.62789, -29.18073], [-56.81251, -29.48154], [-57.09386, -29.74211], [-57.65132, -30.19229], [-57.22502, -30.26121], [-56.90236, -30.02578], [-56.49267, -30.39471], [-56.4795, -30.3899], [-56.4619, -30.38457], [-55.87388, -31.05053], [-55.58866, -30.84117], [-55.5634, -30.8686], [-55.55373, -30.8732], [-55.55218, -30.88193], [-55.54572, -30.89051], [-55.53431, -30.89714], [-55.53276, -30.90218], [-55.52712, -30.89997], [-55.51862, -30.89828], [-55.50841, -30.9027], [-55.50821, -30.91349], [-54.17384, -31.86168], [-53.76024, -32.0751], [-53.39572, -32.58596], [-53.37671, -32.57005], [-53.1111, -32.71147], [-53.53459, -33.16843], [-53.52794, -33.68908], [-53.44031, -33.69344], [-53.39593, -33.75169], [-53.37138, -33.74313], [-52.83257, -34.01481], [-28.34015, -20.99094], [-28.99601, 1.86593], [-51.35485, 4.8383], [-51.63798, 4.51394], [-51.61983, 4.14596], [-51.79599, 3.89336], [-51.82312, 3.85825], [-51.85573, 3.83427], [-52.31787, 3.17896], [-52.6906, 2.37298], [-52.96539, 2.1881], [-53.78743, 2.34412], [-54.16286, 2.10779], [-54.6084, 2.32856], [-55.01919, 2.564], [-55.71493, 2.40342], [-55.96292, 2.53188], [-56.13054, 2.27723], [-55.92159, 2.05236], [-55.89863, 1.89861], [-55.99278, 1.83137], [-56.47045, 1.95135], [-56.7659, 1.89509], [-57.07092, 1.95304], [-57.09109, 2.01854], [-57.23981, 1.95808], [-57.35073, 1.98327], [-57.55743, 1.69605], [-57.77281, 1.73344], [-57.97336, 1.64566], [-58.01873, 1.51966], [-58.33887, 1.58014], [-58.4858, 1.48399], [-58.53571, 1.29154], [-58.84229, 1.17749], [-58.92072, 1.31293], [-59.25583, 1.40559], [-59.74066, 1.87596], [-59.7264, 2.27497], [-59.91177, 2.36759], [-59.99733, 2.92312], [-59.79769, 3.37162], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
22640     { type: "Feature", properties: { iso1A2: "BS", iso1A3: "BHS", iso1N3: "044", wikidata: "Q778", nameEn: "The Bahamas", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.98446, 20.4801], [-71.70065, 25.7637], [-78.91214, 27.76553], [-80.65727, 23.71953], [-72.98446, 20.4801]]]] } },
22641     { type: "Feature", properties: { iso1A2: "BT", iso1A3: "BTN", iso1N3: "064", wikidata: "Q917", nameEn: "Bhutan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["975"] }, geometry: { type: "MultiPolygon", coordinates: [[[[91.6469, 27.76358], [91.5629, 27.84823], [91.48973, 27.93903], [91.46327, 28.0064], [91.25779, 28.07509], [91.20019, 27.98715], [90.69894, 28.07784], [90.58842, 28.02838], [90.13387, 28.19178], [89.79762, 28.23979], [89.59525, 28.16433], [89.12825, 27.62502], [89.0582, 27.60985], [88.97213, 27.51671], [88.95355, 27.4106], [89.00216, 27.32532], [88.96947, 27.30319], [88.93678, 27.33777], [88.91901, 27.32483], [88.74219, 27.144], [88.86984, 27.10937], [88.8714, 26.97488], [88.92301, 26.99286], [88.95807, 26.92668], [89.09554, 26.89089], [89.12825, 26.81661], [89.1926, 26.81329], [89.37913, 26.86224], [89.38319, 26.85963], [89.3901, 26.84225], [89.42349, 26.83727], [89.63369, 26.74402], [89.86124, 26.73307], [90.04535, 26.72422], [90.30402, 26.85098], [90.39271, 26.90704], [90.48504, 26.8594], [90.67715, 26.77215], [91.50067, 26.79223], [91.83181, 26.87318], [92.05523, 26.8692], [92.11863, 26.893], [92.03457, 27.07334], [92.04702, 27.26861], [92.12019, 27.27829], [92.01132, 27.47352], [91.65007, 27.48287], [91.55819, 27.6144], [91.6469, 27.76358]]]] } },
22642     { type: "Feature", properties: { iso1A2: "BV", iso1A3: "BVT", iso1N3: "074", wikidata: "Q23408", nameEn: "Bouvet Island", country: "NO", groups: ["005", "419", "019", "UN"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.54042, -54.0949], [2.28941, -54.13089], [3.35353, -55.17558], [4.54042, -54.0949]]]] } },
22643     { type: "Feature", properties: { iso1A2: "BW", iso1A3: "BWA", iso1N3: "072", wikidata: "Q963", nameEn: "Botswana", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["267"] }, geometry: { type: "MultiPolygon", coordinates: [[[[25.26433, -17.79571], [25.16882, -17.78253], [25.05895, -17.84452], [24.95586, -17.79674], [24.73364, -17.89338], [24.71887, -17.9218], [24.6303, -17.9863], [24.57485, -18.07151], [24.40577, -17.95726], [24.19416, -18.01919], [23.61088, -18.4881], [23.29618, -17.99855], [23.0996, -18.00075], [21.45556, -18.31795], [20.99904, -18.31743], [20.99751, -22.00026], [19.99912, -21.99991], [19.99817, -24.76768], [20.02809, -24.78725], [20.03678, -24.81004], [20.29826, -24.94869], [20.64795, -25.47827], [20.86081, -26.14892], [20.61754, -26.4692], [20.63275, -26.78181], [20.68596, -26.9039], [20.87031, -26.80047], [21.13353, -26.86661], [21.37869, -26.82083], [21.69322, -26.86152], [21.7854, -26.79199], [21.77114, -26.69015], [21.83291, -26.65959], [21.90703, -26.66808], [22.06192, -26.61882], [22.21206, -26.3773], [22.41921, -26.23078], [22.56365, -26.19668], [22.70808, -25.99186], [22.86012, -25.50572], [23.03497, -25.29971], [23.47588, -25.29971], [23.9244, -25.64286], [24.18287, -25.62916], [24.36531, -25.773], [24.44703, -25.73021], [24.67319, -25.81749], [24.8946, -25.80723], [25.01718, -25.72507], [25.12266, -25.75931], [25.33076, -25.76616], [25.58543, -25.6343], [25.6643, -25.4491], [25.69661, -25.29284], [25.72702, -25.25503], [25.88571, -24.87802], [25.84295, -24.78661], [25.8515, -24.75727], [26.39409, -24.63468], [26.46346, -24.60358], [26.51667, -24.47219], [26.84165, -24.24885], [26.99749, -23.65486], [27.33768, -23.40917], [27.52393, -23.37952], [27.6066, -23.21894], [27.74154, -23.2137], [27.93539, -23.04941], [27.93729, -22.96194], [28.04752, -22.90243], [28.04562, -22.8394], [28.34874, -22.5694], [28.63287, -22.55887], [28.91889, -22.44299], [29.0151, -22.22907], [29.10881, -22.21202], [29.15268, -22.21399], [29.18974, -22.18599], [29.21955, -22.17771], [29.37703, -22.19581], [29.3533, -22.18363], [29.24648, -22.05967], [29.1974, -22.07472], [29.14501, -22.07275], [29.08495, -22.04867], [29.04108, -22.00563], [29.02191, -21.95665], [29.02191, -21.90647], [29.04023, -21.85864], [29.07763, -21.81877], [28.58114, -21.63455], [28.49942, -21.66634], [28.29416, -21.59037], [28.01669, -21.57624], [27.91407, -21.31621], [27.69171, -21.08409], [27.72972, -20.51735], [27.69361, -20.48531], [27.28865, -20.49873], [27.29831, -20.28935], [27.21278, -20.08244], [26.72246, -19.92707], [26.17227, -19.53709], [25.96226, -19.08152], [25.99837, -19.02943], [25.94326, -18.90362], [25.82353, -18.82808], [25.79217, -18.6355], [25.68859, -18.56165], [25.53465, -18.39041], [25.39972, -18.12691], [25.31799, -18.07091], [25.23909, -17.90832], [25.26433, -17.79571]]]] } },
22644     { type: "Feature", properties: { iso1A2: "BY", iso1A3: "BLR", iso1N3: "112", wikidata: "Q184", nameEn: "Belarus", groups: ["151", "150", "UN"], callingCodes: ["375"] }, geometry: { type: "MultiPolygon", coordinates: [[[[28.15217, 56.16964], [27.97865, 56.11849], [27.63065, 55.89687], [27.61683, 55.78558], [27.3541, 55.8089], [27.27804, 55.78299], [27.1559, 55.85032], [26.97153, 55.8102], [26.87448, 55.7172], [26.76872, 55.67658], [26.71802, 55.70645], [26.64888, 55.70515], [26.63231, 55.67968], [26.63167, 55.57887], [26.55094, 55.5093], [26.5522, 55.40277], [26.44937, 55.34832], [26.5709, 55.32572], [26.6714, 55.33902], [26.80929, 55.31642], [26.83266, 55.30444], [26.835, 55.28182], [26.73017, 55.24226], [26.72983, 55.21788], [26.68075, 55.19787], [26.69243, 55.16718], [26.54753, 55.14181], [26.51481, 55.16051], [26.46249, 55.12814], [26.35121, 55.1525], [26.30628, 55.12536], [26.23202, 55.10439], [26.26941, 55.08032], [26.20397, 54.99729], [26.13386, 54.98924], [26.05907, 54.94631], [25.99129, 54.95705], [25.89462, 54.93438], [25.74122, 54.80108], [25.75977, 54.57252], [25.68045, 54.5321], [25.64813, 54.48704], [25.62203, 54.4656], [25.63371, 54.42075], [25.5376, 54.33158], [25.55425, 54.31591], [25.68513, 54.31727], [25.78553, 54.23327], [25.78563, 54.15747], [25.71084, 54.16704], [25.64875, 54.1259], [25.54724, 54.14925], [25.51452, 54.17799], [25.56823, 54.25212], [25.509, 54.30267], [25.35559, 54.26544], [25.22705, 54.26271], [25.19199, 54.219], [25.0728, 54.13419], [24.991, 54.14241], [24.96894, 54.17589], [24.77131, 54.11091], [24.85311, 54.02862], [24.74279, 53.96663], [24.69185, 53.96543], [24.69652, 54.01901], [24.62275, 54.00217], [24.44411, 53.90076], [24.34128, 53.90076], [24.19638, 53.96405], [23.98837, 53.92554], [23.95098, 53.9613], [23.81309, 53.94205], [23.80543, 53.89558], [23.71726, 53.93379], [23.61677, 53.92691], [23.51284, 53.95052], [23.62004, 53.60942], [23.81995, 53.24131], [23.85657, 53.22923], [23.91393, 53.16469], [23.87548, 53.0831], [23.92184, 53.02079], [23.94689, 52.95919], [23.91805, 52.94016], [23.93763, 52.71332], [23.73615, 52.6149], [23.58296, 52.59868], [23.45112, 52.53774], [23.34141, 52.44845], [23.18196, 52.28812], [23.20071, 52.22848], [23.47859, 52.18215], [23.54314, 52.12148], [23.61, 52.11264], [23.64066, 52.07626], [23.68733, 51.9906], [23.61523, 51.92066], [23.62691, 51.78208], [23.53198, 51.74298], [23.57053, 51.55938], [23.56236, 51.53673], [23.62751, 51.50512], [23.6736, 51.50255], [23.60906, 51.62122], [23.7766, 51.66809], [23.91118, 51.63316], [23.8741, 51.59734], [23.99907, 51.58369], [24.13075, 51.66979], [24.3163, 51.75063], [24.29021, 51.80841], [24.37123, 51.88222], [24.98784, 51.91273], [25.20228, 51.97143], [25.46163, 51.92205], [25.73673, 51.91973], [25.80574, 51.94556], [25.83217, 51.92587], [26.00408, 51.92967], [26.19084, 51.86781], [26.39367, 51.87315], [26.46962, 51.80501], [26.69759, 51.82284], [26.80043, 51.75777], [26.9489, 51.73788], [26.99422, 51.76933], [27.20602, 51.77291], [27.20948, 51.66713], [27.26613, 51.65957], [27.24828, 51.60161], [27.47212, 51.61184], [27.51058, 51.5854], [27.55727, 51.63486], [27.71932, 51.60672], [27.67125, 51.50854], [27.76052, 51.47604], [27.85253, 51.62293], [27.91844, 51.61952], [27.95827, 51.56065], [28.10658, 51.57857], [28.23452, 51.66988], [28.37592, 51.54505], [28.47051, 51.59734], [28.64429, 51.5664], [28.69161, 51.44695], [28.73143, 51.46236], [28.75615, 51.41442], [28.78224, 51.45294], [28.76027, 51.48802], [28.81795, 51.55552], [28.95528, 51.59222], [28.99098, 51.56833], [29.1187, 51.65872], [29.16402, 51.64679], [29.20659, 51.56918], [29.25603, 51.57089], [29.25191, 51.49828], [29.32881, 51.37843], [29.42357, 51.4187], [29.49773, 51.39814], [29.54372, 51.48372], [29.7408, 51.53417], [29.77376, 51.4461], [30.17888, 51.51025], [30.34642, 51.42555], [30.36153, 51.33984], [30.56203, 51.25655], [30.64992, 51.35014], [30.51946, 51.59649], [30.68804, 51.82806], [30.76443, 51.89739], [30.90897, 52.00699], [30.95589, 52.07775], [31.13332, 52.1004], [31.25142, 52.04131], [31.38326, 52.12991], [31.7822, 52.11406], [31.77877, 52.18636], [31.6895, 52.1973], [31.70735, 52.26711], [31.57971, 52.32146], [31.62084, 52.33849], [31.61397, 52.48843], [31.56316, 52.51518], [31.63869, 52.55361], [31.50406, 52.69707], [31.57277, 52.71613], [31.592, 52.79011], [31.35667, 52.97854], [31.24147, 53.031], [31.32283, 53.04101], [31.33519, 53.08805], [31.3915, 53.09712], [31.36403, 53.13504], [31.40523, 53.21406], [31.56316, 53.19432], [31.62496, 53.22886], [31.787, 53.18033], [31.82373, 53.10042], [32.15368, 53.07594], [32.40773, 53.18856], [32.51725, 53.28431], [32.73257, 53.33494], [32.74968, 53.45597], [32.47777, 53.5548], [32.40499, 53.6656], [32.50112, 53.68594], [32.45717, 53.74039], [32.36663, 53.7166], [32.12621, 53.81586], [31.89137, 53.78099], [31.77028, 53.80015], [31.85019, 53.91801], [31.88744, 54.03653], [31.89599, 54.0837], [31.57002, 54.14535], [31.30791, 54.25315], [31.3177, 54.34067], [31.22945, 54.46585], [31.08543, 54.50361], [31.21399, 54.63113], [31.19339, 54.66947], [30.99187, 54.67046], [30.98226, 54.68872], [31.0262, 54.70698], [30.97127, 54.71967], [30.95479, 54.74346], [30.75165, 54.80699], [30.8264, 54.90062], [30.81759, 54.94064], [30.93144, 54.9585], [30.95754, 54.98609], [30.9081, 55.02232], [30.94243, 55.03964], [31.00972, 55.02783], [31.02071, 55.06167], [30.97369, 55.17134], [30.87944, 55.28223], [30.81946, 55.27931], [30.8257, 55.3313], [30.93144, 55.3914], [30.90123, 55.46621], [30.95204, 55.50667], [30.93419, 55.6185], [30.86003, 55.63169], [30.7845, 55.58514], [30.72957, 55.66268], [30.67464, 55.64176], [30.63344, 55.73079], [30.51037, 55.76568], [30.51346, 55.78982], [30.48257, 55.81066], [30.30987, 55.83592], [30.27776, 55.86819], [30.12136, 55.8358], [29.97975, 55.87281], [29.80672, 55.79569], [29.61446, 55.77716], [29.51283, 55.70294], [29.3604, 55.75862], [29.44692, 55.95978], [29.21717, 55.98971], [29.08299, 56.03427], [28.73418, 55.97131], [28.63668, 56.07262], [28.68337, 56.10173], [28.5529, 56.11705], [28.43068, 56.09407], [28.37987, 56.11399], [28.36888, 56.05805], [28.30571, 56.06035], [28.15217, 56.16964]]]] } },
22645     { type: "Feature", properties: { iso1A2: "BZ", iso1A3: "BLZ", iso1N3: "084", wikidata: "Q242", nameEn: "Belize", groups: ["013", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["501"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-88.3268, 18.49048], [-88.48242, 18.49164], [-88.71505, 18.0707], [-88.8716, 17.89535], [-89.03839, 18.0067], [-89.15105, 17.95104], [-89.14985, 17.81563], [-89.15025, 17.04813], [-89.22683, 15.88619], [-89.17418, 15.90898], [-89.02415, 15.9063], [-88.95358, 15.88698], [-88.40779, 16.09624], [-86.92368, 17.61462], [-87.84815, 18.18511], [-87.85693, 18.18266], [-87.86657, 18.19971], [-87.87604, 18.18313], [-87.90671, 18.15213], [-88.03165, 18.16657], [-88.03238, 18.41778], [-88.26593, 18.47617], [-88.29909, 18.47591], [-88.3268, 18.49048]]]] } },
22646     { type: "Feature", properties: { iso1A2: "CA", iso1A3: "CAN", iso1N3: "124", wikidata: "Q16", nameEn: "Canada", groups: ["021", "003", "019", "UN"], callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.20349, 45.1722], [-67.19603, 45.16771], [-67.15965, 45.16179], [-67.11316, 45.11176], [-67.0216, 44.95333], [-66.96824, 44.90965], [-66.98249, 44.87071], [-66.96824, 44.83078], [-66.93432, 44.82597], [-67.16117, 44.20069], [-61.98255, 37.34815], [-56.27503, 47.39728], [-53.12387, 41.40385], [-46.37635, 57.3249], [-77.52957, 77.23408], [-68.21821, 80.48551], [-49.33696, 84.57952], [-140.97446, 84.39275], [-141.00116, 60.30648], [-140.5227, 60.22077], [-140.45648, 60.30919], [-139.98024, 60.18027], [-139.68991, 60.33693], [-139.05831, 60.35205], [-139.20603, 60.08896], [-139.05365, 59.99655], [-138.71149, 59.90728], [-138.62145, 59.76431], [-137.60623, 59.24465], [-137.4925, 58.89415], [-136.82619, 59.16198], [-136.52365, 59.16752], [-136.47323, 59.46617], [-136.33727, 59.44466], [-136.22381, 59.55526], [-136.31566, 59.59083], [-135.48007, 59.79937], [-135.03069, 59.56208], [-135.00267, 59.28745], [-134.7047, 59.2458], [-134.55699, 59.1297], [-134.48059, 59.13231], [-134.27175, 58.8634], [-133.84645, 58.73543], [-133.38523, 58.42773], [-131.8271, 56.62247], [-130.77769, 56.36185], [-130.33965, 56.10849], [-130.10173, 56.12178], [-130.00093, 56.00325], [-130.00857, 55.91344], [-130.15373, 55.74895], [-129.97513, 55.28029], [-130.08035, 55.21556], [-130.18765, 55.07744], [-130.27203, 54.97174], [-130.44184, 54.85377], [-130.64499, 54.76912], [-130.61931, 54.70835], [-133.92876, 54.62289], [-133.36909, 48.51151], [-125.03842, 48.53282], [-123.50039, 48.21223], [-123.15614, 48.35395], [-123.26565, 48.6959], [-123.0093, 48.76586], [-123.0093, 48.83186], [-123.32163, 49.00419], [-95.15355, 48.9996], [-95.15357, 49.384], [-95.12903, 49.37056], [-95.05825, 49.35311], [-95.01419, 49.35647], [-94.99532, 49.36579], [-94.95681, 49.37035], [-94.85381, 49.32492], [-94.8159, 49.32299], [-94.82487, 49.29483], [-94.77355, 49.11998], [-94.75017, 49.09931], [-94.687, 48.84077], [-94.70087, 48.8339], [-94.70486, 48.82365], [-94.69669, 48.80918], [-94.69335, 48.77883], [-94.58903, 48.71803], [-94.54885, 48.71543], [-94.53826, 48.70216], [-94.44258, 48.69223], [-94.4174, 48.71049], [-94.27153, 48.70232], [-94.25172, 48.68404], [-94.25104, 48.65729], [-94.23215, 48.65202], [-93.85769, 48.63284], [-93.83288, 48.62745], [-93.80676, 48.58232], [-93.80939, 48.52439], [-93.79267, 48.51631], [-93.66382, 48.51845], [-93.47022, 48.54357], [-93.44472, 48.59147], [-93.40693, 48.60948], [-93.39758, 48.60364], [-93.3712, 48.60599], [-93.33946, 48.62787], [-93.25391, 48.64266], [-92.94973, 48.60866], [-92.7287, 48.54005], [-92.6342, 48.54133], [-92.62747, 48.50278], [-92.69927, 48.49573], [-92.71323, 48.46081], [-92.65606, 48.43471], [-92.50712, 48.44921], [-92.45588, 48.40624], [-92.48147, 48.36609], [-92.37185, 48.22259], [-92.27167, 48.25046], [-92.30939, 48.31251], [-92.26662, 48.35651], [-92.202, 48.35252], [-92.14732, 48.36578], [-92.05339, 48.35958], [-91.98929, 48.25409], [-91.86125, 48.21278], [-91.71231, 48.19875], [-91.70451, 48.11805], [-91.55649, 48.10611], [-91.58025, 48.04339], [-91.45829, 48.07454], [-91.43248, 48.04912], [-91.25025, 48.08522], [-91.08016, 48.18096], [-90.87588, 48.2484], [-90.75045, 48.09143], [-90.56444, 48.12184], [-90.56312, 48.09488], [-90.07418, 48.11043], [-89.89974, 47.98109], [-89.77248, 48.02607], [-89.57972, 48.00023], [-89.48837, 48.01412], [-88.37033, 48.30586], [-84.85871, 46.88881], [-84.55635, 46.45974], [-84.47607, 46.45225], [-84.4481, 46.48972], [-84.42101, 46.49853], [-84.34174, 46.50683], [-84.29893, 46.49127], [-84.26351, 46.49508], [-84.2264, 46.53337], [-84.1945, 46.54061], [-84.17723, 46.52753], [-84.12885, 46.53068], [-84.11196, 46.50248], [-84.13451, 46.39218], [-84.11254, 46.32329], [-84.11615, 46.2681], [-84.09756, 46.25512], [-84.1096, 46.23987], [-83.95399, 46.05634], [-83.90453, 46.05922], [-83.83329, 46.12169], [-83.57017, 46.105], [-83.43746, 45.99749], [-83.59589, 45.82131], [-82.48419, 45.30225], [-82.42469, 42.992], [-82.4146, 42.97626], [-82.4253, 42.95423], [-82.45331, 42.93139], [-82.4826, 42.8068], [-82.46613, 42.76615], [-82.51063, 42.66025], [-82.51858, 42.611], [-82.57583, 42.5718], [-82.58873, 42.54984], [-82.64242, 42.55594], [-82.82964, 42.37355], [-83.02253, 42.33045], [-83.07837, 42.30978], [-83.09837, 42.28877], [-83.12724, 42.2376], [-83.14962, 42.04089], [-83.11184, 41.95671], [-82.67862, 41.67615], [-78.93684, 42.82887], [-78.90712, 42.89733], [-78.90905, 42.93022], [-78.93224, 42.95229], [-78.96312, 42.95509], [-78.98126, 42.97], [-79.02074, 42.98444], [-79.02424, 43.01983], [-78.99941, 43.05612], [-79.01055, 43.06659], [-79.07486, 43.07845], [-79.05671, 43.10937], [-79.06881, 43.12029], [-79.0427, 43.13934], [-79.04652, 43.16396], [-79.05384, 43.17418], [-79.05002, 43.20133], [-79.05544, 43.21224], [-79.05512, 43.25375], [-79.06921, 43.26183], [-79.25796, 43.54052], [-76.79706, 43.63099], [-76.43859, 44.09393], [-76.35324, 44.13493], [-76.31222, 44.19894], [-76.244, 44.19643], [-76.1664, 44.23051], [-76.16285, 44.28262], [-76.00018, 44.34896], [-75.95947, 44.34463], [-75.8217, 44.43176], [-75.76813, 44.51537], [-75.41441, 44.76614], [-75.2193, 44.87821], [-75.01363, 44.95608], [-74.99101, 44.98051], [-74.8447, 45.00606], [-74.66689, 45.00646], [-74.32699, 44.99029], [-73.35025, 45.00942], [-71.50067, 45.01357], [-71.48735, 45.07784], [-71.42778, 45.12624], [-71.40364, 45.21382], [-71.44252, 45.2361], [-71.37133, 45.24624], [-71.29371, 45.29996], [-71.22338, 45.25184], [-71.19723, 45.25438], [-71.14568, 45.24128], [-71.08364, 45.30623], [-71.01866, 45.31573], [-71.0107, 45.34819], [-70.95193, 45.33895], [-70.91169, 45.29849], [-70.89864, 45.2398], [-70.84816, 45.22698], [-70.80236, 45.37444], [-70.82638, 45.39828], [-70.78372, 45.43269], [-70.65383, 45.37592], [-70.62518, 45.42286], [-70.72651, 45.49771], [-70.68516, 45.56964], [-70.54019, 45.67291], [-70.38934, 45.73215], [-70.41523, 45.79497], [-70.25976, 45.89675], [-70.24694, 45.95138], [-70.31025, 45.96424], [-70.23855, 46.1453], [-70.29078, 46.18832], [-70.18547, 46.35357], [-70.05812, 46.41768], [-69.99966, 46.69543], [-69.22119, 47.46461], [-69.05148, 47.42012], [-69.05073, 47.30076], [-69.05039, 47.2456], [-68.89222, 47.1807], [-68.70125, 47.24399], [-68.60575, 47.24659], [-68.57914, 47.28431], [-68.38332, 47.28723], [-68.37458, 47.35851], [-68.23244, 47.35712], [-67.94843, 47.1925], [-67.87993, 47.10377], [-67.78578, 47.06473], [-67.78111, 45.9392], [-67.75196, 45.91814], [-67.80961, 45.87531], [-67.75654, 45.82324], [-67.80653, 45.80022], [-67.80705, 45.69528], [-67.6049, 45.60725], [-67.43815, 45.59162], [-67.42144, 45.50584], [-67.50578, 45.48971], [-67.42394, 45.37969], [-67.48201, 45.27351], [-67.34927, 45.122], [-67.29754, 45.14865], [-67.29748, 45.18173], [-67.27039, 45.1934], [-67.22751, 45.16344], [-67.20349, 45.1722]]]] } },
22647     { type: "Feature", properties: { iso1A2: "CC", iso1A3: "CCK", iso1N3: "166", wikidata: "Q36004", nameEn: "Cocos (Keeling) Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[96.61846, -10.82438], [96.02343, -12.68334], [97.93979, -12.33309], [96.61846, -10.82438]]]] } },
22648     { type: "Feature", properties: { iso1A2: "CD", iso1A3: "COD", iso1N3: "180", wikidata: "Q974", nameEn: "Democratic Republic of the Congo", aliases: ["ZR"], groups: ["017", "202", "002", "UN"], callingCodes: ["243"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.44012, 5.07349], [27.09575, 5.22305], [26.93064, 5.13535], [26.85579, 5.03887], [26.74572, 5.10685], [26.48595, 5.04984], [26.13371, 5.25594], [25.86073, 5.19455], [25.53271, 5.37431], [25.34558, 5.29101], [25.31256, 5.03668], [24.71816, 4.90509], [24.46719, 5.0915], [23.38847, 4.60013], [22.94817, 4.82392], [22.89094, 4.79321], [22.84691, 4.69887], [22.78526, 4.71423], [22.6928, 4.47285], [22.60915, 4.48821], [22.5431, 4.22041], [22.45504, 4.13039], [22.27682, 4.11347], [22.10721, 4.20723], [21.6405, 4.317], [21.55904, 4.25553], [21.25744, 4.33676], [21.21341, 4.29285], [21.11214, 4.33895], [21.08793, 4.39603], [20.90383, 4.44877], [20.60184, 4.42394], [18.62755, 3.47564], [18.63857, 3.19342], [18.10683, 2.26876], [18.08034, 1.58553], [17.85887, 1.04327], [17.86989, 0.58873], [17.95255, 0.48128], [17.93877, 0.32424], [17.81204, 0.23884], [17.66051, -0.26535], [17.72112, -0.52707], [17.32438, -0.99265], [16.97999, -1.12762], [16.70724, -1.45815], [16.50336, -1.8795], [16.16173, -2.16586], [16.22785, -2.59528], [16.1755, -3.25014], [16.21407, -3.2969], [15.89448, -3.9513], [15.53081, -4.042], [15.48121, -4.22062], [15.41785, -4.28381], [15.32693, -4.27282], [15.25411, -4.31121], [15.1978, -4.32388], [14.83101, -4.80838], [14.67948, -4.92093], [14.5059, -4.84956], [14.41499, -4.8825], [14.37366, -4.56125], [14.47284, -4.42941], [14.3957, -4.36623], [14.40672, -4.28381], [13.9108, -4.50906], [13.81162, -4.41842], [13.71794, -4.44864], [13.70417, -4.72601], [13.50305, -4.77818], [13.41764, -4.89897], [13.11182, -4.5942], [13.09648, -4.63739], [13.11195, -4.67745], [12.8733, -4.74346], [12.70868, -4.95505], [12.63465, -4.94632], [12.60251, -5.01715], [12.46297, -5.09408], [12.49815, -5.14058], [12.51589, -5.1332], [12.53586, -5.14658], [12.53599, -5.1618], [12.52301, -5.17481], [12.52318, -5.74353], [12.26557, -5.74031], [12.20376, -5.76338], [11.95767, -5.94705], [12.42245, -6.07585], [13.04371, -5.87078], [16.55507, -5.85631], [16.96282, -7.21787], [17.5828, -8.13784], [18.33635, -8.00126], [19.33698, -7.99743], [19.5469, -7.00195], [20.30218, -6.98955], [20.31846, -6.91953], [20.61689, -6.90876], [20.56263, -7.28566], [21.79824, -7.29628], [21.84856, -9.59871], [22.19039, -9.94628], [22.32604, -10.76291], [22.17954, -10.85884], [22.25951, -11.24911], [22.54205, -11.05784], [23.16602, -11.10577], [23.45631, -10.946], [23.86868, -11.02856], [24.00027, -10.89356], [24.34528, -11.06816], [24.42612, -11.44975], [25.34069, -11.19707], [25.33058, -11.65767], [26.01777, -11.91488], [26.88687, -12.01868], [27.04351, -11.61312], [27.22541, -11.60323], [27.21025, -11.76157], [27.59932, -12.22123], [28.33199, -12.41375], [29.01918, -13.41353], [29.60531, -13.21685], [29.65078, -13.41844], [29.81551, -13.44683], [29.8139, -12.14898], [29.48404, -12.23604], [29.4992, -12.43843], [29.18592, -12.37921], [28.48357, -11.87532], [28.37241, -11.57848], [28.65032, -10.65133], [28.62795, -9.92942], [28.68532, -9.78], [28.56208, -9.49122], [28.51627, -9.44726], [28.52636, -9.35379], [28.36562, -9.30091], [28.38526, -9.23393], [28.9711, -8.66935], [28.88917, -8.4831], [30.79243, -8.27382], [30.2567, -7.14121], [29.52552, -6.2731], [29.43673, -4.44845], [29.23708, -3.75856], [29.21463, -3.3514], [29.25633, -3.05471], [29.17258, -2.99385], [29.16037, -2.95457], [29.09797, -2.91935], [29.09119, -2.87871], [29.0505, -2.81774], [29.00404, -2.81978], [29.00167, -2.78523], [29.04081, -2.7416], [29.00357, -2.70596], [28.94346, -2.69124], [28.89793, -2.66111], [28.90226, -2.62385], [28.89288, -2.55848], [28.87943, -2.55165], [28.86193, -2.53185], [28.86209, -2.5231], [28.87497, -2.50887], [28.88846, -2.50493], [28.89342, -2.49017], [28.89132, -2.47557], [28.86846, -2.44866], [28.86826, -2.41888], [28.89601, -2.37321], [28.95642, -2.37321], [29.00051, -2.29001], [29.105, -2.27043], [29.17562, -2.12278], [29.11847, -1.90576], [29.24458, -1.69663], [29.24323, -1.66826], [29.36322, -1.50887], [29.45038, -1.5054], [29.53062, -1.40499], [29.59061, -1.39016], [29.58388, -0.89821], [29.63006, -0.8997], [29.62708, -0.71055], [29.67176, -0.55714], [29.67474, -0.47969], [29.65091, -0.46777], [29.72687, -0.08051], [29.7224, 0.07291], [29.77454, 0.16675], [29.81922, 0.16824], [29.87284, 0.39166], [29.97413, 0.52124], [29.95477, 0.64486], [29.98307, 0.84295], [30.1484, 0.89805], [30.22139, 0.99635], [30.24671, 1.14974], [30.48503, 1.21675], [31.30127, 2.11006], [31.28042, 2.17853], [31.20148, 2.2217], [31.1985, 2.29462], [31.12104, 2.27676], [31.07934, 2.30207], [31.06593, 2.35862], [30.96911, 2.41071], [30.91102, 2.33332], [30.83059, 2.42559], [30.74271, 2.43601], [30.75612, 2.5863], [30.8857, 2.83923], [30.8574, 2.9508], [30.77101, 3.04897], [30.84251, 3.26908], [30.93486, 3.40737], [30.94081, 3.50847], [30.85153, 3.48867], [30.85997, 3.5743], [30.80713, 3.60506], [30.78512, 3.67097], [30.56277, 3.62703], [30.57378, 3.74567], [30.55396, 3.84451], [30.47691, 3.83353], [30.27658, 3.95653], [30.22374, 3.93896], [30.1621, 4.10586], [30.06964, 4.13221], [29.79666, 4.37809], [29.82087, 4.56246], [29.49726, 4.7007], [29.43341, 4.50101], [29.22207, 4.34297], [29.03054, 4.48784], [28.8126, 4.48784], [28.6651, 4.42638], [28.20719, 4.35614], [27.79551, 4.59976], [27.76469, 4.79284], [27.65462, 4.89375], [27.56656, 4.89375], [27.44012, 5.07349]]]] } },
22649     { type: "Feature", properties: { iso1A2: "CF", iso1A3: "CAF", iso1N3: "140", wikidata: "Q929", nameEn: "Central African Republic", groups: ["017", "202", "002", "UN"], callingCodes: ["236"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.87758, 10.91915], [22.45889, 11.00246], [21.72139, 10.64136], [21.71479, 10.29932], [21.63553, 10.217], [21.52766, 10.2105], [21.34934, 9.95907], [21.26348, 9.97642], [20.82979, 9.44696], [20.36748, 9.11019], [19.06421, 9.00367], [18.86388, 8.87971], [19.11044, 8.68172], [18.79783, 8.25929], [18.67455, 8.22226], [18.62612, 8.14163], [18.64153, 8.08714], [18.6085, 8.05009], [18.02731, 8.01085], [17.93926, 7.95853], [17.67288, 7.98905], [16.8143, 7.53971], [16.6668, 7.67281], [16.658, 7.75353], [16.59415, 7.76444], [16.58315, 7.88657], [16.41583, 7.77971], [16.40703, 7.68809], [15.79942, 7.44149], [15.73118, 7.52006], [15.49743, 7.52179], [15.23397, 7.25135], [15.04717, 6.77085], [14.96311, 6.75693], [14.79966, 6.39043], [14.80122, 6.34866], [14.74206, 6.26356], [14.56149, 6.18928], [14.43073, 6.08867], [14.42917, 6.00508], [14.49455, 5.91683], [14.60974, 5.91838], [14.62375, 5.70466], [14.58951, 5.59777], [14.62531, 5.51411], [14.52724, 5.28319], [14.57083, 5.23979], [14.65489, 5.21343], [14.73383, 4.6135], [15.00825, 4.41458], [15.08609, 4.30282], [15.10644, 4.1362], [15.17482, 4.05131], [15.07686, 4.01805], [15.73522, 3.24348], [15.77725, 3.26835], [16.05449, 3.02306], [16.08252, 2.45708], [16.19357, 2.21537], [16.50126, 2.84739], [16.46701, 2.92512], [16.57598, 3.47999], [16.68283, 3.54257], [17.01746, 3.55136], [17.35649, 3.63045], [17.46876, 3.70515], [17.60966, 3.63705], [17.83421, 3.61068], [17.85842, 3.53378], [18.05656, 3.56893], [18.14902, 3.54476], [18.17323, 3.47665], [18.24148, 3.50302], [18.2723, 3.57992], [18.39558, 3.58212], [18.49245, 3.63924], [18.58711, 3.49423], [18.62755, 3.47564], [20.60184, 4.42394], [20.90383, 4.44877], [21.08793, 4.39603], [21.11214, 4.33895], [21.21341, 4.29285], [21.25744, 4.33676], [21.55904, 4.25553], [21.6405, 4.317], [22.10721, 4.20723], [22.27682, 4.11347], [22.45504, 4.13039], [22.5431, 4.22041], [22.60915, 4.48821], [22.6928, 4.47285], [22.78526, 4.71423], [22.84691, 4.69887], [22.89094, 4.79321], [22.94817, 4.82392], [23.38847, 4.60013], [24.46719, 5.0915], [24.71816, 4.90509], [25.31256, 5.03668], [25.34558, 5.29101], [25.53271, 5.37431], [25.86073, 5.19455], [26.13371, 5.25594], [26.48595, 5.04984], [26.74572, 5.10685], [26.85579, 5.03887], [26.93064, 5.13535], [27.09575, 5.22305], [27.44012, 5.07349], [27.26886, 5.25876], [27.23017, 5.37167], [27.28621, 5.56382], [27.22705, 5.62889], [27.22705, 5.71254], [26.51721, 6.09655], [26.58259, 6.1987], [26.32729, 6.36272], [26.38022, 6.63493], [25.90076, 7.09549], [25.37461, 7.33024], [25.35281, 7.42595], [25.20337, 7.50312], [25.20649, 7.61115], [25.29214, 7.66675], [25.25319, 7.8487], [24.98855, 7.96588], [24.85156, 8.16933], [24.35965, 8.26177], [24.13238, 8.36959], [24.25691, 8.69288], [23.51905, 8.71749], [23.59065, 8.99743], [23.44744, 8.99128], [23.4848, 9.16959], [23.56263, 9.19418], [23.64358, 9.28637], [23.64981, 9.44303], [23.62179, 9.53823], [23.69155, 9.67566], [23.67164, 9.86923], [23.3128, 10.45214], [23.02221, 10.69235], [22.87758, 10.91915]]]] } },
22650     { type: "Feature", properties: { iso1A2: "CG", iso1A3: "COG", iso1N3: "178", wikidata: "Q971", nameEn: "Republic of the Congo", groups: ["017", "202", "002", "UN"], callingCodes: ["242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.62755, 3.47564], [18.58711, 3.49423], [18.49245, 3.63924], [18.39558, 3.58212], [18.2723, 3.57992], [18.24148, 3.50302], [18.17323, 3.47665], [18.14902, 3.54476], [18.05656, 3.56893], [17.85842, 3.53378], [17.83421, 3.61068], [17.60966, 3.63705], [17.46876, 3.70515], [17.35649, 3.63045], [17.01746, 3.55136], [16.68283, 3.54257], [16.57598, 3.47999], [16.46701, 2.92512], [16.50126, 2.84739], [16.19357, 2.21537], [16.15568, 2.18955], [16.08563, 2.19733], [16.05294, 1.9811], [16.14634, 1.70259], [16.02647, 1.65591], [16.02959, 1.76483], [15.48942, 1.98265], [15.34776, 1.91264], [15.22634, 2.03243], [15.00996, 1.98887], [14.61145, 2.17866], [13.29457, 2.16106], [13.13461, 1.57238], [13.25447, 1.32339], [13.15519, 1.23368], [13.89582, 1.4261], [14.25186, 1.39842], [14.48179, 0.9152], [14.26066, 0.57255], [14.10909, 0.58563], [13.88648, 0.26652], [13.90632, -0.2287], [14.06862, -0.20826], [14.2165, -0.38261], [14.41887, -0.44799], [14.52569, -0.57818], [14.41838, -1.89412], [14.25932, -1.97624], [14.23518, -2.15671], [14.16202, -2.23916], [14.23829, -2.33715], [14.10442, -2.49268], [13.85846, -2.46935], [13.92073, -2.35581], [13.75884, -2.09293], [13.47977, -2.43224], [13.02759, -2.33098], [12.82172, -1.91091], [12.61312, -1.8129], [12.44656, -1.92025], [12.47925, -2.32626], [12.04895, -2.41704], [11.96866, -2.33559], [11.74605, -2.39936], [11.57637, -2.33379], [11.64487, -2.61865], [11.5359, -2.85654], [11.64798, -2.81146], [11.80365, -3.00424], [11.70558, -3.0773], [11.70227, -3.17465], [11.96554, -3.30267], [11.8318, -3.5812], [11.92719, -3.62768], [11.87083, -3.71571], [11.68608, -3.68942], [11.57949, -3.52798], [11.48764, -3.51089], [11.22301, -3.69888], [11.12647, -3.94169], [10.75913, -4.39519], [11.50888, -5.33417], [12.00924, -5.02627], [12.16068, -4.90089], [12.20901, -4.75642], [12.25587, -4.79437], [12.32324, -4.78415], [12.40964, -4.60609], [12.64835, -4.55937], [12.76844, -4.38709], [12.87096, -4.40315], [12.91489, -4.47907], [13.09648, -4.63739], [13.11182, -4.5942], [13.41764, -4.89897], [13.50305, -4.77818], [13.70417, -4.72601], [13.71794, -4.44864], [13.81162, -4.41842], [13.9108, -4.50906], [14.40672, -4.28381], [14.3957, -4.36623], [14.47284, -4.42941], [14.37366, -4.56125], [14.41499, -4.8825], [14.5059, -4.84956], [14.67948, -4.92093], [14.83101, -4.80838], [15.1978, -4.32388], [15.25411, -4.31121], [15.32693, -4.27282], [15.41785, -4.28381], [15.48121, -4.22062], [15.53081, -4.042], [15.89448, -3.9513], [16.21407, -3.2969], [16.1755, -3.25014], [16.22785, -2.59528], [16.16173, -2.16586], [16.50336, -1.8795], [16.70724, -1.45815], [16.97999, -1.12762], [17.32438, -0.99265], [17.72112, -0.52707], [17.66051, -0.26535], [17.81204, 0.23884], [17.93877, 0.32424], [17.95255, 0.48128], [17.86989, 0.58873], [17.85887, 1.04327], [18.08034, 1.58553], [18.10683, 2.26876], [18.63857, 3.19342], [18.62755, 3.47564]]]] } },
22651     { type: "Feature", properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] } },
22652     { type: "Feature", properties: { iso1A2: "CI", iso1A3: "CIV", iso1N3: "384", wikidata: "Q1008", nameEn: "C\xF4te d'Ivoire", groups: ["011", "202", "002", "UN"], callingCodes: ["225"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.52774, 3.7105], [-3.34019, 4.17519], [-3.10675, 5.08515], [-3.11073, 5.12675], [-3.063, 5.13665], [-2.96554, 5.10397], [-2.95261, 5.12477], [-2.75502, 5.10657], [-2.73074, 5.1364], [-2.77625, 5.34621], [-2.72737, 5.34789], [-2.76614, 5.60963], [-2.85378, 5.65156], [-2.93132, 5.62137], [-2.96671, 5.6415], [-2.95323, 5.71865], [-3.01896, 5.71697], [-3.25999, 6.62521], [-3.21954, 6.74407], [-3.23327, 6.81744], [-2.95438, 7.23737], [-2.97822, 7.27165], [-2.92339, 7.60847], [-2.79467, 7.86002], [-2.78395, 7.94974], [-2.74819, 7.92613], [-2.67787, 8.02055], [-2.61232, 8.02645], [-2.62901, 8.11495], [-2.49037, 8.20872], [-2.58243, 8.7789], [-2.66357, 9.01771], [-2.77799, 9.04949], [-2.69814, 9.22717], [-2.68802, 9.49343], [-2.76494, 9.40778], [-2.93012, 9.57403], [-3.00765, 9.74019], [-3.16609, 9.85147], [-3.19306, 9.93781], [-3.27228, 9.84981], [-3.31779, 9.91125], [-3.69703, 9.94279], [-4.25999, 9.76012], [-4.31392, 9.60062], [-4.6426, 9.70696], [-4.96621, 9.89132], [-4.96453, 9.99923], [-5.12465, 10.29788], [-5.39602, 10.2929], [-5.51058, 10.43177], [-5.65135, 10.46767], [-5.78124, 10.43952], [-5.99478, 10.19694], [-6.18851, 10.24244], [-6.1731, 10.46983], [-6.24795, 10.74248], [-6.325, 10.68624], [-6.40646, 10.69922], [-6.42847, 10.5694], [-6.52974, 10.59104], [-6.63541, 10.66893], [-6.68164, 10.35074], [-6.93921, 10.35291], [-7.01186, 10.25111], [-6.97444, 10.21644], [-7.00966, 10.15794], [-7.0603, 10.14711], [-7.13331, 10.24877], [-7.3707, 10.24677], [-7.44555, 10.44602], [-7.52261, 10.4655], [-7.54462, 10.40921], [-7.63048, 10.46334], [-7.92107, 10.15577], [-7.97971, 10.17117], [-8.01225, 10.1021], [-8.11921, 10.04577], [-8.15652, 9.94288], [-8.09434, 9.86936], [-8.14657, 9.55062], [-8.03463, 9.39604], [-7.85056, 9.41812], [-7.90777, 9.20456], [-7.73862, 9.08422], [-7.92518, 8.99332], [-7.95503, 8.81146], [-7.69882, 8.66148], [-7.65653, 8.36873], [-7.92518, 8.50652], [-8.22991, 8.48438], [-8.2411, 8.24196], [-8.062, 8.16071], [-7.98675, 8.20134], [-7.99919, 8.11023], [-7.94695, 8.00925], [-8.06449, 8.04989], [-8.13414, 7.87991], [-8.09931, 7.78626], [-8.21374, 7.54466], [-8.4003, 7.6285], [-8.47114, 7.55676], [-8.41935, 7.51203], [-8.37458, 7.25794], [-8.29249, 7.1691], [-8.31736, 6.82837], [-8.59456, 6.50612], [-8.48652, 6.43797], [-8.45666, 6.49977], [-8.38453, 6.35887], [-8.3298, 6.36381], [-8.17557, 6.28222], [-8.00642, 6.31684], [-7.90692, 6.27728], [-7.83478, 6.20309], [-7.8497, 6.08932], [-7.79747, 6.07696], [-7.78254, 5.99037], [-7.70294, 5.90625], [-7.67309, 5.94337], [-7.48155, 5.80974], [-7.46165, 5.84934], [-7.43677, 5.84687], [-7.43926, 5.74787], [-7.37209, 5.61173], [-7.43428, 5.42355], [-7.36463, 5.32944], [-7.46165, 5.26256], [-7.48901, 5.14118], [-7.55369, 5.08667], [-7.53876, 4.94294], [-7.59349, 4.8909], [-7.53259, 4.35145], [-7.52774, 3.7105]]]] } },
22653     { type: "Feature", properties: { iso1A2: "CK", iso1A3: "COK", iso1N3: "184", wikidata: "Q26988", nameEn: "Cook Islands", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["682"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.15106, -10.26955], [-156.45576, -31.75456], [-156.48634, -15.52824], [-156.50903, -7.4975], [-168.15106, -10.26955]]]] } },
22654     { type: "Feature", properties: { iso1A2: "CL", iso1A3: "CHL", iso1N3: "152", wikidata: "Q298", nameEn: "Chile", groups: ["005", "419", "019", "UN"], callingCodes: ["56"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.60702, -52.65781], [-68.41683, -52.33516], [-69.97824, -52.00845], [-71.99889, -51.98018], [-72.33873, -51.59954], [-72.31343, -50.58411], [-73.15765, -50.78337], [-73.55259, -49.92488], [-73.45156, -49.79461], [-73.09655, -49.14342], [-72.56894, -48.81116], [-72.54042, -48.52392], [-72.27662, -48.28727], [-72.50478, -47.80586], [-71.94152, -47.13595], [-71.68577, -46.55385], [-71.75614, -45.61611], [-71.35687, -45.22075], [-72.06985, -44.81756], [-71.26418, -44.75684], [-71.16436, -44.46244], [-71.81318, -44.38097], [-71.64206, -43.64774], [-72.14828, -42.85321], [-72.15541, -42.15941], [-71.74901, -42.11711], [-71.92726, -40.72714], [-71.37826, -38.91474], [-70.89532, -38.6923], [-71.24279, -37.20264], [-70.95047, -36.4321], [-70.38008, -36.02375], [-70.49416, -35.24145], [-69.87386, -34.13344], [-69.88099, -33.34489], [-70.55832, -31.51559], [-70.14479, -30.36595], [-69.8596, -30.26131], [-69.99507, -29.28351], [-69.80969, -29.07185], [-69.66709, -28.44055], [-69.22504, -27.95042], [-68.77586, -27.16029], [-68.43363, -27.08414], [-68.27677, -26.90626], [-68.59048, -26.49861], [-68.56909, -26.28146], [-68.38372, -26.15353], [-68.57622, -25.32505], [-68.38372, -25.08636], [-68.56909, -24.69831], [-68.24825, -24.42596], [-67.33563, -24.04237], [-66.99632, -22.99839], [-67.18382, -22.81525], [-67.54284, -22.89771], [-67.85114, -22.87076], [-68.18816, -21.28614], [-68.40403, -20.94562], [-68.53957, -20.91542], [-68.55383, -20.7355], [-68.44023, -20.62701], [-68.7276, -20.46178], [-68.74273, -20.08817], [-68.57132, -20.03134], [-68.54611, -19.84651], [-68.66761, -19.72118], [-68.41218, -19.40499], [-68.61989, -19.27584], [-68.80602, -19.08355], [-68.87082, -19.06003], [-68.94987, -18.93302], [-69.07432, -18.28259], [-69.14807, -18.16893], [-69.07496, -18.03715], [-69.28671, -17.94844], [-69.34126, -17.72753], [-69.46623, -17.60518], [-69.46897, -17.4988], [-69.66483, -17.65083], [-69.79087, -17.65563], [-69.82868, -17.72048], [-69.75305, -17.94605], [-69.81607, -18.12582], [-69.96732, -18.25992], [-70.16394, -18.31737], [-70.31267, -18.31258], [-70.378, -18.3495], [-70.59118, -18.35072], [-113.52687, -26.52828], [-68.11646, -58.14883], [-66.07313, -55.19618], [-67.11046, -54.94199], [-67.46182, -54.92205], [-68.01394, -54.8753], [-68.60733, -54.9125], [-68.60702, -52.65781]]]] } },
22655     { type: "Feature", properties: { iso1A2: "CM", iso1A3: "CMR", iso1N3: "120", wikidata: "Q1009", nameEn: "Cameroon", groups: ["017", "202", "002", "UN"], callingCodes: ["237"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.83314, 12.62963], [14.55058, 12.78256], [14.56101, 12.91036], [14.46881, 13.08259], [14.08251, 13.0797], [14.20204, 12.53405], [14.17523, 12.41916], [14.22215, 12.36533], [14.4843, 12.35223], [14.6474, 12.17466], [14.61612, 11.7798], [14.55207, 11.72001], [14.64591, 11.66166], [14.6124, 11.51283], [14.17821, 11.23831], [13.97489, 11.30258], [13.78945, 11.00154], [13.7403, 11.00593], [13.70753, 10.94451], [13.73434, 10.9255], [13.54964, 10.61236], [13.5705, 10.53183], [13.43644, 10.13326], [13.34111, 10.12299], [13.25025, 10.03647], [13.25323, 10.00127], [13.286, 9.9822], [13.27409, 9.93232], [13.24132, 9.91031], [13.25025, 9.86042], [13.29941, 9.8296], [13.25472, 9.76795], [13.22642, 9.57266], [13.02385, 9.49334], [12.85628, 9.36698], [12.91958, 9.33905], [12.90022, 9.11411], [12.81085, 8.91992], [12.79, 8.75361], [12.71701, 8.7595], [12.68722, 8.65938], [12.44146, 8.6152], [12.4489, 8.52536], [12.26123, 8.43696], [12.24782, 8.17904], [12.19271, 8.10826], [12.20909, 7.97553], [11.99908, 7.67302], [12.01844, 7.52981], [11.93205, 7.47812], [11.84864, 7.26098], [11.87396, 7.09398], [11.63117, 6.9905], [11.55818, 6.86186], [11.57755, 6.74059], [11.51499, 6.60892], [11.42264, 6.5882], [11.42041, 6.53789], [11.09495, 6.51717], [11.09644, 6.68437], [10.94302, 6.69325], [10.8179, 6.83377], [10.83727, 6.9358], [10.60789, 7.06885], [10.59746, 7.14719], [10.57214, 7.16345], [10.53639, 6.93432], [10.21466, 6.88996], [10.15135, 7.03781], [9.86314, 6.77756], [9.77824, 6.79088], [9.70674, 6.51717], [9.51757, 6.43874], [8.84209, 5.82562], [8.88156, 5.78857], [8.83687, 5.68483], [8.92029, 5.58403], [8.78027, 5.1243], [8.60302, 4.87353], [8.34397, 4.30689], [9.22018, 3.72052], [9.81162, 2.33797], [9.82123, 2.35097], [9.83754, 2.32428], [9.83238, 2.29079], [9.84716, 2.24676], [9.89012, 2.20457], [9.90749, 2.20049], [9.991, 2.16561], [11.3561, 2.17217], [11.37116, 2.29975], [13.28534, 2.25716], [13.29457, 2.16106], [14.61145, 2.17866], [15.00996, 1.98887], [15.22634, 2.03243], [15.34776, 1.91264], [15.48942, 1.98265], [16.02959, 1.76483], [16.02647, 1.65591], [16.14634, 1.70259], [16.05294, 1.9811], [16.08563, 2.19733], [16.15568, 2.18955], [16.19357, 2.21537], [16.08252, 2.45708], [16.05449, 3.02306], [15.77725, 3.26835], [15.73522, 3.24348], [15.07686, 4.01805], [15.17482, 4.05131], [15.10644, 4.1362], [15.08609, 4.30282], [15.00825, 4.41458], [14.73383, 4.6135], [14.65489, 5.21343], [14.57083, 5.23979], [14.52724, 5.28319], [14.62531, 5.51411], [14.58951, 5.59777], [14.62375, 5.70466], [14.60974, 5.91838], [14.49455, 5.91683], [14.42917, 6.00508], [14.43073, 6.08867], [14.56149, 6.18928], [14.74206, 6.26356], [14.80122, 6.34866], [14.79966, 6.39043], [14.96311, 6.75693], [15.04717, 6.77085], [15.23397, 7.25135], [15.49743, 7.52179], [15.56964, 7.58936], [15.59272, 7.7696], [15.50743, 7.79302], [15.20426, 8.50892], [15.09484, 8.65982], [14.83566, 8.80557], [14.35707, 9.19611], [14.37094, 9.2954], [13.97544, 9.6365], [14.01793, 9.73169], [14.1317, 9.82413], [14.20411, 10.00055], [14.4673, 10.00264], [14.80082, 9.93818], [14.95722, 9.97926], [15.05999, 9.94845], [15.14043, 9.99246], [15.24618, 9.99246], [15.41408, 9.92876], [15.68761, 9.99344], [15.50535, 10.1098], [15.30874, 10.31063], [15.23724, 10.47764], [15.14936, 10.53915], [15.15532, 10.62846], [15.06737, 10.80921], [15.09127, 10.87431], [15.04957, 11.02347], [15.10021, 11.04101], [15.0585, 11.40481], [15.13149, 11.5537], [15.06595, 11.71126], [15.11579, 11.79313], [15.04808, 11.8731], [15.05786, 12.0608], [15.0349, 12.10698], [15.00146, 12.1223], [14.96952, 12.0925], [14.89019, 12.16593], [14.90827, 12.3269], [14.83314, 12.62963]]]] } },
22656     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
22657     { type: "Feature", properties: { iso1A2: "CO", iso1A3: "COL", iso1N3: "170", wikidata: "Q739", nameEn: "Colombia", groups: ["005", "419", "019", "UN"], callingCodes: ["57"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.19849, 12.65801], [-81.58685, 18.0025], [-82.06974, 14.49418], [-82.56142, 11.91792], [-78.79327, 9.93766], [-77.58292, 9.22278], [-77.32389, 8.81247], [-77.45064, 8.49991], [-77.17257, 7.97422], [-77.57185, 7.51147], [-77.72514, 7.72348], [-77.72157, 7.47612], [-77.81426, 7.48319], [-77.89178, 7.22681], [-78.06168, 7.07793], [-82.12561, 4.00341], [-78.87137, 1.47457], [-78.42749, 1.15389], [-77.85677, 0.80197], [-77.7148, 0.85003], [-77.68613, 0.83029], [-77.66416, 0.81604], [-77.67815, 0.73863], [-77.49984, 0.64476], [-77.52001, 0.40782], [-76.89177, 0.24736], [-76.4094, 0.24015], [-76.41215, 0.38228], [-76.23441, 0.42294], [-75.82927, 0.09578], [-75.25764, -0.11943], [-75.18513, -0.0308], [-74.42701, -0.50218], [-74.26675, -0.97229], [-73.65312, -1.26222], [-72.92587, -2.44514], [-71.75223, -2.15058], [-70.94377, -2.23142], [-70.04609, -2.73906], [-70.71396, -3.7921], [-70.52393, -3.87553], [-70.3374, -3.79505], [-69.94708, -4.2431], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.03658, -0.19681], [-70.04162, 0.55437], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.82987, 1.07864], [-69.83491, 1.69353], [-69.53746, 1.76408], [-69.38621, 1.70865], [-68.18128, 1.72881], [-68.26699, 1.83463], [-68.18632, 2.00091], [-67.9292, 1.82455], [-67.40488, 2.22258], [-67.299, 1.87494], [-67.15784, 1.80439], [-67.08222, 1.17441], [-66.85795, 1.22998], [-67.21967, 2.35778], [-67.65696, 2.81691], [-67.85862, 2.79173], [-67.85862, 2.86727], [-67.30945, 3.38393], [-67.50067, 3.75812], [-67.62671, 3.74303], [-67.85358, 4.53249], [-67.83341, 5.31104], [-67.59141, 5.5369], [-67.63914, 5.64963], [-67.58558, 5.84537], [-67.43513, 5.98835], [-67.4625, 6.20625], [-67.60654, 6.2891], [-69.41843, 6.1072], [-70.10716, 6.96516], [-70.7596, 7.09799], [-71.03941, 6.98163], [-71.37234, 7.01588], [-71.42212, 7.03854], [-71.44118, 7.02116], [-71.82441, 7.04314], [-72.04895, 7.03837], [-72.19437, 7.37034], [-72.43132, 7.40034], [-72.47415, 7.48928], [-72.45321, 7.57232], [-72.47827, 7.65604], [-72.46763, 7.79518], [-72.44454, 7.86031], [-72.46183, 7.90682], [-72.45806, 7.91141], [-72.47042, 7.92306], [-72.48183, 7.92909], [-72.48801, 7.94329], [-72.47213, 7.96106], [-72.39137, 8.03534], [-72.35163, 8.01163], [-72.36987, 8.19976], [-72.4042, 8.36513], [-72.65474, 8.61428], [-72.77415, 9.10165], [-72.94052, 9.10663], [-73.02119, 9.27584], [-73.36905, 9.16636], [-72.98085, 9.85253], [-72.88002, 10.44309], [-72.4767, 11.1117], [-72.24983, 11.14138], [-71.9675, 11.65536], [-71.3275, 11.85], [-70.92579, 11.96275], [-71.19849, 12.65801]]]] } },
22658     { type: "Feature", properties: { iso1A2: "CP", iso1A3: "CPT", wikidata: "Q161258", nameEn: "Clipperton Island", country: "FR", groups: ["EU", "013", "003", "019", "UN"], isoStatus: "excRes" }, geometry: { type: "MultiPolygon", coordinates: [[[[-110.36279, 9.79626], [-108.755, 9.84085], [-109.04145, 11.13245], [-110.36279, 9.79626]]]] } },
22659     { type: "Feature", properties: { iso1A2: "CR", iso1A3: "CRI", iso1N3: "188", wikidata: "Q800", nameEn: "Costa Rica", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["506"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.68276, 11.01562], [-83.66597, 10.79916], [-83.90838, 10.71161], [-84.68197, 11.07568], [-84.92439, 10.9497], [-85.60529, 11.22607], [-85.71223, 11.06868], [-86.14524, 11.09059], [-87.41779, 5.02401], [-82.94503, 7.93865], [-82.89978, 8.04083], [-82.89137, 8.05755], [-82.88641, 8.10219], [-82.9388, 8.26634], [-83.05209, 8.33394], [-82.93056, 8.43465], [-82.8679, 8.44042], [-82.8382, 8.48117], [-82.83322, 8.52464], [-82.83975, 8.54755], [-82.82739, 8.60153], [-82.8794, 8.6981], [-82.92068, 8.74832], [-82.91377, 8.774], [-82.88253, 8.83331], [-82.72126, 8.97125], [-82.93516, 9.07687], [-82.93516, 9.46741], [-82.84871, 9.4973], [-82.87919, 9.62645], [-82.77206, 9.59573], [-82.66667, 9.49746], [-82.61345, 9.49881], [-82.56507, 9.57279], [-82.51044, 9.65379], [-83.54024, 10.96805], [-83.68276, 11.01562]]]] } },
22660     { type: "Feature", properties: { iso1A2: "CU", iso1A3: "CUB", iso1N3: "192", wikidata: "Q241", nameEn: "Cuba", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["53"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-73.62304, 20.6935], [-82.02215, 24.23074], [-85.77883, 21.92705], [-74.81171, 18.82201], [-73.62304, 20.6935]]]] } },
22661     { type: "Feature", properties: { iso1A2: "CV", iso1A3: "CPV", iso1N3: "132", wikidata: "Q1011", nameEn: "Cape Verde", groups: ["Q105472", "011", "202", "002", "UN"], callingCodes: ["238"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-28.81604, 14.57305], [-20.39702, 14.12816], [-23.37101, 19.134], [-28.81604, 14.57305]]]] } },
22662     { type: "Feature", properties: { iso1A2: "CW", iso1A3: "CUW", iso1N3: "531", wikidata: "Q25279", nameEn: "Cura\xE7ao", aliases: ["NL-CW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["599"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.90012, 12.62309], [-69.59009, 12.46019], [-68.99639, 11.79035], [-68.33524, 11.78151], [-68.90012, 12.62309]]]] } },
22663     { type: "Feature", properties: { iso1A2: "CX", iso1A3: "CXR", iso1N3: "162", wikidata: "Q31063", nameEn: "Christmas Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.66835, -9.31927], [104.67494, -11.2566], [106.66176, -11.14349], [105.66835, -9.31927]]]] } },
22664     { type: "Feature", properties: { iso1A2: "CY", iso1A3: "CYP", iso1N3: "196", wikidata: "Q229", nameEn: "Republic of Cyprus", groups: ["Q644636", "EU", "145", "142", "UN"], driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.46489, 35.48584], [30.15137, 34.08517], [32.74412, 34.43926], [32.75515, 34.64985], [32.76136, 34.68318], [32.79433, 34.67883], [32.82717, 34.70622], [32.86014, 34.70585], [32.86167, 34.68734], [32.9068, 34.66102], [32.91398, 34.67343], [32.93043, 34.67091], [32.92807, 34.66736], [32.93449, 34.66241], [32.93693, 34.67027], [32.94379, 34.67111], [32.94683, 34.67907], [32.95539, 34.68471], [32.99135, 34.68061], [32.98668, 34.67268], [32.99014, 34.65518], [32.97736, 34.65277], [32.97079, 34.66112], [32.95325, 34.66462], [32.94796, 34.6587], [32.94976, 34.65204], [32.95471, 34.64528], [32.95323, 34.64075], [32.95891, 34.62919], [32.96718, 34.63446], [32.96968, 34.64046], [33.0138, 34.64424], [33.26744, 34.49942], [33.83531, 34.73974], [33.70575, 34.97947], [33.70639, 34.99303], [33.71514, 35.00294], [33.69731, 35.01754], [33.69938, 35.03123], [33.67678, 35.03866], [33.63765, 35.03869], [33.61215, 35.0527], [33.59658, 35.03635], [33.567, 35.04803], [33.57478, 35.06049], [33.53975, 35.08151], [33.48915, 35.06594], [33.47666, 35.00701], [33.45256, 35.00288], [33.45178, 35.02078], [33.47825, 35.04103], [33.48136, 35.0636], [33.46813, 35.10564], [33.41675, 35.16325], [33.4076, 35.20062], [33.38575, 35.2018], [33.37248, 35.18698], [33.3717, 35.1788], [33.36569, 35.17479], [33.35612, 35.17402], [33.35596, 35.17942], [33.34964, 35.17803], [33.35056, 35.18328], [33.31955, 35.18096], [33.3072, 35.16816], [33.27068, 35.16815], [33.15138, 35.19504], [33.11105, 35.15639], [33.08249, 35.17319], [33.01192, 35.15639], [32.94471, 35.09422], [32.86406, 35.1043], [32.85733, 35.07742], [32.70779, 35.14127], [32.70947, 35.18328], [32.64864, 35.19967], [32.60361, 35.16647], [32.46489, 35.48584]]], [[[33.74144, 35.01053], [33.7492, 35.01319], [33.74983, 35.02274], [33.74265, 35.02329], [33.73781, 35.02181], [33.7343, 35.01178], [33.74144, 35.01053]]], [[[33.77312, 34.9976], [33.75994, 35.00113], [33.75682, 34.99916], [33.76605, 34.99543], [33.76738, 34.99188], [33.7778, 34.98981], [33.77843, 34.988], [33.78149, 34.98854], [33.78318, 34.98699], [33.78571, 34.98951], [33.78917, 34.98854], [33.79191, 34.98914], [33.78516, 34.99582], [33.77553, 34.99518], [33.77312, 34.9976]]]] } },
22665     { type: "Feature", properties: { iso1A2: "CZ", iso1A3: "CZE", iso1N3: "203", wikidata: "Q213", nameEn: "Czechia", groups: ["EU", "151", "150", "UN"], callingCodes: ["420"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.82803, 50.86966], [14.79139, 50.81438], [14.70661, 50.84096], [14.61993, 50.86049], [14.63434, 50.8883], [14.65259, 50.90513], [14.64802, 50.93241], [14.58024, 50.91443], [14.56374, 50.922], [14.59702, 50.96148], [14.59908, 50.98685], [14.58215, 50.99306], [14.56432, 51.01008], [14.53438, 51.00374], [14.53321, 51.01679], [14.49873, 51.02242], [14.50809, 51.0427], [14.49991, 51.04692], [14.49154, 51.04382], [14.49202, 51.02286], [14.45827, 51.03712], [14.41335, 51.02086], [14.30098, 51.05515], [14.25665, 50.98935], [14.28776, 50.97718], [14.32353, 50.98556], [14.32793, 50.97379], [14.30251, 50.96606], [14.31422, 50.95243], [14.39848, 50.93866], [14.38691, 50.89907], [14.30098, 50.88448], [14.27123, 50.89386], [14.24314, 50.88761], [14.22331, 50.86049], [14.02982, 50.80662], [13.98864, 50.8177], [13.89113, 50.78533], [13.89444, 50.74142], [13.82942, 50.7251], [13.76316, 50.73487], [13.70204, 50.71771], [13.65977, 50.73096], [13.52474, 50.70394], [13.53748, 50.67654], [13.5226, 50.64721], [13.49742, 50.63133], [13.46413, 50.60102], [13.42189, 50.61243], [13.37485, 50.64931], [13.37805, 50.627], [13.32264, 50.60317], [13.32594, 50.58009], [13.29454, 50.57904], [13.25158, 50.59268], [13.19043, 50.50237], [13.13424, 50.51709], [13.08301, 50.50132], [13.0312, 50.50944], [13.02038, 50.4734], [13.02147, 50.44763], [12.98433, 50.42016], [12.94058, 50.40944], [12.82465, 50.45738], [12.73476, 50.43237], [12.73044, 50.42268], [12.70731, 50.39948], [12.67261, 50.41949], [12.51356, 50.39694], [12.48747, 50.37278], [12.49214, 50.35228], [12.48256, 50.34784], [12.46643, 50.35527], [12.43722, 50.33774], [12.43371, 50.32506], [12.39924, 50.32302], [12.40158, 50.29521], [12.36594, 50.28289], [12.35425, 50.23993], [12.33263, 50.24367], [12.32445, 50.20442], [12.33847, 50.19432], [12.32596, 50.17146], [12.29232, 50.17524], [12.28063, 50.19544], [12.28755, 50.22429], [12.23943, 50.24594], [12.24791, 50.25525], [12.26953, 50.25189], [12.25119, 50.27079], [12.20823, 50.2729], [12.18013, 50.32146], [12.10907, 50.32041], [12.13716, 50.27396], [12.09287, 50.25032], [12.19335, 50.19997], [12.21484, 50.16399], [12.1917, 50.13434], [12.2073, 50.10315], [12.23709, 50.10213], [12.27433, 50.0771], [12.26111, 50.06331], [12.30798, 50.05719], [12.49908, 49.97305], [12.47264, 49.94222], [12.55197, 49.92094], [12.48256, 49.83575], [12.46603, 49.78882], [12.40489, 49.76321], [12.4462, 49.70233], [12.52553, 49.68415], [12.53544, 49.61888], [12.56188, 49.6146], [12.60155, 49.52887], [12.64782, 49.52565], [12.64121, 49.47628], [12.669, 49.42935], [12.71227, 49.42363], [12.75854, 49.3989], [12.78168, 49.34618], [12.88414, 49.33541], [12.88249, 49.35479], [12.94859, 49.34079], [13.03618, 49.30417], [13.02957, 49.27399], [13.05883, 49.26259], [13.17665, 49.16713], [13.17019, 49.14339], [13.20405, 49.12303], [13.23689, 49.11412], [13.28242, 49.1228], [13.39479, 49.04812], [13.40802, 48.98851], [13.50221, 48.93752], [13.50552, 48.97441], [13.58319, 48.96899], [13.61624, 48.9462], [13.67739, 48.87886], [13.73854, 48.88538], [13.76994, 48.83537], [13.78977, 48.83319], [13.8096, 48.77877], [13.84023, 48.76988], [14.06151, 48.66873], [14.01482, 48.63788], [14.09104, 48.5943], [14.20691, 48.5898], [14.33909, 48.55852], [14.43076, 48.58855], [14.4587, 48.64695], [14.56139, 48.60429], [14.60808, 48.62881], [14.66762, 48.58215], [14.71794, 48.59794], [14.72756, 48.69502], [14.80584, 48.73489], [14.80821, 48.77711], [14.81545, 48.7874], [14.94773, 48.76268], [14.95641, 48.75915], [14.9758, 48.76857], [14.98112, 48.77524], [14.9782, 48.7766], [14.98032, 48.77959], [14.95072, 48.79101], [14.98917, 48.90082], [14.97612, 48.96983], [14.99878, 49.01444], [15.15534, 48.99056], [15.16358, 48.94278], [15.26177, 48.95766], [15.28305, 48.98831], [15.34823, 48.98444], [15.48027, 48.94481], [15.51357, 48.91549], [15.61622, 48.89541], [15.6921, 48.85973], [15.75341, 48.8516], [15.78087, 48.87644], [15.84404, 48.86921], [16.06034, 48.75436], [16.37345, 48.729], [16.40915, 48.74576], [16.46134, 48.80865], [16.67008, 48.77699], [16.68518, 48.7281], [16.71883, 48.73806], [16.79779, 48.70998], [16.90354, 48.71541], [16.93955, 48.60371], [17.00215, 48.70887], [17.11202, 48.82925], [17.19355, 48.87602], [17.29054, 48.85546], [17.3853, 48.80936], [17.45671, 48.85004], [17.5295, 48.81117], [17.7094, 48.86721], [17.73126, 48.87885], [17.77944, 48.92318], [17.87831, 48.92679], [17.91814, 49.01784], [18.06885, 49.03157], [18.1104, 49.08624], [18.15022, 49.24518], [18.18456, 49.28909], [18.36446, 49.3267], [18.4139, 49.36517], [18.4084, 49.40003], [18.44686, 49.39467], [18.54848, 49.47059], [18.53063, 49.49022], [18.57183, 49.51162], [18.6144, 49.49824], [18.67757, 49.50895], [18.74761, 49.492], [18.84521, 49.51672], [18.84786, 49.5446], [18.80479, 49.6815], [18.72838, 49.68163], [18.69817, 49.70473], [18.62676, 49.71983], [18.62943, 49.74603], [18.62645, 49.75002], [18.61368, 49.75426], [18.61278, 49.7618], [18.57183, 49.83334], [18.60341, 49.86256], [18.57045, 49.87849], [18.57697, 49.91565], [18.54299, 49.92537], [18.54495, 49.9079], [18.53423, 49.89906], [18.41604, 49.93498], [18.33562, 49.94747], [18.33278, 49.92415], [18.31914, 49.91565], [18.27794, 49.93863], [18.27107, 49.96779], [18.21752, 49.97309], [18.20241, 49.99958], [18.10628, 50.00223], [18.07898, 50.04535], [18.03212, 50.06574], [18.00396, 50.04954], [18.04585, 50.03311], [18.04585, 50.01194], [18.00191, 50.01723], [17.86886, 49.97452], [17.77669, 50.02253], [17.7506, 50.07896], [17.6888, 50.12037], [17.66683, 50.10275], [17.59404, 50.16437], [17.70528, 50.18812], [17.76296, 50.23382], [17.72176, 50.25665], [17.74648, 50.29966], [17.69292, 50.32859], [17.67764, 50.28977], [17.58889, 50.27837], [17.3702, 50.28123], [17.34548, 50.2628], [17.34273, 50.32947], [17.27681, 50.32246], [17.19991, 50.3654], [17.19579, 50.38817], [17.14498, 50.38117], [17.1224, 50.39494], [16.89229, 50.45117], [16.85933, 50.41093], [16.90877, 50.38642], [16.94448, 50.31281], [16.99803, 50.30316], [17.02138, 50.27772], [16.99803, 50.25753], [17.02825, 50.23118], [17.00353, 50.21449], [16.98018, 50.24172], [16.8456, 50.20834], [16.7014, 50.09659], [16.63137, 50.1142], [16.55446, 50.16613], [16.56407, 50.21009], [16.42674, 50.32509], [16.39379, 50.3207], [16.3622, 50.34875], [16.36495, 50.37679], [16.30289, 50.38292], [16.28118, 50.36891], [16.22821, 50.41054], [16.21585, 50.40627], [16.19526, 50.43291], [16.31413, 50.50274], [16.34572, 50.49575], [16.44597, 50.58041], [16.33611, 50.66579], [16.23174, 50.67101], [16.20839, 50.63096], [16.10265, 50.66405], [16.02437, 50.60046], [15.98317, 50.61528], [16.0175, 50.63009], [15.97219, 50.69799], [15.87331, 50.67188], [15.81683, 50.75666], [15.73186, 50.73885], [15.43798, 50.80833], [15.3803, 50.77187], [15.36656, 50.83956], [15.2773, 50.8907], [15.27043, 50.97724], [15.2361, 50.99886], [15.1743, 50.9833], [15.16744, 51.01959], [15.11937, 50.99021], [15.10152, 51.01095], [15.06218, 51.02269], [15.03895, 51.0123], [15.02433, 51.0242], [14.96419, 50.99108], [15.01088, 50.97984], [14.99852, 50.86817], [14.82803, 50.86966]]]] } },
22666     { type: "Feature", properties: { iso1A2: "DE", iso1A3: "DEU", iso1N3: "276", wikidata: "Q183", nameEn: "Germany", groups: ["EU", "155", "150", "UN"], callingCodes: ["49"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.70847, 47.68904], [8.71773, 47.69088], [8.70237, 47.71453], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.68985, 47.69552], [8.70847, 47.68904]]], [[[8.72617, 47.69651], [8.72809, 47.69282], [8.75856, 47.68969], [8.79511, 47.67462], [8.79966, 47.70222], [8.76965, 47.7075], [8.77309, 47.72059], [8.80663, 47.73821], [8.82002, 47.71458], [8.86989, 47.70504], [8.85065, 47.68209], [8.87383, 47.67045], [8.87625, 47.65441], [8.89946, 47.64769], [8.94093, 47.65596], [9.02093, 47.6868], [9.09891, 47.67801], [9.13845, 47.66389], [9.15181, 47.66904], [9.1705, 47.65513], [9.1755, 47.65584], [9.17593, 47.65399], [9.18203, 47.65598], [9.25619, 47.65939], [9.55125, 47.53629], [9.72736, 47.53457], [9.76748, 47.5934], [9.80254, 47.59419], [9.82591, 47.58158], [9.8189, 47.54688], [9.87499, 47.52953], [9.87733, 47.54688], [9.92407, 47.53111], [9.96029, 47.53899], [10.00003, 47.48216], [10.03859, 47.48927], [10.07131, 47.45531], [10.09001, 47.46005], [10.1052, 47.4316], [10.06897, 47.40709], [10.09819, 47.35724], [10.11805, 47.37228], [10.16362, 47.36674], [10.17648, 47.38889], [10.2127, 47.38019], [10.22774, 47.38904], [10.23757, 47.37609], [10.19998, 47.32832], [10.2147, 47.31014], [10.17648, 47.29149], [10.17531, 47.27167], [10.23257, 47.27088], [10.33424, 47.30813], [10.39851, 47.37623], [10.4324, 47.38494], [10.4359, 47.41183], [10.47446, 47.43318], [10.46278, 47.47901], [10.44291, 47.48453], [10.4324, 47.50111], [10.44992, 47.5524], [10.43473, 47.58394], [10.47329, 47.58552], [10.48849, 47.54057], [10.56912, 47.53584], [10.60337, 47.56755], [10.63456, 47.5591], [10.68832, 47.55752], [10.6965, 47.54253], [10.7596, 47.53228], [10.77596, 47.51729], [10.88814, 47.53701], [10.91268, 47.51334], [10.86945, 47.5015], [10.87061, 47.4786], [10.90918, 47.48571], [10.93839, 47.48018], [10.92437, 47.46991], [10.98513, 47.42882], [10.97111, 47.41617], [10.97111, 47.39561], [11.11835, 47.39719], [11.12536, 47.41222], [11.20482, 47.43198], [11.25157, 47.43277], [11.22002, 47.3964], [11.27844, 47.39956], [11.29597, 47.42566], [11.33804, 47.44937], [11.4175, 47.44621], [11.38128, 47.47465], [11.4362, 47.51413], [11.52618, 47.50939], [11.58578, 47.52281], [11.58811, 47.55515], [11.60681, 47.57881], [11.63934, 47.59202], [11.84052, 47.58354], [11.85572, 47.60166], [12.0088, 47.62451], [12.02282, 47.61033], [12.05788, 47.61742], [12.13734, 47.60639], [12.17824, 47.61506], [12.18145, 47.61019], [12.17737, 47.60121], [12.18568, 47.6049], [12.20398, 47.60667], [12.20801, 47.61082], [12.19895, 47.64085], [12.18507, 47.65984], [12.18347, 47.66663], [12.16769, 47.68167], [12.16217, 47.70105], [12.18303, 47.70065], [12.22571, 47.71776], [12.2542, 47.7433], [12.26238, 47.73544], [12.24017, 47.69534], [12.26004, 47.67725], [12.27991, 47.68827], [12.336, 47.69534], [12.37222, 47.68433], [12.43883, 47.6977], [12.44117, 47.6741], [12.50076, 47.62293], [12.53816, 47.63553], [12.57438, 47.63238], [12.6071, 47.6741], [12.7357, 47.6787], [12.77777, 47.66689], [12.76492, 47.64485], [12.82101, 47.61493], [12.77427, 47.58025], [12.80699, 47.54477], [12.84672, 47.54556], [12.85256, 47.52741], [12.9624, 47.47452], [12.98344, 47.48716], [12.9998, 47.46267], [13.04537, 47.49426], [13.03252, 47.53373], [13.05355, 47.56291], [13.04537, 47.58183], [13.06641, 47.58577], [13.06407, 47.60075], [13.09562, 47.63304], [13.07692, 47.68814], [13.01382, 47.72116], [12.98578, 47.7078], [12.92969, 47.71094], [12.91333, 47.7178], [12.90274, 47.72513], [12.91711, 47.74026], [12.9353, 47.74788], [12.94371, 47.76281], [12.93202, 47.77302], [12.96311, 47.79957], [12.98543, 47.82896], [13.00588, 47.84374], [12.94163, 47.92927], [12.93886, 47.94046], [12.93642, 47.94436], [12.93419, 47.94063], [12.92668, 47.93879], [12.91985, 47.94069], [12.9211, 47.95135], [12.91683, 47.95647], [12.87476, 47.96195], [12.8549, 48.01122], [12.76141, 48.07373], [12.74973, 48.10885], [12.7617, 48.12796], [12.78595, 48.12445], [12.80676, 48.14979], [12.82673, 48.15245], [12.8362, 48.15876], [12.836, 48.1647], [12.84475, 48.16556], [12.87126, 48.20318], [12.95306, 48.20629], [13.02083, 48.25689], [13.0851, 48.27711], [13.126, 48.27867], [13.18093, 48.29577], [13.26039, 48.29422], [13.30897, 48.31575], [13.40709, 48.37292], [13.43929, 48.43386], [13.42527, 48.45711], [13.45727, 48.51092], [13.43695, 48.55776], [13.45214, 48.56472], [13.46967, 48.55157], [13.50663, 48.57506], [13.50131, 48.58091], [13.51291, 48.59023], [13.57535, 48.55912], [13.59705, 48.57013], [13.62508, 48.55501], [13.65186, 48.55092], [13.66113, 48.53558], [13.72802, 48.51208], [13.74816, 48.53058], [13.7513, 48.5624], [13.76921, 48.55324], [13.80519, 48.58026], [13.80038, 48.59487], [13.82609, 48.62345], [13.81901, 48.6761], [13.81283, 48.68426], [13.81791, 48.69832], [13.79337, 48.71375], [13.81863, 48.73257], [13.82266, 48.75544], [13.84023, 48.76988], [13.8096, 48.77877], [13.78977, 48.83319], [13.76994, 48.83537], [13.73854, 48.88538], [13.67739, 48.87886], [13.61624, 48.9462], [13.58319, 48.96899], [13.50552, 48.97441], [13.50221, 48.93752], [13.40802, 48.98851], [13.39479, 49.04812], [13.28242, 49.1228], [13.23689, 49.11412], [13.20405, 49.12303], [13.17019, 49.14339], [13.17665, 49.16713], [13.05883, 49.26259], [13.02957, 49.27399], [13.03618, 49.30417], [12.94859, 49.34079], [12.88249, 49.35479], [12.88414, 49.33541], [12.78168, 49.34618], [12.75854, 49.3989], [12.71227, 49.42363], [12.669, 49.42935], [12.64121, 49.47628], [12.64782, 49.52565], [12.60155, 49.52887], [12.56188, 49.6146], [12.53544, 49.61888], [12.52553, 49.68415], [12.4462, 49.70233], [12.40489, 49.76321], [12.46603, 49.78882], [12.48256, 49.83575], [12.55197, 49.92094], [12.47264, 49.94222], [12.49908, 49.97305], [12.30798, 50.05719], [12.26111, 50.06331], [12.27433, 50.0771], [12.23709, 50.10213], [12.2073, 50.10315], [12.1917, 50.13434], [12.21484, 50.16399], [12.19335, 50.19997], [12.09287, 50.25032], [12.13716, 50.27396], [12.10907, 50.32041], [12.18013, 50.32146], [12.20823, 50.2729], [12.25119, 50.27079], [12.26953, 50.25189], [12.24791, 50.25525], [12.23943, 50.24594], [12.28755, 50.22429], [12.28063, 50.19544], [12.29232, 50.17524], [12.32596, 50.17146], [12.33847, 50.19432], [12.32445, 50.20442], [12.33263, 50.24367], [12.35425, 50.23993], [12.36594, 50.28289], [12.40158, 50.29521], [12.39924, 50.32302], [12.43371, 50.32506], [12.43722, 50.33774], [12.46643, 50.35527], [12.48256, 50.34784], [12.49214, 50.35228], [12.48747, 50.37278], [12.51356, 50.39694], [12.67261, 50.41949], [12.70731, 50.39948], [12.73044, 50.42268], [12.73476, 50.43237], [12.82465, 50.45738], [12.94058, 50.40944], [12.98433, 50.42016], [13.02147, 50.44763], [13.02038, 50.4734], [13.0312, 50.50944], [13.08301, 50.50132], [13.13424, 50.51709], [13.19043, 50.50237], [13.25158, 50.59268], [13.29454, 50.57904], [13.32594, 50.58009], [13.32264, 50.60317], [13.37805, 50.627], [13.37485, 50.64931], [13.42189, 50.61243], [13.46413, 50.60102], [13.49742, 50.63133], [13.5226, 50.64721], [13.53748, 50.67654], [13.52474, 50.70394], [13.65977, 50.73096], [13.70204, 50.71771], [13.76316, 50.73487], [13.82942, 50.7251], [13.89444, 50.74142], [13.89113, 50.78533], [13.98864, 50.8177], [14.02982, 50.80662], [14.22331, 50.86049], [14.24314, 50.88761], [14.27123, 50.89386], [14.30098, 50.88448], [14.38691, 50.89907], [14.39848, 50.93866], [14.31422, 50.95243], [14.30251, 50.96606], [14.32793, 50.97379], [14.32353, 50.98556], [14.28776, 50.97718], [14.25665, 50.98935], [14.30098, 51.05515], [14.41335, 51.02086], [14.45827, 51.03712], [14.49202, 51.02286], [14.49154, 51.04382], [14.49991, 51.04692], [14.50809, 51.0427], [14.49873, 51.02242], [14.53321, 51.01679], [14.53438, 51.00374], [14.56432, 51.01008], [14.58215, 50.99306], [14.59908, 50.98685], [14.59702, 50.96148], [14.56374, 50.922], [14.58024, 50.91443], [14.64802, 50.93241], [14.65259, 50.90513], [14.63434, 50.8883], [14.61993, 50.86049], [14.70661, 50.84096], [14.79139, 50.81438], [14.82803, 50.86966], [14.81664, 50.88148], [14.89681, 50.9422], [14.89252, 50.94999], [14.92942, 50.99744], [14.95529, 51.04552], [14.97938, 51.07742], [14.98229, 51.11354], [14.99689, 51.12205], [14.99079, 51.14284], [14.99646, 51.14365], [15.00083, 51.14974], [14.99414, 51.15813], [14.99311, 51.16249], [15.0047, 51.16874], [15.01242, 51.21285], [15.04288, 51.28387], [14.98008, 51.33449], [14.96899, 51.38367], [14.9652, 51.44793], [14.94749, 51.47155], [14.73219, 51.52922], [14.72652, 51.53902], [14.73047, 51.54606], [14.71125, 51.56209], [14.7727, 51.61263], [14.75759, 51.62318], [14.75392, 51.67445], [14.69065, 51.70842], [14.66386, 51.73282], [14.64625, 51.79472], [14.60493, 51.80473], [14.59089, 51.83302], [14.6588, 51.88359], [14.6933, 51.9044], [14.70601, 51.92944], [14.7177, 51.94048], [14.72163, 51.95188], [14.71836, 51.95606], [14.7139, 51.95643], [14.70488, 51.97679], [14.71339, 52.00337], [14.76026, 52.06624], [14.72971, 52.09167], [14.6917, 52.10283], [14.67683, 52.13936], [14.70616, 52.16927], [14.68344, 52.19612], [14.71319, 52.22144], [14.70139, 52.25038], [14.58149, 52.28007], [14.56378, 52.33838], [14.55228, 52.35264], [14.54423, 52.42568], [14.63056, 52.48993], [14.60081, 52.53116], [14.6289, 52.57136], [14.61073, 52.59847], [14.22071, 52.81175], [14.13806, 52.82392], [14.12256, 52.84311], [14.15873, 52.87715], [14.14056, 52.95786], [14.25954, 53.00264], [14.35044, 53.05829], [14.38679, 53.13669], [14.36696, 53.16444], [14.37853, 53.20405], [14.40662, 53.21098], [14.45125, 53.26241], [14.44133, 53.27427], [14.4215, 53.27724], [14.35209, 53.49506], [14.3273, 53.50587], [14.30416, 53.55499], [14.31904, 53.61581], [14.2853, 53.63392], [14.28477, 53.65955], [14.27133, 53.66613], [14.2836, 53.67721], [14.26782, 53.69866], [14.27249, 53.74464], [14.21323, 53.8664], [14.20823, 53.90776], [14.18544, 53.91258], [14.20647, 53.91671], [14.22634, 53.9291], [14.20811, 54.12784], [13.93395, 54.84044], [12.85844, 54.82438], [11.90309, 54.38543], [11.00303, 54.63689], [10.31111, 54.65968], [10.16755, 54.73883], [9.89314, 54.84171], [9.73563, 54.8247], [9.61187, 54.85548], [9.62734, 54.88057], [9.58937, 54.88785], [9.4659, 54.83131], [9.43155, 54.82586], [9.41213, 54.84254], [9.38532, 54.83968], [9.36496, 54.81749], [9.33849, 54.80233], [9.32771, 54.80602], [9.2474, 54.8112], [9.23445, 54.83432], [9.24631, 54.84726], [9.20571, 54.85841], [9.14275, 54.87421], [9.04629, 54.87249], [8.92795, 54.90452], [8.81178, 54.90518], [8.76387, 54.8948], [8.63979, 54.91069], [8.55769, 54.91837], [8.45719, 55.06747], [8.02459, 55.09613], [5.45168, 54.20039], [6.91025, 53.44221], [7.00198, 53.32672], [7.19052, 53.31866], [7.21679, 53.20058], [7.22681, 53.18165], [7.17898, 53.13817], [7.21694, 53.00742], [7.07253, 52.81083], [7.04557, 52.63318], [6.77307, 52.65375], [6.71641, 52.62905], [6.69507, 52.488], [6.94293, 52.43597], [6.99041, 52.47235], [7.03417, 52.40237], [7.07044, 52.37805], [7.02703, 52.27941], [7.06365, 52.23789], [7.03729, 52.22695], [6.9897, 52.2271], [6.97189, 52.20329], [6.83984, 52.11728], [6.76117, 52.11895], [6.68128, 52.05052], [6.83035, 51.9905], [6.82357, 51.96711], [6.72319, 51.89518], [6.68386, 51.91861], [6.58556, 51.89386], [6.50231, 51.86313], [6.47179, 51.85395], [6.38815, 51.87257], [6.40704, 51.82771], [6.30593, 51.84998], [6.29872, 51.86801], [6.21443, 51.86801], [6.15349, 51.90439], [6.11551, 51.89769], [6.16902, 51.84094], [6.10337, 51.84829], [6.06705, 51.86136], [5.99848, 51.83195], [5.94568, 51.82786], [5.98665, 51.76944], [5.95003, 51.7493], [6.04091, 51.71821], [6.02767, 51.6742], [6.11759, 51.65609], [6.09055, 51.60564], [6.18017, 51.54096], [6.21724, 51.48568], [6.20654, 51.40049], [6.22641, 51.39948], [6.22674, 51.36135], [6.16977, 51.33169], [6.07889, 51.24432], [6.07889, 51.17038], [6.17384, 51.19589], [6.16706, 51.15677], [5.98292, 51.07469], [5.9541, 51.03496], [5.9134, 51.06736], [5.86735, 51.05182], [5.87849, 51.01969], [5.90493, 51.00198], [5.90296, 50.97356], [5.95282, 50.98728], [6.02697, 50.98303], [6.01615, 50.93367], [6.09297, 50.92066], [6.07486, 50.89307], [6.08805, 50.87223], [6.07693, 50.86025], [6.07431, 50.84674], [6.05702, 50.85179], [6.05623, 50.8572], [6.01921, 50.84435], [6.02328, 50.81694], [6.00462, 50.80065], [5.98404, 50.80988], [5.97497, 50.79992], [6.02624, 50.77453], [6.01976, 50.75398], [6.03889, 50.74618], [6.0326, 50.72647], [6.0406, 50.71848], [6.04428, 50.72861], [6.11707, 50.72231], [6.17852, 50.6245], [6.26957, 50.62444], [6.2476, 50.60392], [6.24888, 50.59869], [6.24005, 50.58732], [6.22581, 50.5907], [6.20281, 50.56952], [6.17739, 50.55875], [6.17802, 50.54179], [6.19735, 50.53576], [6.19579, 50.5313], [6.18716, 50.52653], [6.19193, 50.5212], [6.20599, 50.52089], [6.22335, 50.49578], [6.26637, 50.50272], [6.30809, 50.50058], [6.3465, 50.48833], [6.34005, 50.46083], [6.37219, 50.45397], [6.36852, 50.40776], [6.34406, 50.37994], [6.3688, 50.35898], [6.40785, 50.33557], [6.40641, 50.32425], [6.35701, 50.31139], [6.32488, 50.32333], [6.29949, 50.30887], [6.28797, 50.27458], [6.208, 50.25179], [6.16853, 50.2234], [6.18364, 50.20815], [6.18739, 50.1822], [6.14588, 50.17106], [6.14132, 50.14971], [6.15298, 50.14126], [6.1379, 50.12964], [6.12055, 50.09171], [6.11274, 50.05916], [6.13458, 50.04141], [6.13044, 50.02929], [6.14666, 50.02207], [6.13794, 50.01466], [6.13273, 50.02019], [6.1295, 50.01849], [6.13806, 50.01056], [6.14948, 50.00908], [6.14147, 49.99563], [6.1701, 49.98518], [6.16466, 49.97086], [6.17872, 49.9537], [6.18554, 49.95622], [6.18045, 49.96611], [6.19089, 49.96991], [6.19856, 49.95053], [6.22094, 49.94955], [6.22608, 49.929], [6.21882, 49.92403], [6.22926, 49.92096], [6.23496, 49.89972], [6.26146, 49.88203], [6.28874, 49.87592], [6.29692, 49.86685], [6.30963, 49.87021], [6.32303, 49.85133], [6.32098, 49.83728], [6.33585, 49.83785], [6.34267, 49.84974], [6.36576, 49.85032], [6.40022, 49.82029], [6.42521, 49.81591], [6.42905, 49.81091], [6.44131, 49.81443], [6.45425, 49.81164], [6.47111, 49.82263], [6.48718, 49.81267], [6.50647, 49.80916], [6.51215, 49.80124], [6.52121, 49.81338], [6.53122, 49.80666], [6.52169, 49.79787], [6.50534, 49.78952], [6.51669, 49.78336], [6.51056, 49.77515], [6.51828, 49.76855], [6.51646, 49.75961], [6.50174, 49.75292], [6.50193, 49.73291], [6.51805, 49.72425], [6.51397, 49.72058], [6.50261, 49.72718], [6.49535, 49.72645], [6.49694, 49.72205], [6.5042, 49.71808], [6.50647, 49.71353], [6.49785, 49.71118], [6.48014, 49.69767], [6.46048, 49.69092], [6.44654, 49.67799], [6.42937, 49.66857], [6.42726, 49.66078], [6.43768, 49.66021], [6.4413, 49.65722], [6.41861, 49.61723], [6.39822, 49.60081], [6.385, 49.59946], [6.37464, 49.58886], [6.38342, 49.5799], [6.38024, 49.57593], [6.36676, 49.57813], [6.35825, 49.57053], [6.38228, 49.55855], [6.38072, 49.55171], [6.35666, 49.52931], [6.36788, 49.50377], [6.36907, 49.48931], [6.36778, 49.46937], [6.38352, 49.46463], [6.39168, 49.4667], [6.40274, 49.46546], [6.42432, 49.47683], [6.55404, 49.42464], [6.533, 49.40748], [6.60091, 49.36864], [6.58807, 49.35358], [6.572, 49.35027], [6.60186, 49.31055], [6.66583, 49.28065], [6.69274, 49.21661], [6.71843, 49.2208], [6.73256, 49.20486], [6.71137, 49.18808], [6.73765, 49.16375], [6.78265, 49.16793], [6.83385, 49.15162], [6.84703, 49.15734], [6.86225, 49.18185], [6.85016, 49.19354], [6.85119, 49.20038], [6.83555, 49.21249], [6.85939, 49.22376], [6.89298, 49.20863], [6.91875, 49.22261], [6.93831, 49.2223], [6.94028, 49.21641], [6.95963, 49.203], [6.97273, 49.2099], [7.01318, 49.19018], [7.03459, 49.19096], [7.0274, 49.17042], [7.03178, 49.15734], [7.04662, 49.13724], [7.04409, 49.12123], [7.04843, 49.11422], [7.05548, 49.11185], [7.06642, 49.11415], [7.07162, 49.1255], [7.09007, 49.13094], [7.07859, 49.15031], [7.10715, 49.15631], [7.10384, 49.13787], [7.12504, 49.14253], [7.1358, 49.1282], [7.1593, 49.1204], [7.23473, 49.12971], [7.29514, 49.11426], [7.3195, 49.14231], [7.35995, 49.14399], [7.3662, 49.17308], [7.44052, 49.18354], [7.44455, 49.16765], [7.49473, 49.17], [7.49172, 49.13915], [7.53012, 49.09818], [7.56416, 49.08136], [7.62575, 49.07654], [7.63618, 49.05428], [7.75948, 49.04562], [7.79557, 49.06583], [7.86386, 49.03499], [7.93641, 49.05544], [7.97783, 49.03161], [8.14189, 48.97833], [8.22604, 48.97352], [8.20031, 48.95856], [8.19989, 48.95825], [8.12813, 48.87985], [8.10253, 48.81829], [8.06802, 48.78957], [8.0326, 48.79017], [8.01534, 48.76085], [7.96994, 48.75606], [7.96812, 48.72491], [7.89002, 48.66317], [7.84098, 48.64217], [7.80057, 48.5857], [7.80167, 48.54758], [7.80647, 48.51239], [7.76833, 48.48945], [7.73109, 48.39192], [7.74562, 48.32736], [7.69022, 48.30018], [7.6648, 48.22219], [7.57137, 48.12292], [7.56966, 48.03265], [7.62302, 47.97898], [7.55673, 47.87371], [7.52921, 47.77747], [7.54761, 47.72912], [7.53722, 47.71635], [7.51266, 47.70197], [7.51915, 47.68335], [7.52067, 47.66437], [7.53384, 47.65115], [7.5591, 47.63849], [7.57423, 47.61628], [7.58851, 47.60794], [7.59301, 47.60058], [7.58945, 47.59017], [7.60523, 47.58519], [7.60459, 47.57869], [7.61929, 47.57683], [7.64309, 47.59151], [7.64213, 47.5944], [7.64599, 47.59695], [7.67395, 47.59212], [7.68229, 47.59905], [7.69385, 47.60099], [7.68486, 47.59601], [7.67115, 47.5871], [7.68904, 47.57133], [7.67655, 47.56435], [7.63338, 47.56256], [7.65083, 47.54662], [7.66174, 47.54554], [7.6656, 47.53752], [7.68101, 47.53232], [7.69642, 47.53297], [7.71961, 47.54219], [7.75261, 47.54599], [7.79486, 47.55691], [7.81901, 47.58798], [7.84412, 47.5841], [7.88664, 47.58854], [7.90673, 47.57674], [7.91251, 47.55031], [7.94494, 47.54511], [7.95682, 47.55789], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04383, 47.55443], [8.06663, 47.56374], [8.08557, 47.55768], [8.10002, 47.56504], [8.10395, 47.57918], [8.11543, 47.5841], [8.13662, 47.58432], [8.13823, 47.59147], [8.14947, 47.59558], [8.1652, 47.5945], [8.19378, 47.61636], [8.20617, 47.62141], [8.22011, 47.6181], [8.22577, 47.60385], [8.23809, 47.61204], [8.25863, 47.61571], [8.26313, 47.6103], [8.2824, 47.61225], [8.29722, 47.60603], [8.29524, 47.5919], [8.30277, 47.58607], [8.32735, 47.57133], [8.35512, 47.57014], [8.38273, 47.56608], [8.39477, 47.57826], [8.43235, 47.56617], [8.49431, 47.58107], [8.48949, 47.588], [8.46637, 47.58389], [8.45578, 47.60121], [8.50747, 47.61897], [8.51686, 47.63476], [8.55756, 47.62394], [8.57586, 47.59537], [8.60348, 47.61204], [8.59545, 47.64298], [8.60701, 47.65271], [8.61471, 47.64514], [8.60412, 47.63735], [8.62049, 47.63757], [8.62884, 47.65098], [8.61113, 47.66332], [8.6052, 47.67258], [8.57683, 47.66158], [8.56141, 47.67088], [8.52801, 47.66059], [8.5322, 47.64687], [8.49656, 47.64709], [8.46605, 47.64103], [8.4667, 47.65747], [8.44711, 47.65379], [8.42264, 47.66667], [8.41346, 47.66676], [8.40473, 47.67499], [8.4211, 47.68407], [8.40569, 47.69855], [8.44807, 47.72426], [8.45771, 47.7493], [8.48868, 47.77215], [8.56814, 47.78001], [8.56415, 47.80633], [8.61657, 47.79998], [8.62408, 47.7626], [8.64425, 47.76398], [8.65292, 47.80066], [8.68022, 47.78599], [8.68985, 47.75686], [8.71778, 47.76571], [8.74251, 47.75168], [8.70543, 47.73121], [8.73671, 47.7169], [8.72617, 47.69651]]]] } },
22667     { type: "Feature", properties: { iso1A2: "DG", iso1A3: "DGA", wikidata: "Q184851", nameEn: "Diego Garcia", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], isoStatus: "excRes", callingCodes: ["246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[73.14823, -7.76302], [73.09982, -6.07324], [71.43792, -7.73904], [73.14823, -7.76302]]]] } },
22668     { type: "Feature", properties: { iso1A2: "DJ", iso1A3: "DJI", iso1N3: "262", wikidata: "Q977", nameEn: "Djibouti", groups: ["014", "202", "002", "UN"], callingCodes: ["253"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.90659, 12.3823], [43.90659, 12.3823], [43.32909, 12.59711], [43.29075, 12.79154], [42.86195, 12.58747], [42.7996, 12.42629], [42.6957, 12.36201], [42.46941, 12.52661], [42.4037, 12.46478], [41.95461, 11.81157], [41.82878, 11.72361], [41.77727, 11.49902], [41.8096, 11.33606], [41.80056, 10.97127], [42.06302, 10.92599], [42.13691, 10.97586], [42.42669, 10.98493], [42.62989, 11.09711], [42.75111, 11.06992], [42.79037, 10.98493], [42.95776, 10.98533], [43.90659, 12.3823]]]] } },
22669     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
22670     { type: "Feature", properties: { iso1A2: "DM", iso1A3: "DMA", iso1N3: "212", wikidata: "Q784", nameEn: "Dominica", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 767"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.32485, 14.91445], [-60.86656, 15.82603], [-61.95646, 15.5094], [-61.32485, 14.91445]]]] } },
22671     { type: "Feature", properties: { iso1A2: "DO", iso1A3: "DOM", iso1N3: "214", wikidata: "Q786", nameEn: "Dominican Republic", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["1 809", "1 829", "1 849"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.87844, 21.7938], [-72.38946, 20.27111], [-71.77419, 19.73128], [-71.75865, 19.70231], [-71.7429, 19.58445], [-71.71449, 19.55364], [-71.71268, 19.53374], [-71.6802, 19.45008], [-71.69448, 19.37866], [-71.77766, 19.33823], [-71.73229, 19.26686], [-71.62642, 19.21212], [-71.65337, 19.11759], [-71.69938, 19.10916], [-71.71088, 19.08353], [-71.74088, 19.0437], [-71.88102, 18.95007], [-71.77766, 18.95007], [-71.72624, 18.87802], [-71.71885, 18.78423], [-71.82556, 18.62551], [-71.95412, 18.64939], [-72.00201, 18.62312], [-71.88102, 18.50125], [-71.90875, 18.45821], [-71.69952, 18.34101], [-71.78271, 18.18302], [-71.75465, 18.14405], [-71.74994, 18.11115], [-71.73783, 18.07177], [-71.75671, 18.03456], [-72.29523, 17.48026], [-68.39466, 16.14167], [-67.87844, 21.7938]]]] } },
22672     { type: "Feature", properties: { iso1A2: "DZ", iso1A3: "DZA", iso1N3: "012", wikidata: "Q262", nameEn: "Algeria", groups: ["015", "002", "UN"], callingCodes: ["213"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.59123, 37.14286], [5.10072, 39.89531], [-2.27707, 35.35051], [-2.21248, 35.08532], [-2.21445, 35.04378], [-2.04734, 34.93218], [-1.97833, 34.93218], [-1.97469, 34.886], [-1.73707, 34.74226], [-1.84569, 34.61907], [-1.69788, 34.48056], [-1.78042, 34.39018], [-1.64666, 34.10405], [-1.73494, 33.71721], [-1.59508, 33.59929], [-1.67067, 33.27084], [-1.46249, 33.0499], [-1.54244, 32.95499], [-1.37794, 32.73628], [-0.9912, 32.52467], [-1.24998, 32.32993], [-1.24453, 32.1917], [-1.15735, 32.12096], [-1.22829, 32.07832], [-2.46166, 32.16603], [-2.93873, 32.06557], [-2.82784, 31.79459], [-3.66314, 31.6339], [-3.66386, 31.39202], [-3.77647, 31.31912], [-3.77103, 31.14984], [-3.54944, 31.0503], [-3.65418, 30.85566], [-3.64735, 30.67539], [-4.31774, 30.53229], [-4.6058, 30.28343], [-5.21671, 29.95253], [-5.58831, 29.48103], [-5.72121, 29.52322], [-5.75616, 29.61407], [-6.69965, 29.51623], [-6.78351, 29.44634], [-6.95824, 29.50924], [-7.61585, 29.36252], [-8.6715, 28.71194], [-8.66879, 27.6666], [-8.66674, 27.31569], [-4.83423, 24.99935], [1.15698, 21.12843], [1.20992, 20.73533], [3.24648, 19.81703], [3.12501, 19.1366], [3.36082, 18.9745], [4.26651, 19.14224], [5.8153, 19.45101], [7.38361, 20.79165], [7.48273, 20.87258], [11.96886, 23.51735], [11.62498, 24.26669], [11.41061, 24.21456], [10.85323, 24.5595], [10.33159, 24.5465], [10.02432, 24.98124], [10.03146, 25.35635], [9.38834, 26.19288], [9.51696, 26.39148], [9.89569, 26.57696], [9.78136, 29.40961], [9.3876, 30.16738], [9.55544, 30.23971], [9.07483, 32.07865], [8.35999, 32.50101], [8.31895, 32.83483], [8.1179, 33.05086], [8.11433, 33.10175], [7.83028, 33.18851], [7.73687, 33.42114], [7.54088, 33.7726], [7.52851, 34.06493], [7.66174, 34.20167], [7.74207, 34.16492], [7.81242, 34.21841], [7.86264, 34.3987], [8.20482, 34.57575], [8.29655, 34.72798], [8.25189, 34.92009], [8.30727, 34.95378], [8.3555, 35.10007], [8.47318, 35.23376], [8.30329, 35.29884], [8.36086, 35.47774], [8.35371, 35.66373], [8.26472, 35.73669], [8.2626, 35.91733], [8.40731, 36.42208], [8.18936, 36.44939], [8.16167, 36.48817], [8.47609, 36.66607], [8.46537, 36.7706], [8.57613, 36.78062], [8.67706, 36.8364], [8.62972, 36.86499], [8.64044, 36.9401], [8.59123, 37.14286]]]] } },
22673     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
22674     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
22675     { type: "Feature", properties: { iso1A2: "EE", iso1A3: "EST", iso1N3: "233", wikidata: "Q191", nameEn: "Estonia", aliases: ["EW"], groups: ["EU", "154", "150", "UN"], callingCodes: ["372"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.32936, 60.00121], [20.5104, 59.15546], [19.84909, 57.57876], [22.80496, 57.87798], [23.20055, 57.56697], [24.26221, 57.91787], [24.3579, 57.87471], [25.19484, 58.0831], [25.28237, 57.98539], [25.29581, 58.08288], [25.73499, 57.90193], [26.05949, 57.84744], [26.0324, 57.79037], [26.02456, 57.78342], [26.027, 57.78158], [26.0266, 57.77441], [26.02069, 57.77169], [26.02415, 57.76865], [26.03332, 57.7718], [26.0543, 57.76105], [26.08098, 57.76619], [26.2029, 57.7206], [26.1866, 57.6849], [26.29253, 57.59244], [26.46527, 57.56885], [26.54675, 57.51813], [26.90364, 57.62823], [27.34698, 57.52242], [27.31919, 57.57672], [27.40393, 57.62125], [27.3746, 57.66834], [27.52615, 57.72843], [27.50171, 57.78842], [27.56689, 57.83356], [27.78526, 57.83963], [27.81841, 57.89244], [27.67282, 57.92627], [27.62393, 58.09462], [27.48541, 58.22615], [27.55489, 58.39525], [27.36366, 58.78381], [27.74429, 58.98351], [27.80482, 59.1116], [27.87978, 59.18097], [27.90911, 59.24353], [28.00689, 59.28351], [28.14215, 59.28934], [28.19284, 59.35791], [28.20537, 59.36491], [28.21137, 59.38058], [28.19061, 59.39962], [28.04187, 59.47017], [27.85643, 59.58538], [26.90044, 59.63819], [26.32936, 60.00121]]]] } },
22676     { type: "Feature", properties: { iso1A2: "EG", iso1A3: "EGY", iso1N3: "818", wikidata: "Q79", nameEn: "Egypt", groups: ["015", "002", "UN"], callingCodes: ["20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.62659, 31.82938], [26.92891, 33.39516], [24.8458, 31.39877], [25.01077, 30.73861], [24.71117, 30.17441], [24.99968, 29.24574], [24.99885, 21.99535], [33.17563, 22.00405], [34.0765, 22.00501], [37.8565, 22.00903], [34.4454, 27.91479], [34.8812, 29.36878], [34.92298, 29.45305], [34.26742, 31.21998], [34.24012, 31.29591], [34.23572, 31.2966], [34.21853, 31.32363], [34.052, 31.46619], [33.62659, 31.82938]]]] } },
22677     { type: "Feature", properties: { iso1A2: "EH", iso1A3: "ESH", iso1N3: "732", wikidata: "Q6250", nameEn: "Western Sahara", groups: ["015", "002"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.66879, 27.6666], [-8.77527, 27.66663], [-8.71787, 26.9898], [-9.08698, 26.98639], [-9.56957, 26.90042], [-9.81998, 26.71379], [-10.68417, 26.90984], [-11.35695, 26.8505], [-11.23622, 26.72023], [-11.38635, 26.611], [-11.62052, 26.05229], [-12.06001, 26.04442], [-12.12281, 25.13682], [-12.92147, 24.39502], [-13.00628, 24.01923], [-13.75627, 23.77231], [-14.10361, 22.75501], [-14.1291, 22.41636], [-14.48112, 22.00886], [-14.47329, 21.63839], [-14.78487, 21.36587], [-16.44269, 21.39745], [-16.9978, 21.36239], [-17.02707, 21.34022], [-17.21511, 21.34226], [-17.35589, 20.80492], [-17.0471, 20.76408], [-17.0695, 20.85742], [-17.06781, 20.92697], [-17.0396, 20.9961], [-17.0357, 21.05368], [-16.99806, 21.12142], [-16.95474, 21.33997], [-13.01525, 21.33343], [-13.08438, 22.53866], [-13.15313, 22.75649], [-13.10753, 22.89493], [-13.00412, 23.02297], [-12.5741, 23.28975], [-12.36213, 23.3187], [-12.14969, 23.41935], [-12.00251, 23.4538], [-12.0002, 25.9986], [-8.66721, 25.99918], [-8.66674, 27.31569], [-8.66879, 27.6666]]]] } },
22678     { type: "Feature", properties: { iso1A2: "ER", iso1A3: "ERI", iso1N3: "232", wikidata: "Q986", nameEn: "Eritrea", groups: ["014", "202", "002", "UN"], callingCodes: ["291"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.99158, 15.81743], [39.63762, 18.37348], [38.57727, 17.98125], [38.45916, 17.87167], [38.37133, 17.66269], [38.13362, 17.53906], [37.50967, 17.32199], [37.42694, 17.04041], [36.99777, 17.07172], [36.92193, 16.23451], [36.76371, 15.80831], [36.69761, 15.75323], [36.54276, 15.23478], [36.44337, 15.14963], [36.54376, 14.25597], [36.56536, 14.26177], [36.55659, 14.28237], [36.63364, 14.31172], [36.85787, 14.32201], [37.01622, 14.2561], [37.09486, 14.27155], [37.13206, 14.40746], [37.3106, 14.44657], [37.47319, 14.2149], [37.528, 14.18413], [37.91287, 14.89447], [38.0364, 14.72745], [38.25562, 14.67287], [38.3533, 14.51323], [38.45748, 14.41445], [38.78306, 14.4754], [38.98058, 14.54895], [39.02834, 14.63717], [39.16074, 14.65187], [39.14772, 14.61827], [39.19547, 14.56996], [39.23888, 14.56365], [39.26927, 14.48801], [39.2302, 14.44598], [39.2519, 14.40393], [39.37685, 14.54402], [39.52756, 14.49011], [39.50585, 14.55735], [39.58182, 14.60987], [39.76632, 14.54264], [39.9443, 14.41024], [40.07236, 14.54264], [40.14649, 14.53969], [40.21128, 14.39342], [40.25686, 14.41445], [40.9167, 14.11152], [41.25097, 13.60787], [41.62864, 13.38626], [42.05841, 12.80912], [42.21469, 12.75832], [42.2798, 12.6355], [42.4037, 12.46478], [42.46941, 12.52661], [42.6957, 12.36201], [42.7996, 12.42629], [42.86195, 12.58747], [43.29075, 12.79154], [40.99158, 15.81743]]]] } },
22679     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
22680     { type: "Feature", properties: { iso1A2: "ET", iso1A3: "ETH", iso1N3: "231", wikidata: "Q115", nameEn: "Ethiopia", groups: ["014", "202", "002", "UN"], callingCodes: ["251"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.4037, 12.46478], [42.2798, 12.6355], [42.21469, 12.75832], [42.05841, 12.80912], [41.62864, 13.38626], [41.25097, 13.60787], [40.9167, 14.11152], [40.25686, 14.41445], [40.21128, 14.39342], [40.14649, 14.53969], [40.07236, 14.54264], [39.9443, 14.41024], [39.76632, 14.54264], [39.58182, 14.60987], [39.50585, 14.55735], [39.52756, 14.49011], [39.37685, 14.54402], [39.2519, 14.40393], [39.2302, 14.44598], [39.26927, 14.48801], [39.23888, 14.56365], [39.19547, 14.56996], [39.14772, 14.61827], [39.16074, 14.65187], [39.02834, 14.63717], [38.98058, 14.54895], [38.78306, 14.4754], [38.45748, 14.41445], [38.3533, 14.51323], [38.25562, 14.67287], [38.0364, 14.72745], [37.91287, 14.89447], [37.528, 14.18413], [37.47319, 14.2149], [37.3106, 14.44657], [37.13206, 14.40746], [37.09486, 14.27155], [37.01622, 14.2561], [36.85787, 14.32201], [36.63364, 14.31172], [36.55659, 14.28237], [36.56536, 14.26177], [36.54376, 14.25597], [36.44653, 13.95666], [36.48824, 13.83954], [36.38993, 13.56459], [36.24545, 13.36759], [36.13374, 12.92665], [36.16651, 12.88019], [36.14268, 12.70879], [36.01458, 12.72478], [35.70476, 12.67101], [35.24302, 11.91132], [35.11492, 11.85156], [35.05832, 11.71158], [35.09556, 11.56278], [34.95704, 11.24448], [35.01215, 11.19626], [34.93172, 10.95946], [34.97789, 10.91559], [34.97491, 10.86147], [34.86916, 10.78832], [34.86618, 10.74588], [34.77532, 10.69027], [34.77383, 10.74588], [34.59062, 10.89072], [34.4372, 10.781], [34.2823, 10.53508], [34.34783, 10.23914], [34.32102, 10.11599], [34.22718, 10.02506], [34.20484, 9.9033], [34.13186, 9.7492], [34.08717, 9.55243], [34.10229, 9.50238], [34.14304, 9.04654], [34.14453, 8.60204], [34.01346, 8.50041], [33.89579, 8.4842], [33.87195, 8.41938], [33.71407, 8.3678], [33.66938, 8.44442], [33.54575, 8.47094], [33.3119, 8.45474], [33.19721, 8.40317], [33.1853, 8.29264], [33.18083, 8.13047], [33.08401, 8.05822], [33.0006, 7.90333], [33.04944, 7.78989], [33.24637, 7.77939], [33.32531, 7.71297], [33.44745, 7.7543], [33.71407, 7.65983], [33.87642, 7.5491], [34.02984, 7.36449], [34.03878, 7.27437], [34.01495, 7.25664], [34.19369, 7.12807], [34.19369, 7.04382], [34.35753, 6.91963], [34.47669, 6.91076], [34.53925, 6.82794], [34.53776, 6.74808], [34.65096, 6.72589], [34.77459, 6.5957], [34.87736, 6.60161], [35.01738, 6.46991], [34.96227, 6.26415], [35.00546, 5.89387], [35.12611, 5.68937], [35.13058, 5.62118], [35.31188, 5.50106], [35.29938, 5.34042], [35.50792, 5.42431], [35.8576, 5.33413], [35.81968, 5.10757], [35.82118, 4.77382], [35.9419, 4.61933], [35.95449, 4.53244], [36.03924, 4.44406], [36.84474, 4.44518], [37.07724, 4.33503], [38.14168, 3.62487], [38.45812, 3.60445], [38.52336, 3.62551], [38.91938, 3.51198], [39.07736, 3.5267], [39.19954, 3.47834], [39.49444, 3.45521], [39.51551, 3.40895], [39.55132, 3.39634], [39.58339, 3.47434], [39.76808, 3.67058], [39.86043, 3.86974], [40.77498, 4.27683], [41.1754, 3.94079], [41.89488, 3.97375], [42.07619, 4.17667], [42.55853, 4.20518], [42.84526, 4.28357], [42.97746, 4.44032], [43.04177, 4.57923], [43.40263, 4.79289], [44.02436, 4.9451], [44.98104, 4.91821], [47.97917, 8.00124], [47.92477, 8.00111], [46.99339, 7.9989], [44.19222, 8.93028], [43.32613, 9.59205], [43.23518, 9.84605], [43.0937, 9.90579], [42.87643, 10.18441], [42.69452, 10.62672], [42.95776, 10.98533], [42.79037, 10.98493], [42.75111, 11.06992], [42.62989, 11.09711], [42.42669, 10.98493], [42.13691, 10.97586], [42.06302, 10.92599], [41.80056, 10.97127], [41.8096, 11.33606], [41.77727, 11.49902], [41.82878, 11.72361], [41.95461, 11.81157], [42.4037, 12.46478]]]] } },
22681     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
22682     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
22683     { type: "Feature", properties: { iso1A2: "FJ", iso1A3: "FJI", iso1N3: "242", wikidata: "Q712", nameEn: "Fiji", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["679"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174.245, -23.1974], [179.99999, -22.5], [179.99999, -11.5], [174, -11.5], [174.245, -23.1974]]], [[[-176.76826, -14.95183], [-180, -14.96041], [-180, -22.90585], [-176.74538, -22.89767], [-176.76826, -14.95183]]]] } },
22684     { type: "Feature", properties: { iso1A2: "FK", iso1A3: "FLK", iso1N3: "238", wikidata: "Q9648", nameEn: "Falkland Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.67376, -55.11859], [-54.56126, -51.26248], [-61.26735, -50.63919], [-63.67376, -55.11859]]]] } },
22685     { type: "Feature", properties: { iso1A2: "FM", iso1A3: "FSM", iso1N3: "583", wikidata: "Q702", nameEn: "Federated States of Micronesia", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["691"] }, geometry: { type: "MultiPolygon", coordinates: [[[[138.20583, 13.3783], [136.27107, 6.73747], [156.88247, -1.39237], [165.19726, 6.22546], [138.20583, 13.3783]]]] } },
22686     { type: "Feature", properties: { iso1A2: "FO", iso1A3: "FRO", iso1N3: "234", wikidata: "Q4628", nameEn: "Faroe Islands", country: "DK", groups: ["154", "150", "UN"], callingCodes: ["298"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.51774, 62.35338], [-6.51083, 60.95272], [-5.70102, 62.77194], [-8.51774, 62.35338]]]] } },
22687     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
22688     { type: "Feature", properties: { iso1A2: "FX", iso1A3: "FXX", iso1N3: "249", wikidata: "Q212429", nameEn: "Metropolitan France", country: "FR", groups: ["EU", "155", "150", "UN"], isoStatus: "excRes", callingCodes: ["33"] }, geometry: { type: "MultiPolygon", coordinates: [[[[2.55904, 51.07014], [2.18458, 51.52087], [1.17405, 50.74239], [-2.02963, 49.91866], [-2.09454, 49.46288], [-1.83944, 49.23037], [-2.00491, 48.86706], [-2.65349, 49.15373], [-6.28985, 48.93406], [-1.81005, 43.59738], [-1.77289, 43.38957], [-1.79319, 43.37497], [-1.78332, 43.36399], [-1.78714, 43.35476], [-1.77068, 43.34396], [-1.75334, 43.34107], [-1.75079, 43.3317], [-1.7397, 43.32979], [-1.73074, 43.29481], [-1.69407, 43.31378], [-1.62481, 43.30726], [-1.63052, 43.28591], [-1.61341, 43.25269], [-1.57674, 43.25269], [-1.55963, 43.28828], [-1.50992, 43.29481], [-1.45289, 43.27049], [-1.40942, 43.27272], [-1.3758, 43.24511], [-1.41562, 43.12815], [-1.47555, 43.08372], [-1.44067, 43.047], [-1.35272, 43.02658], [-1.34419, 43.09665], [-1.32209, 43.1127], [-1.27118, 43.11961], [-1.30052, 43.09581], [-1.30531, 43.06859], [-1.25244, 43.04164], [-1.22881, 43.05534], [-1.10333, 43.0059], [-1.00963, 42.99279], [-0.97133, 42.96239], [-0.81652, 42.95166], [-0.75478, 42.96916], [-0.72037, 42.92541], [-0.73422, 42.91228], [-0.72608, 42.89318], [-0.69837, 42.87945], [-0.67637, 42.88303], [-0.55497, 42.77846], [-0.50863, 42.82713], [-0.44334, 42.79939], [-0.41319, 42.80776], [-0.38833, 42.80132], [-0.3122, 42.84788], [-0.17939, 42.78974], [-0.16141, 42.79535], [-0.10519, 42.72761], [-0.02468, 42.68513], [0.17569, 42.73424], [0.25336, 42.7174], [0.29407, 42.67431], [0.36251, 42.72282], [0.40214, 42.69779], [0.67873, 42.69458], [0.65421, 42.75872], [0.66121, 42.84021], [0.711, 42.86372], [0.93089, 42.79154], [0.96166, 42.80629], [0.98292, 42.78754], [1.0804, 42.78569], [1.15928, 42.71407], [1.35562, 42.71944], [1.44197, 42.60217], [1.47986, 42.61346], [1.46718, 42.63296], [1.48043, 42.65203], [1.50867, 42.64483], [1.55418, 42.65669], [1.60085, 42.62703], [1.63485, 42.62957], [1.6625, 42.61982], [1.68267, 42.62533], [1.73452, 42.61515], [1.72588, 42.59098], [1.7858, 42.57698], [1.73683, 42.55492], [1.72515, 42.50338], [1.76335, 42.48863], [1.83037, 42.48395], [1.88853, 42.4501], [1.93663, 42.45439], [1.94292, 42.44316], [1.94061, 42.43333], [1.94084, 42.43039], [1.9574, 42.42401], [1.96482, 42.37787], [2.00488, 42.35399], [2.06241, 42.35906], [2.11621, 42.38393], [2.12789, 42.41291], [2.16599, 42.42314], [2.20578, 42.41633], [2.25551, 42.43757], [2.38504, 42.39977], [2.43299, 42.39423], [2.43508, 42.37568], [2.48457, 42.33933], [2.54382, 42.33406], [2.55516, 42.35351], [2.57934, 42.35808], [2.6747, 42.33974], [2.65311, 42.38771], [2.72056, 42.42298], [2.75497, 42.42578], [2.77464, 42.41046], [2.84335, 42.45724], [2.85675, 42.45444], [2.86983, 42.46843], [2.88413, 42.45938], [2.92107, 42.4573], [2.94283, 42.48174], [2.96518, 42.46692], [3.03734, 42.47363], [3.08167, 42.42748], [3.10027, 42.42621], [3.11379, 42.43646], [3.17156, 42.43545], [3.75438, 42.33445], [7.60802, 41.05927], [10.09675, 41.44089], [9.56115, 43.20816], [7.50102, 43.51859], [7.42422, 43.72209], [7.40903, 43.7296], [7.41113, 43.73156], [7.41291, 43.73168], [7.41298, 43.73311], [7.41233, 43.73439], [7.42062, 43.73977], [7.42299, 43.74176], [7.42443, 43.74087], [7.42809, 43.74396], [7.43013, 43.74895], [7.43624, 43.75014], [7.43708, 43.75197], [7.4389, 43.75151], [7.4379, 43.74963], [7.47823, 43.73341], [7.53006, 43.78405], [7.50423, 43.84345], [7.49355, 43.86551], [7.51162, 43.88301], [7.56075, 43.89932], [7.56858, 43.94506], [7.60771, 43.95772], [7.65266, 43.9763], [7.66848, 43.99943], [7.6597, 44.03009], [7.72508, 44.07578], [7.66878, 44.12795], [7.68694, 44.17487], [7.63245, 44.17877], [7.62155, 44.14881], [7.36364, 44.11882], [7.34547, 44.14359], [7.27827, 44.1462], [7.16929, 44.20352], [7.00764, 44.23736], [6.98221, 44.28289], [6.89171, 44.36637], [6.88784, 44.42043], [6.94504, 44.43112], [6.86233, 44.49834], [6.85507, 44.53072], [6.96042, 44.62129], [6.95133, 44.66264], [7.00582, 44.69364], [7.07484, 44.68073], [7.00401, 44.78782], [7.02217, 44.82519], [6.93499, 44.8664], [6.90774, 44.84322], [6.75518, 44.89915], [6.74519, 44.93661], [6.74791, 45.01939], [6.66981, 45.02324], [6.62803, 45.11175], [6.7697, 45.16044], [6.85144, 45.13226], [6.96706, 45.20841], [7.07074, 45.21228], [7.13115, 45.25386], [7.10572, 45.32924], [7.18019, 45.40071], [7.00037, 45.509], [6.98948, 45.63869], [6.80785, 45.71864], [6.80785, 45.83265], [6.95315, 45.85163], [7.04151, 45.92435], [7.00946, 45.9944], [6.93862, 46.06502], [6.87868, 46.03855], [6.89321, 46.12548], [6.78968, 46.14058], [6.86052, 46.28512], [6.77152, 46.34784], [6.8024, 46.39171], [6.82312, 46.42661], [6.53358, 46.45431], [6.25432, 46.3632], [6.21981, 46.31304], [6.24826, 46.30175], [6.25137, 46.29014], [6.23775, 46.27822], [6.24952, 46.26255], [6.26749, 46.24745], [6.29474, 46.26221], [6.31041, 46.24417], [6.29663, 46.22688], [6.27694, 46.21566], [6.26007, 46.21165], [6.24821, 46.20531], [6.23913, 46.20511], [6.23544, 46.20714], [6.22175, 46.20045], [6.22222, 46.19888], [6.21844, 46.19837], [6.21603, 46.19507], [6.21273, 46.19409], [6.21114, 46.1927], [6.20539, 46.19163], [6.19807, 46.18369], [6.19552, 46.18401], [6.18707, 46.17999], [6.18871, 46.16644], [6.18116, 46.16187], [6.15305, 46.15194], [6.13397, 46.1406], [6.09926, 46.14373], [6.09199, 46.15191], [6.07491, 46.14879], [6.05203, 46.15191], [6.04564, 46.14031], [6.03614, 46.13712], [6.01791, 46.14228], [5.9871, 46.14499], [5.97893, 46.13303], [5.95781, 46.12925], [5.9641, 46.14412], [5.97508, 46.15863], [5.98188, 46.17392], [5.98846, 46.17046], [5.99573, 46.18587], [5.96515, 46.19638], [5.97542, 46.21525], [6.02461, 46.23313], [6.03342, 46.2383], [6.04602, 46.23127], [6.05029, 46.23518], [6.0633, 46.24583], [6.07072, 46.24085], [6.08563, 46.24651], [6.10071, 46.23772], [6.12446, 46.25059], [6.11926, 46.2634], [6.1013, 46.28512], [6.11697, 46.29547], [6.1198, 46.31157], [6.13876, 46.33844], [6.15738, 46.3491], [6.16987, 46.36759], [6.15985, 46.37721], [6.15016, 46.3778], [6.09926, 46.40768], [6.06407, 46.41676], [6.08427, 46.44305], [6.07269, 46.46244], [6.1567, 46.54402], [6.11084, 46.57649], [6.27135, 46.68251], [6.38351, 46.73171], [6.45209, 46.77502], [6.43216, 46.80336], [6.46456, 46.88865], [6.43341, 46.92703], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.8489, 47.15933], [6.9508, 47.24338], [6.95108, 47.26428], [6.94316, 47.28747], [7.05305, 47.33304], [7.0564, 47.35134], [7.03125, 47.36996], [6.87959, 47.35335], [6.88542, 47.37262], [6.93744, 47.40714], [6.93953, 47.43388], [7.0024, 47.45264], [6.98425, 47.49432], [7.0231, 47.50522], [7.07425, 47.48863], [7.12781, 47.50371], [7.16249, 47.49025], [7.19583, 47.49455], [7.17026, 47.44312], [7.24669, 47.4205], [7.33526, 47.44186], [7.35603, 47.43432], [7.40308, 47.43638], [7.43088, 47.45846], [7.4462, 47.46264], [7.4583, 47.47216], [7.42923, 47.48628], [7.43356, 47.49712], [7.47534, 47.47932], [7.51076, 47.49651], [7.49804, 47.51798], [7.5229, 47.51644], [7.53199, 47.5284], [7.51904, 47.53515], [7.50588, 47.52856], [7.49691, 47.53821], [7.50873, 47.54546], [7.51723, 47.54578], [7.52831, 47.55347], [7.53634, 47.55553], [7.55652, 47.56779], [7.55689, 47.57232], [7.56548, 47.57617], [7.56684, 47.57785], [7.58386, 47.57536], [7.58945, 47.59017], [7.59301, 47.60058], [7.58851, 47.60794], [7.57423, 47.61628], [7.5591, 47.63849], [7.53384, 47.65115], [7.52067, 47.66437], [7.51915, 47.68335], [7.51266, 47.70197], [7.53722, 47.71635], [7.54761, 47.72912], [7.52921, 47.77747], [7.55673, 47.87371], [7.62302, 47.97898], [7.56966, 48.03265], [7.57137, 48.12292], [7.6648, 48.22219], [7.69022, 48.30018], [7.74562, 48.32736], [7.73109, 48.39192], [7.76833, 48.48945], [7.80647, 48.51239], [7.80167, 48.54758], [7.80057, 48.5857], [7.84098, 48.64217], [7.89002, 48.66317], [7.96812, 48.72491], [7.96994, 48.75606], [8.01534, 48.76085], [8.0326, 48.79017], [8.06802, 48.78957], [8.10253, 48.81829], [8.12813, 48.87985], [8.19989, 48.95825], [8.20031, 48.95856], [8.22604, 48.97352], [8.14189, 48.97833], [7.97783, 49.03161], [7.93641, 49.05544], [7.86386, 49.03499], [7.79557, 49.06583], [7.75948, 49.04562], [7.63618, 49.05428], [7.62575, 49.07654], [7.56416, 49.08136], [7.53012, 49.09818], [7.49172, 49.13915], [7.49473, 49.17], [7.44455, 49.16765], [7.44052, 49.18354], [7.3662, 49.17308], [7.35995, 49.14399], [7.3195, 49.14231], [7.29514, 49.11426], [7.23473, 49.12971], [7.1593, 49.1204], [7.1358, 49.1282], [7.12504, 49.14253], [7.10384, 49.13787], [7.10715, 49.15631], [7.07859, 49.15031], [7.09007, 49.13094], [7.07162, 49.1255], [7.06642, 49.11415], [7.05548, 49.11185], [7.04843, 49.11422], [7.04409, 49.12123], [7.04662, 49.13724], [7.03178, 49.15734], [7.0274, 49.17042], [7.03459, 49.19096], [7.01318, 49.19018], [6.97273, 49.2099], [6.95963, 49.203], [6.94028, 49.21641], [6.93831, 49.2223], [6.91875, 49.22261], [6.89298, 49.20863], [6.85939, 49.22376], [6.83555, 49.21249], [6.85119, 49.20038], [6.85016, 49.19354], [6.86225, 49.18185], [6.84703, 49.15734], [6.83385, 49.15162], [6.78265, 49.16793], [6.73765, 49.16375], [6.71137, 49.18808], [6.73256, 49.20486], [6.71843, 49.2208], [6.69274, 49.21661], [6.66583, 49.28065], [6.60186, 49.31055], [6.572, 49.35027], [6.58807, 49.35358], [6.60091, 49.36864], [6.533, 49.40748], [6.55404, 49.42464], [6.42432, 49.47683], [6.40274, 49.46546], [6.39168, 49.4667], [6.38352, 49.46463], [6.36778, 49.46937], [6.3687, 49.4593], [6.28818, 49.48465], [6.27875, 49.503], [6.25029, 49.50609], [6.2409, 49.51408], [6.19543, 49.50536], [6.17386, 49.50934], [6.15366, 49.50226], [6.16115, 49.49297], [6.14321, 49.48796], [6.12814, 49.49365], [6.12346, 49.4735], [6.10325, 49.4707], [6.09845, 49.46351], [6.10072, 49.45268], [6.08373, 49.45594], [6.07887, 49.46399], [6.05553, 49.46663], [6.04176, 49.44801], [6.02743, 49.44845], [6.02648, 49.45451], [5.97693, 49.45513], [5.96876, 49.49053], [5.94224, 49.49608], [5.94128, 49.50034], [5.86571, 49.50015], [5.83389, 49.52152], [5.83467, 49.52717], [5.84466, 49.53027], [5.83648, 49.5425], [5.81664, 49.53775], [5.80871, 49.5425], [5.81838, 49.54777], [5.79195, 49.55228], [5.77435, 49.56298], [5.7577, 49.55915], [5.75649, 49.54321], [5.64505, 49.55146], [5.60909, 49.51228], [5.55001, 49.52729], [5.46541, 49.49825], [5.46734, 49.52648], [5.43713, 49.5707], [5.3974, 49.61596], [5.34837, 49.62889], [5.33851, 49.61599], [5.3137, 49.61225], [5.30214, 49.63055], [5.33039, 49.6555], [5.31465, 49.66846], [5.26232, 49.69456], [5.14545, 49.70287], [5.09249, 49.76193], [4.96714, 49.79872], [4.85464, 49.78995], [4.86965, 49.82271], [4.85134, 49.86457], [4.88529, 49.9236], [4.78827, 49.95609], [4.8382, 50.06738], [4.88602, 50.15182], [4.83279, 50.15331], [4.82438, 50.16878], [4.75237, 50.11314], [4.70064, 50.09384], [4.68695, 49.99685], [4.5414, 49.96911], [4.51098, 49.94659], [4.43488, 49.94122], [4.35051, 49.95315], [4.31963, 49.97043], [4.20532, 49.95803], [4.14239, 49.98034], [4.13508, 50.01976], [4.16294, 50.04719], [4.23101, 50.06945], [4.20147, 50.13535], [4.13561, 50.13078], [4.16014, 50.19239], [4.15524, 50.21103], [4.21945, 50.25539], [4.20651, 50.27333], [4.17861, 50.27443], [4.17347, 50.28838], [4.15524, 50.2833], [4.16808, 50.25786], [4.13665, 50.25609], [4.11954, 50.30425], [4.10957, 50.30234], [4.10237, 50.31247], [4.0689, 50.3254], [4.0268, 50.35793], [3.96771, 50.34989], [3.90781, 50.32814], [3.84314, 50.35219], [3.73911, 50.34809], [3.70987, 50.3191], [3.71009, 50.30305], [3.66976, 50.34563], [3.65709, 50.36873], [3.67262, 50.38663], [3.67494, 50.40239], [3.66153, 50.45165], [3.64426, 50.46275], [3.61014, 50.49568], [3.58361, 50.49049], [3.5683, 50.50192], [3.49509, 50.48885], [3.51564, 50.5256], [3.47385, 50.53397], [3.44629, 50.51009], [3.37693, 50.49538], [3.28575, 50.52724], [3.2729, 50.60718], [3.23951, 50.6585], [3.264, 50.67668], [3.2536, 50.68977], [3.26141, 50.69151], [3.26063, 50.70086], [3.24593, 50.71389], [3.22042, 50.71019], [3.20845, 50.71662], [3.19017, 50.72569], [3.20064, 50.73547], [3.18811, 50.74025], [3.18339, 50.74981], [3.16476, 50.76843], [3.15017, 50.79031], [3.1257, 50.78603], [3.11987, 50.79188], [3.11206, 50.79416], [3.10614, 50.78303], [3.09163, 50.77717], [3.04314, 50.77674], [3.00537, 50.76588], [2.96778, 50.75242], [2.95019, 50.75138], [2.90873, 50.702], [2.91036, 50.6939], [2.90069, 50.69263], [2.88504, 50.70656], [2.87937, 50.70298], [2.86985, 50.7033], [2.8483, 50.72276], [2.81056, 50.71773], [2.71165, 50.81295], [2.63331, 50.81457], [2.59093, 50.91751], [2.63074, 50.94746], [2.57551, 51.00326], [2.55904, 51.07014]], [[1.99838, 42.44682], [1.98378, 42.44697], [1.96125, 42.45364], [1.95606, 42.45785], [1.96215, 42.47854], [1.97003, 42.48081], [1.97227, 42.48487], [1.97697, 42.48568], [1.98022, 42.49569], [1.98916, 42.49351], [1.99766, 42.4858], [1.98579, 42.47486], [1.99216, 42.46208], [2.01564, 42.45171], [1.99838, 42.44682]]]] } },
22689     { type: "Feature", properties: { iso1A2: "GA", iso1A3: "GAB", iso1N3: "266", wikidata: "Q1000", nameEn: "Gabon", groups: ["017", "202", "002", "UN"], callingCodes: ["241"] }, geometry: { type: "MultiPolygon", coordinates: [[[[13.29457, 2.16106], [13.28534, 2.25716], [11.37116, 2.29975], [11.3561, 2.17217], [11.35307, 1.00251], [9.79648, 1.0019], [9.75065, 1.06753], [9.66433, 1.06723], [7.24416, -0.64092], [10.75913, -4.39519], [11.12647, -3.94169], [11.22301, -3.69888], [11.48764, -3.51089], [11.57949, -3.52798], [11.68608, -3.68942], [11.87083, -3.71571], [11.92719, -3.62768], [11.8318, -3.5812], [11.96554, -3.30267], [11.70227, -3.17465], [11.70558, -3.0773], [11.80365, -3.00424], [11.64798, -2.81146], [11.5359, -2.85654], [11.64487, -2.61865], [11.57637, -2.33379], [11.74605, -2.39936], [11.96866, -2.33559], [12.04895, -2.41704], [12.47925, -2.32626], [12.44656, -1.92025], [12.61312, -1.8129], [12.82172, -1.91091], [13.02759, -2.33098], [13.47977, -2.43224], [13.75884, -2.09293], [13.92073, -2.35581], [13.85846, -2.46935], [14.10442, -2.49268], [14.23829, -2.33715], [14.16202, -2.23916], [14.23518, -2.15671], [14.25932, -1.97624], [14.41838, -1.89412], [14.52569, -0.57818], [14.41887, -0.44799], [14.2165, -0.38261], [14.06862, -0.20826], [13.90632, -0.2287], [13.88648, 0.26652], [14.10909, 0.58563], [14.26066, 0.57255], [14.48179, 0.9152], [14.25186, 1.39842], [13.89582, 1.4261], [13.15519, 1.23368], [13.25447, 1.32339], [13.13461, 1.57238], [13.29457, 2.16106]]]] } },
22690     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
22691     { type: "Feature", properties: { iso1A2: "GD", iso1A3: "GRD", iso1N3: "308", wikidata: "Q769", nameEn: "Grenada", aliases: ["WG"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 473"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-61.77886, 11.36496], [-59.94058, 12.34011], [-62.64026, 12.69984]]]] } },
22692     { type: "Feature", properties: { iso1A2: "GE", iso1A3: "GEO", iso1N3: "268", wikidata: "Q230", nameEn: "Georgia", groups: ["145", "142", "UN"], callingCodes: ["995"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [45.61676, 42.20768], [45.78692, 42.48358], [45.36501, 42.55268], [45.15318, 42.70598], [44.88754, 42.74934], [44.80941, 42.61277], [44.70002, 42.74679], [44.54202, 42.75699], [43.95517, 42.55396], [43.73119, 42.62043], [43.81453, 42.74297], [43.0419, 43.02413], [43.03322, 43.08883], [42.75889, 43.19651], [42.66667, 43.13917], [42.40563, 43.23226], [41.64935, 43.22331], [40.65957, 43.56212], [40.10657, 43.57344], [40.04445, 43.47776], [40.03312, 43.44262], [40.01007, 43.42411], [40.01552, 43.42025], [40.00853, 43.40578], [40.0078, 43.38551], [39.81147, 43.06294], [40.89217, 41.72528], [41.54366, 41.52185], [41.7148, 41.4932], [41.7124, 41.47417], [41.81939, 41.43621], [41.95134, 41.52466], [42.26387, 41.49346], [42.51772, 41.43606], [42.59202, 41.58183], [42.72794, 41.59714], [42.84471, 41.58912], [42.78995, 41.50126], [42.84899, 41.47265], [42.8785, 41.50516], [43.02956, 41.37891], [43.21707, 41.30331], [43.13373, 41.25503], [43.1945, 41.25242], [43.23096, 41.17536], [43.36118, 41.2028], [43.44973, 41.17666], [43.4717, 41.12611], [43.67712, 41.13398], [43.74717, 41.1117], [43.84835, 41.16329], [44.16591, 41.19141], [44.18148, 41.24644], [44.32139, 41.2079], [44.34337, 41.20312], [44.34417, 41.2382], [44.46791, 41.18204], [44.59322, 41.1933], [44.61462, 41.24018], [44.72814, 41.20338], [44.82084, 41.21513], [44.87887, 41.20195], [44.89911, 41.21366], [44.84358, 41.23088], [44.81749, 41.23488], [44.80053, 41.25949], [44.81437, 41.30371], [44.93493, 41.25685], [45.0133, 41.29747], [45.09867, 41.34065], [45.1797, 41.42231], [45.26285, 41.46433], [45.31352, 41.47168], [45.4006, 41.42402], [45.45973, 41.45898], [45.68389, 41.3539], [45.71035, 41.36208], [45.75705, 41.35157], [45.69946, 41.29545], [45.80842, 41.2229], [45.95786, 41.17956], [46.13221, 41.19479], [46.27698, 41.19011], [46.37661, 41.10805], [46.456, 41.09984], [46.48558, 41.0576], [46.55096, 41.1104], [46.63969, 41.09515], [46.66148, 41.20533], [46.72375, 41.28609], [46.63658, 41.37727], [46.4669, 41.43331], [46.40307, 41.48464], [46.33925, 41.4963], [46.29794, 41.5724], [46.34126, 41.57454], [46.34039, 41.5947], [46.3253, 41.60912], [46.28182, 41.60089], [46.26531, 41.63339], [46.24429, 41.59883], [46.19759, 41.62327], [46.17891, 41.72094], [46.20538, 41.77205], [46.23962, 41.75811], [46.30863, 41.79133], [46.3984, 41.84399], [46.42738, 41.91323]]]] } },
22693     { type: "Feature", properties: { iso1A2: "GF", iso1A3: "GUF", iso1N3: "254", wikidata: "Q3769", nameEn: "French Guiana", country: "FR", groups: ["Q3320166", "EU", "005", "419", "019", "UN"], callingCodes: ["594"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-51.35485, 4.8383], [-53.7094, 6.2264], [-54.01074, 5.68785], [-54.01877, 5.52789], [-54.26916, 5.26909], [-54.4717, 4.91964], [-54.38444, 4.13222], [-54.19367, 3.84387], [-54.05128, 3.63557], [-53.98914, 3.627], [-53.9849, 3.58697], [-54.28534, 2.67798], [-54.42864, 2.42442], [-54.6084, 2.32856], [-54.16286, 2.10779], [-53.78743, 2.34412], [-52.96539, 2.1881], [-52.6906, 2.37298], [-52.31787, 3.17896], [-51.85573, 3.83427], [-51.82312, 3.85825], [-51.79599, 3.89336], [-51.61983, 4.14596], [-51.63798, 4.51394], [-51.35485, 4.8383]]]] } },
22694     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
22695     { type: "Feature", properties: { iso1A2: "GH", iso1A3: "GHA", iso1N3: "288", wikidata: "Q117", nameEn: "Ghana", groups: ["011", "202", "002", "UN"], callingCodes: ["233"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-0.13493, 11.14075], [-0.27374, 11.17157], [-0.28566, 11.12713], [-0.35955, 11.07801], [-0.38219, 11.12596], [-0.42391, 11.11661], [-0.44298, 11.04292], [-0.61937, 10.91305], [-0.67143, 10.99811], [-2.83373, 11.0067], [-2.94232, 10.64281], [-2.83108, 10.40252], [-2.74174, 9.83172], [-2.76534, 9.56589], [-2.68802, 9.49343], [-2.69814, 9.22717], [-2.77799, 9.04949], [-2.66357, 9.01771], [-2.58243, 8.7789], [-2.49037, 8.20872], [-2.62901, 8.11495], [-2.61232, 8.02645], [-2.67787, 8.02055], [-2.74819, 7.92613], [-2.78395, 7.94974], [-2.79467, 7.86002], [-2.92339, 7.60847], [-2.97822, 7.27165], [-2.95438, 7.23737], [-3.23327, 6.81744], [-3.21954, 6.74407], [-3.25999, 6.62521], [-3.01896, 5.71697], [-2.95323, 5.71865], [-2.96671, 5.6415], [-2.93132, 5.62137], [-2.85378, 5.65156], [-2.76614, 5.60963], [-2.72737, 5.34789], [-2.77625, 5.34621], [-2.73074, 5.1364], [-2.75502, 5.10657], [-2.95261, 5.12477], [-2.96554, 5.10397], [-3.063, 5.13665], [-3.11073, 5.12675], [-3.10675, 5.08515], [-3.34019, 4.17519], [1.07031, 5.15655], [1.27574, 5.93551], [1.19771, 6.11522], [1.19966, 6.17069], [1.09187, 6.17074], [1.05969, 6.22998], [1.03108, 6.24064], [0.99652, 6.33779], [0.89283, 6.33779], [0.71048, 6.53083], [0.74862, 6.56517], [0.63659, 6.63857], [0.6497, 6.73682], [0.58176, 6.76049], [0.57406, 6.80348], [0.52853, 6.82921], [0.56508, 6.92971], [0.52098, 6.94391], [0.52217, 6.9723], [0.59606, 7.01252], [0.65327, 7.31643], [0.62943, 7.41099], [0.57223, 7.39326], [0.52455, 7.45354], [0.51979, 7.58706], [0.58295, 7.62368], [0.62943, 7.85751], [0.58891, 8.12779], [0.6056, 8.13959], [0.61156, 8.18324], [0.5913, 8.19622], [0.63897, 8.25873], [0.73432, 8.29529], [0.64731, 8.48866], [0.47211, 8.59945], [0.37319, 8.75262], [0.52455, 8.87746], [0.45424, 9.04581], [0.56388, 9.40697], [0.49118, 9.48339], [0.36485, 9.49749], [0.33148, 9.44812], [0.25758, 9.42696], [0.2254, 9.47869], [0.31241, 9.50337], [0.30406, 9.521], [0.2409, 9.52335], [0.23851, 9.57389], [0.38153, 9.58682], [0.36008, 9.6256], [0.29334, 9.59387], [0.26712, 9.66437], [0.28261, 9.69022], [0.32313, 9.6491], [0.34816, 9.66907], [0.34816, 9.71607], [0.32075, 9.72781], [0.36366, 10.03309], [0.41252, 10.02018], [0.41371, 10.06361], [0.35293, 10.09412], [0.39584, 10.31112], [0.33028, 10.30408], [0.29453, 10.41546], [0.18846, 10.4096], [0.12886, 10.53149], [-0.05945, 10.63458], [-0.09141, 10.7147], [-0.07327, 10.71845], [-0.07183, 10.76794], [-0.0228, 10.81916], [-0.02685, 10.8783], [-908e-5, 10.91644], [-63e-4, 10.96417], [0.03355, 10.9807], [0.02395, 11.06229], [342e-5, 11.08317], [-514e-5, 11.10763], [-0.0275, 11.11202], [-0.05733, 11.08628], [-0.14462, 11.10811], [-0.13493, 11.14075]]]] } },
22696     { type: "Feature", properties: { iso1A2: "GI", iso1A3: "GIB", iso1N3: "292", wikidata: "Q1410", nameEn: "Gibraltar", country: "GB", groups: ["Q12837", "BOTS", "039", "150", "UN"], callingCodes: ["350"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.34064, 36.03744], [-5.27801, 36.14942], [-5.33822, 36.15272], [-5.34536, 36.15501], [-5.40526, 36.15488], [-5.34064, 36.03744]]]] } },
22697     { type: "Feature", properties: { iso1A2: "GL", iso1A3: "GRL", iso1N3: "304", wikidata: "Q223", nameEn: "Greenland", country: "DK", groups: ["Q1451600", "021", "003", "019", "UN"], callingCodes: ["299"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-49.33696, 84.57952], [-68.21821, 80.48551], [-77.52957, 77.23408], [-46.37635, 57.3249], [-9.68082, 72.73731], [-5.7106, 84.28058], [-49.33696, 84.57952]]]] } },
22698     { type: "Feature", properties: { iso1A2: "GM", iso1A3: "GMB", iso1N3: "270", wikidata: "Q1005", nameEn: "The Gambia", groups: ["011", "202", "002", "UN"], callingCodes: ["220"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-15.14917, 13.57989], [-14.36795, 13.23033], [-13.79409, 13.34472], [-13.8955, 13.59126], [-14.34721, 13.46578], [-14.93719, 13.80173], [-15.36504, 13.79313], [-15.47902, 13.58758], [-17.43598, 13.59273], [-17.43966, 13.04579], [-16.74676, 13.06025], [-16.69343, 13.16791], [-15.80355, 13.16729], [-15.80478, 13.34832], [-15.26908, 13.37768], [-15.14917, 13.57989]]]] } },
22699     { type: "Feature", properties: { iso1A2: "GN", iso1A3: "GIN", iso1N3: "324", wikidata: "Q1006", nameEn: "Guinea", groups: ["011", "202", "002", "UN"], callingCodes: ["224"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-11.37536, 12.40788], [-11.46267, 12.44559], [-11.91331, 12.42008], [-12.35415, 12.32758], [-12.87336, 12.51892], [-13.06603, 12.49342], [-13.05296, 12.64003], [-13.70523, 12.68013], [-13.7039, 12.60313], [-13.65089, 12.49515], [-13.64168, 12.42764], [-13.70851, 12.24978], [-13.92745, 12.24077], [-13.94589, 12.16869], [-13.7039, 12.00869], [-13.7039, 11.70195], [-14.09799, 11.63649], [-14.26623, 11.67486], [-14.31513, 11.60713], [-14.51173, 11.49708], [-14.66677, 11.51188], [-14.77786, 11.36323], [-14.95993, 10.99244], [-15.07174, 10.89557], [-15.96748, 10.162], [-14.36218, 8.64107], [-13.29911, 9.04245], [-13.18586, 9.0925], [-13.08953, 9.0409], [-12.94095, 9.26335], [-12.76788, 9.3133], [-12.47254, 9.86834], [-12.24262, 9.92386], [-12.12634, 9.87203], [-11.91023, 9.93927], [-11.89624, 9.99763], [-11.2118, 10.00098], [-10.6534, 9.29919], [-10.74484, 9.07998], [-10.5783, 9.06386], [-10.56197, 8.81225], [-10.47707, 8.67669], [-10.61422, 8.5314], [-10.70565, 8.29235], [-10.63934, 8.35326], [-10.54891, 8.31174], [-10.37257, 8.48941], [-10.27575, 8.48711], [-10.203, 8.47991], [-10.14579, 8.52665], [-10.05375, 8.50697], [-10.05873, 8.42578], [-9.77763, 8.54633], [-9.47415, 8.35195], [-9.50898, 8.18455], [-9.41445, 8.02448], [-9.44928, 7.9284], [-9.35724, 7.74111], [-9.37465, 7.62032], [-9.48161, 7.37122], [-9.41943, 7.41809], [-9.305, 7.42056], [-9.20798, 7.38109], [-9.18311, 7.30461], [-9.09107, 7.1985], [-8.93435, 7.2824], [-8.85724, 7.26019], [-8.8448, 7.35149], [-8.72789, 7.51429], [-8.67814, 7.69428], [-8.55874, 7.70167], [-8.55874, 7.62525], [-8.47114, 7.55676], [-8.4003, 7.6285], [-8.21374, 7.54466], [-8.09931, 7.78626], [-8.13414, 7.87991], [-8.06449, 8.04989], [-7.94695, 8.00925], [-7.99919, 8.11023], [-7.98675, 8.20134], [-8.062, 8.16071], [-8.2411, 8.24196], [-8.22991, 8.48438], [-7.92518, 8.50652], [-7.65653, 8.36873], [-7.69882, 8.66148], [-7.95503, 8.81146], [-7.92518, 8.99332], [-7.73862, 9.08422], [-7.90777, 9.20456], [-7.85056, 9.41812], [-8.03463, 9.39604], [-8.14657, 9.55062], [-8.09434, 9.86936], [-8.15652, 9.94288], [-8.11921, 10.04577], [-8.01225, 10.1021], [-7.97971, 10.17117], [-7.9578, 10.2703], [-8.10207, 10.44649], [-8.22711, 10.41722], [-8.32614, 10.69273], [-8.2667, 10.91762], [-8.35083, 11.06234], [-8.66923, 10.99397], [-8.40058, 11.37466], [-8.80854, 11.66715], [-8.94784, 12.34842], [-9.13689, 12.50875], [-9.38067, 12.48446], [-9.32097, 12.29009], [-9.63938, 12.18312], [-9.714, 12.0226], [-10.30604, 12.24634], [-10.71897, 11.91552], [-10.80355, 12.1053], [-10.99758, 12.24634], [-11.24136, 12.01286], [-11.50006, 12.17826], [-11.37536, 12.40788]]]] } },
22700     { type: "Feature", properties: { iso1A2: "GP", iso1A3: "GLP", iso1N3: "312", wikidata: "Q17012", nameEn: "Guadeloupe", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-60.03183, 16.1129], [-61.60296, 16.73066], [-63.00549, 15.26166], [-60.03183, 16.1129]]]] } },
22701     { type: "Feature", properties: { iso1A2: "GQ", iso1A3: "GNQ", iso1N3: "226", wikidata: "Q983", nameEn: "Equatorial Guinea", groups: ["017", "202", "002", "UN"], callingCodes: ["240"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.22018, 3.72052], [8.34397, 4.30689], [7.71762, 0.6674], [3.35016, -3.29031], [9.66433, 1.06723], [9.75065, 1.06753], [9.79648, 1.0019], [11.35307, 1.00251], [11.3561, 2.17217], [9.991, 2.16561], [9.90749, 2.20049], [9.89012, 2.20457], [9.84716, 2.24676], [9.83238, 2.29079], [9.83754, 2.32428], [9.82123, 2.35097], [9.81162, 2.33797], [9.22018, 3.72052]]]] } },
22702     { type: "Feature", properties: { iso1A2: "GR", iso1A3: "GRC", iso1N3: "300", wikidata: "Q41", nameEn: "Greece", aliases: ["EL"], groups: ["EU", "039", "150", "UN"], callingCodes: ["30"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.03489, 40.73051], [26.0754, 40.72772], [26.08638, 40.73214], [26.12495, 40.74283], [26.12854, 40.77339], [26.15685, 40.80709], [26.21351, 40.83298], [26.20856, 40.86048], [26.26169, 40.9168], [26.29441, 40.89119], [26.28623, 40.93005], [26.32259, 40.94042], [26.35894, 40.94292], [26.33297, 40.98388], [26.3606, 41.02027], [26.31928, 41.07386], [26.32259, 41.24929], [26.39861, 41.25053], [26.5209, 41.33993], [26.5837, 41.32131], [26.62997, 41.34613], [26.61767, 41.42281], [26.59742, 41.48058], [26.59196, 41.60491], [26.5209, 41.62592], [26.47958, 41.67037], [26.35957, 41.71149], [26.30255, 41.70925], [26.2654, 41.71544], [26.22888, 41.74139], [26.21325, 41.73223], [26.16841, 41.74858], [26.06148, 41.70345], [26.07083, 41.64584], [26.15146, 41.60828], [26.14328, 41.55496], [26.17951, 41.55409], [26.176, 41.50072], [26.14796, 41.47533], [26.20288, 41.43943], [26.16548, 41.42278], [26.12926, 41.35878], [25.87919, 41.30526], [25.8266, 41.34563], [25.70507, 41.29209], [25.66183, 41.31316], [25.61042, 41.30614], [25.55082, 41.31667], [25.52394, 41.2798], [25.48187, 41.28506], [25.28322, 41.23411], [25.11611, 41.34212], [24.942, 41.38685], [24.90928, 41.40876], [24.86136, 41.39298], [24.82514, 41.4035], [24.8041, 41.34913], [24.71529, 41.41928], [24.61129, 41.42278], [24.52599, 41.56808], [24.30513, 41.51297], [24.27124, 41.57682], [24.18126, 41.51735], [24.10063, 41.54796], [24.06323, 41.53222], [24.06908, 41.46132], [23.96975, 41.44118], [23.91483, 41.47971], [23.89613, 41.45257], [23.80148, 41.43943], [23.76525, 41.40175], [23.67644, 41.41139], [23.63203, 41.37632], [23.52453, 41.40262], [23.40416, 41.39999], [23.33639, 41.36317], [23.31301, 41.40525], [23.22771, 41.37106], [23.21953, 41.33773], [23.1833, 41.31755], [22.93334, 41.34104], [22.81199, 41.3398], [22.76408, 41.32225], [22.74538, 41.16321], [22.71266, 41.13945], [22.65306, 41.18168], [22.62852, 41.14385], [22.58295, 41.11568], [22.5549, 41.13065], [22.42285, 41.11921], [22.26744, 41.16409], [22.17629, 41.15969], [22.1424, 41.12449], [22.06527, 41.15617], [21.90869, 41.09191], [21.91102, 41.04786], [21.7556, 40.92525], [21.69601, 40.9429], [21.57448, 40.86076], [21.53007, 40.90759], [21.41555, 40.9173], [21.35595, 40.87578], [21.25779, 40.86165], [21.21105, 40.8855], [21.15262, 40.85546], [20.97887, 40.85475], [20.98396, 40.79109], [20.95752, 40.76982], [20.98134, 40.76046], [21.05833, 40.66586], [21.03932, 40.56299], [20.96908, 40.51526], [20.94925, 40.46625], [20.83688, 40.47882], [20.7906, 40.42726], [20.78234, 40.35803], [20.71789, 40.27739], [20.67162, 40.09433], [20.62566, 40.0897], [20.61081, 40.07866], [20.55593, 40.06524], [20.51297, 40.08168], [20.48487, 40.06271], [20.42373, 40.06777], [20.37911, 39.99058], [20.31135, 39.99438], [20.41546, 39.82832], [20.41475, 39.81437], [20.38572, 39.78516], [20.30804, 39.81563], [20.29152, 39.80421], [20.31961, 39.72799], [20.27412, 39.69884], [20.22707, 39.67459], [20.22376, 39.64532], [20.15988, 39.652], [20.12956, 39.65805], [20.05189, 39.69112], [20.00957, 39.69227], [19.98042, 39.6504], [19.92466, 39.69533], [19.97622, 39.78684], [19.95905, 39.82857], [19.0384, 40.35325], [19.20409, 39.7532], [22.5213, 33.45682], [29.73302, 35.92555], [29.69611, 36.10365], [29.61805, 36.14179], [29.61002, 36.1731], [29.48192, 36.18377], [29.30783, 36.01033], [28.23708, 36.56812], [27.95037, 36.46155], [27.89482, 36.69898], [27.46117, 36.53789], [27.24613, 36.71622], [27.45627, 36.9008], [27.20312, 36.94571], [27.14757, 37.32], [26.95583, 37.64989], [26.99377, 37.69034], [27.16428, 37.72343], [27.05537, 37.9131], [26.21136, 38.17558], [26.24183, 38.44695], [26.32173, 38.48731], [26.21136, 38.65436], [26.61814, 38.81372], [26.70773, 39.0312], [26.43357, 39.43096], [25.94257, 39.39358], [25.61285, 40.17161], [26.04292, 40.3958], [25.94795, 40.72797], [26.03489, 40.73051]]]] } },
22703     { type: "Feature", properties: { iso1A2: "GS", iso1A3: "SGS", iso1N3: "239", wikidata: "Q35086", nameEn: "South Georgia and South Sandwich Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-35.26394, -43.68272], [-53.39656, -59.87088], [-22.31757, -59.85974], [-35.26394, -43.68272]]]] } },
22704     { type: "Feature", properties: { iso1A2: "GT", iso1A3: "GTM", iso1N3: "320", wikidata: "Q774", nameEn: "Guatemala", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["502"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.14985, 17.81563], [-90.98678, 17.81655], [-90.99199, 17.25192], [-91.43809, 17.25373], [-91.04436, 16.92175], [-90.69064, 16.70697], [-90.61212, 16.49832], [-90.40499, 16.40524], [-90.44567, 16.07573], [-91.73182, 16.07371], [-92.20983, 15.26077], [-92.0621, 15.07406], [-92.1454, 14.98143], [-92.1423, 14.88647], [-92.18161, 14.84147], [-92.1454, 14.6804], [-92.2261, 14.53423], [-92.37213, 14.39277], [-90.55276, 12.8866], [-90.11344, 13.73679], [-90.10505, 13.85104], [-89.88937, 14.0396], [-89.81807, 14.07073], [-89.76103, 14.02923], [-89.73251, 14.04133], [-89.75569, 14.07073], [-89.70756, 14.1537], [-89.61844, 14.21937], [-89.52397, 14.22628], [-89.50614, 14.26084], [-89.58814, 14.33165], [-89.57441, 14.41637], [-89.39028, 14.44561], [-89.34776, 14.43013], [-89.35189, 14.47553], [-89.23719, 14.58046], [-89.15653, 14.57802], [-89.13132, 14.71582], [-89.23467, 14.85596], [-89.15149, 14.97775], [-89.18048, 14.99967], [-89.15149, 15.07392], [-88.97343, 15.14039], [-88.32467, 15.63665], [-88.31459, 15.66942], [-88.24022, 15.69247], [-88.22552, 15.72294], [-88.20359, 16.03858], [-88.40779, 16.09624], [-88.95358, 15.88698], [-89.02415, 15.9063], [-89.17418, 15.90898], [-89.22683, 15.88619], [-89.15025, 17.04813], [-89.14985, 17.81563]]]] } },
22705     { type: "Feature", properties: { iso1A2: "GU", iso1A3: "GUM", iso1N3: "316", wikidata: "Q16635", nameEn: "Guam", aliases: ["US-GU"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 671"] }, geometry: { type: "MultiPolygon", coordinates: [[[[146.25931, 13.85876], [143.82485, 13.92273], [144.61642, 12.82462], [146.25931, 13.85876]]]] } },
22706     { type: "Feature", properties: { iso1A2: "GW", iso1A3: "GNB", iso1N3: "624", wikidata: "Q1007", nameEn: "Guinea-Bissau", groups: ["011", "202", "002", "UN"], callingCodes: ["245"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.31513, 11.60713], [-14.26623, 11.67486], [-14.09799, 11.63649], [-13.7039, 11.70195], [-13.7039, 12.00869], [-13.94589, 12.16869], [-13.92745, 12.24077], [-13.70851, 12.24978], [-13.64168, 12.42764], [-13.65089, 12.49515], [-13.7039, 12.60313], [-13.70523, 12.68013], [-15.17582, 12.6847], [-15.67302, 12.42974], [-16.20591, 12.46157], [-16.38191, 12.36449], [-16.70562, 12.34803], [-17.4623, 11.92379], [-15.96748, 10.162], [-15.07174, 10.89557], [-14.95993, 10.99244], [-14.77786, 11.36323], [-14.66677, 11.51188], [-14.51173, 11.49708], [-14.31513, 11.60713]]]] } },
22707     { type: "Feature", properties: { iso1A2: "GY", iso1A3: "GUY", iso1N3: "328", wikidata: "Q734", nameEn: "Guyana", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["592"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.84822, 6.73257], [-59.54058, 8.6862], [-59.98508, 8.53046], [-59.85562, 8.35213], [-59.80661, 8.28906], [-59.83156, 8.23261], [-59.97059, 8.20791], [-60.02407, 8.04557], [-60.38056, 7.8302], [-60.51959, 7.83373], [-60.64793, 7.56877], [-60.71923, 7.55817], [-60.59802, 7.33194], [-60.63367, 7.25061], [-60.54098, 7.14804], [-60.44116, 7.20817], [-60.28074, 7.1162], [-60.39419, 6.94847], [-60.54873, 6.8631], [-61.13632, 6.70922], [-61.20762, 6.58174], [-61.15058, 6.19558], [-61.4041, 5.95304], [-60.73204, 5.20931], [-60.32352, 5.21299], [-60.20944, 5.28754], [-59.98129, 5.07097], [-60.04189, 4.69801], [-60.15953, 4.53456], [-59.78878, 4.45637], [-59.69361, 4.34069], [-59.73353, 4.20399], [-59.51963, 3.91951], [-59.86899, 3.57089], [-59.79769, 3.37162], [-59.99733, 2.92312], [-59.91177, 2.36759], [-59.7264, 2.27497], [-59.74066, 1.87596], [-59.25583, 1.40559], [-58.92072, 1.31293], [-58.84229, 1.17749], [-58.53571, 1.29154], [-58.4858, 1.48399], [-58.33887, 1.58014], [-58.01873, 1.51966], [-57.97336, 1.64566], [-57.77281, 1.73344], [-57.55743, 1.69605], [-57.35073, 1.98327], [-57.23981, 1.95808], [-57.09109, 2.01854], [-57.07092, 1.95304], [-56.7659, 1.89509], [-56.47045, 1.95135], [-56.55439, 2.02003], [-56.70519, 2.02964], [-57.35891, 3.32121], [-58.0307, 3.95513], [-57.8699, 4.89394], [-57.37442, 5.0208], [-57.22536, 5.15605], [-57.31629, 5.33714], [-56.84822, 6.73257]]]] } },
22708     { type: "Feature", properties: { iso1A2: "HK", iso1A3: "HKG", iso1N3: "344", wikidata: "Q8646", nameEn: "Hong Kong", country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["852"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.92195, 22.13873], [114.50148, 22.15017], [114.44998, 22.55977], [114.25154, 22.55977], [114.22888, 22.5436], [114.22185, 22.55343], [114.20655, 22.55706], [114.18338, 22.55444], [114.17247, 22.55944], [114.1597, 22.56041], [114.15123, 22.55163], [114.1482, 22.54091], [114.13823, 22.54319], [114.12665, 22.54003], [114.11656, 22.53415], [114.11181, 22.52878], [114.1034, 22.5352], [114.09692, 22.53435], [114.09048, 22.53716], [114.08606, 22.53276], [114.07817, 22.52997], [114.07267, 22.51855], [114.06272, 22.51617], [114.05729, 22.51104], [114.05438, 22.5026], [114.03113, 22.5065], [113.86771, 22.42972], [113.81621, 22.2163], [113.83338, 22.1826], [113.92195, 22.13873]]]] } },
22709     { type: "Feature", properties: { iso1A2: "HM", iso1A3: "HMD", iso1N3: "334", wikidata: "Q131198", nameEn: "Heard Island and McDonald Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[71.08716, -53.87687], [75.44182, -53.99822], [72.87012, -51.48322], [71.08716, -53.87687]]]] } },
22710     { type: "Feature", properties: { iso1A2: "HN", iso1A3: "HND", iso1N3: "340", wikidata: "Q783", nameEn: "Honduras", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["504"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.86109, 17.73736], [-88.20359, 16.03858], [-88.22552, 15.72294], [-88.24022, 15.69247], [-88.31459, 15.66942], [-88.32467, 15.63665], [-88.97343, 15.14039], [-89.15149, 15.07392], [-89.18048, 14.99967], [-89.15149, 14.97775], [-89.23467, 14.85596], [-89.13132, 14.71582], [-89.15653, 14.57802], [-89.23719, 14.58046], [-89.35189, 14.47553], [-89.34776, 14.43013], [-89.04187, 14.33644], [-88.94608, 14.20207], [-88.85785, 14.17763], [-88.815, 14.11652], [-88.73182, 14.10919], [-88.70661, 14.04317], [-88.49738, 13.97224], [-88.48982, 13.86458], [-88.25791, 13.91108], [-88.23018, 13.99915], [-88.07641, 13.98447], [-88.00331, 13.86948], [-87.7966, 13.91353], [-87.68821, 13.80829], [-87.73106, 13.75443], [-87.78148, 13.52906], [-87.71657, 13.50577], [-87.72115, 13.46083], [-87.73841, 13.44169], [-87.77354, 13.45767], [-87.83467, 13.44655], [-87.84675, 13.41078], [-87.80177, 13.35689], [-87.73714, 13.32715], [-87.69751, 13.25228], [-87.55124, 13.12523], [-87.37107, 12.98646], [-87.06306, 13.00892], [-87.03785, 12.98682], [-86.93197, 13.05313], [-86.93383, 13.18677], [-86.87066, 13.30641], [-86.71267, 13.30348], [-86.76812, 13.79605], [-86.35219, 13.77157], [-86.14801, 14.04317], [-86.00685, 14.08474], [-86.03458, 13.99181], [-85.75477, 13.8499], [-85.73964, 13.9698], [-85.45762, 14.11304], [-85.32149, 14.2562], [-85.18602, 14.24929], [-85.1575, 14.53934], [-84.90082, 14.80489], [-84.82596, 14.82212], [-84.70119, 14.68078], [-84.48373, 14.63249], [-84.10584, 14.76353], [-83.89551, 14.76697], [-83.62101, 14.89448], [-83.49268, 15.01158], [-83.13724, 15.00002], [-83.04763, 15.03256], [-82.06974, 14.49418], [-81.58685, 18.0025], [-83.86109, 17.73736]]]] } },
22711     { type: "Feature", properties: { iso1A2: "HR", iso1A3: "HRV", iso1N3: "191", wikidata: "Q224", nameEn: "Croatia", groups: ["EU", "039", "150", "UN"], callingCodes: ["385"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.6444, 42.88641], [17.5392, 42.92787], [17.70879, 42.97223], [17.64268, 43.08595], [17.46986, 43.16559], [17.286, 43.33065], [17.25579, 43.40353], [17.29699, 43.44542], [17.24411, 43.49376], [17.15828, 43.49376], [17.00585, 43.58037], [16.80736, 43.76011], [16.75316, 43.77157], [16.70922, 43.84887], [16.55472, 43.95326], [16.50528, 44.0244], [16.43629, 44.02826], [16.43662, 44.07523], [16.36864, 44.08263], [16.18688, 44.27012], [16.21346, 44.35231], [16.12969, 44.38275], [16.16814, 44.40679], [16.10566, 44.52586], [16.03012, 44.55572], [16.00884, 44.58605], [16.05828, 44.61538], [15.89348, 44.74964], [15.8255, 44.71501], [15.72584, 44.82334], [15.79472, 44.8455], [15.76096, 44.87045], [15.74723, 44.96818], [15.78568, 44.97401], [15.74585, 45.0638], [15.78842, 45.11519], [15.76371, 45.16508], [15.83512, 45.22459], [15.98412, 45.23088], [16.12153, 45.09616], [16.29036, 44.99732], [16.35404, 45.00241], [16.35863, 45.03529], [16.3749, 45.05206], [16.38219, 45.05139], [16.38309, 45.05955], [16.40023, 45.1147], [16.4634, 45.14522], [16.49155, 45.21153], [16.52982, 45.22713], [16.5501, 45.2212], [16.56559, 45.22307], [16.60194, 45.23042], [16.64962, 45.20714], [16.74845, 45.20393], [16.78219, 45.19002], [16.81137, 45.18434], [16.83804, 45.18951], [16.92405, 45.27607], [16.9385, 45.22742], [17.0415, 45.20759], [17.18438, 45.14764], [17.24325, 45.146], [17.25131, 45.14957], [17.26815, 45.18444], [17.32092, 45.16246], [17.33573, 45.14521], [17.41229, 45.13335], [17.4498, 45.16119], [17.45615, 45.12523], [17.47589, 45.12656], [17.51469, 45.10791], [17.59104, 45.10816], [17.66571, 45.13408], [17.84826, 45.04489], [17.87148, 45.04645], [17.93706, 45.08016], [17.97336, 45.12245], [17.97834, 45.13831], [17.99479, 45.14958], [18.01594, 45.15163], [18.03121, 45.12632], [18.1624, 45.07654], [18.24387, 45.13699], [18.32077, 45.1021], [18.41896, 45.11083], [18.47939, 45.05871], [18.65723, 45.07544], [18.78357, 44.97741], [18.80661, 44.93561], [18.76369, 44.93707], [18.76347, 44.90669], [18.8704, 44.85097], [19.01994, 44.85493], [18.98957, 44.90645], [19.02871, 44.92541], [19.06853, 44.89915], [19.15573, 44.95409], [19.05205, 44.97692], [19.1011, 45.01191], [19.07952, 45.14668], [19.14063, 45.12972], [19.19144, 45.17863], [19.43589, 45.17137], [19.41941, 45.23475], [19.28208, 45.23813], [19.10774, 45.29547], [18.97446, 45.37528], [18.99918, 45.49333], [19.08364, 45.48804], [19.07471, 45.53086], [18.94562, 45.53712], [18.88776, 45.57253], [18.96691, 45.66731], [18.90305, 45.71863], [18.85783, 45.85493], [18.81394, 45.91329], [18.80211, 45.87995], [18.6792, 45.92057], [18.57483, 45.80772], [18.44368, 45.73972], [18.12439, 45.78905], [18.08869, 45.76511], [17.99805, 45.79671], [17.87377, 45.78522], [17.66545, 45.84207], [17.56821, 45.93728], [17.35672, 45.95209], [17.14592, 46.16697], [16.8903, 46.28122], [16.8541, 46.36255], [16.7154, 46.39523], [16.6639, 46.45203], [16.59527, 46.47524], [16.52604, 46.47831], [16.5007, 46.49644], [16.44036, 46.5171], [16.38771, 46.53608], [16.37193, 46.55008], [16.29793, 46.5121], [16.26733, 46.51505], [16.26759, 46.50566], [16.23961, 46.49653], [16.25124, 46.48067], [16.27398, 46.42875], [16.27329, 46.41467], [16.30162, 46.40437], [16.30233, 46.37837], [16.18824, 46.38282], [16.14859, 46.40547], [16.05281, 46.39141], [16.05065, 46.3833], [16.07314, 46.36458], [16.07616, 46.3463], [15.97965, 46.30652], [15.79284, 46.25811], [15.78817, 46.21719], [15.75479, 46.20336], [15.75436, 46.21969], [15.67395, 46.22478], [15.6434, 46.21396], [15.64904, 46.19229], [15.59909, 46.14761], [15.6083, 46.11992], [15.62317, 46.09103], [15.72977, 46.04682], [15.71246, 46.01196], [15.70327, 46.00015], [15.70636, 45.92116], [15.67967, 45.90455], [15.68383, 45.88867], [15.68232, 45.86819], [15.70411, 45.8465], [15.66662, 45.84085], [15.64185, 45.82915], [15.57952, 45.84953], [15.52234, 45.82195], [15.47325, 45.8253], [15.47531, 45.79802], [15.40836, 45.79491], [15.25423, 45.72275], [15.30872, 45.69014], [15.34919, 45.71623], [15.4057, 45.64727], [15.38952, 45.63682], [15.34214, 45.64702], [15.34695, 45.63382], [15.31027, 45.6303], [15.27747, 45.60504], [15.29837, 45.5841], [15.30249, 45.53224], [15.38188, 45.48752], [15.33051, 45.45258], [15.27758, 45.46678], [15.16862, 45.42309], [15.05187, 45.49079], [15.02385, 45.48533], [14.92266, 45.52788], [14.90554, 45.47769], [14.81992, 45.45913], [14.80124, 45.49515], [14.71718, 45.53442], [14.68605, 45.53006], [14.69694, 45.57366], [14.59576, 45.62812], [14.60977, 45.66403], [14.57397, 45.67165], [14.53816, 45.6205], [14.5008, 45.60852], [14.49769, 45.54424], [14.36693, 45.48642], [14.32487, 45.47142], [14.27681, 45.4902], [14.26611, 45.48239], [14.24239, 45.50607], [14.22371, 45.50388], [14.20348, 45.46896], [14.07116, 45.48752], [14.00578, 45.52352], [13.96063, 45.50825], [13.99488, 45.47551], [13.97309, 45.45258], [13.90771, 45.45149], [13.88124, 45.42637], [13.81742, 45.43729], [13.7785, 45.46787], [13.67398, 45.4436], [13.62902, 45.45898], [13.56979, 45.4895], [13.45644, 45.59464], [13.05142, 45.33128], [13.12821, 44.48877], [16.15283, 42.18525], [18.45131, 42.21682], [18.54128, 42.39171], [18.52152, 42.42302], [18.43588, 42.48556], [18.44307, 42.51077], [18.43735, 42.55921], [18.36197, 42.61423], [18.24318, 42.6112], [17.88201, 42.83668], [17.80854, 42.9182], [17.7948, 42.89556], [17.68151, 42.92725], [17.6444, 42.88641]]]] } },
22712     { type: "Feature", properties: { iso1A2: "HT", iso1A3: "HTI", iso1N3: "332", wikidata: "Q790", nameEn: "Haiti", aliases: ["RH"], groups: ["029", "003", "419", "019", "UN"], callingCodes: ["509"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.71885, 18.78423], [-71.72624, 18.87802], [-71.77766, 18.95007], [-71.88102, 18.95007], [-71.74088, 19.0437], [-71.71088, 19.08353], [-71.69938, 19.10916], [-71.65337, 19.11759], [-71.62642, 19.21212], [-71.73229, 19.26686], [-71.77766, 19.33823], [-71.69448, 19.37866], [-71.6802, 19.45008], [-71.71268, 19.53374], [-71.71449, 19.55364], [-71.7429, 19.58445], [-71.75865, 19.70231], [-71.77419, 19.73128], [-72.38946, 20.27111], [-73.37289, 20.43199], [-74.7289, 18.71009], [-74.76465, 18.06252], [-72.29523, 17.48026], [-71.75671, 18.03456], [-71.73783, 18.07177], [-71.74994, 18.11115], [-71.75465, 18.14405], [-71.78271, 18.18302], [-71.69952, 18.34101], [-71.90875, 18.45821], [-71.88102, 18.50125], [-72.00201, 18.62312], [-71.95412, 18.64939], [-71.82556, 18.62551], [-71.71885, 18.78423]]]] } },
22713     { type: "Feature", properties: { iso1A2: "HU", iso1A3: "HUN", iso1N3: "348", wikidata: "Q28", nameEn: "Hungary", groups: ["EU", "151", "150", "UN"], callingCodes: ["36"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.72525, 48.34628], [21.67134, 48.3989], [21.6068, 48.50365], [21.44063, 48.58456], [21.11516, 48.49546], [20.83248, 48.5824], [20.5215, 48.53336], [20.29943, 48.26104], [20.24312, 48.2784], [19.92452, 48.1283], [19.63338, 48.25006], [19.52489, 48.19791], [19.47957, 48.09437], [19.28182, 48.08336], [19.23924, 48.0595], [19.01952, 48.07052], [18.82176, 48.04206], [18.76134, 47.97499], [18.76821, 47.87469], [18.8506, 47.82308], [18.74074, 47.8157], [18.66521, 47.76772], [18.56496, 47.76588], [18.29305, 47.73541], [18.02938, 47.75665], [17.71215, 47.7548], [17.23699, 48.02094], [17.16001, 48.00636], [17.09786, 47.97336], [17.11022, 47.92461], [17.08275, 47.87719], [17.00997, 47.86245], [17.07039, 47.81129], [17.05048, 47.79377], [17.08893, 47.70928], [16.87538, 47.68895], [16.86509, 47.72268], [16.82938, 47.68432], [16.7511, 47.67878], [16.72089, 47.73469], [16.65679, 47.74197], [16.61183, 47.76171], [16.54779, 47.75074], [16.53514, 47.73837], [16.55129, 47.72268], [16.4222, 47.66537], [16.58699, 47.61772], [16.64193, 47.63114], [16.71059, 47.52692], [16.64821, 47.50155], [16.6718, 47.46139], [16.57152, 47.40868], [16.52414, 47.41007], [16.49908, 47.39416], [16.45104, 47.41181], [16.47782, 47.25918], [16.44142, 47.25079], [16.43663, 47.21127], [16.41739, 47.20649], [16.42801, 47.18422], [16.4523, 47.18812], [16.46442, 47.16845], [16.44932, 47.14418], [16.52863, 47.13974], [16.46134, 47.09395], [16.52176, 47.05747], [16.43936, 47.03548], [16.51369, 47.00084], [16.28202, 47.00159], [16.27594, 46.9643], [16.22403, 46.939], [16.19904, 46.94134], [16.10983, 46.867], [16.14365, 46.8547], [16.15711, 46.85434], [16.21892, 46.86961], [16.2365, 46.87775], [16.2941, 46.87137], [16.34547, 46.83836], [16.3408, 46.80641], [16.31303, 46.79838], [16.30966, 46.7787], [16.37816, 46.69975], [16.42641, 46.69228], [16.41863, 46.66238], [16.38594, 46.6549], [16.39217, 46.63673], [16.50139, 46.56684], [16.52885, 46.53303], [16.52604, 46.5051], [16.59527, 46.47524], [16.6639, 46.45203], [16.7154, 46.39523], [16.8541, 46.36255], [16.8903, 46.28122], [17.14592, 46.16697], [17.35672, 45.95209], [17.56821, 45.93728], [17.66545, 45.84207], [17.87377, 45.78522], [17.99805, 45.79671], [18.08869, 45.76511], [18.12439, 45.78905], [18.44368, 45.73972], [18.57483, 45.80772], [18.6792, 45.92057], [18.80211, 45.87995], [18.81394, 45.91329], [18.99712, 45.93537], [19.01284, 45.96529], [19.0791, 45.96458], [19.10388, 46.04015], [19.14543, 45.9998], [19.28826, 45.99694], [19.52473, 46.1171], [19.56113, 46.16824], [19.66007, 46.19005], [19.81491, 46.1313], [19.93508, 46.17553], [20.01816, 46.17696], [20.03533, 46.14509], [20.09713, 46.17315], [20.26068, 46.12332], [20.28324, 46.1438], [20.35573, 46.16629], [20.45377, 46.14405], [20.49718, 46.18721], [20.63863, 46.12728], [20.76085, 46.21002], [20.74574, 46.25467], [20.86797, 46.28884], [21.06572, 46.24897], [21.16872, 46.30118], [21.28061, 46.44941], [21.26929, 46.4993], [21.33214, 46.63035], [21.43926, 46.65109], [21.5151, 46.72147], [21.48935, 46.7577], [21.52028, 46.84118], [21.59307, 46.86935], [21.59581, 46.91628], [21.68645, 46.99595], [21.648, 47.03902], [21.78395, 47.11104], [21.94463, 47.38046], [22.01055, 47.37767], [22.03389, 47.42508], [22.00917, 47.50492], [22.31816, 47.76126], [22.41979, 47.7391], [22.46559, 47.76583], [22.67247, 47.7871], [22.76617, 47.8417], [22.77991, 47.87211], [22.89849, 47.95851], [22.84276, 47.98602], [22.87847, 48.04665], [22.81804, 48.11363], [22.73427, 48.12005], [22.66835, 48.09162], [22.58733, 48.10813], [22.59007, 48.15121], [22.49806, 48.25189], [22.38133, 48.23726], [22.2083, 48.42534], [22.14689, 48.4005], [21.83339, 48.36242], [21.8279, 48.33321], [21.72525, 48.34628]]]] } },
22714     { type: "Feature", properties: { iso1A2: "IC", wikidata: "Q5813", nameEn: "Canary Islands", country: "ES", groups: ["Q3320166", "Q105472", "EU", "039", "150", "UN"], isoStatus: "excRes", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-12.00985, 30.24121], [-25.3475, 27.87574], [-14.43883, 27.02969], [-12.00985, 30.24121]]]] } },
22715     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
22716     { type: "Feature", properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-22.01468, 48.19557], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] } },
22717     { type: "Feature", properties: { iso1A2: "IL", iso1A3: "ISR", iso1N3: "376", wikidata: "Q801", nameEn: "Israel", groups: ["145", "142", "UN"], callingCodes: ["972"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.29262, 31.70393], [34.48681, 31.59711], [34.56797, 31.54197], [34.48892, 31.48365], [34.40077, 31.40926], [34.36505, 31.36404], [34.37381, 31.30598], [34.36523, 31.28963], [34.29417, 31.24194], [34.26742, 31.21998], [34.92298, 29.45305], [34.97718, 29.54294], [34.98207, 29.58147], [35.02147, 29.66343], [35.14108, 30.07374], [35.19183, 30.34636], [35.16218, 30.43535], [35.19595, 30.50297], [35.21379, 30.60401], [35.29311, 30.71365], [35.33456, 30.81224], [35.33984, 30.8802], [35.41371, 30.95565], [35.43658, 31.12444], [35.40316, 31.25535], [35.47672, 31.49578], [35.39675, 31.49572], [35.22921, 31.37445], [35.13033, 31.3551], [35.02459, 31.35979], [34.92571, 31.34337], [34.88932, 31.37093], [34.87833, 31.39321], [34.89756, 31.43891], [34.93258, 31.47816], [34.94356, 31.50743], [34.9415, 31.55601], [34.95249, 31.59813], [35.00879, 31.65426], [35.08226, 31.69107], [35.10782, 31.71594], [35.11895, 31.71454], [35.12933, 31.7325], [35.13931, 31.73012], [35.15119, 31.73634], [35.15474, 31.73352], [35.16478, 31.73242], [35.18023, 31.72067], [35.20538, 31.72388], [35.21937, 31.71578], [35.22392, 31.71899], [35.23972, 31.70896], [35.24315, 31.71244], [35.2438, 31.7201], [35.24981, 31.72543], [35.25182, 31.73945], [35.26319, 31.74846], [35.25225, 31.7678], [35.26058, 31.79064], [35.25573, 31.81362], [35.26404, 31.82567], [35.251, 31.83085], [35.25753, 31.8387], [35.24816, 31.8458], [35.2304, 31.84222], [35.2249, 31.85433], [35.22817, 31.8638], [35.22567, 31.86745], [35.22294, 31.87889], [35.22014, 31.88264], [35.2136, 31.88241], [35.21276, 31.88153], [35.21016, 31.88237], [35.20945, 31.8815], [35.20791, 31.8821], [35.20673, 31.88151], [35.20381, 31.86716], [35.21128, 31.863], [35.216, 31.83894], [35.21469, 31.81835], [35.19461, 31.82687], [35.18169, 31.82542], [35.18603, 31.80901], [35.14174, 31.81325], [35.07677, 31.85627], [35.05617, 31.85685], [35.01978, 31.82944], [34.9724, 31.83352], [34.99712, 31.85569], [35.03489, 31.85919], [35.03978, 31.89276], [35.03489, 31.92448], [35.00124, 31.93264], [34.98682, 31.96935], [35.00261, 32.027], [34.9863, 32.09551], [34.99437, 32.10962], [34.98507, 32.12606], [34.99039, 32.14626], [34.96009, 32.17503], [34.95703, 32.19522], [34.98885, 32.20758], [35.01841, 32.23981], [35.02939, 32.2671], [35.01119, 32.28684], [35.01772, 32.33863], [35.04243, 32.35008], [35.05142, 32.3667], [35.0421, 32.38242], [35.05311, 32.4024], [35.05423, 32.41754], [35.07059, 32.4585], [35.08564, 32.46948], [35.09236, 32.47614], [35.10024, 32.47856], [35.10882, 32.4757], [35.15937, 32.50466], [35.2244, 32.55289], [35.25049, 32.52453], [35.29306, 32.50947], [35.30685, 32.51024], [35.35212, 32.52047], [35.40224, 32.50136], [35.42034, 32.46009], [35.41598, 32.45593], [35.41048, 32.43706], [35.42078, 32.41562], [35.55807, 32.38674], [35.55494, 32.42687], [35.57485, 32.48669], [35.56614, 32.64393], [35.59813, 32.65159], [35.61669, 32.67999], [35.66527, 32.681], [35.68467, 32.70715], [35.75983, 32.74803], [35.78745, 32.77938], [35.83758, 32.82817], [35.84021, 32.8725], [35.87012, 32.91976], [35.89298, 32.9456], [35.87188, 32.98028], [35.84802, 33.1031], [35.81911, 33.11077], [35.81911, 33.1336], [35.84285, 33.16673], [35.83846, 33.19397], [35.81647, 33.2028], [35.81295, 33.24841], [35.77513, 33.27342], [35.813, 33.3172], [35.77477, 33.33609], [35.62019, 33.27278], [35.62283, 33.24226], [35.58502, 33.26653], [35.58326, 33.28381], [35.56523, 33.28969], [35.55555, 33.25844], [35.54544, 33.25513], [35.54808, 33.236], [35.5362, 33.23196], [35.54228, 33.19865], [35.52573, 33.11921], [35.50335, 33.114], [35.50272, 33.09056], [35.448, 33.09264], [35.43059, 33.06659], [35.35223, 33.05617], [35.31429, 33.10515], [35.1924, 33.08743], [35.10645, 33.09318], [34.78515, 33.20368], [33.62659, 31.82938], [34.052, 31.46619]]]] } },
22718     { type: "Feature", properties: { iso1A2: "IM", iso1A3: "IMN", iso1N3: "833", wikidata: "Q9676", nameEn: "Isle of Man", country: "GB", groups: ["Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01624", "44 07624", "44 07524", "44 07924"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.98763, 54.07351], [-4.1819, 54.57861], [-5.6384, 53.81157], [-3.98763, 54.07351]]]] } },
22719     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
22720     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
22721     { type: "Feature", properties: { iso1A2: "IQ", iso1A3: "IRQ", iso1N3: "368", wikidata: "Q796", nameEn: "Iraq", groups: ["145", "142", "UN"], callingCodes: ["964"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.78887, 37.38615], [42.56725, 37.14878], [42.35724, 37.10998], [42.36697, 37.0627], [41.81736, 36.58782], [41.40058, 36.52502], [41.28864, 36.35368], [41.2564, 36.06012], [41.37027, 35.84095], [41.38184, 35.62502], [41.26569, 35.42708], [41.21654, 35.1508], [41.2345, 34.80049], [41.12388, 34.65742], [40.97676, 34.39788], [40.64314, 34.31604], [38.79171, 33.37328], [39.08202, 32.50304], [38.98762, 32.47694], [39.04251, 32.30203], [39.26157, 32.35555], [39.29903, 32.23259], [40.01521, 32.05667], [42.97601, 30.72204], [42.97796, 30.48295], [44.72255, 29.19736], [46.42415, 29.05947], [46.5527, 29.10283], [46.89695, 29.50584], [47.15166, 30.01044], [47.37192, 30.10421], [47.7095, 30.10453], [48.01114, 29.98906], [48.06782, 30.02906], [48.17332, 30.02448], [48.40479, 29.85763], [48.59531, 29.66815], [48.83867, 29.78572], [48.61441, 29.93675], [48.51011, 29.96238], [48.44785, 30.00148], [48.4494, 30.04456], [48.43384, 30.08233], [48.38869, 30.11062], [48.38714, 30.13485], [48.41671, 30.17254], [48.41117, 30.19846], [48.26393, 30.3408], [48.24385, 30.33846], [48.21279, 30.31644], [48.19425, 30.32796], [48.18321, 30.39703], [48.14585, 30.44133], [48.02443, 30.4789], [48.03221, 30.9967], [47.68219, 31.00004], [47.6804, 31.39086], [47.86337, 31.78422], [47.64771, 32.07666], [47.52474, 32.15972], [47.57144, 32.20583], [47.37529, 32.47808], [47.17218, 32.45393], [46.46788, 32.91992], [46.32298, 32.9731], [46.17198, 32.95612], [46.09103, 32.98354], [46.15175, 33.07229], [46.03966, 33.09577], [46.05367, 33.13097], [46.11905, 33.11924], [46.20623, 33.20395], [45.99919, 33.5082], [45.86687, 33.49263], [45.96183, 33.55751], [45.89801, 33.63661], [45.77814, 33.60938], [45.50261, 33.94968], [45.42789, 33.9458], [45.41077, 33.97421], [45.47264, 34.03099], [45.56176, 34.15088], [45.58667, 34.30147], [45.53552, 34.35148], [45.49171, 34.3439], [45.46697, 34.38221], [45.43879, 34.45949], [45.51883, 34.47692], [45.53219, 34.60441], [45.59074, 34.55558], [45.60224, 34.55057], [45.73923, 34.54416], [45.70031, 34.69277], [45.65672, 34.7222], [45.68284, 34.76624], [45.70031, 34.82322], [45.73641, 34.83975], [45.79682, 34.85133], [45.78904, 34.91135], [45.86532, 34.89858], [45.89477, 34.95805], [45.87864, 35.03441], [45.92173, 35.0465], [45.92203, 35.09538], [45.93108, 35.08148], [45.94756, 35.09188], [46.06508, 35.03699], [46.07747, 35.0838], [46.11763, 35.07551], [46.19116, 35.11097], [46.15642, 35.1268], [46.16229, 35.16984], [46.19738, 35.18536], [46.18457, 35.22561], [46.11367, 35.23729], [46.15474, 35.2883], [46.13152, 35.32548], [46.05358, 35.38568], [45.98453, 35.49848], [46.01518, 35.52012], [45.97584, 35.58132], [46.03028, 35.57416], [46.01307, 35.59756], [46.0165, 35.61501], [45.99452, 35.63574], [46.0117, 35.65059], [46.01631, 35.69139], [46.23736, 35.71414], [46.34166, 35.78363], [46.32921, 35.82655], [46.17198, 35.8013], [46.08325, 35.8581], [45.94711, 35.82218], [45.89784, 35.83708], [45.81442, 35.82107], [45.76145, 35.79898], [45.6645, 35.92872], [45.60018, 35.96069], [45.55245, 35.99943], [45.46594, 36.00042], [45.38275, 35.97156], [45.33916, 35.99424], [45.37652, 36.06222], [45.37312, 36.09917], [45.32235, 36.17383], [45.30038, 36.27769], [45.26261, 36.3001], [45.27394, 36.35846], [45.23953, 36.43257], [45.11811, 36.40751], [45.00759, 36.5402], [45.06985, 36.62645], [45.06985, 36.6814], [45.01537, 36.75128], [44.84725, 36.77622], [44.83479, 36.81362], [44.90173, 36.86096], [44.91199, 36.91468], [44.89862, 37.01897], [44.81611, 37.04383], [44.75229, 37.11958], [44.78319, 37.1431], [44.76698, 37.16162], [44.63179, 37.19229], [44.42631, 37.05825], [44.38117, 37.05825], [44.35315, 37.04955], [44.35937, 37.02843], [44.30645, 36.97373], [44.25975, 36.98119], [44.18503, 37.09551], [44.22239, 37.15756], [44.27998, 37.16501], [44.2613, 37.25055], [44.13521, 37.32486], [44.02002, 37.33229], [43.90949, 37.22453], [43.84878, 37.22205], [43.82699, 37.19477], [43.8052, 37.22825], [43.7009, 37.23692], [43.63085, 37.21957], [43.56702, 37.25675], [43.50787, 37.24436], [43.33508, 37.33105], [43.30083, 37.30629], [43.11403, 37.37436], [42.93705, 37.32015], [42.78887, 37.38615]]]] } },
22722     { type: "Feature", properties: { iso1A2: "IR", iso1A3: "IRN", iso1N3: "364", wikidata: "Q794", nameEn: "Iran", groups: ["034", "142", "UN"], callingCodes: ["98"] }, geometry: { type: "MultiPolygon", coordinates: [[[[44.96746, 39.42998], [44.88916, 39.59653], [44.81043, 39.62677], [44.71806, 39.71124], [44.65422, 39.72163], [44.6137, 39.78393], [44.47298, 39.68788], [44.48111, 39.61579], [44.41849, 39.56659], [44.42832, 39.4131], [44.37921, 39.4131], [44.29818, 39.378], [44.22452, 39.4169], [44.03667, 39.39223], [44.1043, 39.19842], [44.20946, 39.13975], [44.18863, 38.93881], [44.30322, 38.81581], [44.26155, 38.71427], [44.28065, 38.6465], [44.32058, 38.62752], [44.3207, 38.49799], [44.3119, 38.37887], [44.38309, 38.36117], [44.44386, 38.38295], [44.50115, 38.33939], [44.42476, 38.25763], [44.22509, 37.88859], [44.3883, 37.85433], [44.45948, 37.77065], [44.55498, 37.783], [44.62096, 37.71985], [44.56887, 37.6429], [44.61401, 37.60165], [44.58449, 37.45018], [44.81021, 37.2915], [44.75986, 37.21549], [44.7868, 37.16644], [44.78319, 37.1431], [44.75229, 37.11958], [44.81611, 37.04383], [44.89862, 37.01897], [44.91199, 36.91468], [44.90173, 36.86096], [44.83479, 36.81362], [44.84725, 36.77622], [45.01537, 36.75128], [45.06985, 36.6814], [45.06985, 36.62645], [45.00759, 36.5402], [45.11811, 36.40751], [45.23953, 36.43257], [45.27394, 36.35846], [45.26261, 36.3001], [45.30038, 36.27769], [45.32235, 36.17383], [45.37312, 36.09917], [45.37652, 36.06222], [45.33916, 35.99424], [45.38275, 35.97156], [45.46594, 36.00042], [45.55245, 35.99943], [45.60018, 35.96069], [45.6645, 35.92872], [45.76145, 35.79898], [45.81442, 35.82107], [45.89784, 35.83708], [45.94711, 35.82218], [46.08325, 35.8581], [46.17198, 35.8013], [46.32921, 35.82655], [46.34166, 35.78363], [46.23736, 35.71414], [46.01631, 35.69139], [46.0117, 35.65059], [45.99452, 35.63574], [46.0165, 35.61501], [46.01307, 35.59756], [46.03028, 35.57416], [45.97584, 35.58132], [46.01518, 35.52012], [45.98453, 35.49848], [46.05358, 35.38568], [46.13152, 35.32548], [46.15474, 35.2883], [46.11367, 35.23729], [46.18457, 35.22561], [46.19738, 35.18536], [46.16229, 35.16984], [46.15642, 35.1268], [46.19116, 35.11097], [46.11763, 35.07551], [46.07747, 35.0838], [46.06508, 35.03699], [45.94756, 35.09188], [45.93108, 35.08148], [45.92203, 35.09538], [45.92173, 35.0465], [45.87864, 35.03441], [45.89477, 34.95805], [45.86532, 34.89858], [45.78904, 34.91135], [45.79682, 34.85133], [45.73641, 34.83975], [45.70031, 34.82322], [45.68284, 34.76624], [45.65672, 34.7222], [45.70031, 34.69277], [45.73923, 34.54416], [45.60224, 34.55057], [45.59074, 34.55558], [45.53219, 34.60441], [45.51883, 34.47692], [45.43879, 34.45949], [45.46697, 34.38221], [45.49171, 34.3439], [45.53552, 34.35148], [45.58667, 34.30147], [45.56176, 34.15088], [45.47264, 34.03099], [45.41077, 33.97421], [45.42789, 33.9458], [45.50261, 33.94968], [45.77814, 33.60938], [45.89801, 33.63661], [45.96183, 33.55751], [45.86687, 33.49263], [45.99919, 33.5082], [46.20623, 33.20395], [46.11905, 33.11924], [46.05367, 33.13097], [46.03966, 33.09577], [46.15175, 33.07229], [46.09103, 32.98354], [46.17198, 32.95612], [46.32298, 32.9731], [46.46788, 32.91992], [47.17218, 32.45393], [47.37529, 32.47808], [47.57144, 32.20583], [47.52474, 32.15972], [47.64771, 32.07666], [47.86337, 31.78422], [47.6804, 31.39086], [47.68219, 31.00004], [48.03221, 30.9967], [48.02443, 30.4789], [48.14585, 30.44133], [48.18321, 30.39703], [48.19425, 30.32796], [48.21279, 30.31644], [48.24385, 30.33846], [48.26393, 30.3408], [48.41117, 30.19846], [48.41671, 30.17254], [48.38714, 30.13485], [48.38869, 30.11062], [48.43384, 30.08233], [48.4494, 30.04456], [48.44785, 30.00148], [48.51011, 29.96238], [48.61441, 29.93675], [48.83867, 29.78572], [49.98877, 27.87827], [50.37726, 27.89227], [54.39838, 25.68383], [55.14145, 25.62624], [55.81777, 26.18798], [56.2644, 26.58649], [56.68954, 26.76645], [56.79239, 26.41236], [56.82555, 25.7713], [56.86325, 25.03856], [61.46682, 24.57869], [61.6433, 25.27541], [61.683, 25.66638], [61.83968, 25.7538], [61.83831, 26.07249], [61.89391, 26.26251], [62.05117, 26.31647], [62.21304, 26.26601], [62.31484, 26.528], [62.77352, 26.64099], [63.1889, 26.65072], [63.18688, 26.83844], [63.25005, 26.84212], [63.25005, 27.08692], [63.32283, 27.14437], [63.19649, 27.25674], [62.80604, 27.22412], [62.79684, 27.34381], [62.84905, 27.47627], [62.7638, 28.02992], [62.79412, 28.28108], [62.59499, 28.24842], [62.40259, 28.42703], [61.93581, 28.55284], [61.65978, 28.77937], [61.53765, 29.00507], [61.31508, 29.38903], [60.87231, 29.86514], [61.80829, 30.84224], [61.78268, 30.92724], [61.8335, 30.97669], [61.83257, 31.0452], [61.80957, 31.12576], [61.80569, 31.16167], [61.70929, 31.37391], [60.84541, 31.49561], [60.86191, 32.22565], [60.56485, 33.12944], [60.88908, 33.50219], [60.91133, 33.55596], [60.69573, 33.56054], [60.57762, 33.59772], [60.5485, 33.73422], [60.5838, 33.80793], [60.50209, 34.13992], [60.66502, 34.31539], [60.91321, 34.30411], [60.72316, 34.52857], [60.99922, 34.63064], [61.00197, 34.70631], [61.06926, 34.82139], [61.12831, 35.09938], [61.0991, 35.27845], [61.18187, 35.30249], [61.27371, 35.61482], [61.22719, 35.67038], [61.26152, 35.80749], [61.22444, 35.92879], [61.12007, 35.95992], [61.22719, 36.12759], [61.1393, 36.38782], [61.18187, 36.55348], [61.14516, 36.64644], [60.34767, 36.63214], [60.00768, 37.04102], [59.74678, 37.12499], [59.55178, 37.13594], [59.39385, 37.34257], [59.39797, 37.47892], [59.33507, 37.53146], [59.22905, 37.51161], [58.9338, 37.67374], [58.6921, 37.64548], [58.5479, 37.70526], [58.47786, 37.6433], [58.39959, 37.63134], [58.22999, 37.6856], [58.21399, 37.77281], [57.79534, 37.89299], [57.35042, 37.98546], [57.37236, 38.09321], [57.21169, 38.28965], [57.03453, 38.18717], [56.73928, 38.27887], [56.62255, 38.24005], [56.43303, 38.26054], [56.32454, 38.18502], [56.33278, 38.08132], [55.97847, 38.08024], [55.76561, 38.12238], [55.44152, 38.08564], [55.13412, 37.94705], [54.851, 37.75739], [54.77684, 37.62264], [54.81804, 37.61285], [54.77822, 37.51597], [54.67247, 37.43532], [54.58664, 37.45809], [54.36211, 37.34912], [54.24565, 37.32047], [53.89734, 37.3464], [48.88288, 38.43975], [48.84969, 38.45015], [48.81072, 38.44853], [48.78979, 38.45026], [48.70001, 38.40564], [48.62217, 38.40198], [48.58793, 38.45076], [48.45084, 38.61013], [48.3146, 38.59958], [48.24773, 38.71883], [48.02581, 38.82705], [48.01409, 38.90333], [48.07734, 38.91616], [48.08627, 38.94434], [48.28437, 38.97186], [48.33884, 39.03022], [48.31239, 39.09278], [48.15361, 39.19419], [48.12404, 39.25208], [48.15984, 39.30028], [48.37385, 39.37584], [48.34264, 39.42935], [47.98977, 39.70999], [47.84774, 39.66285], [47.50099, 39.49615], [47.38978, 39.45999], [47.31301, 39.37492], [47.05927, 39.24846], [47.05771, 39.20143], [46.95341, 39.13505], [46.92539, 39.16644], [46.83822, 39.13143], [46.75752, 39.03231], [46.53497, 38.86548], [46.34059, 38.92076], [46.20601, 38.85262], [46.14785, 38.84206], [46.06766, 38.87861], [46.00228, 38.87376], [45.94624, 38.89072], [45.90266, 38.87739], [45.83883, 38.90768], [45.65172, 38.95199], [45.6155, 38.94304], [45.6131, 38.964], [45.44966, 38.99243], [45.44811, 39.04927], [45.40452, 39.07224], [45.40148, 39.09007], [45.30489, 39.18333], [45.16168, 39.21952], [45.08751, 39.35052], [45.05932, 39.36435], [44.96746, 39.42998]]]] } },
22723     { type: "Feature", properties: { iso1A2: "IS", iso1A3: "ISL", iso1N3: "352", wikidata: "Q189", nameEn: "Iceland", groups: ["154", "150", "UN"], callingCodes: ["354"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-33.15676, 62.62995], [-8.25539, 63.0423], [-15.70914, 69.67442], [-33.15676, 62.62995]]]] } },
22724     { type: "Feature", properties: { iso1A2: "IT", iso1A3: "ITA", iso1N3: "380", wikidata: "Q38", nameEn: "Italy", groups: ["EU", "039", "150", "UN"], callingCodes: ["39"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.95861, 45.96485], [8.97604, 45.96151], [8.97741, 45.98317], [8.96668, 45.98436], [8.95861, 45.96485]]], [[[7.63035, 43.57419], [9.56115, 43.20816], [10.09675, 41.44089], [7.60802, 41.05927], [7.89009, 38.19924], [11.2718, 37.6713], [12.13667, 34.20326], [14.02721, 36.53141], [17.67657, 35.68918], [18.83516, 40.36999], [16.15283, 42.18525], [13.12821, 44.48877], [13.05142, 45.33128], [13.45644, 45.59464], [13.6076, 45.64761], [13.7198, 45.59352], [13.74587, 45.59811], [13.78445, 45.5825], [13.84106, 45.58185], [13.86771, 45.59898], [13.8695, 45.60835], [13.9191, 45.6322], [13.87933, 45.65207], [13.83422, 45.68703], [13.83332, 45.70855], [13.8235, 45.7176], [13.66986, 45.79955], [13.59784, 45.8072], [13.58858, 45.83503], [13.57563, 45.8425], [13.58644, 45.88173], [13.59565, 45.89446], [13.60857, 45.89907], [13.61931, 45.91782], [13.63815, 45.93607], [13.6329, 45.94894], [13.64307, 45.98326], [13.63458, 45.98947], [13.62074, 45.98388], [13.58903, 45.99009], [13.56759, 45.96991], [13.52963, 45.96588], [13.50104, 45.98078], [13.47474, 46.00546], [13.49702, 46.01832], [13.50998, 46.04498], [13.49568, 46.04839], [13.50104, 46.05986], [13.57072, 46.09022], [13.64053, 46.13587], [13.66472, 46.17392], [13.64451, 46.18966], [13.56682, 46.18703], [13.56114, 46.2054], [13.47587, 46.22725], [13.42218, 46.20758], [13.37671, 46.29668], [13.44808, 46.33507], [13.43418, 46.35992], [13.47019, 46.3621], [13.5763, 46.40915], [13.5763, 46.42613], [13.59777, 46.44137], [13.68684, 46.43881], [13.7148, 46.5222], [13.64088, 46.53438], [13.27627, 46.56059], [12.94445, 46.60401], [12.59992, 46.6595], [12.38708, 46.71529], [12.27591, 46.88651], [12.2006, 46.88854], [12.11675, 47.01241], [12.21781, 47.03996], [12.19254, 47.09331], [11.74789, 46.98484], [11.50739, 47.00644], [11.33355, 46.99862], [11.10618, 46.92966], [11.00764, 46.76896], [10.72974, 46.78972], [10.75753, 46.82258], [10.66405, 46.87614], [10.54783, 46.84505], [10.47197, 46.85698], [10.38659, 46.67847], [10.40475, 46.63671], [10.44686, 46.64162], [10.49375, 46.62049], [10.46136, 46.53164], [10.25309, 46.57432], [10.23674, 46.63484], [10.10307, 46.61003], [10.03715, 46.44479], [10.165, 46.41051], [10.10506, 46.3372], [10.17862, 46.25626], [10.14439, 46.22992], [10.07055, 46.21668], [9.95249, 46.38045], [9.73086, 46.35071], [9.71273, 46.29266], [9.57015, 46.2958], [9.46117, 46.37481], [9.45936, 46.50873], [9.40487, 46.46621], [9.36128, 46.5081], [9.28136, 46.49685], [9.25502, 46.43743], [9.29226, 46.32717], [9.24503, 46.23616], [9.01618, 46.04928], [8.99257, 45.9698], [9.09065, 45.89906], [9.06642, 45.8761], [9.04546, 45.84968], [9.04059, 45.8464], [9.03505, 45.83976], [9.03793, 45.83548], [9.03279, 45.82865], [9.0298, 45.82127], [9.00324, 45.82055], [8.99663, 45.83466], [8.9621, 45.83707], [8.94737, 45.84285], [8.91129, 45.8388], [8.93504, 45.86245], [8.94372, 45.86587], [8.93649, 45.86775], [8.88904, 45.95465], [8.86688, 45.96135], [8.85121, 45.97239], [8.8319, 45.9879], [8.79362, 45.99207], [8.78585, 45.98973], [8.79414, 46.00913], [8.85617, 46.0748], [8.80778, 46.10085], [8.75697, 46.10395], [8.62242, 46.12112], [8.45032, 46.26869], [8.46317, 46.43712], [8.42464, 46.46367], [8.30648, 46.41587], [8.31162, 46.38044], [8.08814, 46.26692], [8.16866, 46.17817], [8.11383, 46.11577], [8.02906, 46.10331], [7.98881, 45.99867], [7.9049, 45.99945], [7.85949, 45.91485], [7.56343, 45.97421], [7.10685, 45.85653], [7.04151, 45.92435], [6.95315, 45.85163], [6.80785, 45.83265], [6.80785, 45.71864], [6.98948, 45.63869], [7.00037, 45.509], [7.18019, 45.40071], [7.10572, 45.32924], [7.13115, 45.25386], [7.07074, 45.21228], [6.96706, 45.20841], [6.85144, 45.13226], [6.7697, 45.16044], [6.62803, 45.11175], [6.66981, 45.02324], [6.74791, 45.01939], [6.74519, 44.93661], [6.75518, 44.89915], [6.90774, 44.84322], [6.93499, 44.8664], [7.02217, 44.82519], [7.00401, 44.78782], [7.07484, 44.68073], [7.00582, 44.69364], [6.95133, 44.66264], [6.96042, 44.62129], [6.85507, 44.53072], [6.86233, 44.49834], [6.94504, 44.43112], [6.88784, 44.42043], [6.89171, 44.36637], [6.98221, 44.28289], [7.00764, 44.23736], [7.16929, 44.20352], [7.27827, 44.1462], [7.34547, 44.14359], [7.36364, 44.11882], [7.62155, 44.14881], [7.63245, 44.17877], [7.68694, 44.17487], [7.66878, 44.12795], [7.72508, 44.07578], [7.6597, 44.03009], [7.66848, 43.99943], [7.65266, 43.9763], [7.60771, 43.95772], [7.56858, 43.94506], [7.56075, 43.89932], [7.51162, 43.88301], [7.49355, 43.86551], [7.50423, 43.84345], [7.53006, 43.78405], [7.63035, 43.57419]], [[12.45181, 41.90056], [12.44834, 41.90095], [12.44582, 41.90194], [12.44815, 41.90326], [12.44984, 41.90545], [12.45091, 41.90625], [12.45543, 41.90738], [12.45561, 41.90629], [12.45762, 41.9058], [12.45755, 41.9033], [12.45826, 41.90281], [12.45834, 41.90174], [12.4577, 41.90115], [12.45691, 41.90125], [12.45626, 41.90172], [12.45435, 41.90143], [12.45446, 41.90028], [12.45181, 41.90056]], [[12.45648, 43.89369], [12.44184, 43.90498], [12.41641, 43.89991], [12.40935, 43.9024], [12.41233, 43.90956], [12.40733, 43.92379], [12.41551, 43.92984], [12.41165, 43.93769], [12.40506, 43.94325], [12.40415, 43.95485], [12.41414, 43.95273], [12.42005, 43.9578], [12.43662, 43.95698], [12.44684, 43.96597], [12.46205, 43.97463], [12.47853, 43.98052], [12.49406, 43.98492], [12.50678, 43.99113], [12.51463, 43.99122], [12.5154, 43.98508], [12.51064, 43.98165], [12.51109, 43.97201], [12.50622, 43.97131], [12.50875, 43.96198], [12.50655, 43.95796], [12.51427, 43.94897], [12.51553, 43.94096], [12.50496, 43.93017], [12.50269, 43.92363], [12.49724, 43.92248], [12.49247, 43.91774], [12.49429, 43.90973], [12.48771, 43.89706], [12.45648, 43.89369]]]] } },
22725     { type: "Feature", properties: { iso1A2: "JE", iso1A3: "JEY", iso1N3: "832", wikidata: "Q785", nameEn: "Bailiwick of Jersey", country: "GB", groups: ["830", "Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01534"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.00491, 48.86706], [-1.83944, 49.23037], [-2.09454, 49.46288], [-2.65349, 49.15373], [-2.00491, 48.86706]]]] } },
22726     { type: "Feature", properties: { iso1A2: "JM", iso1A3: "JAM", iso1N3: "388", wikidata: "Q766", nameEn: "Jamaica", aliases: ["JA"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 876", "1 658"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.09729, 17.36817], [-78.9741, 19.59515], [-78.34606, 16.57862], [-74.09729, 17.36817]]]] } },
22727     { type: "Feature", properties: { iso1A2: "JO", iso1A3: "JOR", iso1N3: "400", wikidata: "Q810", nameEn: "Jordan", groups: ["145", "142", "UN"], callingCodes: ["962"] }, geometry: { type: "MultiPolygon", coordinates: [[[[39.04251, 32.30203], [38.98762, 32.47694], [39.08202, 32.50304], [38.79171, 33.37328], [36.83946, 32.31293], [36.40959, 32.37908], [36.23948, 32.50108], [36.20875, 32.49529], [36.20379, 32.52751], [36.08074, 32.51463], [36.02239, 32.65911], [35.96633, 32.66237], [35.93307, 32.71966], [35.88405, 32.71321], [35.75983, 32.74803], [35.68467, 32.70715], [35.66527, 32.681], [35.61669, 32.67999], [35.59813, 32.65159], [35.56614, 32.64393], [35.57485, 32.48669], [35.55494, 32.42687], [35.55807, 32.38674], [35.57111, 32.21877], [35.52012, 32.04076], [35.54375, 31.96587], [35.52758, 31.9131], [35.55941, 31.76535], [35.47672, 31.49578], [35.40316, 31.25535], [35.43658, 31.12444], [35.41371, 30.95565], [35.33984, 30.8802], [35.33456, 30.81224], [35.29311, 30.71365], [35.21379, 30.60401], [35.19595, 30.50297], [35.16218, 30.43535], [35.19183, 30.34636], [35.14108, 30.07374], [35.02147, 29.66343], [34.98207, 29.58147], [34.97718, 29.54294], [34.92298, 29.45305], [34.8812, 29.36878], [36.07081, 29.18469], [36.50005, 29.49696], [36.75083, 29.86903], [37.4971, 29.99949], [37.66395, 30.33245], [37.99354, 30.49998], [36.99791, 31.50081], [38.99233, 31.99721], [39.29903, 32.23259], [39.26157, 32.35555], [39.04251, 32.30203]]]] } },
22728     { type: "Feature", properties: { iso1A2: "JP", iso1A3: "JPN", iso1N3: "392", wikidata: "Q17", nameEn: "Japan", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["81"] }, geometry: { type: "MultiPolygon", coordinates: [[[[145.82361, 43.38904], [145.23667, 43.76813], [145.82343, 44.571], [140.9182, 45.92937], [133.61399, 37.41], [129.2669, 34.87122], [122.26612, 25.98197], [123.92912, 17.8782], [155.16731, 23.60141], [145.82361, 43.38904]]]] } },
22729     { type: "Feature", properties: { iso1A2: "KE", iso1A3: "KEN", iso1N3: "404", wikidata: "Q114", nameEn: "Kenya", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["254"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.9419, 4.61933], [35.51424, 4.61643], [35.42366, 4.76969], [35.47843, 4.91872], [35.30992, 4.90402], [35.34151, 5.02364], [34.47601, 4.72162], [33.9873, 4.23316], [34.06046, 4.15235], [34.15429, 3.80464], [34.45815, 3.67385], [34.44922, 3.51627], [34.39112, 3.48802], [34.41794, 3.44342], [34.40006, 3.37949], [34.45815, 3.18319], [34.56242, 3.11478], [34.60114, 2.93034], [34.65774, 2.8753], [34.73967, 2.85447], [34.78137, 2.76223], [34.77244, 2.70272], [34.95267, 2.47209], [34.90947, 2.42447], [34.98692, 1.97348], [34.9899, 1.6668], [34.92734, 1.56109], [34.87819, 1.5596], [34.7918, 1.36752], [34.82606, 1.30944], [34.82606, 1.26626], [34.80223, 1.22754], [34.67562, 1.21265], [34.58029, 1.14712], [34.57427, 1.09868], [34.52369, 1.10692], [34.43349, 0.85254], [34.40041, 0.80266], [34.31516, 0.75693], [34.27345, 0.63182], [34.20196, 0.62289], [34.13493, 0.58118], [34.11408, 0.48884], [34.08727, 0.44713], [34.10067, 0.36372], [33.90936, 0.10581], [33.98449, -0.13079], [33.9264, -0.54188], [33.93107, -0.99298], [34.02286, -1.00779], [34.03084, -1.05101], [34.0824, -1.02264], [37.67199, -3.06222], [37.71745, -3.304], [37.5903, -3.42735], [37.63099, -3.50723], [37.75036, -3.54243], [37.81321, -3.69179], [39.21631, -4.67835], [39.44306, -4.93877], [39.62121, -4.68136], [41.75542, -1.85308], [41.56362, -1.66375], [41.56, -1.59812], [41.00099, -0.83068], [40.98767, 2.82959], [41.31368, 3.14314], [41.89488, 3.97375], [41.1754, 3.94079], [40.77498, 4.27683], [39.86043, 3.86974], [39.76808, 3.67058], [39.58339, 3.47434], [39.55132, 3.39634], [39.51551, 3.40895], [39.49444, 3.45521], [39.19954, 3.47834], [39.07736, 3.5267], [38.91938, 3.51198], [38.52336, 3.62551], [38.45812, 3.60445], [38.14168, 3.62487], [37.07724, 4.33503], [36.84474, 4.44518], [36.03924, 4.44406], [35.95449, 4.53244], [35.9419, 4.61933]]]] } },
22730     { type: "Feature", properties: { iso1A2: "KG", iso1A3: "KGZ", iso1N3: "417", wikidata: "Q813", nameEn: "Kyrgyzstan", groups: ["143", "142", "UN"], callingCodes: ["996"] }, geometry: { type: "MultiPolygon", coordinates: [[[[74.88756, 42.98612], [74.75, 42.99029], [74.70331, 43.02519], [74.64615, 43.05881], [74.57491, 43.13702], [74.22489, 43.24657], [73.55634, 43.03071], [73.50992, 42.82356], [73.44393, 42.43098], [71.88792, 42.83578], [71.62405, 42.76613], [71.53272, 42.8014], [71.2724, 42.77853], [71.22785, 42.69248], [71.17807, 42.67381], [71.15232, 42.60486], [70.97717, 42.50147], [70.85973, 42.30188], [70.94483, 42.26238], [71.13263, 42.28356], [71.28719, 42.18033], [70.69777, 41.92554], [70.17682, 41.5455], [70.48909, 41.40335], [70.67586, 41.47953], [70.78572, 41.36419], [70.77885, 41.24813], [70.86263, 41.23833], [70.9615, 41.16393], [71.02193, 41.19494], [71.11806, 41.15359], [71.25813, 41.18796], [71.27187, 41.11015], [71.34877, 41.16807], [71.40198, 41.09436], [71.46148, 41.13958], [71.43814, 41.19644], [71.46688, 41.31883], [71.57227, 41.29175], [71.6787, 41.42111], [71.65914, 41.49599], [71.73054, 41.54713], [71.71132, 41.43012], [71.76625, 41.4466], [71.83914, 41.3546], [71.91457, 41.2982], [71.85964, 41.19081], [72.07249, 41.11739], [72.10745, 41.15483], [72.16433, 41.16483], [72.17594, 41.15522], [72.14864, 41.13363], [72.1792, 41.10621], [72.21061, 41.05607], [72.17594, 41.02377], [72.18339, 40.99571], [72.324, 41.03381], [72.34026, 41.04539], [72.34757, 41.06104], [72.36138, 41.04384], [72.38511, 41.02785], [72.45206, 41.03018], [72.48742, 40.97136], [72.55109, 40.96046], [72.59136, 40.86947], [72.68157, 40.84942], [72.84291, 40.85512], [72.94454, 40.8094], [73.01869, 40.84681], [73.13267, 40.83512], [73.13412, 40.79122], [73.0612, 40.76678], [72.99133, 40.76457], [72.93296, 40.73089], [72.8722, 40.71111], [72.85372, 40.7116], [72.84754, 40.67229], [72.80137, 40.67856], [72.74866, 40.60873], [72.74894, 40.59592], [72.75982, 40.57273], [72.74862, 40.57131], [72.74768, 40.58051], [72.73995, 40.58409], [72.69579, 40.59778], [72.66713, 40.59076], [72.66713, 40.5219], [72.47795, 40.5532], [72.40517, 40.61917], [72.34406, 40.60144], [72.41714, 40.55736], [72.38384, 40.51535], [72.41513, 40.50856], [72.44191, 40.48222], [72.40346, 40.4007], [72.24368, 40.46091], [72.18648, 40.49893], [71.96401, 40.31907], [72.05464, 40.27586], [71.85002, 40.25647], [71.82646, 40.21872], [71.73054, 40.14818], [71.71719, 40.17886], [71.69621, 40.18492], [71.70569, 40.20391], [71.68386, 40.26984], [71.61931, 40.26775], [71.61725, 40.20615], [71.51549, 40.22986], [71.51215, 40.26943], [71.4246, 40.28619], [71.36663, 40.31593], [71.13042, 40.34106], [71.05901, 40.28765], [70.95789, 40.28761], [70.9818, 40.22392], [70.80495, 40.16813], [70.7928, 40.12797], [70.65827, 40.0981], [70.65946, 39.9878], [70.58912, 39.95211], [70.55033, 39.96619], [70.47557, 39.93216], [70.57384, 39.99394], [70.58297, 40.00891], [70.01283, 40.23288], [69.67001, 40.10639], [69.64704, 40.12165], [69.57615, 40.10524], [69.55555, 40.12296], [69.53794, 40.11833], [69.53855, 40.0887], [69.5057, 40.03277], [69.53615, 39.93991], [69.43557, 39.92877], [69.43134, 39.98431], [69.35649, 40.01994], [69.26938, 39.8127], [69.3594, 39.52516], [69.68677, 39.59281], [69.87491, 39.53882], [70.11111, 39.58223], [70.2869, 39.53141], [70.44757, 39.60128], [70.64087, 39.58792], [70.7854, 39.38933], [71.06418, 39.41586], [71.08752, 39.50704], [71.49814, 39.61397], [71.55856, 39.57588], [71.5517, 39.45722], [71.62688, 39.44056], [71.76816, 39.45456], [71.80164, 39.40631], [71.7522, 39.32031], [71.79202, 39.27355], [71.90601, 39.27674], [72.04059, 39.36704], [72.09689, 39.26823], [72.17242, 39.2661], [72.23834, 39.17248], [72.33173, 39.33093], [72.62027, 39.39696], [72.85934, 39.35116], [73.18454, 39.35536], [73.31912, 39.38615], [73.45096, 39.46677], [73.59831, 39.46425], [73.87018, 39.47879], [73.94683, 39.60733], [73.92354, 39.69565], [73.9051, 39.75073], [73.83006, 39.76136], [73.97049, 40.04378], [74.25533, 40.13191], [74.35063, 40.09742], [74.69875, 40.34668], [74.85996, 40.32857], [74.78168, 40.44886], [74.82013, 40.52197], [75.08243, 40.43945], [75.22834, 40.45382], [75.5854, 40.66874], [75.69663, 40.28642], [75.91361, 40.2948], [75.96168, 40.38064], [76.33659, 40.3482], [76.5261, 40.46114], [76.75681, 40.95354], [76.99302, 41.0696], [77.28004, 41.0033], [77.3693, 41.0375], [77.52723, 41.00227], [77.76206, 41.01574], [77.81287, 41.14307], [78.12873, 41.23091], [78.15757, 41.38565], [78.3732, 41.39603], [79.92977, 42.04113], [80.17842, 42.03211], [80.17807, 42.21166], [79.97364, 42.42816], [79.52921, 42.44778], [79.19763, 42.804], [78.91502, 42.76839], [78.48469, 42.89649], [75.82823, 42.94848], [75.72174, 42.79672], [75.29966, 42.86183], [75.22619, 42.85528], [74.88756, 42.98612]], [[70.74189, 39.86319], [70.63105, 39.77923], [70.59667, 39.83542], [70.54998, 39.85137], [70.52631, 39.86989], [70.53651, 39.89155], [70.74189, 39.86319]], [[71.86463, 39.98598], [71.84316, 39.95582], [71.7504, 39.93701], [71.71511, 39.96348], [71.78838, 40.01404], [71.86463, 39.98598]], [[71.21139, 40.03369], [71.1427, 39.95026], [71.23067, 39.93581], [71.16101, 39.88423], [71.10531, 39.91354], [71.04979, 39.89808], [71.10501, 39.95568], [71.09063, 39.99], [71.11668, 39.99291], [71.11037, 40.01984], [71.01035, 40.05481], [71.00236, 40.18154], [71.06305, 40.1771], [71.12218, 40.03052], [71.21139, 40.03369]]]] } },
22731     { type: "Feature", properties: { iso1A2: "KH", iso1A3: "KHM", iso1N3: "116", wikidata: "Q424", nameEn: "Cambodia", groups: ["035", "142", "UN"], callingCodes: ["855"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.87328, 11.55953], [105.81645, 11.56876], [105.80867, 11.60536], [105.8507, 11.66635], [105.88962, 11.67854], [105.95188, 11.63738], [106.00792, 11.7197], [106.02038, 11.77457], [106.06708, 11.77761], [106.13158, 11.73283], [106.18539, 11.75171], [106.26478, 11.72122], [106.30525, 11.67549], [106.37219, 11.69836], [106.44691, 11.66787], [106.45158, 11.68616], [106.41577, 11.76999], [106.44535, 11.8279], [106.44068, 11.86294], [106.4687, 11.86751], [106.4111, 11.97413], [106.70687, 11.96956], [106.79405, 12.0807], [106.92325, 12.06548], [106.99953, 12.08983], [107.15831, 12.27547], [107.34511, 12.33327], [107.42917, 12.24657], [107.4463, 12.29373], [107.55059, 12.36824], [107.5755, 12.52177], [107.55993, 12.7982], [107.49611, 12.88926], [107.49144, 13.01215], [107.62843, 13.3668], [107.61909, 13.52577], [107.53503, 13.73908], [107.45252, 13.78897], [107.46498, 13.91593], [107.44318, 13.99751], [107.38247, 13.99147], [107.35757, 14.02319], [107.37158, 14.07906], [107.33577, 14.11832], [107.40427, 14.24509], [107.39493, 14.32655], [107.44941, 14.41552], [107.48521, 14.40346], [107.52569, 14.54665], [107.52102, 14.59034], [107.55371, 14.628], [107.54361, 14.69092], [107.47238, 14.61523], [107.44435, 14.52785], [107.37897, 14.54443], [107.3276, 14.58812], [107.29803, 14.58963], [107.26534, 14.54292], [107.256, 14.48716], [107.21241, 14.48716], [107.17038, 14.41782], [107.09722, 14.3937], [107.03962, 14.45099], [107.04585, 14.41782], [106.98825, 14.36806], [106.9649, 14.3198], [106.90574, 14.33639], [106.8497, 14.29416], [106.80767, 14.31226], [106.73762, 14.42687], [106.63333, 14.44194], [106.59908, 14.50977], [106.57106, 14.50525], [106.54148, 14.59565], [106.50723, 14.58963], [106.45898, 14.55045], [106.47766, 14.50977], [106.43874, 14.52032], [106.40916, 14.45249], [106.32355, 14.44043], [106.25194, 14.48415], [106.21302, 14.36203], [106.00131, 14.36957], [105.99509, 14.32734], [106.02311, 14.30623], [106.04801, 14.20363], [106.10872, 14.18401], [106.11962, 14.11307], [106.18656, 14.06324], [106.16632, 14.01794], [106.10094, 13.98471], [106.10405, 13.9137], [105.90791, 13.92881], [105.78182, 14.02247], [105.78338, 14.08438], [105.5561, 14.15684], [105.44869, 14.10703], [105.36775, 14.09948], [105.2759, 14.17496], [105.20894, 14.34967], [105.17748, 14.34432], [105.14012, 14.23873], [105.08408, 14.20402], [105.02804, 14.23722], [104.97667, 14.38806], [104.69335, 14.42726], [104.55014, 14.36091], [104.27616, 14.39861], [103.93836, 14.3398], [103.70175, 14.38052], [103.71109, 14.4348], [103.53518, 14.42575], [103.39353, 14.35639], [103.16469, 14.33075], [102.93275, 14.19044], [102.91251, 14.01531], [102.77864, 13.93374], [102.72727, 13.77806], [102.56848, 13.69366], [102.5481, 13.6589], [102.58635, 13.6286], [102.62483, 13.60883], [102.57573, 13.60461], [102.5358, 13.56933], [102.44601, 13.5637], [102.36859, 13.57488], [102.33828, 13.55613], [102.361, 13.50551], [102.35563, 13.47307], [102.35692, 13.38274], [102.34611, 13.35618], [102.36001, 13.31142], [102.36146, 13.26006], [102.43422, 13.09061], [102.46011, 13.08057], [102.52275, 12.99813], [102.48694, 12.97537], [102.49335, 12.92711], [102.53053, 12.77506], [102.4994, 12.71736], [102.51963, 12.66117], [102.57567, 12.65358], [102.7796, 12.43781], [102.78116, 12.40284], [102.73134, 12.37091], [102.70176, 12.1686], [102.77026, 12.06815], [102.78427, 11.98746], [102.83957, 11.8519], [102.90973, 11.75613], [102.91449, 11.65512], [102.52395, 11.25257], [102.47649, 9.66162], [103.99198, 10.48391], [104.43778, 10.42386], [104.47963, 10.43046], [104.49869, 10.4057], [104.59018, 10.53073], [104.87933, 10.52833], [104.95094, 10.64003], [105.09571, 10.72722], [105.02722, 10.89236], [105.08326, 10.95656], [105.11449, 10.96332], [105.34011, 10.86179], [105.42884, 10.96878], [105.50045, 10.94586], [105.77751, 11.03671], [105.86376, 10.89839], [105.84603, 10.85873], [105.93403, 10.83853], [105.94535, 10.9168], [106.06708, 10.8098], [106.18539, 10.79451], [106.14301, 10.98176], [106.20095, 10.97795], [106.1757, 11.07301], [106.1527, 11.10476], [106.10444, 11.07879], [105.86782, 11.28343], [105.88962, 11.43605], [105.87328, 11.55953]]]] } },
22732     { type: "Feature", properties: { iso1A2: "KI", iso1A3: "KIR", iso1N3: "296", wikidata: "Q710", nameEn: "Kiribati", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["686"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [169, -3.5], [178, -3.5], [178, 3.9], [169, 3.9]]], [[[-161.06795, 5.2462], [-158.12991, -1.86122], [-175.33482, -1.40631], [-175.31804, -7.54825], [-156.50903, -7.4975], [-156.48634, -15.52824], [-135.59706, -4.70473], [-161.06795, 5.2462]]]] } },
22733     { type: "Feature", properties: { iso1A2: "KM", iso1A3: "COM", iso1N3: "174", wikidata: "Q970", nameEn: "Comoros", groups: ["014", "202", "002", "UN"], callingCodes: ["269"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.63904, -10.02522], [43.28731, -13.97126], [45.4971, -11.75965], [42.63904, -10.02522]]]] } },
22734     { type: "Feature", properties: { iso1A2: "KN", iso1A3: "KNA", iso1N3: "659", wikidata: "Q763", nameEn: "St. Kitts and Nevis", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 869"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.29333, 17.43155], [-62.76692, 17.64353], [-63.09677, 17.21372], [-62.63813, 16.65446], [-62.29333, 17.43155]]]] } },
22735     { type: "Feature", properties: { iso1A2: "KP", iso1A3: "PRK", iso1N3: "408", wikidata: "Q423", nameEn: "North Korea", groups: ["030", "142", "UN"], callingCodes: ["850"] }, geometry: { type: "MultiPolygon", coordinates: [[[[130.26095, 42.9027], [130.09764, 42.91425], [130.12957, 42.98361], [129.96409, 42.97306], [129.95082, 43.01051], [129.8865, 43.00395], [129.85261, 42.96494], [129.83277, 42.86746], [129.80719, 42.79218], [129.7835, 42.76521], [129.77183, 42.69435], [129.75294, 42.59409], [129.72541, 42.43739], [129.60482, 42.44461], [129.54701, 42.37254], [129.42882, 42.44702], [129.28541, 42.41574], [129.22423, 42.3553], [129.22285, 42.26491], [129.15178, 42.17224], [128.96068, 42.06657], [128.94007, 42.03537], [128.04487, 42.01769], [128.15119, 41.74568], [128.30716, 41.60322], [128.20061, 41.40895], [128.18546, 41.41279], [128.12967, 41.37931], [128.03311, 41.39232], [128.02633, 41.42103], [127.92943, 41.44291], [127.29712, 41.49473], [127.17841, 41.59714], [126.90729, 41.79955], [126.60631, 41.65565], [126.53189, 41.35206], [126.242, 41.15454], [126.00335, 40.92835], [125.76869, 40.87908], [125.71172, 40.85223], [124.86913, 40.45387], [124.40719, 40.13655], [124.38556, 40.11047], [124.3322, 40.05573], [124.37089, 40.03004], [124.35029, 39.95639], [124.23201, 39.9248], [124.17532, 39.8232], [123.90497, 38.79949], [123.85601, 37.49093], [124.67666, 38.05679], [124.84224, 37.977], [124.87921, 37.80827], [125.06408, 37.66334], [125.37112, 37.62643], [125.81159, 37.72949], [126.13074, 37.70512], [126.18776, 37.74728], [126.19097, 37.81462], [126.24402, 37.83113], [126.43239, 37.84095], [126.46818, 37.80873], [126.56709, 37.76857], [126.59918, 37.76364], [126.66067, 37.7897], [126.68793, 37.83728], [126.68793, 37.9175], [126.67023, 37.95852], [126.84961, 38.0344], [126.88106, 38.10246], [126.95887, 38.1347], [126.95338, 38.17735], [127.04479, 38.25518], [127.15749, 38.30722], [127.38727, 38.33227], [127.49672, 38.30647], [127.55013, 38.32257], [128.02917, 38.31861], [128.27652, 38.41657], [128.31105, 38.58462], [128.37487, 38.62345], [128.65655, 38.61914], [131.95041, 41.5445], [130.65022, 42.32281], [130.66367, 42.38024], [130.64181, 42.41422], [130.60805, 42.4317], [130.56835, 42.43281], [130.55143, 42.52158], [130.50123, 42.61636], [130.44361, 42.54849], [130.41826, 42.6011], [130.2385, 42.71127], [130.23068, 42.80125], [130.26095, 42.9027]]]] } },
22736     { type: "Feature", properties: { iso1A2: "KR", iso1A3: "KOR", iso1N3: "410", wikidata: "Q884", nameEn: "South Korea", groups: ["030", "142", "UN"], callingCodes: ["82"] }, geometry: { type: "MultiPolygon", coordinates: [[[[133.11729, 37.53115], [128.65655, 38.61914], [128.37487, 38.62345], [128.31105, 38.58462], [128.27652, 38.41657], [128.02917, 38.31861], [127.55013, 38.32257], [127.49672, 38.30647], [127.38727, 38.33227], [127.15749, 38.30722], [127.04479, 38.25518], [126.95338, 38.17735], [126.95887, 38.1347], [126.88106, 38.10246], [126.84961, 38.0344], [126.67023, 37.95852], [126.68793, 37.9175], [126.68793, 37.83728], [126.66067, 37.7897], [126.59918, 37.76364], [126.56709, 37.76857], [126.46818, 37.80873], [126.43239, 37.84095], [126.24402, 37.83113], [126.19097, 37.81462], [126.18776, 37.74728], [126.13074, 37.70512], [125.81159, 37.72949], [125.37112, 37.62643], [125.06408, 37.66334], [124.87921, 37.80827], [124.84224, 37.977], [124.67666, 38.05679], [123.85601, 37.49093], [122.80525, 33.30571], [125.99728, 32.63328], [129.2669, 34.87122], [133.11729, 37.53115]]]] } },
22737     { type: "Feature", properties: { iso1A2: "KW", iso1A3: "KWT", iso1N3: "414", wikidata: "Q817", nameEn: "Kuwait", groups: ["145", "142", "UN"], callingCodes: ["965"] }, geometry: { type: "MultiPolygon", coordinates: [[[[49.00421, 28.81495], [48.59531, 29.66815], [48.40479, 29.85763], [48.17332, 30.02448], [48.06782, 30.02906], [48.01114, 29.98906], [47.7095, 30.10453], [47.37192, 30.10421], [47.15166, 30.01044], [46.89695, 29.50584], [46.5527, 29.10283], [47.46202, 29.0014], [47.58376, 28.83382], [47.59863, 28.66798], [47.70561, 28.5221], [48.42991, 28.53628], [49.00421, 28.81495]]]] } },
22738     { type: "Feature", properties: { iso1A2: "KY", iso1A3: "CYM", iso1N3: "136", wikidata: "Q5785", nameEn: "Cayman Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 345"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-82.11509, 19.60401], [-80.36068, 18.11751], [-79.32727, 20.06742], [-82.11509, 19.60401]]]] } },
22739     { type: "Feature", properties: { iso1A2: "KZ", iso1A3: "KAZ", iso1N3: "398", wikidata: "Q232", nameEn: "Kazakhstan", groups: ["143", "142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[68.90865, 55.38148], [68.19206, 55.18823], [68.26661, 55.09226], [68.21308, 54.98645], [65.20174, 54.55216], [65.24663, 54.35721], [65.11033, 54.33028], [64.97216, 54.4212], [63.97686, 54.29763], [64.02715, 54.22679], [63.91224, 54.20013], [63.80604, 54.27079], [62.58651, 54.05871], [62.56876, 53.94047], [62.45931, 53.90737], [62.38535, 54.03961], [62.00966, 54.04134], [62.03913, 53.94768], [61.65318, 54.02445], [61.56941, 53.95703], [61.47603, 54.08048], [61.3706, 54.08464], [61.26863, 53.92797], [60.99796, 53.93699], [61.14283, 53.90063], [61.22574, 53.80268], [60.90626, 53.62937], [61.55706, 53.57144], [61.57185, 53.50112], [61.37957, 53.45887], [61.29082, 53.50992], [61.14291, 53.41481], [61.19024, 53.30536], [62.14574, 53.09626], [62.12799, 52.99133], [62.0422, 52.96105], [61.23462, 53.03227], [61.05842, 52.92217], [60.71989, 52.75923], [60.71693, 52.66245], [60.84118, 52.63912], [60.84709, 52.52228], [60.98021, 52.50068], [61.05417, 52.35096], [60.78201, 52.22067], [60.72581, 52.15538], [60.48915, 52.15175], [60.19925, 51.99173], [59.99809, 51.98263], [60.09867, 51.87135], [60.50986, 51.7964], [60.36787, 51.66815], [60.5424, 51.61675], [60.92401, 51.61124], [60.95655, 51.48615], [61.50677, 51.40687], [61.55114, 51.32746], [61.6813, 51.25716], [61.56889, 51.23679], [61.4431, 50.80679], [60.81833, 50.6629], [60.31914, 50.67705], [60.17262, 50.83312], [60.01288, 50.8163], [59.81172, 50.54451], [59.51886, 50.49937], [59.48928, 50.64216], [58.87974, 50.70852], [58.3208, 51.15151], [57.75578, 51.13852], [57.74986, 50.93017], [57.44221, 50.88354], [57.17302, 51.11253], [56.17906, 50.93204], [56.11398, 50.7471], [55.67774, 50.54508], [54.72067, 51.03261], [54.56685, 51.01958], [54.71476, 50.61214], [54.55797, 50.52006], [54.41894, 50.61214], [54.46331, 50.85554], [54.12248, 51.11542], [53.69299, 51.23466], [53.46165, 51.49445], [52.54329, 51.48444], [52.36119, 51.74161], [51.8246, 51.67916], [51.77431, 51.49536], [51.301, 51.48799], [51.26254, 51.68466], [50.59695, 51.61859], [50.26859, 51.28677], [49.97277, 51.2405], [49.76866, 51.11067], [49.39001, 51.09396], [49.41959, 50.85927], [49.12673, 50.78639], [48.86936, 50.61589], [48.57946, 50.63278], [48.90782, 50.02281], [48.68352, 49.89546], [48.42564, 49.82283], [48.24519, 49.86099], [48.10044, 50.09242], [47.58551, 50.47867], [47.30448, 50.30894], [47.34589, 50.09308], [47.18319, 49.93721], [46.9078, 49.86707], [46.78398, 49.34026], [47.04658, 49.19834], [47.00857, 49.04921], [46.78392, 48.95352], [46.49011, 48.43019], [47.11516, 48.27188], [47.12107, 47.83687], [47.38731, 47.68176], [47.41689, 47.83687], [47.64973, 47.76559], [48.15348, 47.74545], [48.45173, 47.40818], [48.52326, 47.4102], [49.01136, 46.72716], [48.51142, 46.69268], [48.54988, 46.56267], [49.16518, 46.38542], [49.32259, 46.26944], [49.88945, 46.04554], [49.2134, 44.84989], [52.26048, 41.69249], [52.47884, 41.78034], [52.97575, 42.1308], [54.20635, 42.38477], [54.95182, 41.92424], [55.45471, 41.25609], [56.00314, 41.32584], [55.97584, 44.99322], [55.97584, 44.99328], [55.97584, 44.99338], [55.97584, 44.99343], [55.97584, 44.99348], [55.97584, 44.99353], [55.97584, 44.99359], [55.97584, 44.99369], [55.97584, 44.99374], [55.97584, 44.99384], [55.97584, 44.9939], [55.97584, 44.994], [55.97584, 44.99405], [55.97584, 44.99415], [55.97584, 44.99421], [55.97584, 44.99426], [55.97584, 44.99431], [55.97584, 44.99436], [55.97584, 44.99441], [55.97594, 44.99446], [55.97605, 44.99452], [55.97605, 44.99457], [55.97605, 44.99462], [55.97605, 44.99467], [55.97605, 44.99477], [55.97615, 44.99477], [55.97615, 44.99483], [55.97615, 44.99493], [55.97615, 44.99498], [55.97615, 44.99503], [55.97615, 44.99508], [55.97625, 44.99514], [55.97636, 44.99519], [55.97636, 44.99524], [55.97646, 44.99529], [55.97646, 44.99534], [55.97656, 44.99539], [55.97667, 44.99545], [55.97677, 44.9955], [55.97677, 44.99555], [55.97677, 44.9956], [55.97687, 44.9956], [55.97698, 44.99565], [55.97698, 44.9957], [55.97708, 44.99576], [55.97718, 44.99581], [55.97729, 44.99586], [55.97739, 44.99586], [55.97739, 44.99591], [55.97749, 44.99591], [55.9776, 44.99591], [55.9777, 44.99596], [55.9777, 44.99601], [55.9778, 44.99607], [55.97791, 44.99607], [55.97801, 44.99607], [55.97801, 44.99612], [55.97811, 44.99617], [55.97822, 44.99617], [55.97832, 44.99622], [55.97842, 44.99622], [58.59711, 45.58671], [61.01475, 44.41383], [62.01711, 43.51008], [63.34656, 43.64003], [64.53885, 43.56941], [64.96464, 43.74748], [65.18666, 43.48835], [65.53277, 43.31856], [65.85194, 42.85481], [66.09482, 42.93426], [66.00546, 41.94455], [66.53302, 41.87388], [66.69129, 41.1311], [67.9644, 41.14611], [67.98511, 41.02794], [68.08273, 41.08148], [68.1271, 41.0324], [67.96736, 40.83798], [68.49983, 40.56437], [68.63, 40.59358], [68.58444, 40.91447], [68.49983, 40.99669], [68.62221, 41.03019], [68.65662, 40.93861], [68.73945, 40.96989], [68.7217, 41.05025], [69.01308, 41.22804], [69.05006, 41.36183], [69.15137, 41.43078], [69.17701, 41.43769], [69.18528, 41.45175], [69.20439, 41.45391], [69.22671, 41.46298], [69.23332, 41.45847], [69.25059, 41.46693], [69.29778, 41.43673], [69.35554, 41.47211], [69.37468, 41.46555], [69.45081, 41.46246], [69.39485, 41.51518], [69.45751, 41.56863], [69.49545, 41.545], [70.94483, 42.26238], [70.85973, 42.30188], [70.97717, 42.50147], [71.15232, 42.60486], [71.17807, 42.67381], [71.22785, 42.69248], [71.2724, 42.77853], [71.53272, 42.8014], [71.62405, 42.76613], [71.88792, 42.83578], [73.44393, 42.43098], [73.50992, 42.82356], [73.55634, 43.03071], [74.22489, 43.24657], [74.57491, 43.13702], [74.64615, 43.05881], [74.70331, 43.02519], [74.75, 42.99029], [74.88756, 42.98612], [75.22619, 42.85528], [75.29966, 42.86183], [75.72174, 42.79672], [75.82823, 42.94848], [78.48469, 42.89649], [78.91502, 42.76839], [79.19763, 42.804], [79.52921, 42.44778], [79.97364, 42.42816], [80.17807, 42.21166], [80.26841, 42.23797], [80.16892, 42.61137], [80.26886, 42.8366], [80.38169, 42.83142], [80.58999, 42.9011], [80.3735, 43.01557], [80.62913, 43.141], [80.78817, 43.14235], [80.77771, 43.30065], [80.69718, 43.32589], [80.75156, 43.44948], [80.40031, 44.10986], [80.40229, 44.23319], [80.38384, 44.63073], [79.8987, 44.89957], [80.11169, 45.03352], [81.73278, 45.3504], [82.51374, 45.1755], [82.58474, 45.40027], [82.21792, 45.56619], [83.04622, 47.19053], [83.92184, 46.98912], [84.73077, 47.01394], [84.93995, 46.87399], [85.22443, 47.04816], [85.54294, 47.06171], [85.69696, 47.2898], [85.61067, 47.49753], [85.5169, 48.05493], [85.73581, 48.3939], [86.38069, 48.46064], [86.75343, 48.70331], [86.73568, 48.99918], [86.87238, 49.12432], [87.28386, 49.11626], [87.31465, 49.23603], [87.03071, 49.25142], [86.82606, 49.51796], [86.61307, 49.60239], [86.79056, 49.74787], [86.63674, 49.80136], [86.18709, 49.50259], [85.24047, 49.60239], [84.99198, 50.06793], [84.29385, 50.27257], [83.8442, 50.87375], [83.14607, 51.00796], [82.55443, 50.75412], [81.94999, 50.79307], [81.46581, 50.77658], [81.41248, 50.97524], [81.06091, 50.94833], [81.16999, 51.15662], [80.80318, 51.28262], [80.44819, 51.20855], [80.4127, 50.95581], [80.08138, 50.77658], [79.11255, 52.01171], [77.90383, 53.29807], [76.54243, 53.99329], [76.44076, 54.16017], [76.82266, 54.1798], [76.91052, 54.4677], [75.3668, 54.07439], [75.43398, 53.98652], [75.07405, 53.80831], [73.39218, 53.44623], [73.25412, 53.61532], [73.68921, 53.86522], [73.74778, 54.07194], [73.37963, 53.96132], [72.71026, 54.1161], [72.43415, 53.92685], [72.17477, 54.36303], [71.96141, 54.17736], [71.10379, 54.13326], [71.08706, 54.33376], [71.24185, 54.64965], [71.08288, 54.71253], [70.96009, 55.10558], [70.76493, 55.3027], [70.19179, 55.1476], [69.74917, 55.35545], [69.34224, 55.36344], [68.90865, 55.38148]]]] } },
22740     { type: "Feature", properties: { iso1A2: "LA", iso1A3: "LAO", iso1N3: "418", wikidata: "Q819", nameEn: "Laos", groups: ["035", "142", "UN"], callingCodes: ["856"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.1245, 22.43372], [102.03633, 22.46164], [101.98487, 22.42766], [101.91344, 22.44417], [101.90714, 22.38688], [101.86828, 22.38397], [101.7685, 22.50337], [101.68973, 22.46843], [101.61306, 22.27515], [101.56789, 22.28876], [101.53638, 22.24794], [101.60675, 22.13513], [101.57525, 22.13026], [101.62566, 21.96574], [101.7791, 21.83019], [101.74555, 21.72852], [101.83257, 21.61562], [101.80001, 21.57461], [101.7475, 21.5873], [101.7727, 21.51794], [101.74224, 21.48276], [101.74014, 21.30967], [101.84412, 21.25291], [101.83887, 21.20983], [101.76745, 21.21571], [101.79266, 21.19025], [101.7622, 21.14813], [101.70548, 21.14911], [101.66977, 21.20004], [101.60886, 21.17947], [101.59491, 21.18621], [101.6068, 21.23329], [101.54563, 21.25668], [101.29326, 21.17254], [101.2229, 21.23271], [101.26912, 21.36482], [101.19349, 21.41959], [101.2124, 21.56422], [101.15156, 21.56129], [101.16198, 21.52808], [101.00234, 21.39612], [100.80173, 21.2934], [100.72716, 21.31786], [100.63578, 21.05639], [100.55281, 21.02796], [100.50974, 20.88574], [100.64628, 20.88279], [100.60112, 20.8347], [100.51079, 20.82194], [100.36375, 20.82783], [100.1957, 20.68247], [100.08404, 20.36626], [100.09999, 20.31614], [100.09337, 20.26293], [100.11785, 20.24787], [100.1712, 20.24324], [100.16668, 20.2986], [100.22076, 20.31598], [100.25769, 20.3992], [100.33383, 20.4028], [100.37439, 20.35156], [100.41473, 20.25625], [100.44992, 20.23644], [100.4537, 20.19971], [100.47567, 20.19133], [100.51052, 20.14928], [100.55218, 20.17741], [100.58808, 20.15791], [100.5094, 19.87904], [100.398, 19.75047], [100.49604, 19.53504], [100.58219, 19.49164], [100.64606, 19.55884], [100.77231, 19.48324], [100.90302, 19.61901], [101.08928, 19.59748], [101.26545, 19.59242], [101.26991, 19.48324], [101.21347, 19.46223], [101.20604, 19.35296], [101.24911, 19.33334], [101.261, 19.12717], [101.35606, 19.04716], [101.25803, 18.89545], [101.22832, 18.73377], [101.27585, 18.68875], [101.06047, 18.43247], [101.18227, 18.34367], [101.15108, 18.25624], [101.19118, 18.2125], [101.1793, 18.0544], [101.02185, 17.87637], [100.96541, 17.57926], [101.15108, 17.47586], [101.44667, 17.7392], [101.72294, 17.92867], [101.78087, 18.07559], [101.88485, 18.02474], [102.11359, 18.21532], [102.45523, 17.97106], [102.59234, 17.96127], [102.60971, 17.95411], [102.61432, 17.92273], [102.5896, 17.84889], [102.59485, 17.83537], [102.68194, 17.80151], [102.69946, 17.81686], [102.67543, 17.84529], [102.68538, 17.86653], [102.75954, 17.89561], [102.79044, 17.93612], [102.81988, 17.94233], [102.86323, 17.97531], [102.95812, 18.0054], [102.9912, 17.9949], [103.01998, 17.97095], [103.0566, 18.00144], [103.07823, 18.03833], [103.07343, 18.12351], [103.1493, 18.17799], [103.14994, 18.23172], [103.17093, 18.2618], [103.29757, 18.30475], [103.23818, 18.34875], [103.24779, 18.37807], [103.30977, 18.4341], [103.41044, 18.4486], [103.47773, 18.42841], [103.60957, 18.40528], [103.699, 18.34125], [103.82449, 18.33979], [103.85642, 18.28666], [103.93916, 18.33914], [103.97725, 18.33631], [104.06533, 18.21656], [104.10927, 18.10826], [104.21776, 17.99335], [104.2757, 17.86139], [104.35432, 17.82871], [104.45404, 17.66788], [104.69867, 17.53038], [104.80061, 17.39367], [104.80716, 17.19025], [104.73712, 17.01404], [104.7373, 16.91125], [104.76442, 16.84752], [104.7397, 16.81005], [104.76099, 16.69302], [104.73349, 16.565], [104.88057, 16.37311], [105.00262, 16.25627], [105.06204, 16.09792], [105.42001, 16.00657], [105.38508, 15.987], [105.34115, 15.92737], [105.37959, 15.84074], [105.42285, 15.76971], [105.46573, 15.74742], [105.61756, 15.68792], [105.60446, 15.53301], [105.58191, 15.41031], [105.47635, 15.3796], [105.4692, 15.33709], [105.50662, 15.32054], [105.58043, 15.32724], [105.46661, 15.13132], [105.61162, 15.00037], [105.5121, 14.80802], [105.53864, 14.55731], [105.43783, 14.43865], [105.20894, 14.34967], [105.2759, 14.17496], [105.36775, 14.09948], [105.44869, 14.10703], [105.5561, 14.15684], [105.78338, 14.08438], [105.78182, 14.02247], [105.90791, 13.92881], [106.10405, 13.9137], [106.10094, 13.98471], [106.16632, 14.01794], [106.18656, 14.06324], [106.11962, 14.11307], [106.10872, 14.18401], [106.04801, 14.20363], [106.02311, 14.30623], [105.99509, 14.32734], [106.00131, 14.36957], [106.21302, 14.36203], [106.25194, 14.48415], [106.32355, 14.44043], [106.40916, 14.45249], [106.43874, 14.52032], [106.47766, 14.50977], [106.45898, 14.55045], [106.50723, 14.58963], [106.54148, 14.59565], [106.57106, 14.50525], [106.59908, 14.50977], [106.63333, 14.44194], [106.73762, 14.42687], [106.80767, 14.31226], [106.8497, 14.29416], [106.90574, 14.33639], [106.9649, 14.3198], [106.98825, 14.36806], [107.04585, 14.41782], [107.03962, 14.45099], [107.09722, 14.3937], [107.17038, 14.41782], [107.21241, 14.48716], [107.256, 14.48716], [107.26534, 14.54292], [107.29803, 14.58963], [107.3276, 14.58812], [107.37897, 14.54443], [107.44435, 14.52785], [107.47238, 14.61523], [107.54361, 14.69092], [107.51579, 14.79282], [107.59285, 14.87795], [107.48277, 14.93751], [107.46516, 15.00982], [107.61486, 15.0566], [107.61926, 15.13949], [107.58844, 15.20111], [107.62587, 15.2266], [107.60605, 15.37524], [107.62367, 15.42193], [107.53341, 15.40496], [107.50699, 15.48771], [107.3815, 15.49832], [107.34408, 15.62345], [107.27583, 15.62769], [107.27143, 15.71459], [107.21859, 15.74638], [107.21419, 15.83747], [107.34188, 15.89464], [107.39471, 15.88829], [107.46296, 16.01106], [107.44975, 16.08511], [107.33968, 16.05549], [107.25822, 16.13587], [107.14595, 16.17816], [107.15035, 16.26271], [107.09091, 16.3092], [107.02597, 16.31132], [106.97385, 16.30204], [106.96638, 16.34938], [106.88067, 16.43594], [106.88727, 16.52671], [106.84104, 16.55415], [106.74418, 16.41904], [106.65832, 16.47816], [106.66052, 16.56892], [106.61477, 16.60713], [106.58267, 16.6012], [106.59013, 16.62259], [106.55485, 16.68704], [106.55265, 16.86831], [106.52183, 16.87884], [106.51963, 16.92097], [106.54824, 16.92729], [106.55045, 17.0031], [106.50862, 16.9673], [106.43597, 17.01362], [106.31929, 17.20509], [106.29287, 17.3018], [106.24444, 17.24714], [106.18991, 17.28227], [106.09019, 17.36399], [105.85744, 17.63221], [105.76612, 17.67147], [105.60381, 17.89356], [105.64784, 17.96687], [105.46292, 18.22008], [105.38366, 18.15315], [105.15942, 18.38691], [105.10408, 18.43533], [105.1327, 18.58355], [105.19654, 18.64196], [105.12829, 18.70453], [104.64617, 18.85668], [104.5361, 18.97747], [103.87125, 19.31854], [104.06058, 19.43484], [104.10832, 19.51575], [104.05617, 19.61743], [104.06498, 19.66926], [104.23229, 19.70242], [104.41281, 19.70035], [104.53169, 19.61743], [104.64837, 19.62365], [104.68359, 19.72729], [104.8355, 19.80395], [104.8465, 19.91783], [104.9874, 20.09573], [104.91695, 20.15567], [104.86852, 20.14121], [104.61315, 20.24452], [104.62195, 20.36633], [104.72102, 20.40554], [104.66158, 20.47774], [104.47886, 20.37459], [104.40621, 20.3849], [104.38199, 20.47155], [104.63957, 20.6653], [104.27412, 20.91433], [104.11121, 20.96779], [103.98024, 20.91531], [103.82282, 20.8732], [103.73478, 20.6669], [103.68633, 20.66324], [103.45737, 20.82382], [103.38032, 20.79501], [103.21497, 20.89832], [103.12055, 20.89994], [103.03469, 21.05821], [102.97745, 21.05821], [102.89825, 21.24707], [102.80794, 21.25736], [102.88939, 21.3107], [102.94223, 21.46034], [102.86297, 21.4255], [102.98846, 21.58936], [102.97965, 21.74076], [102.86077, 21.71213], [102.85637, 21.84501], [102.81894, 21.83888], [102.82115, 21.73667], [102.74189, 21.66713], [102.67145, 21.65894], [102.62301, 21.91447], [102.49092, 21.99002], [102.51734, 22.02676], [102.18712, 22.30403], [102.14099, 22.40092], [102.1245, 22.43372]]]] } },
22741     { type: "Feature", properties: { iso1A2: "LB", iso1A3: "LBN", iso1N3: "422", wikidata: "Q822", nameEn: "Lebanon", aliases: ["RL"], groups: ["145", "142", "UN"], callingCodes: ["961"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.94816, 33.47886], [35.94465, 33.52774], [36.05723, 33.57904], [35.9341, 33.6596], [36.06778, 33.82927], [36.14517, 33.85118], [36.3967, 33.83365], [36.38263, 33.86579], [36.28589, 33.91981], [36.41078, 34.05253], [36.50576, 34.05982], [36.5128, 34.09916], [36.62537, 34.20251], [36.59195, 34.2316], [36.58667, 34.27667], [36.60778, 34.31009], [36.56556, 34.31881], [36.53039, 34.3798], [36.55853, 34.41609], [36.46179, 34.46541], [36.4442, 34.50165], [36.34745, 34.5002], [36.3369, 34.52629], [36.39846, 34.55672], [36.41429, 34.61175], [36.45299, 34.59438], [36.46003, 34.6378], [36.42941, 34.62505], [36.35384, 34.65447], [36.35135, 34.68516], [36.32399, 34.69334], [36.29165, 34.62991], [35.98718, 34.64977], [35.97386, 34.63322], [35.48515, 34.70851], [34.78515, 33.20368], [35.10645, 33.09318], [35.1924, 33.08743], [35.31429, 33.10515], [35.35223, 33.05617], [35.43059, 33.06659], [35.448, 33.09264], [35.50272, 33.09056], [35.50335, 33.114], [35.52573, 33.11921], [35.54228, 33.19865], [35.5362, 33.23196], [35.54808, 33.236], [35.54544, 33.25513], [35.55555, 33.25844], [35.56523, 33.28969], [35.58326, 33.28381], [35.58502, 33.26653], [35.62283, 33.24226], [35.62019, 33.27278], [35.77477, 33.33609], [35.81324, 33.36354], [35.82577, 33.40479], [35.88668, 33.43183], [35.94816, 33.47886]]]] } },
22742     { type: "Feature", properties: { iso1A2: "LC", iso1A3: "LCA", iso1N3: "662", wikidata: "Q760", nameEn: "St. Lucia", aliases: ["WL"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 758"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.69315, 14.26451], [-59.94058, 12.34011], [-59.95997, 14.20285]]]] } },
22743     { type: "Feature", properties: { iso1A2: "LI", iso1A3: "LIE", iso1N3: "438", wikidata: "Q347", nameEn: "Liechtenstein", aliases: ["FL"], groups: ["155", "150", "UN"], callingCodes: ["423"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.60717, 47.06091], [9.61216, 47.07732], [9.63395, 47.08443], [9.62623, 47.14685], [9.56539, 47.17124], [9.58264, 47.20673], [9.56981, 47.21926], [9.55176, 47.22585], [9.56766, 47.24281], [9.53116, 47.27029], [9.52406, 47.24959], [9.50318, 47.22153], [9.4891, 47.19346], [9.48774, 47.17402], [9.51044, 47.13727], [9.52089, 47.10019], [9.51362, 47.08505], [9.47139, 47.06402], [9.47548, 47.05257], [9.54041, 47.06495], [9.55721, 47.04762], [9.60717, 47.06091]]]] } },
22744     { type: "Feature", properties: { iso1A2: "LK", iso1A3: "LKA", iso1N3: "144", wikidata: "Q854", nameEn: "Sri Lanka", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["94"] }, geometry: { type: "MultiPolygon", coordinates: [[[[76.59015, 5.591], [85.15017, 5.21497], [80.48418, 10.20786], [79.42124, 9.80115], [79.50447, 8.91876], [76.59015, 5.591]]]] } },
22745     { type: "Feature", properties: { iso1A2: "LR", iso1A3: "LBR", iso1N3: "430", wikidata: "Q1014", nameEn: "Liberia", groups: ["011", "202", "002", "UN"], callingCodes: ["231"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.47114, 7.55676], [-8.55874, 7.62525], [-8.55874, 7.70167], [-8.67814, 7.69428], [-8.72789, 7.51429], [-8.8448, 7.35149], [-8.85724, 7.26019], [-8.93435, 7.2824], [-9.09107, 7.1985], [-9.18311, 7.30461], [-9.20798, 7.38109], [-9.305, 7.42056], [-9.41943, 7.41809], [-9.48161, 7.37122], [-9.37465, 7.62032], [-9.35724, 7.74111], [-9.44928, 7.9284], [-9.41445, 8.02448], [-9.50898, 8.18455], [-9.47415, 8.35195], [-9.77763, 8.54633], [-10.05873, 8.42578], [-10.05375, 8.50697], [-10.14579, 8.52665], [-10.203, 8.47991], [-10.27575, 8.48711], [-10.30084, 8.30008], [-10.31635, 8.28554], [-10.29839, 8.21283], [-10.35227, 8.15223], [-10.45023, 8.15627], [-10.51554, 8.1393], [-10.57523, 8.04829], [-10.60492, 8.04072], [-10.60422, 7.7739], [-11.29417, 7.21576], [-11.4027, 6.97746], [-11.50429, 6.92704], [-12.15048, 6.15992], [-7.52774, 3.7105], [-7.53259, 4.35145], [-7.59349, 4.8909], [-7.53876, 4.94294], [-7.55369, 5.08667], [-7.48901, 5.14118], [-7.46165, 5.26256], [-7.36463, 5.32944], [-7.43428, 5.42355], [-7.37209, 5.61173], [-7.43926, 5.74787], [-7.43677, 5.84687], [-7.46165, 5.84934], [-7.48155, 5.80974], [-7.67309, 5.94337], [-7.70294, 5.90625], [-7.78254, 5.99037], [-7.79747, 6.07696], [-7.8497, 6.08932], [-7.83478, 6.20309], [-7.90692, 6.27728], [-8.00642, 6.31684], [-8.17557, 6.28222], [-8.3298, 6.36381], [-8.38453, 6.35887], [-8.45666, 6.49977], [-8.48652, 6.43797], [-8.59456, 6.50612], [-8.31736, 6.82837], [-8.29249, 7.1691], [-8.37458, 7.25794], [-8.41935, 7.51203], [-8.47114, 7.55676]]]] } },
22746     { type: "Feature", properties: { iso1A2: "LS", iso1A3: "LSO", iso1N3: "426", wikidata: "Q1013", nameEn: "Lesotho", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["266"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.33204, -29.45598], [29.44883, -29.3772], [29.40524, -29.21246], [28.68043, -28.58744], [28.65091, -28.57025], [28.40612, -28.6215], [28.30518, -28.69531], [28.2348, -28.69471], [28.1317, -28.7293], [28.02503, -28.85991], [27.98675, -28.8787], [27.9392, -28.84864], [27.88933, -28.88156], [27.8907, -28.91612], [27.75458, -28.89839], [27.55974, -29.18954], [27.5158, -29.2261], [27.54258, -29.25575], [27.48679, -29.29349], [27.45125, -29.29708], [27.47254, -29.31968], [27.4358, -29.33465], [27.33464, -29.48161], [27.01016, -29.65439], [27.09489, -29.72796], [27.22719, -30.00718], [27.29603, -30.05473], [27.32555, -30.14785], [27.40778, -30.14577], [27.37293, -30.19401], [27.36649, -30.27246], [27.38108, -30.33456], [27.45452, -30.32239], [27.56901, -30.42504], [27.56781, -30.44562], [27.62137, -30.50509], [27.6521, -30.51707], [27.67819, -30.53437], [27.69467, -30.55862], [27.74814, -30.60635], [28.12073, -30.68072], [28.2319, -30.28476], [28.399, -30.1592], [28.68627, -30.12885], [28.80222, -30.10579], [28.9338, -30.05072], [29.16548, -29.91706], [29.12553, -29.76266], [29.28545, -29.58456], [29.33204, -29.45598]]]] } },
22747     { type: "Feature", properties: { iso1A2: "LT", iso1A3: "LTU", iso1N3: "440", wikidata: "Q37", nameEn: "Lithuania", groups: ["EU", "154", "150", "UN"], callingCodes: ["370"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.89005, 56.46666], [24.83686, 56.41565], [24.70022, 56.40483], [24.57353, 56.31525], [24.58143, 56.29125], [24.42746, 56.26522], [24.32334, 56.30226], [24.13139, 56.24881], [24.02657, 56.3231], [23.75726, 56.37282], [23.49803, 56.34307], [23.40486, 56.37689], [23.31606, 56.3827], [23.17312, 56.36795], [23.09531, 56.30511], [22.96988, 56.41213], [22.83048, 56.367], [22.69354, 56.36284], [22.56441, 56.39305], [22.3361, 56.4016], [22.09728, 56.42851], [22.00548, 56.41508], [21.74558, 56.33181], [21.57888, 56.31406], [21.49736, 56.29106], [21.24644, 56.16917], [21.15016, 56.07818], [20.68447, 56.04073], [20.60454, 55.40986], [20.95181, 55.27994], [21.26425, 55.24456], [21.35465, 55.28427], [21.38446, 55.29348], [21.46766, 55.21115], [21.51095, 55.18507], [21.55605, 55.20311], [21.64954, 55.1791], [21.85521, 55.09493], [21.96505, 55.07353], [21.99543, 55.08691], [22.03984, 55.07888], [22.02582, 55.05078], [22.06087, 55.02935], [22.11697, 55.02131], [22.14267, 55.05345], [22.31562, 55.0655], [22.47688, 55.04408], [22.58907, 55.07085], [22.60075, 55.01863], [22.65451, 54.97037], [22.68723, 54.9811], [22.76422, 54.92521], [22.85083, 54.88711], [22.87317, 54.79492], [22.73631, 54.72952], [22.73397, 54.66604], [22.75467, 54.6483], [22.74225, 54.64339], [22.7522, 54.63525], [22.68021, 54.58486], [22.71293, 54.56454], [22.67788, 54.532], [22.70208, 54.45312], [22.7253, 54.41732], [22.79705, 54.36264], [22.83756, 54.40827], [23.00584, 54.38514], [22.99649, 54.35927], [23.05726, 54.34565], [23.04323, 54.31567], [23.104, 54.29794], [23.13905, 54.31567], [23.15526, 54.31076], [23.15938, 54.29894], [23.24656, 54.25701], [23.3494, 54.25155], [23.39525, 54.21672], [23.42418, 54.17911], [23.45223, 54.17775], [23.49196, 54.14764], [23.52702, 54.04622], [23.48261, 53.98855], [23.51284, 53.95052], [23.61677, 53.92691], [23.71726, 53.93379], [23.80543, 53.89558], [23.81309, 53.94205], [23.95098, 53.9613], [23.98837, 53.92554], [24.19638, 53.96405], [24.34128, 53.90076], [24.44411, 53.90076], [24.62275, 54.00217], [24.69652, 54.01901], [24.69185, 53.96543], [24.74279, 53.96663], [24.85311, 54.02862], [24.77131, 54.11091], [24.96894, 54.17589], [24.991, 54.14241], [25.0728, 54.13419], [25.19199, 54.219], [25.22705, 54.26271], [25.35559, 54.26544], [25.509, 54.30267], [25.56823, 54.25212], [25.51452, 54.17799], [25.54724, 54.14925], [25.64875, 54.1259], [25.71084, 54.16704], [25.78563, 54.15747], [25.78553, 54.23327], [25.68513, 54.31727], [25.55425, 54.31591], [25.5376, 54.33158], [25.63371, 54.42075], [25.62203, 54.4656], [25.64813, 54.48704], [25.68045, 54.5321], [25.75977, 54.57252], [25.74122, 54.80108], [25.89462, 54.93438], [25.99129, 54.95705], [26.05907, 54.94631], [26.13386, 54.98924], [26.20397, 54.99729], [26.26941, 55.08032], [26.23202, 55.10439], [26.30628, 55.12536], [26.35121, 55.1525], [26.46249, 55.12814], [26.51481, 55.16051], [26.54753, 55.14181], [26.69243, 55.16718], [26.68075, 55.19787], [26.72983, 55.21788], [26.73017, 55.24226], [26.835, 55.28182], [26.83266, 55.30444], [26.80929, 55.31642], [26.6714, 55.33902], [26.5709, 55.32572], [26.44937, 55.34832], [26.5522, 55.40277], [26.55094, 55.5093], [26.63167, 55.57887], [26.63231, 55.67968], [26.58248, 55.6754], [26.46661, 55.70375], [26.39561, 55.71156], [26.18509, 55.86813], [26.03815, 55.95884], [25.90047, 56.0013], [25.85893, 56.00188], [25.81773, 56.05444], [25.69246, 56.08892], [25.68588, 56.14725], [25.53621, 56.16663], [25.39751, 56.15707], [25.23099, 56.19147], [25.09325, 56.1878], [25.05762, 56.26742], [24.89005, 56.46666]]]] } },
22748     { type: "Feature", properties: { iso1A2: "LU", iso1A3: "LUX", iso1N3: "442", wikidata: "Q32", nameEn: "Luxembourg", groups: ["EU", "155", "150", "UN"], callingCodes: ["352"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.1379, 50.12964], [6.1137, 50.13668], [6.12028, 50.16374], [6.08577, 50.17246], [6.06406, 50.15344], [6.03093, 50.16362], [6.02488, 50.18283], [5.96453, 50.17259], [5.95929, 50.13295], [5.89488, 50.11476], [5.8857, 50.07824], [5.85474, 50.06342], [5.86904, 50.04614], [5.8551, 50.02683], [5.81866, 50.01286], [5.82331, 49.99662], [5.83968, 49.9892], [5.83467, 49.97823], [5.81163, 49.97142], [5.80833, 49.96451], [5.77291, 49.96056], [5.77314, 49.93646], [5.73621, 49.89796], [5.78415, 49.87922], [5.75269, 49.8711], [5.75861, 49.85631], [5.74567, 49.85368], [5.75884, 49.84811], [5.74953, 49.84709], [5.74975, 49.83933], [5.74076, 49.83823], [5.7404, 49.83452], [5.74844, 49.82435], [5.74364, 49.82058], [5.74953, 49.81428], [5.75409, 49.79239], [5.78871, 49.7962], [5.82245, 49.75048], [5.83149, 49.74729], [5.82562, 49.72395], [5.84193, 49.72161], [5.86503, 49.72739], [5.88677, 49.70951], [5.86527, 49.69291], [5.86175, 49.67862], [5.9069, 49.66377], [5.90164, 49.6511], [5.90599, 49.63853], [5.88552, 49.63507], [5.88393, 49.62802], [5.87609, 49.62047], [5.8762, 49.60898], [5.84826, 49.5969], [5.84971, 49.58674], [5.86986, 49.58756], [5.87256, 49.57539], [5.8424, 49.56082], [5.84692, 49.55663], [5.84143, 49.5533], [5.81838, 49.54777], [5.80871, 49.5425], [5.81664, 49.53775], [5.83648, 49.5425], [5.84466, 49.53027], [5.83467, 49.52717], [5.83389, 49.52152], [5.86571, 49.50015], [5.94128, 49.50034], [5.94224, 49.49608], [5.96876, 49.49053], [5.97693, 49.45513], [6.02648, 49.45451], [6.02743, 49.44845], [6.04176, 49.44801], [6.05553, 49.46663], [6.07887, 49.46399], [6.08373, 49.45594], [6.10072, 49.45268], [6.09845, 49.46351], [6.10325, 49.4707], [6.12346, 49.4735], [6.12814, 49.49365], [6.14321, 49.48796], [6.16115, 49.49297], [6.15366, 49.50226], [6.17386, 49.50934], [6.19543, 49.50536], [6.2409, 49.51408], [6.25029, 49.50609], [6.27875, 49.503], [6.28818, 49.48465], [6.3687, 49.4593], [6.36778, 49.46937], [6.36907, 49.48931], [6.36788, 49.50377], [6.35666, 49.52931], [6.38072, 49.55171], [6.38228, 49.55855], [6.35825, 49.57053], [6.36676, 49.57813], [6.38024, 49.57593], [6.38342, 49.5799], [6.37464, 49.58886], [6.385, 49.59946], [6.39822, 49.60081], [6.41861, 49.61723], [6.4413, 49.65722], [6.43768, 49.66021], [6.42726, 49.66078], [6.42937, 49.66857], [6.44654, 49.67799], [6.46048, 49.69092], [6.48014, 49.69767], [6.49785, 49.71118], [6.50647, 49.71353], [6.5042, 49.71808], [6.49694, 49.72205], [6.49535, 49.72645], [6.50261, 49.72718], [6.51397, 49.72058], [6.51805, 49.72425], [6.50193, 49.73291], [6.50174, 49.75292], [6.51646, 49.75961], [6.51828, 49.76855], [6.51056, 49.77515], [6.51669, 49.78336], [6.50534, 49.78952], [6.52169, 49.79787], [6.53122, 49.80666], [6.52121, 49.81338], [6.51215, 49.80124], [6.50647, 49.80916], [6.48718, 49.81267], [6.47111, 49.82263], [6.45425, 49.81164], [6.44131, 49.81443], [6.42905, 49.81091], [6.42521, 49.81591], [6.40022, 49.82029], [6.36576, 49.85032], [6.34267, 49.84974], [6.33585, 49.83785], [6.32098, 49.83728], [6.32303, 49.85133], [6.30963, 49.87021], [6.29692, 49.86685], [6.28874, 49.87592], [6.26146, 49.88203], [6.23496, 49.89972], [6.22926, 49.92096], [6.21882, 49.92403], [6.22608, 49.929], [6.22094, 49.94955], [6.19856, 49.95053], [6.19089, 49.96991], [6.18045, 49.96611], [6.18554, 49.95622], [6.17872, 49.9537], [6.16466, 49.97086], [6.1701, 49.98518], [6.14147, 49.99563], [6.14948, 50.00908], [6.13806, 50.01056], [6.1295, 50.01849], [6.13273, 50.02019], [6.13794, 50.01466], [6.14666, 50.02207], [6.13044, 50.02929], [6.13458, 50.04141], [6.11274, 50.05916], [6.12055, 50.09171], [6.1379, 50.12964]]]] } },
22749     { type: "Feature", properties: { iso1A2: "LV", iso1A3: "LVA", iso1N3: "428", wikidata: "Q211", nameEn: "Latvia", groups: ["EU", "154", "150", "UN"], callingCodes: ["371"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.34698, 57.52242], [26.90364, 57.62823], [26.54675, 57.51813], [26.46527, 57.56885], [26.29253, 57.59244], [26.1866, 57.6849], [26.2029, 57.7206], [26.08098, 57.76619], [26.0543, 57.76105], [26.03332, 57.7718], [26.02415, 57.76865], [26.02069, 57.77169], [26.0266, 57.77441], [26.027, 57.78158], [26.02456, 57.78342], [26.0324, 57.79037], [26.05949, 57.84744], [25.73499, 57.90193], [25.29581, 58.08288], [25.28237, 57.98539], [25.19484, 58.0831], [24.3579, 57.87471], [24.26221, 57.91787], [23.20055, 57.56697], [22.80496, 57.87798], [19.84909, 57.57876], [19.64795, 57.06466], [20.68447, 56.04073], [21.15016, 56.07818], [21.24644, 56.16917], [21.49736, 56.29106], [21.57888, 56.31406], [21.74558, 56.33181], [22.00548, 56.41508], [22.09728, 56.42851], [22.3361, 56.4016], [22.56441, 56.39305], [22.69354, 56.36284], [22.83048, 56.367], [22.96988, 56.41213], [23.09531, 56.30511], [23.17312, 56.36795], [23.31606, 56.3827], [23.40486, 56.37689], [23.49803, 56.34307], [23.75726, 56.37282], [24.02657, 56.3231], [24.13139, 56.24881], [24.32334, 56.30226], [24.42746, 56.26522], [24.58143, 56.29125], [24.57353, 56.31525], [24.70022, 56.40483], [24.83686, 56.41565], [24.89005, 56.46666], [25.05762, 56.26742], [25.09325, 56.1878], [25.23099, 56.19147], [25.39751, 56.15707], [25.53621, 56.16663], [25.68588, 56.14725], [25.69246, 56.08892], [25.81773, 56.05444], [25.85893, 56.00188], [25.90047, 56.0013], [26.03815, 55.95884], [26.18509, 55.86813], [26.39561, 55.71156], [26.46661, 55.70375], [26.58248, 55.6754], [26.63231, 55.67968], [26.64888, 55.70515], [26.71802, 55.70645], [26.76872, 55.67658], [26.87448, 55.7172], [26.97153, 55.8102], [27.1559, 55.85032], [27.27804, 55.78299], [27.3541, 55.8089], [27.61683, 55.78558], [27.63065, 55.89687], [27.97865, 56.11849], [28.15217, 56.16964], [28.23716, 56.27588], [28.16599, 56.37806], [28.19057, 56.44637], [28.10069, 56.524], [28.13526, 56.57989], [28.04768, 56.59004], [27.86101, 56.88204], [27.66511, 56.83921], [27.86101, 57.29402], [27.52453, 57.42826], [27.56832, 57.53728], [27.34698, 57.52242]]]] } },
22750     { type: "Feature", properties: { iso1A2: "LY", iso1A3: "LBY", iso1N3: "434", wikidata: "Q1016", nameEn: "Libya", groups: ["015", "002", "UN"], callingCodes: ["218"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.92891, 33.39516], [11.58941, 33.36891], [11.55852, 33.1409], [11.51549, 33.09826], [11.46037, 32.6307], [11.57828, 32.48013], [11.53898, 32.4138], [11.04234, 32.2145], [10.7315, 31.97235], [10.62788, 31.96629], [10.48497, 31.72956], [10.31364, 31.72648], [10.12239, 31.42098], [10.29516, 30.90337], [9.88152, 30.34074], [9.76848, 30.34366], [9.55544, 30.23971], [9.3876, 30.16738], [9.78136, 29.40961], [9.89569, 26.57696], [9.51696, 26.39148], [9.38834, 26.19288], [10.03146, 25.35635], [10.02432, 24.98124], [10.33159, 24.5465], [10.85323, 24.5595], [11.41061, 24.21456], [11.62498, 24.26669], [11.96886, 23.51735], [13.5631, 23.16574], [14.22918, 22.61719], [14.99751, 23.00539], [15.99566, 23.49639], [23.99539, 19.49944], [23.99715, 20.00038], [24.99794, 19.99661], [24.99885, 21.99535], [24.99968, 29.24574], [24.71117, 30.17441], [25.01077, 30.73861], [24.8458, 31.39877], [26.92891, 33.39516]]]] } },
22751     { type: "Feature", properties: { iso1A2: "MA", iso1A3: "MAR", iso1N3: "504", wikidata: "Q1028", nameEn: "Morocco", groups: ["015", "002", "UN"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [-5.10878, 36.05227], [-7.2725, 35.73269], [-14.43883, 27.02969], [-17.27295, 21.93519], [-17.21511, 21.34226], [-17.02707, 21.34022], [-16.9978, 21.36239], [-16.44269, 21.39745], [-14.78487, 21.36587], [-14.47329, 21.63839], [-14.48112, 22.00886], [-14.1291, 22.41636], [-14.10361, 22.75501], [-13.75627, 23.77231], [-13.00628, 24.01923], [-12.92147, 24.39502], [-12.12281, 25.13682], [-12.06001, 26.04442], [-11.62052, 26.05229], [-11.38635, 26.611], [-11.23622, 26.72023], [-11.35695, 26.8505], [-10.68417, 26.90984], [-9.81998, 26.71379], [-9.56957, 26.90042], [-9.08698, 26.98639], [-8.71787, 26.9898], [-8.77527, 27.66663], [-8.66879, 27.6666], [-8.6715, 28.71194], [-7.61585, 29.36252], [-6.95824, 29.50924], [-6.78351, 29.44634], [-6.69965, 29.51623], [-5.75616, 29.61407], [-5.72121, 29.52322], [-5.58831, 29.48103], [-5.21671, 29.95253], [-4.6058, 30.28343], [-4.31774, 30.53229], [-3.64735, 30.67539], [-3.65418, 30.85566], [-3.54944, 31.0503], [-3.77103, 31.14984], [-3.77647, 31.31912], [-3.66386, 31.39202], [-3.66314, 31.6339], [-2.82784, 31.79459], [-2.93873, 32.06557], [-2.46166, 32.16603], [-1.22829, 32.07832], [-1.15735, 32.12096], [-1.24453, 32.1917], [-1.24998, 32.32993], [-0.9912, 32.52467], [-1.37794, 32.73628], [-1.54244, 32.95499], [-1.46249, 33.0499], [-1.67067, 33.27084], [-1.59508, 33.59929], [-1.73494, 33.71721], [-1.64666, 34.10405], [-1.78042, 34.39018], [-1.69788, 34.48056], [-1.84569, 34.61907], [-1.73707, 34.74226], [-1.97469, 34.886], [-1.97833, 34.93218], [-2.04734, 34.93218], [-2.21445, 35.04378], [-2.21248, 35.08532], [-2.27707, 35.35051]], [[-2.91909, 35.33927], [-2.92272, 35.27509], [-2.93893, 35.26737], [-2.95065, 35.26576], [-2.95431, 35.2728], [-2.96516, 35.27967], [-2.96826, 35.28296], [-2.96507, 35.28801], [-2.97035, 35.28852], [-2.96978, 35.29459], [-2.96648, 35.30475], [-2.96038, 35.31609], [-2.91909, 35.33927]], [[-3.90602, 35.21494], [-3.89343, 35.22728], [-3.88372, 35.20767], [-3.90602, 35.21494]], [[-4.30191, 35.17419], [-4.29436, 35.17149], [-4.30112, 35.17058], [-4.30191, 35.17419]], [[-2.40316, 35.16893], [-2.45965, 35.16527], [-2.43262, 35.20652], [-2.40316, 35.16893]], [[-5.38491, 35.92591], [-5.21179, 35.90091], [-5.34379, 35.8711], [-5.35844, 35.87375], [-5.37338, 35.88417], [-5.38491, 35.92591]]]] } },
22752     { type: "Feature", properties: { iso1A2: "MC", iso1A3: "MCO", iso1N3: "492", wikidata: "Q235", nameEn: "Monaco", groups: ["155", "150", "UN"], callingCodes: ["377"] }, geometry: { type: "MultiPolygon", coordinates: [[[[7.47823, 43.73341], [7.4379, 43.74963], [7.4389, 43.75151], [7.43708, 43.75197], [7.43624, 43.75014], [7.43013, 43.74895], [7.42809, 43.74396], [7.42443, 43.74087], [7.42299, 43.74176], [7.42062, 43.73977], [7.41233, 43.73439], [7.41298, 43.73311], [7.41291, 43.73168], [7.41113, 43.73156], [7.40903, 43.7296], [7.42422, 43.72209], [7.47823, 43.73341]]]] } },
22753     { type: "Feature", properties: { iso1A2: "MD", iso1A3: "MDA", iso1N3: "498", wikidata: "Q217", nameEn: "Moldova", groups: ["151", "150", "UN"], callingCodes: ["373"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.74422, 48.45926], [27.6658, 48.44034], [27.59027, 48.46311], [27.5889, 48.49224], [27.46942, 48.454], [27.44333, 48.41209], [27.37741, 48.41026], [27.37604, 48.44398], [27.32159, 48.4434], [27.27855, 48.37534], [27.13434, 48.37288], [27.08078, 48.43214], [27.0231, 48.42485], [27.03821, 48.37653], [26.93384, 48.36558], [26.85556, 48.41095], [26.71274, 48.40388], [26.82809, 48.31629], [26.79239, 48.29071], [26.6839, 48.35828], [26.62823, 48.25804], [26.81161, 48.25049], [26.87708, 48.19919], [26.94265, 48.1969], [26.98042, 48.15752], [26.96119, 48.13003], [27.04118, 48.12522], [27.02985, 48.09083], [27.15622, 47.98538], [27.1618, 47.92391], [27.29069, 47.73722], [27.25519, 47.71366], [27.32202, 47.64009], [27.3979, 47.59473], [27.47942, 47.48113], [27.55731, 47.46637], [27.60263, 47.32507], [27.68706, 47.28962], [27.73172, 47.29248], [27.81892, 47.1381], [28.09095, 46.97621], [28.12173, 46.82283], [28.24808, 46.64305], [28.22281, 46.50481], [28.25769, 46.43334], [28.18902, 46.35283], [28.19864, 46.31869], [28.10937, 46.22852], [28.13684, 46.18099], [28.08612, 46.01105], [28.13111, 45.92819], [28.16568, 45.6421], [28.08927, 45.6051], [28.18741, 45.47358], [28.21139, 45.46895], [28.30201, 45.54744], [28.41836, 45.51715], [28.43072, 45.48538], [28.51449, 45.49982], [28.49252, 45.56716], [28.54196, 45.58062], [28.51587, 45.6613], [28.47879, 45.66994], [28.52823, 45.73803], [28.70401, 45.78019], [28.69852, 45.81753], [28.78503, 45.83475], [28.74383, 45.96664], [28.98004, 46.00385], [29.00613, 46.04962], [28.94643, 46.09176], [29.06656, 46.19716], [28.94953, 46.25852], [28.98478, 46.31803], [29.004, 46.31495], [28.9306, 46.45699], [29.01241, 46.46177], [29.02409, 46.49582], [29.23547, 46.55435], [29.24886, 46.37912], [29.35357, 46.49505], [29.49914, 46.45889], [29.5939, 46.35472], [29.6763, 46.36041], [29.66359, 46.4215], [29.74496, 46.45605], [29.88329, 46.35851], [29.94114, 46.40114], [30.09103, 46.38694], [30.16794, 46.40967], [30.02511, 46.45132], [29.88916, 46.54302], [29.94409, 46.56002], [29.9743, 46.75325], [29.94522, 46.80055], [29.98814, 46.82358], [29.87405, 46.88199], [29.75458, 46.8604], [29.72986, 46.92234], [29.57056, 46.94766], [29.62137, 47.05069], [29.61038, 47.09932], [29.53044, 47.07851], [29.49732, 47.12878], [29.57696, 47.13581], [29.54996, 47.24962], [29.59665, 47.25521], [29.5733, 47.36508], [29.48678, 47.36043], [29.47854, 47.30366], [29.39889, 47.30179], [29.3261, 47.44664], [29.18603, 47.43387], [29.11743, 47.55001], [29.22414, 47.60012], [29.22242, 47.73607], [29.27255, 47.79953], [29.20663, 47.80367], [29.27804, 47.88893], [29.19839, 47.89261], [29.1723, 47.99013], [28.9306, 47.96255], [28.8414, 48.03392], [28.85232, 48.12506], [28.69896, 48.13106], [28.53921, 48.17453], [28.48428, 48.0737], [28.42454, 48.12047], [28.43701, 48.15832], [28.38712, 48.17567], [28.34009, 48.13147], [28.30609, 48.14018], [28.30586, 48.1597], [28.34912, 48.1787], [28.36996, 48.20543], [28.35519, 48.24957], [28.32508, 48.23384], [28.2856, 48.23202], [28.19314, 48.20749], [28.17666, 48.25963], [28.07504, 48.23494], [28.09873, 48.3124], [28.04527, 48.32661], [27.95883, 48.32368], [27.88391, 48.36699], [27.87533, 48.4037], [27.81902, 48.41874], [27.79225, 48.44244], [27.74422, 48.45926]]]] } },
22754     { type: "Feature", properties: { iso1A2: "ME", iso1A3: "MNE", iso1N3: "499", wikidata: "Q236", nameEn: "Montenegro", groups: ["039", "150", "UN"], callingCodes: ["382"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.22807, 43.5264], [19.15685, 43.53943], [19.13933, 43.5282], [19.04934, 43.50384], [19.01078, 43.55806], [18.91379, 43.50299], [18.95469, 43.49367], [18.96053, 43.45042], [19.01078, 43.43854], [19.04071, 43.397], [19.08673, 43.31453], [19.08206, 43.29668], [19.04233, 43.30008], [19.00844, 43.24988], [18.95001, 43.29327], [18.95819, 43.32899], [18.90911, 43.36383], [18.83912, 43.34795], [18.84794, 43.33735], [18.85342, 43.32426], [18.76538, 43.29838], [18.6976, 43.25243], [18.71747, 43.2286], [18.66605, 43.2056], [18.64735, 43.14766], [18.66254, 43.03928], [18.52232, 43.01451], [18.49076, 42.95553], [18.49661, 42.89306], [18.4935, 42.86433], [18.47633, 42.85829], [18.45921, 42.81682], [18.47324, 42.74992], [18.56789, 42.72074], [18.55221, 42.69045], [18.54603, 42.69171], [18.54841, 42.68328], [18.57373, 42.64429], [18.52232, 42.62279], [18.55504, 42.58409], [18.53751, 42.57376], [18.49778, 42.58409], [18.43735, 42.55921], [18.44307, 42.51077], [18.43588, 42.48556], [18.52152, 42.42302], [18.54128, 42.39171], [18.45131, 42.21682], [19.26406, 41.74971], [19.37597, 41.84849], [19.37451, 41.8842], [19.33812, 41.90669], [19.34601, 41.95675], [19.37691, 41.96977], [19.36867, 42.02564], [19.37548, 42.06835], [19.40687, 42.10024], [19.28623, 42.17745], [19.42, 42.33019], [19.42352, 42.36546], [19.4836, 42.40831], [19.65972, 42.62774], [19.73244, 42.66299], [19.77375, 42.58517], [19.74731, 42.57422], [19.76549, 42.50237], [19.82333, 42.46581], [19.9324, 42.51699], [20.00842, 42.5109], [20.01834, 42.54622], [20.07761, 42.55582], [20.0969, 42.65559], [20.02915, 42.71147], [20.02088, 42.74789], [20.04898, 42.77701], [20.2539, 42.76245], [20.27869, 42.81945], [20.35692, 42.8335], [20.34528, 42.90676], [20.16415, 42.97177], [20.14896, 42.99058], [20.12325, 42.96237], [20.05431, 42.99571], [20.04729, 43.02732], [19.98887, 43.0538], [19.96549, 43.11098], [19.92576, 43.08539], [19.79255, 43.11951], [19.76918, 43.16044], [19.64063, 43.19027], [19.62661, 43.2286], [19.54598, 43.25158], [19.52962, 43.31623], [19.48171, 43.32644], [19.44315, 43.38846], [19.22229, 43.47926], [19.22807, 43.5264]]]] } },
22755     { type: "Feature", properties: { iso1A2: "MF", iso1A3: "MAF", iso1N3: "663", wikidata: "Q126125", nameEn: "Saint-Martin", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.93924, 18.02904], [-62.62718, 18.26185], [-63.35989, 18.06012], [-63.33064, 17.9615], [-63.13502, 18.05445], [-63.11042, 18.05339], [-63.09686, 18.04608], [-63.07759, 18.04943], [-63.0579, 18.06614], [-63.04039, 18.05619], [-63.02323, 18.05757], [-62.93924, 18.02904]]]] } },
22756     { type: "Feature", properties: { iso1A2: "MG", iso1A3: "MDG", iso1N3: "450", wikidata: "Q1019", nameEn: "Madagascar", aliases: ["RM"], groups: ["014", "202", "002", "UN"], callingCodes: ["261"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.93891, -10.85085], [45.84651, -12.77177], [42.14681, -19.63341], [45.80092, -33.00974], [51.93891, -10.85085]]]] } },
22757     { type: "Feature", properties: { iso1A2: "MH", iso1A3: "MHL", iso1N3: "584", wikidata: "Q709", nameEn: "Marshall Islands", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["692"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [173.53711, 5.70687], [169.29099, 15.77133], [159.04653, 10.59067], [169, 3.9]]]] } },
22758     { type: "Feature", properties: { iso1A2: "MK", iso1A3: "MKD", iso1N3: "807", wikidata: "Q221", nameEn: "North Macedonia", groups: ["039", "150", "UN"], callingCodes: ["389"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.34773, 42.31725], [22.29275, 42.34913], [22.29605, 42.37477], [22.16384, 42.32103], [22.02908, 42.29848], [21.94405, 42.34669], [21.91595, 42.30392], [21.84654, 42.3247], [21.77176, 42.2648], [21.70111, 42.23789], [21.58992, 42.25915], [21.52145, 42.24465], [21.50823, 42.27156], [21.43882, 42.2789], [21.43882, 42.23609], [21.38428, 42.24465], [21.30496, 42.1418], [21.29913, 42.13954], [21.31983, 42.10993], [21.22728, 42.08909], [21.16614, 42.19815], [21.11491, 42.20794], [20.75464, 42.05229], [20.76786, 41.91839], [20.68523, 41.85318], [20.59524, 41.8818], [20.55976, 41.87068], [20.57144, 41.7897], [20.53405, 41.78099], [20.51301, 41.72433], [20.52937, 41.69292], [20.51769, 41.65975], [20.55508, 41.58113], [20.52103, 41.56473], [20.45809, 41.5549], [20.45331, 41.51436], [20.49039, 41.49277], [20.51301, 41.442], [20.55976, 41.4087], [20.52119, 41.34381], [20.49432, 41.33679], [20.51068, 41.2323], [20.59715, 41.13644], [20.58546, 41.11179], [20.59832, 41.09066], [20.63454, 41.0889], [20.65558, 41.08009], [20.71634, 40.91781], [20.73504, 40.9081], [20.81567, 40.89662], [20.83671, 40.92752], [20.94305, 40.92399], [20.97693, 40.90103], [20.97887, 40.85475], [21.15262, 40.85546], [21.21105, 40.8855], [21.25779, 40.86165], [21.35595, 40.87578], [21.41555, 40.9173], [21.53007, 40.90759], [21.57448, 40.86076], [21.69601, 40.9429], [21.7556, 40.92525], [21.91102, 41.04786], [21.90869, 41.09191], [22.06527, 41.15617], [22.1424, 41.12449], [22.17629, 41.15969], [22.26744, 41.16409], [22.42285, 41.11921], [22.5549, 41.13065], [22.58295, 41.11568], [22.62852, 41.14385], [22.65306, 41.18168], [22.71266, 41.13945], [22.74538, 41.16321], [22.76408, 41.32225], [22.81199, 41.3398], [22.93334, 41.34104], [22.96331, 41.35782], [22.95513, 41.63265], [23.03342, 41.71034], [23.01239, 41.76527], [22.96682, 41.77137], [22.90254, 41.87587], [22.86749, 42.02275], [22.67701, 42.06614], [22.51224, 42.15457], [22.50289, 42.19527], [22.47251, 42.20393], [22.38136, 42.30339], [22.34773, 42.31725]]]] } },
22759     { type: "Feature", properties: { iso1A2: "ML", iso1A3: "MLI", iso1N3: "466", wikidata: "Q912", nameEn: "Mali", groups: ["011", "202", "002", "UN"], callingCodes: ["223"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.83423, 24.99935], [-6.57191, 25.0002], [-5.60725, 16.49919], [-5.33435, 16.33354], [-5.50165, 15.50061], [-9.32979, 15.50032], [-9.31106, 15.69412], [-9.33314, 15.7044], [-9.44673, 15.60553], [-9.40447, 15.4396], [-10.71721, 15.4223], [-10.90932, 15.11001], [-11.43483, 15.62339], [-11.70705, 15.51558], [-11.94903, 14.76143], [-12.23936, 14.76324], [-11.93043, 13.84505], [-12.06897, 13.71049], [-11.83345, 13.33333], [-11.63025, 13.39174], [-11.39935, 12.97808], [-11.37536, 12.40788], [-11.50006, 12.17826], [-11.24136, 12.01286], [-10.99758, 12.24634], [-10.80355, 12.1053], [-10.71897, 11.91552], [-10.30604, 12.24634], [-9.714, 12.0226], [-9.63938, 12.18312], [-9.32097, 12.29009], [-9.38067, 12.48446], [-9.13689, 12.50875], [-8.94784, 12.34842], [-8.80854, 11.66715], [-8.40058, 11.37466], [-8.66923, 10.99397], [-8.35083, 11.06234], [-8.2667, 10.91762], [-8.32614, 10.69273], [-8.22711, 10.41722], [-8.10207, 10.44649], [-7.9578, 10.2703], [-7.97971, 10.17117], [-7.92107, 10.15577], [-7.63048, 10.46334], [-7.54462, 10.40921], [-7.52261, 10.4655], [-7.44555, 10.44602], [-7.3707, 10.24677], [-7.13331, 10.24877], [-7.0603, 10.14711], [-7.00966, 10.15794], [-6.97444, 10.21644], [-7.01186, 10.25111], [-6.93921, 10.35291], [-6.68164, 10.35074], [-6.63541, 10.66893], [-6.52974, 10.59104], [-6.42847, 10.5694], [-6.40646, 10.69922], [-6.325, 10.68624], [-6.24795, 10.74248], [-6.1731, 10.46983], [-6.18851, 10.24244], [-5.99478, 10.19694], [-5.78124, 10.43952], [-5.65135, 10.46767], [-5.51058, 10.43177], [-5.46643, 10.56074], [-5.47083, 10.75329], [-5.41579, 10.84628], [-5.49284, 11.07538], [-5.32994, 11.13371], [-5.32553, 11.21578], [-5.25949, 11.24816], [-5.25509, 11.36905], [-5.20665, 11.43811], [-5.22867, 11.60421], [-5.29251, 11.61715], [-5.26389, 11.75728], [-5.40258, 11.8327], [-5.26389, 11.84778], [-5.07897, 11.97918], [-4.72893, 12.01579], [-4.70692, 12.06746], [-4.62987, 12.06531], [-4.62546, 12.13204], [-4.54841, 12.1385], [-4.57703, 12.19875], [-4.41412, 12.31922], [-4.47356, 12.71252], [-4.238, 12.71467], [-4.21819, 12.95722], [-4.34477, 13.12927], [-3.96501, 13.49778], [-3.90558, 13.44375], [-3.96282, 13.38164], [-3.7911, 13.36665], [-3.54454, 13.1781], [-3.4313, 13.1588], [-3.43507, 13.27272], [-3.23599, 13.29035], [-3.28396, 13.5422], [-3.26407, 13.70699], [-2.88189, 13.64921], [-2.90831, 13.81174], [-2.84667, 14.05532], [-2.66175, 14.14713], [-2.47587, 14.29671], [-2.10223, 14.14878], [-1.9992, 14.19011], [-1.97945, 14.47709], [-1.68083, 14.50023], [-1.32166, 14.72774], [-1.05875, 14.7921], [-0.72004, 15.08655], [-0.24673, 15.07805], [0.06588, 14.96961], [0.23859, 15.00135], [0.72632, 14.95898], [0.96711, 14.98275], [1.31275, 15.27978], [3.01806, 15.34571], [3.03134, 15.42221], [3.50368, 15.35934], [4.19893, 16.39923], [4.21787, 17.00118], [4.26762, 17.00432], [4.26651, 19.14224], [3.36082, 18.9745], [3.12501, 19.1366], [3.24648, 19.81703], [1.20992, 20.73533], [1.15698, 21.12843], [-4.83423, 24.99935]]]] } },
22760     { type: "Feature", properties: { iso1A2: "MM", iso1A3: "MMR", iso1N3: "104", wikidata: "Q836", nameEn: "Myanmar", aliases: ["Burma", "BU"], groups: ["035", "142", "UN"], callingCodes: ["95"] }, geometry: { type: "MultiPolygon", coordinates: [[[[92.62187, 21.87037], [92.59775, 21.6092], [92.68152, 21.28454], [92.60187, 21.24615], [92.55105, 21.3856], [92.43158, 21.37025], [92.37939, 21.47764], [92.20087, 21.337], [92.17752, 21.17445], [92.26071, 21.05697], [92.47409, 20.38654], [92.61042, 13.76986], [94.6371, 13.81803], [97.63455, 9.60854], [98.12555, 9.44056], [98.33094, 9.91973], [98.47298, 9.95782], [98.52291, 9.92389], [98.55174, 9.92804], [98.7391, 10.31488], [98.81944, 10.52761], [98.77275, 10.62548], [98.78511, 10.68351], [98.86819, 10.78336], [99.0069, 10.85485], [98.99701, 10.92962], [99.02337, 10.97217], [99.06938, 10.94857], [99.32756, 11.28545], [99.31573, 11.32081], [99.39485, 11.3925], [99.47598, 11.62434], [99.5672, 11.62732], [99.64108, 11.78948], [99.64891, 11.82699], [99.53424, 12.02317], [99.56445, 12.14805], [99.47519, 12.1353], [99.409, 12.60603], [99.29254, 12.68921], [99.18905, 12.84799], [99.18748, 12.9898], [99.10646, 13.05804], [99.12225, 13.19847], [99.20617, 13.20575], [99.16695, 13.72621], [98.97356, 14.04868], [98.56762, 14.37701], [98.24874, 14.83013], [98.18821, 15.13125], [98.22, 15.21327], [98.30446, 15.30667], [98.40522, 15.25268], [98.41906, 15.27103], [98.39351, 15.34177], [98.4866, 15.39154], [98.56027, 15.33471], [98.58598, 15.46821], [98.541, 15.65406], [98.59853, 15.87197], [98.57019, 16.04578], [98.69585, 16.13353], [98.8376, 16.11706], [98.92656, 16.36425], [98.84485, 16.42354], [98.68074, 16.27068], [98.63817, 16.47424], [98.57912, 16.55983], [98.5695, 16.62826], [98.51113, 16.64503], [98.51833, 16.676], [98.51472, 16.68521], [98.51579, 16.69433], [98.51043, 16.70107], [98.49713, 16.69022], [98.50253, 16.7139], [98.46994, 16.73613], [98.53833, 16.81934], [98.49603, 16.8446], [98.52624, 16.89979], [98.39441, 17.06266], [98.34566, 17.04822], [98.10439, 17.33847], [98.11185, 17.36829], [97.91829, 17.54504], [97.76407, 17.71595], [97.66794, 17.88005], [97.73723, 17.97912], [97.60841, 18.23846], [97.64116, 18.29778], [97.56219, 18.33885], [97.50383, 18.26844], [97.34522, 18.54596], [97.36444, 18.57138], [97.5258, 18.4939], [97.76752, 18.58097], [97.73836, 18.88478], [97.66487, 18.9371], [97.73654, 18.9812], [97.73797, 19.04261], [97.83479, 19.09972], [97.84024, 19.22217], [97.78606, 19.26769], [97.84186, 19.29526], [97.78769, 19.39429], [97.88423, 19.5041], [97.84715, 19.55782], [98.04364, 19.65755], [98.03314, 19.80941], [98.13829, 19.78541], [98.24884, 19.67876], [98.51182, 19.71303], [98.56065, 19.67807], [98.83661, 19.80931], [98.98679, 19.7419], [99.0735, 20.10298], [99.20328, 20.12877], [99.416, 20.08614], [99.52943, 20.14811], [99.5569, 20.20676], [99.46077, 20.36198], [99.46008, 20.39673], [99.68255, 20.32077], [99.81096, 20.33687], [99.86383, 20.44371], [99.88211, 20.44488], [99.88451, 20.44596], [99.89168, 20.44548], [99.89301, 20.44311], [99.89692, 20.44789], [99.90499, 20.4487], [99.91616, 20.44986], [99.95721, 20.46301], [100.08404, 20.36626], [100.1957, 20.68247], [100.36375, 20.82783], [100.51079, 20.82194], [100.60112, 20.8347], [100.64628, 20.88279], [100.50974, 20.88574], [100.55281, 21.02796], [100.63578, 21.05639], [100.72716, 21.31786], [100.80173, 21.2934], [101.00234, 21.39612], [101.16198, 21.52808], [101.15156, 21.56129], [101.11744, 21.77659], [100.87265, 21.67396], [100.72143, 21.51898], [100.57861, 21.45637], [100.4811, 21.46148], [100.42892, 21.54325], [100.35201, 21.53176], [100.25863, 21.47043], [100.18447, 21.51898], [100.1625, 21.48704], [100.12542, 21.50365], [100.10757, 21.59945], [100.17486, 21.65306], [100.12679, 21.70539], [100.04956, 21.66843], [99.98654, 21.71064], [99.94003, 21.82782], [99.99084, 21.97053], [99.96612, 22.05965], [99.85351, 22.04183], [99.47585, 22.13345], [99.33166, 22.09656], [99.1552, 22.15874], [99.19176, 22.16983], [99.17318, 22.18025], [99.28771, 22.4105], [99.37972, 22.50188], [99.38247, 22.57544], [99.31243, 22.73893], [99.45654, 22.85726], [99.43537, 22.94086], [99.54218, 22.90014], [99.52214, 23.08218], [99.34127, 23.13099], [99.25741, 23.09025], [99.04601, 23.12215], [99.05975, 23.16382], [98.88597, 23.18656], [98.92515, 23.29535], [98.93958, 23.31414], [98.87573, 23.33038], [98.92104, 23.36946], [98.87683, 23.48995], [98.82877, 23.47908], [98.80294, 23.5345], [98.88396, 23.59555], [98.81775, 23.694], [98.82933, 23.72921], [98.79607, 23.77947], [98.68209, 23.80492], [98.67797, 23.9644], [98.89632, 24.10612], [98.87998, 24.15624], [98.85319, 24.13042], [98.59256, 24.08371], [98.54476, 24.13119], [98.20666, 24.11406], [98.07806, 24.07988], [98.06703, 24.08028], [98.0607, 24.07812], [98.05671, 24.07961], [98.05302, 24.07408], [98.04709, 24.07616], [97.99583, 24.04932], [97.98691, 24.03897], [97.93951, 24.01953], [97.90998, 24.02094], [97.88616, 24.00463], [97.88414, 23.99405], [97.88814, 23.98605], [97.89683, 23.98389], [97.89676, 23.97931], [97.8955, 23.97758], [97.88811, 23.97446], [97.86545, 23.97723], [97.84328, 23.97603], [97.79416, 23.95663], [97.79456, 23.94836], [97.72302, 23.89288], [97.64667, 23.84574], [97.5247, 23.94032], [97.62363, 24.00506], [97.72903, 24.12606], [97.75305, 24.16902], [97.72799, 24.18883], [97.72998, 24.2302], [97.76799, 24.26365], [97.71941, 24.29652], [97.66723, 24.30027], [97.65624, 24.33781], [97.7098, 24.35658], [97.66998, 24.45288], [97.60029, 24.4401], [97.52757, 24.43748], [97.56286, 24.54535], [97.56525, 24.72838], [97.54675, 24.74202], [97.5542, 24.74943], [97.56383, 24.75535], [97.56648, 24.76475], [97.64354, 24.79171], [97.70181, 24.84557], [97.73127, 24.83015], [97.76481, 24.8289], [97.79949, 24.85655], [97.72903, 24.91332], [97.72216, 25.08508], [97.77023, 25.11492], [97.83614, 25.2715], [97.92541, 25.20815], [98.14925, 25.41547], [98.12591, 25.50722], [98.18084, 25.56298], [98.16848, 25.62739], [98.25774, 25.6051], [98.31268, 25.55307], [98.40606, 25.61129], [98.54064, 25.85129], [98.63128, 25.79937], [98.70818, 25.86241], [98.60763, 26.01512], [98.57085, 26.11547], [98.63128, 26.15492], [98.66884, 26.09165], [98.7329, 26.17218], [98.67797, 26.24487], [98.72741, 26.36183], [98.77547, 26.61994], [98.7333, 26.85615], [98.69582, 27.56499], [98.43353, 27.67086], [98.42529, 27.55404], [98.32641, 27.51385], [98.13964, 27.9478], [98.15337, 28.12114], [97.90069, 28.3776], [97.79632, 28.33168], [97.70705, 28.5056], [97.56835, 28.55628], [97.50518, 28.49716], [97.47085, 28.2688], [97.41729, 28.29783], [97.34547, 28.21385], [97.31292, 28.06784], [97.35412, 28.06663], [97.38845, 28.01329], [97.35824, 27.87256], [97.29919, 27.92233], [96.90112, 27.62149], [96.91431, 27.45752], [97.17422, 27.14052], [97.14675, 27.09041], [96.89132, 27.17474], [96.85287, 27.2065], [96.88445, 27.25046], [96.73888, 27.36638], [96.55761, 27.29928], [96.40779, 27.29818], [96.15591, 27.24572], [96.04949, 27.19428], [95.93002, 27.04149], [95.81603, 27.01335], [95.437, 26.7083], [95.30339, 26.65372], [95.23513, 26.68499], [95.05798, 26.45408], [95.12801, 26.38397], [95.11428, 26.1019], [95.18556, 26.07338], [94.80117, 25.49359], [94.68032, 25.47003], [94.57458, 25.20318], [94.74212, 25.13606], [94.73937, 25.00545], [94.60204, 24.70889], [94.5526, 24.70764], [94.50729, 24.59281], [94.45279, 24.56656], [94.32362, 24.27692], [94.30215, 24.23752], [94.14081, 23.83333], [93.92089, 23.95812], [93.80279, 23.92549], [93.75952, 24.0003], [93.62871, 24.00922], [93.50616, 23.94432], [93.46633, 23.97067], [93.41415, 24.07854], [93.34735, 24.10151], [93.32351, 24.04468], [93.36059, 23.93176], [93.3908, 23.92925], [93.3908, 23.7622], [93.43475, 23.68299], [93.38805, 23.4728], [93.39981, 23.38828], [93.38781, 23.36139], [93.36862, 23.35426], [93.38478, 23.13698], [93.2878, 23.00464], [93.12988, 23.05772], [93.134, 22.92498], [93.09417, 22.69459], [93.134, 22.59573], [93.11477, 22.54374], [93.13537, 22.45873], [93.18206, 22.43716], [93.19991, 22.25425], [93.14224, 22.24535], [93.15734, 22.18687], [93.04885, 22.20595], [92.99255, 22.05965], [92.99804, 21.98964], [92.93899, 22.02656], [92.89504, 21.95143], [92.86208, 22.05456], [92.70416, 22.16017], [92.67532, 22.03547], [92.60949, 21.97638], [92.62187, 21.87037]]]] } },
22761     { type: "Feature", properties: { iso1A2: "MN", iso1A3: "MNG", iso1N3: "496", wikidata: "Q711", nameEn: "Mongolia", groups: ["030", "142", "UN"], callingCodes: ["976"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.14032, 51.35566], [101.5044, 51.50467], [101.39085, 51.45753], [100.61116, 51.73028], [99.89203, 51.74903], [99.75578, 51.90108], [99.27888, 51.96876], [98.87768, 52.14563], [98.74142, 51.8637], [98.33222, 51.71832], [98.22053, 51.46579], [98.05257, 51.46696], [97.83305, 51.00248], [98.01472, 50.86652], [97.9693, 50.78044], [98.06393, 50.61262], [98.31373, 50.4996], [98.29481, 50.33561], [97.85197, 49.91339], [97.76871, 49.99861], [97.56432, 49.92801], [97.56811, 49.84265], [97.24639, 49.74737], [96.97388, 49.88413], [95.80056, 50.04239], [95.74757, 49.97915], [95.02465, 49.96941], [94.97166, 50.04725], [94.6121, 50.04239], [94.49477, 50.17832], [94.39258, 50.22193], [94.30823, 50.57498], [92.99595, 50.63183], [93.01109, 50.79001], [92.44714, 50.78762], [92.07173, 50.69585], [91.86048, 50.73734], [89.59711, 49.90851], [89.70687, 49.72535], [88.82499, 49.44808], [88.42449, 49.48821], [88.17223, 49.46934], [88.15543, 49.30314], [87.98977, 49.18147], [87.81333, 49.17354], [87.88171, 48.95853], [87.73822, 48.89582], [88.0788, 48.71436], [87.96361, 48.58478], [88.58939, 48.34531], [88.58316, 48.21893], [88.8011, 48.11302], [88.93186, 48.10263], [89.0711, 47.98528], [89.55453, 48.0423], [89.76624, 47.82745], [90.06512, 47.88177], [90.10871, 47.7375], [90.33598, 47.68303], [90.48854, 47.41826], [90.48542, 47.30438], [90.76108, 46.99399], [90.84035, 46.99525], [91.03649, 46.72916], [91.0147, 46.58171], [91.07696, 46.57315], [90.89639, 46.30711], [90.99672, 46.14207], [91.03026, 46.04194], [90.70907, 45.73437], [90.65114, 45.49314], [90.89169, 45.19667], [91.64048, 45.07408], [93.51161, 44.95964], [94.10003, 44.71016], [94.71959, 44.35284], [95.01191, 44.25274], [95.39772, 44.2805], [95.32891, 44.02407], [95.52594, 43.99353], [95.89543, 43.2528], [96.35658, 42.90363], [96.37926, 42.72055], [97.1777, 42.7964], [99.50671, 42.56535], [100.33297, 42.68231], [100.84979, 42.67087], [101.80515, 42.50074], [102.07645, 42.22519], [102.72403, 42.14675], [103.92804, 41.78246], [104.52258, 41.8706], [104.51667, 41.66113], [105.0123, 41.63188], [106.76517, 42.28741], [107.24774, 42.36107], [107.29755, 42.41395], [107.49681, 42.46221], [107.57258, 42.40898], [108.84489, 42.40246], [109.00679, 42.45302], [109.452, 42.44842], [109.89402, 42.63111], [110.08401, 42.6411], [110.4327, 42.78293], [111.0149, 43.3289], [111.59087, 43.51207], [111.79758, 43.6637], [111.93776, 43.68709], [111.96289, 43.81596], [111.40498, 44.3461], [111.76275, 44.98032], [111.98695, 45.09074], [112.4164, 45.06858], [112.74662, 44.86297], [113.70918, 44.72891], [114.5166, 45.27189], [114.54801, 45.38337], [114.74612, 45.43585], [114.94546, 45.37377], [115.60329, 45.44717], [116.16989, 45.68603], [116.27366, 45.78637], [116.24012, 45.8778], [116.26678, 45.96479], [116.58612, 46.30211], [116.75551, 46.33083], [116.83166, 46.38637], [117.36609, 46.36335], [117.41782, 46.57862], [117.60748, 46.59771], [117.69554, 46.50991], [118.30534, 46.73519], [118.78747, 46.68689], [118.8337, 46.77742], [118.89974, 46.77139], [118.92616, 46.72765], [119.00541, 46.74273], [119.10448, 46.65516], [119.24978, 46.64761], [119.32827, 46.61433], [119.42827, 46.63783], [119.65265, 46.62342], [119.68127, 46.59015], [119.77373, 46.62947], [119.80455, 46.67631], [119.89261, 46.66423], [119.91242, 46.90091], [119.85518, 46.92196], [119.71209, 47.19192], [119.62403, 47.24575], [119.56019, 47.24874], [119.54918, 47.29505], [119.31964, 47.42617], [119.35892, 47.48104], [119.13995, 47.53997], [119.12343, 47.66458], [118.7564, 47.76947], [118.55766, 47.99277], [118.29654, 48.00246], [118.22677, 48.03853], [118.11009, 48.04], [118.03676, 48.00982], [117.80196, 48.01661], [117.50181, 47.77216], [117.37875, 47.63627], [116.9723, 47.87285], [116.67405, 47.89039], [116.4465, 47.83662], [116.21879, 47.88505], [115.94296, 47.67741], [115.57128, 47.91988], [115.52082, 48.15367], [115.811, 48.25699], [115.78876, 48.51781], [116.06565, 48.81716], [116.03781, 48.87014], [116.71193, 49.83813], [116.62502, 49.92919], [116.22402, 50.04477], [115.73602, 49.87688], [115.26068, 49.97367], [114.9703, 50.19254], [114.325, 50.28098], [113.20216, 49.83356], [113.02647, 49.60772], [110.64493, 49.1816], [110.39891, 49.25083], [110.24373, 49.16676], [109.51325, 49.22859], [109.18017, 49.34709], [108.53969, 49.32325], [108.27937, 49.53167], [107.95387, 49.66659], [107.96116, 49.93191], [107.36407, 49.97612], [107.1174, 50.04239], [107.00007, 50.1977], [106.80326, 50.30177], [106.58373, 50.34044], [106.51122, 50.34408], [106.49628, 50.32436], [106.47156, 50.31909], [106.07865, 50.33474], [106.05562, 50.40582], [105.32528, 50.4648], [103.70343, 50.13952], [102.71178, 50.38873], [102.32194, 50.67982], [102.14032, 51.35566]]]] } },
22762     { type: "Feature", properties: { iso1A2: "MO", iso1A3: "MAC", iso1N3: "446", wikidata: "Q14773", nameEn: "Macau", aliases: ["Macao"], country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["853"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.54942, 22.14519], [113.54839, 22.10909], [113.57191, 22.07696], [113.63011, 22.10782], [113.60504, 22.20464], [113.57123, 22.20416], [113.56865, 22.20973], [113.5508, 22.21672], [113.54333, 22.21688], [113.54093, 22.21314], [113.53593, 22.2137], [113.53301, 22.21235], [113.53552, 22.20607], [113.52659, 22.18271], [113.54093, 22.15497], [113.54942, 22.14519]]]] } },
22763     { type: "Feature", properties: { iso1A2: "MP", iso1A3: "MNP", iso1N3: "580", wikidata: "Q16644", nameEn: "Northern Mariana Islands", aliases: ["US-MP"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.52896, 14.32623], [152.19114, 13.63487], [145.05972, 21.28731], [135.52896, 14.32623]]]] } },
22764     { type: "Feature", properties: { iso1A2: "MQ", iso1A3: "MTQ", iso1N3: "474", wikidata: "Q17054", nameEn: "Martinique", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["596"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.07821, 15.25109], [-61.69315, 14.26451], [-59.95997, 14.20285]]]] } },
22765     { type: "Feature", properties: { iso1A2: "MR", iso1A3: "MRT", iso1N3: "478", wikidata: "Q1025", nameEn: "Mauritania", groups: ["011", "202", "002", "UN"], callingCodes: ["222"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.60725, 16.49919], [-6.57191, 25.0002], [-4.83423, 24.99935], [-8.66674, 27.31569], [-8.66721, 25.99918], [-12.0002, 25.9986], [-12.00251, 23.4538], [-12.14969, 23.41935], [-12.36213, 23.3187], [-12.5741, 23.28975], [-13.00412, 23.02297], [-13.10753, 22.89493], [-13.15313, 22.75649], [-13.08438, 22.53866], [-13.01525, 21.33343], [-16.95474, 21.33997], [-16.99806, 21.12142], [-17.0357, 21.05368], [-17.0396, 20.9961], [-17.06781, 20.92697], [-17.0695, 20.85742], [-17.0471, 20.76408], [-17.15288, 16.07139], [-16.50854, 16.09032], [-16.48967, 16.0496], [-16.44814, 16.09753], [-16.4429, 16.20605], [-16.27016, 16.51565], [-15.6509, 16.50315], [-15.00557, 16.64997], [-14.32144, 16.61495], [-13.80075, 16.13961], [-13.43135, 16.09022], [-13.11029, 15.52116], [-12.23936, 14.76324], [-11.94903, 14.76143], [-11.70705, 15.51558], [-11.43483, 15.62339], [-10.90932, 15.11001], [-10.71721, 15.4223], [-9.40447, 15.4396], [-9.44673, 15.60553], [-9.33314, 15.7044], [-9.31106, 15.69412], [-9.32979, 15.50032], [-5.50165, 15.50061], [-5.33435, 16.33354], [-5.60725, 16.49919]]]] } },
22766     { type: "Feature", properties: { iso1A2: "MS", iso1A3: "MSR", iso1N3: "500", wikidata: "Q13353", nameEn: "Montserrat", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 664"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.91508, 16.51165], [-62.1023, 16.97277], [-62.58307, 16.68909], [-61.91508, 16.51165]]]] } },
22767     { type: "Feature", properties: { iso1A2: "MT", iso1A3: "MLT", iso1N3: "470", wikidata: "Q233", nameEn: "Malta", groups: ["EU", "039", "150", "UN"], driveSide: "left", callingCodes: ["356"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.70991, 35.79901], [14.07544, 36.41525], [13.27636, 35.20764], [15.70991, 35.79901]]]] } },
22768     { type: "Feature", properties: { iso1A2: "MU", iso1A3: "MUS", iso1N3: "480", wikidata: "Q1027", nameEn: "Mauritius", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["230"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.09755, -9.55401], [57.50644, -31.92637], [68.4673, -19.15185], [56.09755, -9.55401]]]] } },
22769     { type: "Feature", properties: { iso1A2: "MV", iso1A3: "MDV", iso1N3: "462", wikidata: "Q826", nameEn: "Maldives", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["960"] }, geometry: { type: "MultiPolygon", coordinates: [[[[71.9161, 8.55531], [72.57428, -3.7623], [76.59015, 5.591], [71.9161, 8.55531]]]] } },
22770     { type: "Feature", properties: { iso1A2: "MW", iso1A3: "MWI", iso1N3: "454", wikidata: "Q1020", nameEn: "Malawi", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["265"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.48052, -9.62442], [33.31581, -9.48554], [33.14925, -9.49322], [32.99397, -9.36712], [32.95389, -9.40138], [33.00476, -9.5133], [33.00256, -9.63053], [33.05485, -9.61316], [33.10163, -9.66525], [33.12144, -9.58929], [33.2095, -9.61099], [33.31517, -9.82364], [33.36581, -9.81063], [33.37902, -9.9104], [33.31297, -10.05133], [33.53863, -10.20148], [33.54797, -10.36077], [33.70675, -10.56896], [33.47636, -10.78465], [33.28022, -10.84428], [33.25998, -10.88862], [33.39697, -11.15296], [33.29267, -11.3789], [33.29267, -11.43536], [33.23663, -11.40637], [33.24252, -11.59302], [33.32692, -11.59248], [33.33937, -11.91252], [33.25998, -12.14242], [33.3705, -12.34931], [33.47636, -12.32498], [33.54485, -12.35996], [33.37517, -12.54085], [33.28177, -12.54692], [33.18837, -12.61377], [33.05917, -12.59554], [32.94397, -12.76868], [32.96733, -12.88251], [33.02181, -12.88707], [32.98289, -13.12671], [33.0078, -13.19492], [32.86113, -13.47292], [32.84176, -13.52794], [32.73683, -13.57682], [32.68436, -13.55769], [32.66468, -13.60019], [32.68654, -13.64268], [32.7828, -13.64805], [32.84528, -13.71576], [32.76962, -13.77224], [32.79015, -13.80755], [32.88985, -13.82956], [32.99042, -13.95689], [33.02977, -14.05022], [33.07568, -13.98447], [33.16749, -13.93992], [33.24249, -14.00019], [33.66677, -14.61306], [33.7247, -14.4989], [33.88503, -14.51652], [33.92898, -14.47929], [34.08588, -14.48893], [34.18733, -14.43823], [34.22355, -14.43607], [34.34453, -14.3985], [34.35843, -14.38652], [34.39277, -14.39467], [34.4192, -14.43191], [34.44641, -14.47746], [34.45053, -14.49873], [34.47628, -14.53363], [34.48932, -14.53646], [34.49636, -14.55091], [34.52366, -14.5667], [34.53962, -14.59776], [34.55112, -14.64494], [34.53516, -14.67782], [34.52057, -14.68263], [34.54503, -14.74672], [34.567, -14.77345], [34.61522, -14.99583], [34.57503, -15.30619], [34.43126, -15.44778], [34.44981, -15.60864], [34.25195, -15.90321], [34.43126, -16.04737], [34.40344, -16.20923], [35.04805, -16.83167], [35.13771, -16.81687], [35.17017, -16.93521], [35.04805, -17.00027], [35.0923, -17.13235], [35.3062, -17.1244], [35.27065, -16.93817], [35.30929, -16.82871], [35.27219, -16.69402], [35.14235, -16.56812], [35.25828, -16.4792], [35.30157, -16.2211], [35.43355, -16.11371], [35.52365, -16.15414], [35.70107, -16.10147], [35.80487, -16.03907], [35.85303, -15.41913], [35.78799, -15.17428], [35.91812, -14.89514], [35.87212, -14.89478], [35.86945, -14.67481], [35.5299, -14.27714], [35.47989, -14.15594], [34.86229, -13.48958], [34.60253, -13.48487], [34.37831, -12.17408], [34.46088, -12.0174], [34.70739, -12.15652], [34.82903, -12.04837], [34.57917, -11.87849], [34.64241, -11.57499], [34.96296, -11.57354], [34.91153, -11.39799], [34.79375, -11.32245], [34.63305, -11.11731], [34.61161, -11.01611], [34.67047, -10.93796], [34.65946, -10.6828], [34.57581, -10.56271], [34.51911, -10.12279], [34.54499, -10.0678], [34.03865, -9.49398], [33.95829, -9.54066], [33.9638, -9.62206], [33.93298, -9.71647], [33.76677, -9.58516], [33.48052, -9.62442]]]] } },
22771     { type: "Feature", properties: { iso1A2: "MX", iso1A3: "MEX", iso1N3: "484", wikidata: "Q96", nameEn: "Mexico", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["52"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-117.1243, 32.53427], [-118.48109, 32.5991], [-120.12904, 18.41089], [-92.37213, 14.39277], [-92.2261, 14.53423], [-92.1454, 14.6804], [-92.18161, 14.84147], [-92.1423, 14.88647], [-92.1454, 14.98143], [-92.0621, 15.07406], [-92.20983, 15.26077], [-91.73182, 16.07371], [-90.44567, 16.07573], [-90.40499, 16.40524], [-90.61212, 16.49832], [-90.69064, 16.70697], [-91.04436, 16.92175], [-91.43809, 17.25373], [-90.99199, 17.25192], [-90.98678, 17.81655], [-89.14985, 17.81563], [-89.15105, 17.95104], [-89.03839, 18.0067], [-88.8716, 17.89535], [-88.71505, 18.0707], [-88.48242, 18.49164], [-88.3268, 18.49048], [-88.29909, 18.47591], [-88.26593, 18.47617], [-88.03238, 18.41778], [-88.03165, 18.16657], [-87.90671, 18.15213], [-87.87604, 18.18313], [-87.86657, 18.19971], [-87.85693, 18.18266], [-87.84815, 18.18511], [-86.92368, 17.61462], [-85.9092, 21.8218], [-96.92418, 25.97377], [-97.13927, 25.96583], [-97.35946, 25.92189], [-97.37332, 25.83854], [-97.42511, 25.83969], [-97.45669, 25.86874], [-97.49828, 25.89877], [-97.52025, 25.88518], [-97.66511, 26.01708], [-97.95155, 26.0625], [-97.97017, 26.05232], [-98.24603, 26.07191], [-98.27075, 26.09457], [-98.30491, 26.10475], [-98.35126, 26.15129], [-99.00546, 26.3925], [-99.03053, 26.41249], [-99.08477, 26.39849], [-99.53573, 27.30926], [-99.49744, 27.43746], [-99.482, 27.47128], [-99.48045, 27.49016], [-99.50208, 27.50021], [-99.52955, 27.49747], [-99.51478, 27.55836], [-99.55409, 27.61314], [-100.50029, 28.66117], [-100.51222, 28.70679], [-100.5075, 28.74066], [-100.52313, 28.75598], [-100.59809, 28.88197], [-100.63689, 28.90812], [-100.67294, 29.09744], [-100.79696, 29.24688], [-100.87982, 29.296], [-100.94056, 29.33371], [-100.94579, 29.34523], [-100.96725, 29.3477], [-101.01128, 29.36947], [-101.05686, 29.44738], [-101.47277, 29.7744], [-102.60596, 29.8192], [-103.15787, 28.93865], [-104.37752, 29.54255], [-104.39363, 29.55396], [-104.3969, 29.57105], [-104.5171, 29.64671], [-104.77674, 30.4236], [-106.00363, 31.39181], [-106.09025, 31.40569], [-106.20346, 31.46305], [-106.23711, 31.51262], [-106.24612, 31.54193], [-106.28084, 31.56173], [-106.30305, 31.62154], [-106.33419, 31.66303], [-106.34864, 31.69663], [-106.3718, 31.71165], [-106.38003, 31.73151], [-106.41773, 31.75196], [-106.43419, 31.75478], [-106.45244, 31.76523], [-106.46726, 31.75998], [-106.47298, 31.75054], [-106.48815, 31.74769], [-106.50111, 31.75714], [-106.50962, 31.76155], [-106.51251, 31.76922], [-106.52266, 31.77509], [-106.529, 31.784], [-108.20899, 31.78534], [-108.20979, 31.33316], [-111.07523, 31.33232], [-114.82011, 32.49609], [-114.79524, 32.55731], [-114.81141, 32.55543], [-114.80584, 32.62028], [-114.76736, 32.64094], [-114.71871, 32.71894], [-115.88053, 32.63624], [-117.1243, 32.53427]]]] } },
22772     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
22773     { type: "Feature", properties: { iso1A2: "MZ", iso1A3: "MOZ", iso1N3: "508", wikidata: "Q1029", nameEn: "Mozambique", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["258"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.74206, -10.25691], [40.44265, -10.4618], [40.00295, -10.80255], [39.58249, -10.96043], [39.24395, -11.17433], [38.88996, -11.16978], [38.47258, -11.4199], [38.21598, -11.27289], [37.93618, -11.26228], [37.8388, -11.3123], [37.76614, -11.53352], [37.3936, -11.68949], [36.80309, -11.56836], [36.62068, -11.72884], [36.19094, -11.70008], [36.19094, -11.57593], [35.82767, -11.41081], [35.63599, -11.55927], [34.96296, -11.57354], [34.64241, -11.57499], [34.57917, -11.87849], [34.82903, -12.04837], [34.70739, -12.15652], [34.46088, -12.0174], [34.37831, -12.17408], [34.60253, -13.48487], [34.86229, -13.48958], [35.47989, -14.15594], [35.5299, -14.27714], [35.86945, -14.67481], [35.87212, -14.89478], [35.91812, -14.89514], [35.78799, -15.17428], [35.85303, -15.41913], [35.80487, -16.03907], [35.70107, -16.10147], [35.52365, -16.15414], [35.43355, -16.11371], [35.30157, -16.2211], [35.25828, -16.4792], [35.14235, -16.56812], [35.27219, -16.69402], [35.30929, -16.82871], [35.27065, -16.93817], [35.3062, -17.1244], [35.0923, -17.13235], [35.04805, -17.00027], [35.17017, -16.93521], [35.13771, -16.81687], [35.04805, -16.83167], [34.40344, -16.20923], [34.43126, -16.04737], [34.25195, -15.90321], [34.44981, -15.60864], [34.43126, -15.44778], [34.57503, -15.30619], [34.61522, -14.99583], [34.567, -14.77345], [34.54503, -14.74672], [34.52057, -14.68263], [34.53516, -14.67782], [34.55112, -14.64494], [34.53962, -14.59776], [34.52366, -14.5667], [34.49636, -14.55091], [34.48932, -14.53646], [34.47628, -14.53363], [34.45053, -14.49873], [34.44641, -14.47746], [34.4192, -14.43191], [34.39277, -14.39467], [34.35843, -14.38652], [34.34453, -14.3985], [34.22355, -14.43607], [34.18733, -14.43823], [34.08588, -14.48893], [33.92898, -14.47929], [33.88503, -14.51652], [33.7247, -14.4989], [33.66677, -14.61306], [33.24249, -14.00019], [30.22098, -14.99447], [30.41902, -15.62269], [30.42568, -15.9962], [30.91597, -15.99924], [30.97761, -16.05848], [31.13171, -15.98019], [31.30563, -16.01193], [31.42451, -16.15154], [31.67988, -16.19595], [31.90223, -16.34388], [31.91324, -16.41569], [32.02772, -16.43892], [32.28529, -16.43892], [32.42838, -16.4727], [32.71017, -16.59932], [32.69917, -16.66893], [32.78943, -16.70267], [32.97655, -16.70689], [32.91051, -16.89446], [32.84113, -16.92259], [32.96554, -17.11971], [33.00517, -17.30477], [33.0426, -17.3468], [32.96554, -17.48964], [32.98536, -17.55891], [33.0492, -17.60298], [32.94133, -17.99705], [33.03159, -18.35054], [33.02278, -18.4696], [32.88629, -18.51344], [32.88629, -18.58023], [32.95013, -18.69079], [32.9017, -18.7992], [32.82465, -18.77419], [32.70137, -18.84712], [32.73439, -18.92628], [32.69917, -18.94293], [32.72118, -19.02204], [32.84006, -19.0262], [32.87088, -19.09279], [32.85107, -19.29238], [32.77966, -19.36098], [32.78282, -19.47513], [32.84446, -19.48343], [32.84666, -19.68462], [32.95013, -19.67219], [33.06461, -19.77787], [33.01178, -20.02007], [32.93032, -20.03868], [32.85987, -20.16686], [32.85987, -20.27841], [32.66174, -20.56106], [32.55167, -20.56312], [32.48122, -20.63319], [32.51644, -20.91929], [32.37115, -21.133], [32.48236, -21.32873], [32.41234, -21.31246], [31.38336, -22.36919], [31.30611, -22.422], [31.55779, -23.176], [31.56539, -23.47268], [31.67942, -23.60858], [31.70223, -23.72695], [31.77445, -23.90082], [31.87707, -23.95293], [31.90368, -24.18892], [31.9835, -24.29983], [32.03196, -25.10785], [32.01676, -25.38117], [31.97875, -25.46356], [32.00631, -25.65044], [31.92649, -25.84216], [31.974, -25.95387], [32.00916, -25.999], [32.08599, -26.00978], [32.10435, -26.15656], [32.07352, -26.40185], [32.13409, -26.5317], [32.13315, -26.84345], [32.19409, -26.84032], [32.22302, -26.84136], [32.29584, -26.852], [32.35222, -26.86027], [34.51034, -26.91792], [42.99868, -12.65261], [40.74206, -10.25691]]]] } },
22774     { type: "Feature", properties: { iso1A2: "NA", iso1A3: "NAM", iso1N3: "516", wikidata: "Q1030", nameEn: "Namibia", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.28743, -17.38814], [13.95896, -17.43141], [13.36212, -16.98048], [12.97145, -16.98567], [12.52111, -17.24495], [12.07076, -17.15165], [11.75063, -17.25013], [10.5065, -17.25284], [12.51595, -32.27486], [16.45332, -28.63117], [16.46592, -28.57126], [16.59922, -28.53246], [16.90446, -28.057], [17.15405, -28.08573], [17.4579, -28.68718], [18.99885, -28.89165], [19.99882, -28.42622], [19.99817, -24.76768], [19.99912, -21.99991], [20.99751, -22.00026], [20.99904, -18.31743], [21.45556, -18.31795], [23.0996, -18.00075], [23.29618, -17.99855], [23.61088, -18.4881], [24.19416, -18.01919], [24.40577, -17.95726], [24.57485, -18.07151], [24.6303, -17.9863], [24.71887, -17.9218], [24.73364, -17.89338], [24.95586, -17.79674], [25.05895, -17.84452], [25.16882, -17.78253], [25.26433, -17.79571], [25.00198, -17.58221], [24.70864, -17.49501], [24.5621, -17.52963], [24.38712, -17.46818], [24.32811, -17.49082], [24.23619, -17.47489], [23.47474, -17.62877], [21.42741, -18.02787], [21.14283, -17.94318], [18.84226, -17.80375], [18.39229, -17.38927], [14.28743, -17.38814]]]] } },
22775     { type: "Feature", properties: { iso1A2: "NC", iso1A3: "NCL", iso1N3: "540", wikidata: "Q33788", nameEn: "New Caledonia", country: "FR", groups: ["EU", "Q1451600", "054", "009", "UN"], callingCodes: ["687"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [174.245, -23.1974], [156.73836, -14.50464], [159.77159, -28.41151]]]] } },
22776     { type: "Feature", properties: { iso1A2: "NE", iso1A3: "NER", iso1N3: "562", wikidata: "Q1032", nameEn: "Niger", aliases: ["RN"], groups: ["011", "202", "002", "UN"], callingCodes: ["227"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.22918, 22.61719], [13.5631, 23.16574], [11.96886, 23.51735], [7.48273, 20.87258], [7.38361, 20.79165], [5.8153, 19.45101], [4.26651, 19.14224], [4.26762, 17.00432], [4.21787, 17.00118], [4.19893, 16.39923], [3.50368, 15.35934], [3.03134, 15.42221], [3.01806, 15.34571], [1.31275, 15.27978], [0.96711, 14.98275], [0.72632, 14.95898], [0.23859, 15.00135], [0.16936, 14.51654], [0.38051, 14.05575], [0.61924, 13.68491], [0.77377, 13.6866], [0.77637, 13.64442], [0.99514, 13.5668], [1.02813, 13.46635], [1.20088, 13.38951], [1.24429, 13.39373], [1.28509, 13.35488], [1.24516, 13.33968], [1.21217, 13.37853], [1.18873, 13.31771], [0.99253, 13.37515], [0.99167, 13.10727], [2.26349, 12.41915], [2.05785, 12.35539], [2.39723, 11.89473], [2.45824, 11.98672], [2.39657, 12.10952], [2.37783, 12.24804], [2.6593, 12.30631], [2.83978, 12.40585], [3.25352, 12.01467], [3.31613, 11.88495], [3.48187, 11.86092], [3.59375, 11.70269], [3.61075, 11.69181], [3.67988, 11.75429], [3.67122, 11.80865], [3.63063, 11.83042], [3.61955, 11.91847], [3.67775, 11.97599], [3.63136, 12.11826], [3.66364, 12.25884], [3.65111, 12.52223], [3.94339, 12.74979], [4.10006, 12.98862], [4.14367, 13.17189], [4.14186, 13.47586], [4.23456, 13.47725], [4.4668, 13.68286], [4.87425, 13.78], [4.9368, 13.7345], [5.07396, 13.75052], [5.21026, 13.73627], [5.27797, 13.75474], [5.35437, 13.83567], [5.52957, 13.8845], [6.15771, 13.64564], [6.27411, 13.67835], [6.43053, 13.6006], [6.69617, 13.34057], [6.94445, 12.99825], [7.0521, 13.00076], [7.12676, 13.02445], [7.22399, 13.1293], [7.39241, 13.09717], [7.81085, 13.34902], [8.07997, 13.30847], [8.25185, 13.20369], [8.41853, 13.06166], [8.49493, 13.07519], [8.60431, 13.01768], [8.64251, 12.93985], [8.97413, 12.83661], [9.65995, 12.80614], [10.00373, 13.18171], [10.19993, 13.27129], [10.46731, 13.28819], [10.66004, 13.36422], [11.4535, 13.37773], [11.88236, 13.2527], [12.04209, 13.14452], [12.16189, 13.10056], [12.19315, 13.12423], [12.47095, 13.06673], [12.58033, 13.27805], [12.6793, 13.29157], [12.87376, 13.48919], [13.05085, 13.53984], [13.19844, 13.52802], [13.33213, 13.71195], [13.6302, 13.71094], [13.47559, 14.40881], [13.48259, 14.46704], [13.68573, 14.55276], [13.67878, 14.64013], [13.809, 14.72915], [13.78991, 14.87519], [13.86301, 15.04043], [14.37425, 15.72591], [15.50373, 16.89649], [15.6032, 18.77402], [15.75098, 19.93002], [15.99632, 20.35364], [15.6721, 20.70069], [15.59841, 20.74039], [15.56004, 20.79488], [15.55382, 20.86507], [15.57248, 20.92138], [15.62515, 20.95395], [15.28332, 21.44557], [15.20213, 21.49365], [15.19692, 21.99339], [14.99751, 23.00539], [14.22918, 22.61719]]]] } },
22777     { type: "Feature", properties: { iso1A2: "NF", iso1A3: "NFK", iso1N3: "574", wikidata: "Q31057", nameEn: "Norfolk Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["672 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.82316, -28.16667], [166.29505, -28.29175], [167.94076, -30.60745], [169.82316, -28.16667]]]] } },
22778     { type: "Feature", properties: { iso1A2: "NG", iso1A3: "NGA", iso1N3: "566", wikidata: "Q1033", nameEn: "Nigeria", groups: ["011", "202", "002", "UN"], callingCodes: ["234"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.15771, 13.64564], [5.52957, 13.8845], [5.35437, 13.83567], [5.27797, 13.75474], [5.21026, 13.73627], [5.07396, 13.75052], [4.9368, 13.7345], [4.87425, 13.78], [4.4668, 13.68286], [4.23456, 13.47725], [4.14186, 13.47586], [4.14367, 13.17189], [4.10006, 12.98862], [3.94339, 12.74979], [3.65111, 12.52223], [3.66364, 12.25884], [3.63136, 12.11826], [3.67775, 11.97599], [3.61955, 11.91847], [3.63063, 11.83042], [3.67122, 11.80865], [3.67988, 11.75429], [3.61075, 11.69181], [3.59375, 11.70269], [3.49175, 11.29765], [3.71505, 11.13015], [3.84243, 10.59316], [3.78292, 10.40538], [3.6844, 10.46351], [3.57275, 10.27185], [3.66908, 10.18136], [3.54429, 9.87739], [3.35383, 9.83641], [3.32099, 9.78032], [3.34726, 9.70696], [3.25093, 9.61632], [3.13928, 9.47167], [3.14147, 9.28375], [3.08017, 9.10006], [2.77907, 9.06924], [2.67523, 7.87825], [2.73095, 7.7755], [2.73405, 7.5423], [2.78668, 7.5116], [2.79442, 7.43486], [2.74489, 7.42565], [2.76965, 7.13543], [2.71702, 6.95722], [2.74024, 6.92802], [2.73405, 6.78508], [2.78823, 6.76356], [2.78204, 6.70514], [2.7325, 6.64057], [2.74334, 6.57291], [2.70464, 6.50831], [2.70566, 6.38038], [2.74181, 6.13349], [5.87055, 3.78489], [8.34397, 4.30689], [8.60302, 4.87353], [8.78027, 5.1243], [8.92029, 5.58403], [8.83687, 5.68483], [8.88156, 5.78857], [8.84209, 5.82562], [9.51757, 6.43874], [9.70674, 6.51717], [9.77824, 6.79088], [9.86314, 6.77756], [10.15135, 7.03781], [10.21466, 6.88996], [10.53639, 6.93432], [10.57214, 7.16345], [10.59746, 7.14719], [10.60789, 7.06885], [10.83727, 6.9358], [10.8179, 6.83377], [10.94302, 6.69325], [11.09644, 6.68437], [11.09495, 6.51717], [11.42041, 6.53789], [11.42264, 6.5882], [11.51499, 6.60892], [11.57755, 6.74059], [11.55818, 6.86186], [11.63117, 6.9905], [11.87396, 7.09398], [11.84864, 7.26098], [11.93205, 7.47812], [12.01844, 7.52981], [11.99908, 7.67302], [12.20909, 7.97553], [12.19271, 8.10826], [12.24782, 8.17904], [12.26123, 8.43696], [12.4489, 8.52536], [12.44146, 8.6152], [12.68722, 8.65938], [12.71701, 8.7595], [12.79, 8.75361], [12.81085, 8.91992], [12.90022, 9.11411], [12.91958, 9.33905], [12.85628, 9.36698], [13.02385, 9.49334], [13.22642, 9.57266], [13.25472, 9.76795], [13.29941, 9.8296], [13.25025, 9.86042], [13.24132, 9.91031], [13.27409, 9.93232], [13.286, 9.9822], [13.25323, 10.00127], [13.25025, 10.03647], [13.34111, 10.12299], [13.43644, 10.13326], [13.5705, 10.53183], [13.54964, 10.61236], [13.73434, 10.9255], [13.70753, 10.94451], [13.7403, 11.00593], [13.78945, 11.00154], [13.97489, 11.30258], [14.17821, 11.23831], [14.6124, 11.51283], [14.64591, 11.66166], [14.55207, 11.72001], [14.61612, 11.7798], [14.6474, 12.17466], [14.4843, 12.35223], [14.22215, 12.36533], [14.17523, 12.41916], [14.20204, 12.53405], [14.08251, 13.0797], [13.6302, 13.71094], [13.33213, 13.71195], [13.19844, 13.52802], [13.05085, 13.53984], [12.87376, 13.48919], [12.6793, 13.29157], [12.58033, 13.27805], [12.47095, 13.06673], [12.19315, 13.12423], [12.16189, 13.10056], [12.04209, 13.14452], [11.88236, 13.2527], [11.4535, 13.37773], [10.66004, 13.36422], [10.46731, 13.28819], [10.19993, 13.27129], [10.00373, 13.18171], [9.65995, 12.80614], [8.97413, 12.83661], [8.64251, 12.93985], [8.60431, 13.01768], [8.49493, 13.07519], [8.41853, 13.06166], [8.25185, 13.20369], [8.07997, 13.30847], [7.81085, 13.34902], [7.39241, 13.09717], [7.22399, 13.1293], [7.12676, 13.02445], [7.0521, 13.00076], [6.94445, 12.99825], [6.69617, 13.34057], [6.43053, 13.6006], [6.27411, 13.67835], [6.15771, 13.64564]]]] } },
22779     { type: "Feature", properties: { iso1A2: "NI", iso1A3: "NIC", iso1N3: "558", wikidata: "Q811", nameEn: "Nicaragua", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["505"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.13724, 15.00002], [-83.49268, 15.01158], [-83.62101, 14.89448], [-83.89551, 14.76697], [-84.10584, 14.76353], [-84.48373, 14.63249], [-84.70119, 14.68078], [-84.82596, 14.82212], [-84.90082, 14.80489], [-85.1575, 14.53934], [-85.18602, 14.24929], [-85.32149, 14.2562], [-85.45762, 14.11304], [-85.73964, 13.9698], [-85.75477, 13.8499], [-86.03458, 13.99181], [-86.00685, 14.08474], [-86.14801, 14.04317], [-86.35219, 13.77157], [-86.76812, 13.79605], [-86.71267, 13.30348], [-86.87066, 13.30641], [-86.93383, 13.18677], [-86.93197, 13.05313], [-87.03785, 12.98682], [-87.06306, 13.00892], [-87.37107, 12.98646], [-87.55124, 13.12523], [-87.7346, 13.13228], [-88.11443, 12.63306], [-86.14524, 11.09059], [-85.71223, 11.06868], [-85.60529, 11.22607], [-84.92439, 10.9497], [-84.68197, 11.07568], [-83.90838, 10.71161], [-83.66597, 10.79916], [-83.68276, 11.01562], [-82.56142, 11.91792], [-82.06974, 14.49418], [-83.04763, 15.03256], [-83.13724, 15.00002]]]] } },
22780     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
22781     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
22782     { type: "Feature", properties: { iso1A2: "NP", iso1A3: "NPL", iso1N3: "524", wikidata: "Q837", nameEn: "Nepal", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["977"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.13378, 27.88015], [87.82681, 27.95248], [87.72718, 27.80938], [87.56996, 27.84517], [87.11696, 27.84104], [87.03757, 27.94835], [86.75582, 28.04182], [86.74181, 28.10638], [86.56265, 28.09569], [86.51609, 27.96623], [86.42736, 27.91122], [86.22966, 27.9786], [86.18607, 28.17364], [86.088, 28.09264], [86.08333, 28.02121], [86.12069, 27.93047], [86.06309, 27.90021], [85.94946, 27.9401], [85.97813, 27.99023], [85.90743, 28.05144], [85.84672, 28.18187], [85.74864, 28.23126], [85.71907, 28.38064], [85.69105, 28.38475], [85.60854, 28.25045], [85.59765, 28.30529], [85.4233, 28.32996], [85.38127, 28.28336], [85.10729, 28.34092], [85.18668, 28.54076], [85.19135, 28.62825], [85.06059, 28.68562], [84.85511, 28.58041], [84.62317, 28.73887], [84.47528, 28.74023], [84.2231, 28.89571], [84.24801, 29.02783], [84.18107, 29.23451], [83.97559, 29.33091], [83.82303, 29.30513], [83.63156, 29.16249], [83.44787, 29.30513], [83.28131, 29.56813], [83.07116, 29.61957], [82.73024, 29.81695], [82.5341, 29.9735], [82.38622, 30.02608], [82.16984, 30.0692], [82.19475, 30.16884], [82.10757, 30.23745], [82.10135, 30.35439], [81.99082, 30.33423], [81.62033, 30.44703], [81.5459, 30.37688], [81.41018, 30.42153], [81.39928, 30.21862], [81.33355, 30.15303], [81.2623, 30.14596], [81.29032, 30.08806], [81.24362, 30.0126], [81.12842, 30.01395], [81.03953, 30.20059], [80.92547, 30.17193], [80.91143, 30.22173], [80.86673, 30.17321], [80.8778, 30.13384], [80.67076, 29.95732], [80.60226, 29.95732], [80.57179, 29.91422], [80.56247, 29.86661], [80.48997, 29.79566], [80.43458, 29.80466], [80.41554, 29.79451], [80.36803, 29.73865], [80.38428, 29.68513], [80.41858, 29.63581], [80.37939, 29.57098], [80.24322, 29.44299], [80.31428, 29.30784], [80.28626, 29.20327], [80.24112, 29.21414], [80.26602, 29.13938], [80.23178, 29.11626], [80.18085, 29.13649], [80.05743, 28.91479], [80.06957, 28.82763], [80.12125, 28.82346], [80.37188, 28.63371], [80.44504, 28.63098], [80.52443, 28.54897], [80.50575, 28.6706], [80.55142, 28.69182], [81.03471, 28.40054], [81.19847, 28.36284], [81.32923, 28.13521], [81.38683, 28.17638], [81.48179, 28.12148], [81.47867, 28.08303], [81.91223, 27.84995], [81.97214, 27.93322], [82.06554, 27.92222], [82.46405, 27.6716], [82.70378, 27.72122], [82.74119, 27.49838], [82.93261, 27.50328], [82.94938, 27.46036], [83.19413, 27.45632], [83.27197, 27.38309], [83.2673, 27.36235], [83.29999, 27.32778], [83.35136, 27.33885], [83.38872, 27.39276], [83.39495, 27.4798], [83.61288, 27.47013], [83.85595, 27.35797], [83.86182, 27.4241], [83.93306, 27.44939], [84.02229, 27.43836], [84.10791, 27.52399], [84.21376, 27.45218], [84.25735, 27.44941], [84.29315, 27.39], [84.62161, 27.33885], [84.69166, 27.21294], [84.64496, 27.04669], [84.793, 26.9968], [84.82913, 27.01989], [84.85754, 26.98984], [84.96687, 26.95599], [84.97186, 26.9149], [85.00536, 26.89523], [85.05592, 26.88991], [85.02635, 26.85381], [85.15883, 26.86966], [85.19291, 26.86909], [85.18046, 26.80519], [85.21159, 26.75933], [85.34302, 26.74954], [85.47752, 26.79292], [85.56471, 26.84133], [85.5757, 26.85955], [85.59461, 26.85161], [85.61621, 26.86721], [85.66239, 26.84822], [85.73483, 26.79613], [85.72315, 26.67471], [85.76907, 26.63076], [85.83126, 26.61134], [85.85126, 26.60866], [85.8492, 26.56667], [86.02729, 26.66756], [86.13596, 26.60651], [86.22513, 26.58863], [86.26235, 26.61886], [86.31564, 26.61925], [86.49726, 26.54218], [86.54258, 26.53819], [86.57073, 26.49825], [86.61313, 26.48658], [86.62686, 26.46891], [86.69124, 26.45169], [86.74025, 26.42386], [86.76797, 26.45892], [86.82898, 26.43919], [86.94543, 26.52076], [86.95912, 26.52076], [87.01559, 26.53228], [87.04691, 26.58685], [87.0707, 26.58571], [87.09147, 26.45039], [87.14751, 26.40542], [87.18863, 26.40558], [87.24682, 26.4143], [87.26587, 26.40592], [87.26568, 26.37294], [87.34568, 26.34787], [87.37314, 26.40815], [87.46566, 26.44058], [87.51571, 26.43106], [87.55274, 26.40596], [87.59175, 26.38342], [87.66803, 26.40294], [87.67893, 26.43501], [87.76004, 26.40711], [87.7918, 26.46737], [87.84193, 26.43663], [87.89085, 26.48565], [87.90115, 26.44923], [88.00895, 26.36029], [88.09414, 26.43732], [88.09963, 26.54195], [88.16452, 26.64111], [88.1659, 26.68177], [88.19107, 26.75516], [88.12302, 26.95324], [88.13422, 26.98705], [88.11719, 26.98758], [87.9887, 27.11045], [88.01587, 27.21388], [88.01646, 27.21612], [88.07277, 27.43007], [88.04008, 27.49223], [88.19107, 27.79285], [88.1973, 27.85067], [88.13378, 27.88015]]]] } },
22783     { type: "Feature", properties: { iso1A2: "NR", iso1A3: "NRU", iso1N3: "520", wikidata: "Q697", nameEn: "Nauru", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["674"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.95155, 0.14829], [166.21778, -0.7977], [167.60042, -0.88259], [166.95155, 0.14829]]]] } },
22784     { type: "Feature", properties: { iso1A2: "NU", iso1A3: "NIU", iso1N3: "570", wikidata: "Q34020", nameEn: "Niue", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["683"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.83899, -18.53439], [-170.82274, -20.44429], [-168.63096, -18.60489], [-170.83899, -18.53439]]]] } },
22785     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
22786     { type: "Feature", properties: { iso1A2: "OM", iso1A3: "OMN", iso1N3: "512", wikidata: "Q842", nameEn: "Oman", groups: ["145", "142", "UN"], callingCodes: ["968"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.82555, 25.7713], [56.79239, 26.41236], [56.68954, 26.76645], [56.2644, 26.58649], [55.81777, 26.18798], [56.08666, 26.05038], [56.15498, 26.06828], [56.19334, 25.9795], [56.13963, 25.82765], [56.17416, 25.77239], [56.13579, 25.73524], [56.14826, 25.66351], [56.18363, 25.65508], [56.20473, 25.61119], [56.25365, 25.60211], [56.26636, 25.60643], [56.25341, 25.61443], [56.26534, 25.62825], [56.82555, 25.7713]]], [[[56.26062, 25.33108], [56.23362, 25.31253], [56.25008, 25.28843], [56.24465, 25.27505], [56.20838, 25.25668], [56.20872, 25.24104], [56.24341, 25.22867], [56.27628, 25.23404], [56.34438, 25.26653], [56.35172, 25.30681], [56.3111, 25.30107], [56.3005, 25.31815], [56.26062, 25.33108]], [[56.28423, 25.26344], [56.27086, 25.26128], [56.2716, 25.27916], [56.28102, 25.28486], [56.29379, 25.2754], [56.28423, 25.26344]]], [[[61.45114, 22.55394], [56.86325, 25.03856], [56.3227, 24.97284], [56.34873, 24.93205], [56.30269, 24.88334], [56.20568, 24.85063], [56.20062, 24.78565], [56.13684, 24.73699], [56.06128, 24.74457], [56.03535, 24.81161], [55.97836, 24.87673], [55.97467, 24.89639], [56.05106, 24.87461], [56.05715, 24.95727], [55.96316, 25.00857], [55.90849, 24.96771], [55.85094, 24.96858], [55.81116, 24.9116], [55.81348, 24.80102], [55.83408, 24.77858], [55.83271, 24.68567], [55.76461, 24.5287], [55.83271, 24.41521], [55.83395, 24.32776], [55.80747, 24.31069], [55.79145, 24.27914], [55.76781, 24.26209], [55.75939, 24.26114], [55.75382, 24.2466], [55.75257, 24.23466], [55.76558, 24.23227], [55.77658, 24.23476], [55.83367, 24.20193], [55.95472, 24.2172], [56.01799, 24.07426], [55.8308, 24.01633], [55.73301, 24.05994], [55.48677, 23.94946], [55.57358, 23.669], [55.22634, 23.10378], [55.2137, 22.71065], [55.66469, 21.99658], [54.99756, 20.00083], [52.00311, 19.00083], [52.78009, 17.35124], [52.74267, 17.29519], [52.81185, 17.28568], [57.49095, 8.14549], [61.45114, 22.55394]]]] } },
22787     { type: "Feature", properties: { iso1A2: "PA", iso1A3: "PAN", iso1N3: "591", wikidata: "Q804", nameEn: "Panama", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["507"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-77.32389, 8.81247], [-77.58292, 9.22278], [-78.79327, 9.93766], [-82.51044, 9.65379], [-82.56507, 9.57279], [-82.61345, 9.49881], [-82.66667, 9.49746], [-82.77206, 9.59573], [-82.87919, 9.62645], [-82.84871, 9.4973], [-82.93516, 9.46741], [-82.93516, 9.07687], [-82.72126, 8.97125], [-82.88253, 8.83331], [-82.91377, 8.774], [-82.92068, 8.74832], [-82.8794, 8.6981], [-82.82739, 8.60153], [-82.83975, 8.54755], [-82.83322, 8.52464], [-82.8382, 8.48117], [-82.8679, 8.44042], [-82.93056, 8.43465], [-83.05209, 8.33394], [-82.9388, 8.26634], [-82.88641, 8.10219], [-82.89137, 8.05755], [-82.89978, 8.04083], [-82.94503, 7.93865], [-82.13751, 6.97312], [-78.06168, 7.07793], [-77.89178, 7.22681], [-77.81426, 7.48319], [-77.72157, 7.47612], [-77.72514, 7.72348], [-77.57185, 7.51147], [-77.17257, 7.97422], [-77.45064, 8.49991], [-77.32389, 8.81247]]]] } },
22788     { type: "Feature", properties: { iso1A2: "PE", iso1A3: "PER", iso1N3: "604", wikidata: "Q419", nameEn: "Peru", groups: ["005", "419", "019", "UN"], callingCodes: ["51"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.26675, -0.97229], [-74.42701, -0.50218], [-75.18513, -0.0308], [-75.25764, -0.11943], [-75.40192, -0.17196], [-75.61997, -0.10012], [-75.60169, -0.18708], [-75.53615, -0.19213], [-75.22862, -0.60048], [-75.22862, -0.95588], [-75.3872, -0.9374], [-75.57429, -1.55961], [-76.05203, -2.12179], [-76.6324, -2.58397], [-77.94147, -3.05454], [-78.19369, -3.36431], [-78.14324, -3.47653], [-78.22642, -3.51113], [-78.24589, -3.39907], [-78.34362, -3.38633], [-78.68394, -4.60754], [-78.85149, -4.66795], [-79.01659, -5.01481], [-79.1162, -4.97774], [-79.26248, -4.95167], [-79.59402, -4.46848], [-79.79722, -4.47558], [-80.13945, -4.29786], [-80.39256, -4.48269], [-80.46386, -4.41516], [-80.32114, -4.21323], [-80.45023, -4.20938], [-80.4822, -4.05477], [-80.46386, -4.01342], [-80.13232, -3.90317], [-80.19926, -3.68894], [-80.18741, -3.63994], [-80.19848, -3.59249], [-80.21642, -3.5888], [-80.20535, -3.51667], [-80.22629, -3.501], [-80.23651, -3.48652], [-80.24586, -3.48677], [-80.24123, -3.46124], [-80.20647, -3.431], [-80.30602, -3.39149], [-84.52388, -3.36941], [-85.71054, -21.15413], [-70.59118, -18.35072], [-70.378, -18.3495], [-70.31267, -18.31258], [-70.16394, -18.31737], [-69.96732, -18.25992], [-69.81607, -18.12582], [-69.75305, -17.94605], [-69.82868, -17.72048], [-69.79087, -17.65563], [-69.66483, -17.65083], [-69.46897, -17.4988], [-69.46863, -17.37466], [-69.62883, -17.28142], [-69.16896, -16.72233], [-69.00853, -16.66769], [-69.04027, -16.57214], [-68.98358, -16.42165], [-68.79464, -16.33272], [-68.96238, -16.194], [-69.09986, -16.22693], [-69.20291, -16.16668], [-69.40336, -15.61358], [-69.14856, -15.23478], [-69.36254, -14.94634], [-68.88135, -14.18639], [-69.05265, -13.68546], [-68.8864, -13.40792], [-68.85615, -12.87769], [-68.65044, -12.50689], [-68.98115, -11.8979], [-69.57156, -10.94555], [-69.57835, -10.94051], [-69.90896, -10.92744], [-70.38791, -11.07096], [-70.51395, -10.92249], [-70.64134, -11.0108], [-70.62487, -9.80666], [-70.55429, -9.76692], [-70.58453, -9.58303], [-70.53373, -9.42628], [-71.23394, -9.9668], [-72.14742, -9.98049], [-72.31883, -9.5184], [-72.72216, -9.41397], [-73.21498, -9.40904], [-72.92886, -9.04074], [-73.76576, -7.89884], [-73.65485, -7.77897], [-73.96938, -7.58465], [-73.77011, -7.28944], [-73.73986, -6.87919], [-73.12983, -6.43852], [-73.24579, -6.05764], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.77601, -4.15717], [-70.33236, -4.15214], [-70.19582, -4.3607], [-70.11305, -4.27281], [-70.00888, -4.37833], [-69.94708, -4.2431], [-70.3374, -3.79505], [-70.52393, -3.87553], [-70.71396, -3.7921], [-70.04609, -2.73906], [-70.94377, -2.23142], [-71.75223, -2.15058], [-72.92587, -2.44514], [-73.65312, -1.26222], [-74.26675, -0.97229]]]] } },
22789     { type: "Feature", properties: { iso1A2: "PF", iso1A3: "PYF", iso1N3: "258", wikidata: "Q30971", nameEn: "French Polynesia", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["689"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-135.59706, -4.70473], [-156.48634, -15.52824], [-156.45576, -31.75456], [-133.59543, -28.4709], [-135.59706, -4.70473]]]] } },
22790     { type: "Feature", properties: { iso1A2: "PG", iso1A3: "PNG", iso1N3: "598", wikidata: "Q691", nameEn: "Papua New Guinea", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["675"] }, geometry: { type: "MultiPolygon", coordinates: [[[[141.03157, 2.12829], [140.99813, -6.3233], [140.85295, -6.72996], [140.90448, -6.85033], [141.01763, -6.90181], [141.01842, -9.35091], [141.88934, -9.36111], [142.19246, -9.15378], [142.48658, -9.36754], [143.29772, -9.33993], [143.87386, -9.02382], [145.2855, -9.62524], [156.73836, -14.50464], [154.74815, -7.33315], [155.60735, -6.92266], [155.69784, -6.92661], [155.92557, -6.84664], [156.03993, -6.65703], [156.03296, -6.55528], [160.43769, -4.17974], [141.03157, 2.12829]]]] } },
22791     { type: "Feature", properties: { iso1A2: "PH", iso1A3: "PHL", iso1N3: "608", wikidata: "Q928", nameEn: "Philippines", aliases: ["PI", "RP"], groups: ["035", "142", "UN"], callingCodes: ["63"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.19694, 7.84182], [121.8109, 21.77688], [120.69238, 21.52331], [118.82252, 14.67191], [115.39742, 10.92666], [116.79524, 7.43869], [117.17735, 7.52841], [117.93857, 6.89845], [117.98544, 6.27477], [119.52945, 5.35672], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
22792     { type: "Feature", properties: { iso1A2: "PK", iso1A3: "PAK", iso1N3: "586", wikidata: "Q843", nameEn: "Pakistan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["92"] }, geometry: { type: "MultiPolygon", coordinates: [[[[75.72737, 36.7529], [75.45562, 36.71971], [75.40481, 36.95382], [75.13839, 37.02622], [74.56453, 37.03023], [74.53739, 36.96224], [74.43389, 37.00977], [74.04856, 36.82648], [73.82685, 36.91421], [72.6323, 36.84601], [72.18135, 36.71838], [71.80267, 36.49924], [71.60491, 36.39429], [71.19505, 36.04134], [71.37969, 35.95865], [71.55273, 35.71483], [71.49917, 35.6267], [71.65435, 35.4479], [71.54294, 35.31037], [71.5541, 35.28776], [71.67495, 35.21262], [71.52938, 35.09023], [71.55273, 35.02615], [71.49917, 35.00478], [71.50329, 34.97328], [71.29472, 34.87728], [71.28356, 34.80882], [71.08718, 34.69034], [71.11602, 34.63047], [71.0089, 34.54568], [71.02401, 34.44835], [71.17662, 34.36769], [71.12815, 34.26619], [71.13078, 34.16503], [71.09453, 34.13524], [71.09307, 34.11961], [71.06933, 34.10564], [71.07345, 34.06242], [70.88119, 33.97933], [70.54336, 33.9463], [69.90203, 34.04194], [69.87307, 33.9689], [69.85671, 33.93719], [70.00503, 33.73528], [70.14236, 33.71701], [70.14785, 33.6553], [70.20141, 33.64387], [70.17062, 33.53535], [70.32775, 33.34496], [70.13686, 33.21064], [70.07369, 33.22557], [70.02563, 33.14282], [69.85259, 33.09451], [69.79766, 33.13247], [69.71526, 33.09911], [69.57656, 33.09911], [69.49004, 33.01509], [69.49854, 32.88843], [69.5436, 32.8768], [69.47082, 32.85834], [69.38018, 32.76601], [69.43649, 32.7302], [69.44747, 32.6678], [69.38155, 32.56601], [69.2868, 32.53938], [69.23599, 32.45946], [69.27932, 32.29119], [69.27032, 32.14141], [69.3225, 31.93186], [69.20577, 31.85957], [69.11514, 31.70782], [69.00939, 31.62249], [68.95995, 31.64822], [68.91078, 31.59687], [68.79997, 31.61665], [68.6956, 31.75687], [68.57475, 31.83158], [68.44222, 31.76446], [68.27605, 31.75863], [68.25614, 31.80357], [68.1655, 31.82691], [68.00071, 31.6564], [67.86887, 31.63536], [67.72056, 31.52304], [67.58323, 31.52772], [67.62374, 31.40473], [67.7748, 31.4188], [67.78854, 31.33203], [67.29964, 31.19586], [67.03323, 31.24519], [67.04147, 31.31561], [66.83273, 31.26867], [66.72561, 31.20526], [66.68166, 31.07597], [66.58175, 30.97532], [66.42645, 30.95309], [66.39194, 30.9408], [66.28413, 30.57001], [66.34869, 30.404], [66.23609, 30.06321], [66.36042, 29.9583], [66.24175, 29.85181], [65.04005, 29.53957], [64.62116, 29.58903], [64.19796, 29.50407], [64.12966, 29.39157], [63.5876, 29.50456], [62.47751, 29.40782], [60.87231, 29.86514], [61.31508, 29.38903], [61.53765, 29.00507], [61.65978, 28.77937], [61.93581, 28.55284], [62.40259, 28.42703], [62.59499, 28.24842], [62.79412, 28.28108], [62.7638, 28.02992], [62.84905, 27.47627], [62.79684, 27.34381], [62.80604, 27.22412], [63.19649, 27.25674], [63.32283, 27.14437], [63.25005, 27.08692], [63.25005, 26.84212], [63.18688, 26.83844], [63.1889, 26.65072], [62.77352, 26.64099], [62.31484, 26.528], [62.21304, 26.26601], [62.05117, 26.31647], [61.89391, 26.26251], [61.83831, 26.07249], [61.83968, 25.7538], [61.683, 25.66638], [61.6433, 25.27541], [61.46682, 24.57869], [68.11329, 23.53945], [68.20763, 23.85849], [68.39339, 23.96838], [68.74643, 23.97027], [68.7416, 24.31904], [68.90914, 24.33156], [68.97781, 24.26021], [69.07806, 24.29777], [69.19341, 24.25646], [69.29778, 24.28712], [69.59579, 24.29777], [69.73335, 24.17007], [70.03428, 24.172], [70.11712, 24.30915], [70.5667, 24.43787], [70.57906, 24.27774], [70.71502, 24.23517], [70.88393, 24.27398], [70.85784, 24.30903], [70.94985, 24.3791], [71.04461, 24.34657], [71.12838, 24.42662], [71.00341, 24.46038], [70.97594, 24.60904], [71.09405, 24.69017], [70.94002, 24.92843], [70.89148, 25.15064], [70.66695, 25.39314], [70.67382, 25.68186], [70.60378, 25.71898], [70.53649, 25.68928], [70.37444, 25.67443], [70.2687, 25.71156], [70.0985, 25.93238], [70.08193, 26.08094], [70.17532, 26.24118], [70.17532, 26.55362], [70.05584, 26.60398], [69.88555, 26.56836], [69.50904, 26.74892], [69.58519, 27.18109], [70.03136, 27.56627], [70.12502, 27.8057], [70.37307, 28.01208], [70.60927, 28.02178], [70.79054, 27.68423], [71.89921, 27.96035], [71.9244, 28.11555], [72.20329, 28.3869], [72.29495, 28.66367], [72.40402, 28.78283], [72.94272, 29.02487], [73.01337, 29.16422], [73.05886, 29.1878], [73.28094, 29.56646], [73.3962, 29.94707], [73.58665, 30.01848], [73.80299, 30.06969], [73.97225, 30.19829], [73.95736, 30.28466], [73.88993, 30.36305], [74.5616, 31.04153], [74.67971, 31.05479], [74.6852, 31.12771], [74.60006, 31.13711], [74.60281, 31.10419], [74.56023, 31.08303], [74.51629, 31.13829], [74.53223, 31.30321], [74.59773, 31.4136], [74.64713, 31.45605], [74.59319, 31.50197], [74.61517, 31.55698], [74.57498, 31.60382], [74.47771, 31.72227], [74.58907, 31.87824], [74.79919, 31.95983], [74.86236, 32.04485], [74.9269, 32.0658], [75.00793, 32.03786], [75.25649, 32.10187], [75.38046, 32.26836], [75.28259, 32.36556], [75.03265, 32.49538], [74.97634, 32.45367], [74.84725, 32.49075], [74.68362, 32.49298], [74.67431, 32.56676], [74.65251, 32.56416], [74.64424, 32.60985], [74.69542, 32.66792], [74.65345, 32.71225], [74.7113, 32.84219], [74.64675, 32.82604], [74.6289, 32.75561], [74.45312, 32.77755], [74.41467, 32.90563], [74.31227, 32.92795], [74.34875, 32.97823], [74.31854, 33.02891], [74.17571, 33.07495], [74.15374, 33.13477], [74.02144, 33.18908], [74.01366, 33.25199], [74.08782, 33.26232], [74.17983, 33.3679], [74.18121, 33.4745], [74.10115, 33.56392], [74.03576, 33.56718], [73.97367, 33.64061], [73.98968, 33.66155], [73.96423, 33.73071], [74.00891, 33.75437], [74.05898, 33.82089], [74.14001, 33.83002], [74.26086, 33.92237], [74.25262, 34.01577], [74.21554, 34.03853], [73.91341, 34.01235], [73.88732, 34.05105], [73.90677, 34.10504], [73.98208, 34.2522], [73.90517, 34.35317], [73.8475, 34.32935], [73.74862, 34.34183], [73.74999, 34.3781], [73.88732, 34.48911], [73.89419, 34.54568], [73.93951, 34.57169], [73.93401, 34.63386], [73.96423, 34.68244], [74.12897, 34.70073], [74.31239, 34.79626], [74.58083, 34.77386], [74.6663, 34.703], [75.01479, 34.64629], [75.38009, 34.55021], [75.75438, 34.51827], [76.04614, 34.67566], [76.15463, 34.6429], [76.47186, 34.78965], [76.67648, 34.76371], [76.74377, 34.84039], [76.74514, 34.92488], [76.87193, 34.96906], [76.99251, 34.93349], [77.11796, 35.05419], [76.93465, 35.39866], [76.85088, 35.39754], [76.75475, 35.52617], [76.77323, 35.66062], [76.50961, 35.8908], [76.33453, 35.84296], [76.14913, 35.82848], [76.15325, 35.9264], [75.93028, 36.13136], [76.00906, 36.17511], [76.0324, 36.41198], [75.92391, 36.56986], [75.72737, 36.7529]]]] } },
22793     { type: "Feature", properties: { iso1A2: "PL", iso1A3: "POL", iso1N3: "616", wikidata: "Q36", nameEn: "Poland", groups: ["EU", "151", "150", "UN"], callingCodes: ["48"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [14.20811, 54.12784], [14.22634, 53.9291], [14.20647, 53.91671], [14.18544, 53.91258], [14.20823, 53.90776], [14.21323, 53.8664], [14.27249, 53.74464], [14.26782, 53.69866], [14.2836, 53.67721], [14.27133, 53.66613], [14.28477, 53.65955], [14.2853, 53.63392], [14.31904, 53.61581], [14.30416, 53.55499], [14.3273, 53.50587], [14.35209, 53.49506], [14.4215, 53.27724], [14.44133, 53.27427], [14.45125, 53.26241], [14.40662, 53.21098], [14.37853, 53.20405], [14.36696, 53.16444], [14.38679, 53.13669], [14.35044, 53.05829], [14.25954, 53.00264], [14.14056, 52.95786], [14.15873, 52.87715], [14.12256, 52.84311], [14.13806, 52.82392], [14.22071, 52.81175], [14.61073, 52.59847], [14.6289, 52.57136], [14.60081, 52.53116], [14.63056, 52.48993], [14.54423, 52.42568], [14.55228, 52.35264], [14.56378, 52.33838], [14.58149, 52.28007], [14.70139, 52.25038], [14.71319, 52.22144], [14.68344, 52.19612], [14.70616, 52.16927], [14.67683, 52.13936], [14.6917, 52.10283], [14.72971, 52.09167], [14.76026, 52.06624], [14.71339, 52.00337], [14.70488, 51.97679], [14.7139, 51.95643], [14.71836, 51.95606], [14.72163, 51.95188], [14.7177, 51.94048], [14.70601, 51.92944], [14.6933, 51.9044], [14.6588, 51.88359], [14.59089, 51.83302], [14.60493, 51.80473], [14.64625, 51.79472], [14.66386, 51.73282], [14.69065, 51.70842], [14.75392, 51.67445], [14.75759, 51.62318], [14.7727, 51.61263], [14.71125, 51.56209], [14.73047, 51.54606], [14.72652, 51.53902], [14.73219, 51.52922], [14.94749, 51.47155], [14.9652, 51.44793], [14.96899, 51.38367], [14.98008, 51.33449], [15.04288, 51.28387], [15.01242, 51.21285], [15.0047, 51.16874], [14.99311, 51.16249], [14.99414, 51.15813], [15.00083, 51.14974], [14.99646, 51.14365], [14.99079, 51.14284], [14.99689, 51.12205], [14.98229, 51.11354], [14.97938, 51.07742], [14.95529, 51.04552], [14.92942, 50.99744], [14.89252, 50.94999], [14.89681, 50.9422], [14.81664, 50.88148], [14.82803, 50.86966], [14.99852, 50.86817], [15.01088, 50.97984], [14.96419, 50.99108], [15.02433, 51.0242], [15.03895, 51.0123], [15.06218, 51.02269], [15.10152, 51.01095], [15.11937, 50.99021], [15.16744, 51.01959], [15.1743, 50.9833], [15.2361, 50.99886], [15.27043, 50.97724], [15.2773, 50.8907], [15.36656, 50.83956], [15.3803, 50.77187], [15.43798, 50.80833], [15.73186, 50.73885], [15.81683, 50.75666], [15.87331, 50.67188], [15.97219, 50.69799], [16.0175, 50.63009], [15.98317, 50.61528], [16.02437, 50.60046], [16.10265, 50.66405], [16.20839, 50.63096], [16.23174, 50.67101], [16.33611, 50.66579], [16.44597, 50.58041], [16.34572, 50.49575], [16.31413, 50.50274], [16.19526, 50.43291], [16.21585, 50.40627], [16.22821, 50.41054], [16.28118, 50.36891], [16.30289, 50.38292], [16.36495, 50.37679], [16.3622, 50.34875], [16.39379, 50.3207], [16.42674, 50.32509], [16.56407, 50.21009], [16.55446, 50.16613], [16.63137, 50.1142], [16.7014, 50.09659], [16.8456, 50.20834], [16.98018, 50.24172], [17.00353, 50.21449], [17.02825, 50.23118], [16.99803, 50.25753], [17.02138, 50.27772], [16.99803, 50.30316], [16.94448, 50.31281], [16.90877, 50.38642], [16.85933, 50.41093], [16.89229, 50.45117], [17.1224, 50.39494], [17.14498, 50.38117], [17.19579, 50.38817], [17.19991, 50.3654], [17.27681, 50.32246], [17.34273, 50.32947], [17.34548, 50.2628], [17.3702, 50.28123], [17.58889, 50.27837], [17.67764, 50.28977], [17.69292, 50.32859], [17.74648, 50.29966], [17.72176, 50.25665], [17.76296, 50.23382], [17.70528, 50.18812], [17.59404, 50.16437], [17.66683, 50.10275], [17.6888, 50.12037], [17.7506, 50.07896], [17.77669, 50.02253], [17.86886, 49.97452], [18.00191, 50.01723], [18.04585, 50.01194], [18.04585, 50.03311], [18.00396, 50.04954], [18.03212, 50.06574], [18.07898, 50.04535], [18.10628, 50.00223], [18.20241, 49.99958], [18.21752, 49.97309], [18.27107, 49.96779], [18.27794, 49.93863], [18.31914, 49.91565], [18.33278, 49.92415], [18.33562, 49.94747], [18.41604, 49.93498], [18.53423, 49.89906], [18.54495, 49.9079], [18.54299, 49.92537], [18.57697, 49.91565], [18.57045, 49.87849], [18.60341, 49.86256], [18.57183, 49.83334], [18.61278, 49.7618], [18.61368, 49.75426], [18.62645, 49.75002], [18.62943, 49.74603], [18.62676, 49.71983], [18.69817, 49.70473], [18.72838, 49.68163], [18.80479, 49.6815], [18.84786, 49.5446], [18.84521, 49.51672], [18.94536, 49.52143], [18.97283, 49.49914], [18.9742, 49.39557], [19.18019, 49.41165], [19.25435, 49.53391], [19.36009, 49.53747], [19.37795, 49.574], [19.45348, 49.61583], [19.52626, 49.57311], [19.53313, 49.52856], [19.57845, 49.46077], [19.64162, 49.45184], [19.6375, 49.40897], [19.72127, 49.39288], [19.78581, 49.41701], [19.82237, 49.27806], [19.75286, 49.20751], [19.86409, 49.19316], [19.90529, 49.23532], [19.98494, 49.22904], [20.08238, 49.1813], [20.13738, 49.31685], [20.21977, 49.35265], [20.31453, 49.34817], [20.31728, 49.39914], [20.39939, 49.3896], [20.46422, 49.41612], [20.5631, 49.375], [20.61666, 49.41791], [20.72274, 49.41813], [20.77971, 49.35383], [20.9229, 49.29626], [20.98733, 49.30774], [21.09799, 49.37176], [21.041, 49.41791], [21.12477, 49.43666], [21.19756, 49.4054], [21.27858, 49.45988], [21.43376, 49.41433], [21.62328, 49.4447], [21.77983, 49.35443], [21.82927, 49.39467], [21.96385, 49.3437], [22.04427, 49.22136], [22.56155, 49.08865], [22.89122, 49.00725], [22.86336, 49.10513], [22.72009, 49.20288], [22.748, 49.32759], [22.69444, 49.49378], [22.64534, 49.53094], [22.78304, 49.65543], [22.80261, 49.69098], [22.83179, 49.69875], [22.99329, 49.84249], [23.28221, 50.0957], [23.67635, 50.33385], [23.71382, 50.38248], [23.79445, 50.40481], [23.99563, 50.41289], [24.03668, 50.44507], [24.07048, 50.5071], [24.0996, 50.60752], [24.0595, 50.71625], [23.95925, 50.79271], [23.99254, 50.83847], [24.0952, 50.83262], [24.14524, 50.86128], [24.04576, 50.90196], [23.92217, 51.00836], [23.90376, 51.07697], [23.80678, 51.18405], [23.63858, 51.32182], [23.69905, 51.40871], [23.62751, 51.50512], [23.56236, 51.53673], [23.57053, 51.55938], [23.53198, 51.74298], [23.62691, 51.78208], [23.61523, 51.92066], [23.68733, 51.9906], [23.64066, 52.07626], [23.61, 52.11264], [23.54314, 52.12148], [23.47859, 52.18215], [23.20071, 52.22848], [23.18196, 52.28812], [23.34141, 52.44845], [23.45112, 52.53774], [23.58296, 52.59868], [23.73615, 52.6149], [23.93763, 52.71332], [23.91805, 52.94016], [23.94689, 52.95919], [23.92184, 53.02079], [23.87548, 53.0831], [23.91393, 53.16469], [23.85657, 53.22923], [23.81995, 53.24131], [23.62004, 53.60942], [23.51284, 53.95052], [23.48261, 53.98855], [23.52702, 54.04622], [23.49196, 54.14764], [23.45223, 54.17775], [23.42418, 54.17911], [23.39525, 54.21672], [23.3494, 54.25155], [23.24656, 54.25701], [23.15938, 54.29894], [23.15526, 54.31076], [23.13905, 54.31567], [23.104, 54.29794], [23.04323, 54.31567], [23.05726, 54.34565], [22.99649, 54.35927], [23.00584, 54.38514], [22.83756, 54.40827], [22.79705, 54.36264], [21.41123, 54.32395], [20.63871, 54.3706], [19.8038, 54.44203], [19.64312, 54.45423], [18.57853, 55.25302]]]] } },
22794     { type: "Feature", properties: { iso1A2: "PM", iso1A3: "SPM", iso1N3: "666", wikidata: "Q34617", nameEn: "Saint Pierre and Miquelon", country: "FR", groups: ["EU", "Q1451600", "021", "003", "019", "UN"], callingCodes: ["508"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.72993, 46.65575], [-55.90758, 46.6223], [-56.27503, 47.39728], [-56.72993, 46.65575]]]] } },
22795     { type: "Feature", properties: { iso1A2: "PN", iso1A3: "PCN", iso1N3: "612", wikidata: "Q35672", nameEn: "Pitcairn Islands", country: "GB", groups: ["BOTS", "061", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-133.59543, -28.4709], [-122.0366, -24.55017], [-133.61511, -21.93325], [-133.59543, -28.4709]]]] } },
22796     { type: "Feature", properties: { iso1A2: "PR", iso1A3: "PRI", iso1N3: "630", wikidata: "Q1183", nameEn: "Puerto Rico", aliases: ["US-PR"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 787", "1 939"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.27974, 17.56928], [-65.02435, 18.73231], [-67.99519, 18.97186], [-68.23894, 17.84663], [-65.27974, 17.56928]]]] } },
22797     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
22798     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
22799     { type: "Feature", properties: { iso1A2: "PW", iso1A3: "PLW", iso1N3: "585", wikidata: "Q695", nameEn: "Palau", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["680"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.97621, 3.08804], [136.39296, 1.54187], [136.04605, 12.45908], [128.97621, 3.08804]]]] } },
22800     { type: "Feature", properties: { iso1A2: "PY", iso1A3: "PRY", iso1N3: "600", wikidata: "Q733", nameEn: "Paraguay", groups: ["005", "419", "019", "UN"], callingCodes: ["595"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.16225, -20.16193], [-58.23216, -19.80058], [-59.06965, -19.29148], [-60.00638, -19.2981], [-61.73723, -19.63958], [-61.93912, -20.10053], [-62.26883, -20.55311], [-62.2757, -21.06657], [-62.64455, -22.25091], [-62.51761, -22.37684], [-62.22768, -22.55807], [-61.9756, -23.0507], [-61.0782, -23.62932], [-60.99754, -23.80934], [-60.28163, -24.04436], [-60.03367, -24.00701], [-59.45482, -24.34787], [-59.33886, -24.49935], [-58.33055, -24.97099], [-58.25492, -24.92528], [-57.80821, -25.13863], [-57.57431, -25.47269], [-57.87176, -25.93604], [-58.1188, -26.16704], [-58.3198, -26.83443], [-58.65321, -27.14028], [-58.59549, -27.29973], [-58.04205, -27.2387], [-56.85337, -27.5165], [-56.18313, -27.29851], [-55.89195, -27.3467], [-55.74475, -27.44485], [-55.59094, -27.32444], [-55.62322, -27.1941], [-55.39611, -26.97679], [-55.25243, -26.93808], [-55.16948, -26.96068], [-55.06351, -26.80195], [-55.00584, -26.78754], [-54.80868, -26.55669], [-54.70732, -26.45099], [-54.69333, -26.37705], [-54.67359, -25.98607], [-54.60664, -25.9691], [-54.62063, -25.91213], [-54.59398, -25.59224], [-54.59509, -25.53696], [-54.60196, -25.48397], [-54.62033, -25.46026], [-54.4423, -25.13381], [-54.28207, -24.07305], [-54.32807, -24.01865], [-54.6238, -23.83078], [-55.02691, -23.97317], [-55.0518, -23.98666], [-55.12292, -23.99669], [-55.41784, -23.9657], [-55.44117, -23.9185], [-55.43585, -23.87157], [-55.5555, -23.28237], [-55.52288, -23.2595], [-55.5446, -23.22811], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.68742, -22.58407], [-55.6986, -22.56268], [-55.72366, -22.5519], [-55.741, -22.52018], [-55.74941, -22.46436], [-55.8331, -22.29008], [-56.23206, -22.25347], [-56.45893, -22.08072], [-56.5212, -22.11556], [-56.6508, -22.28387], [-57.98625, -22.09157], [-57.94642, -21.73799], [-57.88239, -21.6868], [-57.93492, -21.65505], [-57.84536, -20.93155], [-58.16225, -20.16193]]]] } },
22801     { type: "Feature", properties: { iso1A2: "QA", iso1A3: "QAT", iso1N3: "634", wikidata: "Q846", nameEn: "Qatar", groups: ["145", "142", "UN"], callingCodes: ["974"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.92992, 24.54396], [51.09638, 24.46907], [51.29972, 24.50747], [51.39468, 24.62785], [51.58834, 24.66608], [51.83108, 24.71675], [51.83682, 26.70231], [50.93865, 26.30758], [50.81266, 25.88946], [50.86149, 25.6965], [50.7801, 25.595], [50.80824, 25.54641], [50.57069, 25.57887], [50.8133, 24.74049], [50.92992, 24.54396]]]] } },
22802     { type: "Feature", properties: { iso1A2: "RE", iso1A3: "REU", iso1N3: "638", wikidata: "Q17070", nameEn: "R\xE9union", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[53.37984, -21.23941], [56.73473, -21.9174], [56.62373, -20.2711], [53.37984, -21.23941]]]] } },
22803     { type: "Feature", properties: { iso1A2: "RO", iso1A3: "ROU", iso1N3: "642", wikidata: "Q218", nameEn: "Romania", groups: ["EU", "151", "150", "UN"], callingCodes: ["40"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.15622, 47.98538], [27.02985, 48.09083], [27.04118, 48.12522], [26.96119, 48.13003], [26.98042, 48.15752], [26.94265, 48.1969], [26.87708, 48.19919], [26.81161, 48.25049], [26.62823, 48.25804], [26.55202, 48.22445], [26.33504, 48.18418], [26.17711, 47.99246], [26.05901, 47.9897], [25.77723, 47.93919], [25.63878, 47.94924], [25.23778, 47.89403], [25.11144, 47.75203], [24.88896, 47.7234], [24.81893, 47.82031], [24.70632, 47.84428], [24.61994, 47.95062], [24.43578, 47.97131], [24.34926, 47.9244], [24.22566, 47.90231], [24.11281, 47.91487], [24.06466, 47.95317], [24.02999, 47.95087], [24.00801, 47.968], [23.98553, 47.96076], [23.96337, 47.96672], [23.94192, 47.94868], [23.89352, 47.94512], [23.8602, 47.9329], [23.80904, 47.98142], [23.75188, 47.99705], [23.66262, 47.98786], [23.63894, 48.00293], [23.5653, 48.00499], [23.52803, 48.01818], [23.4979, 47.96858], [23.33577, 48.0237], [23.27397, 48.08245], [23.15999, 48.12188], [23.1133, 48.08061], [23.08858, 48.00716], [23.0158, 47.99338], [22.92241, 48.02002], [22.94301, 47.96672], [22.89849, 47.95851], [22.77991, 47.87211], [22.76617, 47.8417], [22.67247, 47.7871], [22.46559, 47.76583], [22.41979, 47.7391], [22.31816, 47.76126], [22.00917, 47.50492], [22.03389, 47.42508], [22.01055, 47.37767], [21.94463, 47.38046], [21.78395, 47.11104], [21.648, 47.03902], [21.68645, 46.99595], [21.59581, 46.91628], [21.59307, 46.86935], [21.52028, 46.84118], [21.48935, 46.7577], [21.5151, 46.72147], [21.43926, 46.65109], [21.33214, 46.63035], [21.26929, 46.4993], [21.28061, 46.44941], [21.16872, 46.30118], [21.06572, 46.24897], [20.86797, 46.28884], [20.74574, 46.25467], [20.76085, 46.21002], [20.63863, 46.12728], [20.49718, 46.18721], [20.45377, 46.14405], [20.35573, 46.16629], [20.28324, 46.1438], [20.26068, 46.12332], [20.35862, 45.99356], [20.54818, 45.89939], [20.65645, 45.82801], [20.70069, 45.7493], [20.77416, 45.75601], [20.78446, 45.78522], [20.82364, 45.77738], [20.80361, 45.65875], [20.76798, 45.60969], [20.83321, 45.53567], [20.77217, 45.49788], [20.86026, 45.47295], [20.87948, 45.42743], [21.09894, 45.30144], [21.17612, 45.32566], [21.20392, 45.2677], [21.29398, 45.24148], [21.48278, 45.19557], [21.51299, 45.15345], [21.4505, 45.04294], [21.35855, 45.01941], [21.54938, 44.9327], [21.56328, 44.89502], [21.48202, 44.87199], [21.44013, 44.87613], [21.35643, 44.86364], [21.38802, 44.78133], [21.55007, 44.77304], [21.60019, 44.75208], [21.61942, 44.67059], [21.67504, 44.67107], [21.71692, 44.65349], [21.7795, 44.66165], [21.99364, 44.63395], [22.08016, 44.49844], [22.13234, 44.47444], [22.18315, 44.48179], [22.30844, 44.6619], [22.45301, 44.7194], [22.61917, 44.61489], [22.69196, 44.61587], [22.76749, 44.54446], [22.70981, 44.51852], [22.61368, 44.55719], [22.56493, 44.53419], [22.54021, 44.47836], [22.45436, 44.47258], [22.56012, 44.30712], [22.68166, 44.28206], [22.67173, 44.21564], [23.04988, 44.07694], [23.01674, 44.01946], [22.87873, 43.9844], [22.83753, 43.88055], [22.85314, 43.84452], [23.05288, 43.79494], [23.26772, 43.84843], [23.4507, 43.84936], [23.61687, 43.79289], [23.73978, 43.80627], [24.18149, 43.68218], [24.35364, 43.70211], [24.50264, 43.76314], [24.62281, 43.74082], [24.73542, 43.68523], [24.96682, 43.72693], [25.10718, 43.6831], [25.17144, 43.70261], [25.39528, 43.61866], [25.72792, 43.69263], [25.94911, 43.85745], [26.05584, 43.90925], [26.10115, 43.96908], [26.38764, 44.04356], [26.62712, 44.05698], [26.95141, 44.13555], [27.26845, 44.12602], [27.39757, 44.0141], [27.60834, 44.01206], [27.64542, 44.04958], [27.73468, 43.95326], [27.92008, 44.00761], [27.99558, 43.84193], [28.23293, 43.76], [29.24336, 43.70874], [30.04414, 45.08461], [29.69272, 45.19227], [29.65428, 45.25629], [29.68175, 45.26885], [29.59798, 45.38857], [29.42632, 45.44545], [29.24779, 45.43388], [28.96077, 45.33164], [28.94292, 45.28045], [28.81383, 45.3384], [28.78911, 45.24179], [28.71358, 45.22631], [28.5735, 45.24759], [28.34554, 45.32102], [28.28504, 45.43907], [28.21139, 45.46895], [28.18741, 45.47358], [28.08927, 45.6051], [28.16568, 45.6421], [28.13111, 45.92819], [28.08612, 46.01105], [28.13684, 46.18099], [28.10937, 46.22852], [28.19864, 46.31869], [28.18902, 46.35283], [28.25769, 46.43334], [28.22281, 46.50481], [28.24808, 46.64305], [28.12173, 46.82283], [28.09095, 46.97621], [27.81892, 47.1381], [27.73172, 47.29248], [27.68706, 47.28962], [27.60263, 47.32507], [27.55731, 47.46637], [27.47942, 47.48113], [27.3979, 47.59473], [27.32202, 47.64009], [27.25519, 47.71366], [27.29069, 47.73722], [27.1618, 47.92391], [27.15622, 47.98538]]]] } },
22804     { type: "Feature", properties: { iso1A2: "RS", iso1A3: "SRB", iso1N3: "688", wikidata: "Q403", nameEn: "Serbia", groups: ["039", "150", "UN"], callingCodes: ["381"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.66007, 46.19005], [19.56113, 46.16824], [19.52473, 46.1171], [19.28826, 45.99694], [19.14543, 45.9998], [19.10388, 46.04015], [19.0791, 45.96458], [19.01284, 45.96529], [18.99712, 45.93537], [18.81394, 45.91329], [18.85783, 45.85493], [18.90305, 45.71863], [18.96691, 45.66731], [18.88776, 45.57253], [18.94562, 45.53712], [19.07471, 45.53086], [19.08364, 45.48804], [18.99918, 45.49333], [18.97446, 45.37528], [19.10774, 45.29547], [19.28208, 45.23813], [19.41941, 45.23475], [19.43589, 45.17137], [19.19144, 45.17863], [19.14063, 45.12972], [19.07952, 45.14668], [19.1011, 45.01191], [19.05205, 44.97692], [19.15573, 44.95409], [19.06853, 44.89915], [19.02871, 44.92541], [18.98957, 44.90645], [19.01994, 44.85493], [19.18183, 44.92055], [19.36722, 44.88164], [19.32543, 44.74058], [19.26388, 44.65412], [19.16699, 44.52197], [19.13369, 44.52521], [19.12278, 44.50132], [19.14837, 44.45253], [19.14681, 44.41463], [19.11785, 44.40313], [19.10749, 44.39421], [19.10704, 44.38249], [19.10365, 44.37795], [19.10298, 44.36924], [19.11865, 44.36712], [19.1083, 44.3558], [19.11547, 44.34218], [19.13556, 44.338], [19.13332, 44.31492], [19.16741, 44.28648], [19.18328, 44.28383], [19.20508, 44.2917], [19.23306, 44.26097], [19.26945, 44.26957], [19.32464, 44.27185], [19.34773, 44.23244], [19.3588, 44.18353], [19.40927, 44.16722], [19.43905, 44.13088], [19.47338, 44.15034], [19.48386, 44.14332], [19.47321, 44.1193], [19.51167, 44.08158], [19.55999, 44.06894], [19.57467, 44.04716], [19.61991, 44.05254], [19.61836, 44.01464], [19.56498, 43.99922], [19.52515, 43.95573], [19.38439, 43.96611], [19.24363, 44.01502], [19.23465, 43.98764], [19.3986, 43.79668], [19.5176, 43.71403], [19.50455, 43.58385], [19.42696, 43.57987], [19.41941, 43.54056], [19.36653, 43.60921], [19.33426, 43.58833], [19.2553, 43.5938], [19.24774, 43.53061], [19.22807, 43.5264], [19.22229, 43.47926], [19.44315, 43.38846], [19.48171, 43.32644], [19.52962, 43.31623], [19.54598, 43.25158], [19.62661, 43.2286], [19.64063, 43.19027], [19.76918, 43.16044], [19.79255, 43.11951], [19.92576, 43.08539], [19.96549, 43.11098], [19.98887, 43.0538], [20.04729, 43.02732], [20.05431, 42.99571], [20.12325, 42.96237], [20.14896, 42.99058], [20.16415, 42.97177], [20.34528, 42.90676], [20.35692, 42.8335], [20.40594, 42.84853], [20.43734, 42.83157], [20.53484, 42.8885], [20.48692, 42.93208], [20.59929, 43.01067], [20.64557, 43.00826], [20.69515, 43.09641], [20.59929, 43.20492], [20.68688, 43.21335], [20.73811, 43.25068], [20.82145, 43.26769], [20.88685, 43.21697], [20.83727, 43.17842], [20.96287, 43.12416], [21.00749, 43.13984], [21.05378, 43.10707], [21.08952, 43.13471], [21.14465, 43.11089], [21.16734, 42.99694], [21.2041, 43.02277], [21.23877, 43.00848], [21.23534, 42.95523], [21.2719, 42.8994], [21.32974, 42.90424], [21.36941, 42.87397], [21.44047, 42.87276], [21.39045, 42.74888], [21.47498, 42.74695], [21.59154, 42.72643], [21.58755, 42.70418], [21.6626, 42.67813], [21.75025, 42.70125], [21.79413, 42.65923], [21.75672, 42.62695], [21.7327, 42.55041], [21.70522, 42.54176], [21.7035, 42.51899], [21.62556, 42.45106], [21.64209, 42.41081], [21.62887, 42.37664], [21.59029, 42.38042], [21.57021, 42.3647], [21.53467, 42.36809], [21.5264, 42.33634], [21.56772, 42.30946], [21.58992, 42.25915], [21.70111, 42.23789], [21.77176, 42.2648], [21.84654, 42.3247], [21.91595, 42.30392], [21.94405, 42.34669], [22.02908, 42.29848], [22.16384, 42.32103], [22.29605, 42.37477], [22.29275, 42.34913], [22.34773, 42.31725], [22.45919, 42.33822], [22.47498, 42.3915], [22.51961, 42.3991], [22.55669, 42.50144], [22.43983, 42.56851], [22.4997, 42.74144], [22.43309, 42.82057], [22.54302, 42.87774], [22.74826, 42.88701], [22.78397, 42.98253], [22.89521, 43.03625], [22.98104, 43.11199], [23.00806, 43.19279], [22.89727, 43.22417], [22.82036, 43.33665], [22.53397, 43.47225], [22.47582, 43.6558], [22.41043, 43.69566], [22.35558, 43.81281], [22.41449, 44.00514], [22.61688, 44.06534], [22.61711, 44.16938], [22.67173, 44.21564], [22.68166, 44.28206], [22.56012, 44.30712], [22.45436, 44.47258], [22.54021, 44.47836], [22.56493, 44.53419], [22.61368, 44.55719], [22.70981, 44.51852], [22.76749, 44.54446], [22.69196, 44.61587], [22.61917, 44.61489], [22.45301, 44.7194], [22.30844, 44.6619], [22.18315, 44.48179], [22.13234, 44.47444], [22.08016, 44.49844], [21.99364, 44.63395], [21.7795, 44.66165], [21.71692, 44.65349], [21.67504, 44.67107], [21.61942, 44.67059], [21.60019, 44.75208], [21.55007, 44.77304], [21.38802, 44.78133], [21.35643, 44.86364], [21.44013, 44.87613], [21.48202, 44.87199], [21.56328, 44.89502], [21.54938, 44.9327], [21.35855, 45.01941], [21.4505, 45.04294], [21.51299, 45.15345], [21.48278, 45.19557], [21.29398, 45.24148], [21.20392, 45.2677], [21.17612, 45.32566], [21.09894, 45.30144], [20.87948, 45.42743], [20.86026, 45.47295], [20.77217, 45.49788], [20.83321, 45.53567], [20.76798, 45.60969], [20.80361, 45.65875], [20.82364, 45.77738], [20.78446, 45.78522], [20.77416, 45.75601], [20.70069, 45.7493], [20.65645, 45.82801], [20.54818, 45.89939], [20.35862, 45.99356], [20.26068, 46.12332], [20.09713, 46.17315], [20.03533, 46.14509], [20.01816, 46.17696], [19.93508, 46.17553], [19.81491, 46.1313], [19.66007, 46.19005]]]] } },
22805     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
22806     { type: "Feature", properties: { iso1A2: "RW", iso1A3: "RWA", iso1N3: "646", wikidata: "Q1037", nameEn: "Rwanda", groups: ["014", "202", "002", "UN"], callingCodes: ["250"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.47194, -1.0555], [30.35212, -1.06896], [30.16369, -1.34303], [29.912, -1.48269], [29.82657, -1.31187], [29.59061, -1.39016], [29.53062, -1.40499], [29.45038, -1.5054], [29.36322, -1.50887], [29.24323, -1.66826], [29.24458, -1.69663], [29.11847, -1.90576], [29.17562, -2.12278], [29.105, -2.27043], [29.00051, -2.29001], [28.95642, -2.37321], [28.89601, -2.37321], [28.86826, -2.41888], [28.86846, -2.44866], [28.89132, -2.47557], [28.89342, -2.49017], [28.88846, -2.50493], [28.87497, -2.50887], [28.86209, -2.5231], [28.86193, -2.53185], [28.87943, -2.55165], [28.89288, -2.55848], [28.90226, -2.62385], [28.89793, -2.66111], [28.94346, -2.69124], [29.00357, -2.70596], [29.04081, -2.7416], [29.0562, -2.58632], [29.32234, -2.6483], [29.36805, -2.82933], [29.88237, -2.75105], [29.95911, -2.33348], [30.14034, -2.43626], [30.42933, -2.31064], [30.54501, -2.41404], [30.83915, -2.35795], [30.89303, -2.08223], [30.80802, -1.91477], [30.84079, -1.64652], [30.71974, -1.43244], [30.57123, -1.33264], [30.50889, -1.16412], [30.45116, -1.10641], [30.47194, -1.0555]]]] } },
22807     { type: "Feature", properties: { iso1A2: "SA", iso1A3: "SAU", iso1N3: "682", wikidata: "Q851", nameEn: "Saudi Arabia", groups: ["145", "142", "UN"], callingCodes: ["966"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.01521, 32.05667], [39.29903, 32.23259], [38.99233, 31.99721], [36.99791, 31.50081], [37.99354, 30.49998], [37.66395, 30.33245], [37.4971, 29.99949], [36.75083, 29.86903], [36.50005, 29.49696], [36.07081, 29.18469], [34.8812, 29.36878], [34.4454, 27.91479], [37.8565, 22.00903], [39.63762, 18.37348], [40.99158, 15.81743], [42.15205, 16.40211], [42.76801, 16.40371], [42.94625, 16.39721], [42.94351, 16.49467], [42.97215, 16.51093], [43.11601, 16.53166], [43.15274, 16.67248], [43.22066, 16.65179], [43.21325, 16.74416], [43.25857, 16.75304], [43.26303, 16.79479], [43.24801, 16.80613], [43.22956, 16.80613], [43.22012, 16.83932], [43.18338, 16.84852], [43.1398, 16.90696], [43.19328, 16.94703], [43.1813, 16.98438], [43.18233, 17.02673], [43.23967, 17.03428], [43.17787, 17.14717], [43.20156, 17.25901], [43.32653, 17.31179], [43.22533, 17.38343], [43.29185, 17.53224], [43.43005, 17.56148], [43.70631, 17.35762], [44.50126, 17.47475], [46.31018, 17.20464], [46.76494, 17.29151], [47.00571, 16.94765], [47.48245, 17.10808], [47.58351, 17.50366], [48.19996, 18.20584], [49.04884, 18.59899], [52.00311, 19.00083], [54.99756, 20.00083], [55.66469, 21.99658], [55.2137, 22.71065], [55.13599, 22.63334], [52.56622, 22.94341], [51.59617, 24.12041], [51.58871, 24.27256], [51.41644, 24.39615], [51.58834, 24.66608], [51.39468, 24.62785], [51.29972, 24.50747], [51.09638, 24.46907], [50.92992, 24.54396], [50.8133, 24.74049], [50.57069, 25.57887], [50.302, 25.87592], [50.26923, 26.08243], [50.38162, 26.53976], [50.71771, 26.73086], [50.37726, 27.89227], [49.98877, 27.87827], [49.00421, 28.81495], [48.42991, 28.53628], [47.70561, 28.5221], [47.59863, 28.66798], [47.58376, 28.83382], [47.46202, 29.0014], [46.5527, 29.10283], [46.42415, 29.05947], [44.72255, 29.19736], [42.97796, 30.48295], [42.97601, 30.72204], [40.01521, 32.05667]]]] } },
22808     { type: "Feature", properties: { iso1A2: "SB", iso1A3: "SLB", iso1N3: "090", wikidata: "Q685", nameEn: "Solomon Islands", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["677"] }, geometry: { type: "MultiPolygon", coordinates: [[[[172.71443, -12.01327], [160.43769, -4.17974], [156.03296, -6.55528], [156.03993, -6.65703], [155.92557, -6.84664], [155.69784, -6.92661], [155.60735, -6.92266], [154.74815, -7.33315], [156.73836, -14.50464], [172.71443, -12.01327]]]] } },
22809     { type: "Feature", properties: { iso1A2: "SC", iso1A3: "SYC", iso1N3: "690", wikidata: "Q1042", nameEn: "Seychelles", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["248"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.75112, -10.38913], [54.83239, -10.93575], [66.3222, 5.65313], [43.75112, -10.38913]]]] } },
22810     { type: "Feature", properties: { iso1A2: "SD", iso1A3: "SDN", iso1N3: "729", wikidata: "Q1049", nameEn: "Sudan", groups: ["015", "002", "UN"], callingCodes: ["249"] }, geometry: { type: "MultiPolygon", coordinates: [[[[37.8565, 22.00903], [34.0765, 22.00501], [33.99686, 21.76784], [33.57251, 21.72406], [33.17563, 22.00405], [24.99885, 21.99535], [24.99794, 19.99661], [23.99715, 20.00038], [23.99539, 19.49944], [23.99997, 15.69575], [23.62785, 15.7804], [23.38812, 15.69649], [23.10792, 15.71297], [22.93201, 15.55107], [22.92579, 15.47007], [22.99584, 15.40105], [22.99584, 15.22989], [22.66115, 14.86308], [22.70474, 14.69149], [22.38562, 14.58907], [22.44944, 14.24986], [22.55997, 14.23024], [22.5553, 14.11704], [22.22995, 13.96754], [22.08674, 13.77863], [22.29689, 13.3731], [22.1599, 13.19281], [22.02914, 13.13976], [21.94819, 13.05637], [21.81432, 12.81362], [21.89371, 12.68001], [21.98711, 12.63292], [22.15679, 12.66634], [22.22684, 12.74682], [22.46345, 12.61925], [22.38873, 12.45514], [22.50548, 12.16769], [22.48369, 12.02766], [22.64092, 12.07485], [22.54907, 11.64372], [22.7997, 11.40424], [22.93124, 11.41645], [22.97249, 11.21955], [22.87758, 10.91915], [23.02221, 10.69235], [23.3128, 10.45214], [23.67164, 9.86923], [23.69155, 9.67566], [24.09319, 9.66572], [24.12744, 9.73784], [24.49389, 9.79962], [24.84653, 9.80643], [24.97739, 9.9081], [25.05688, 10.06776], [25.0918, 10.33718], [25.78141, 10.42599], [25.93163, 10.38159], [25.93241, 10.17941], [26.21338, 9.91545], [26.35815, 9.57946], [26.70685, 9.48735], [27.14427, 9.62858], [27.90704, 9.61323], [28.99983, 9.67155], [29.06988, 9.74826], [29.53844, 9.75133], [29.54, 10.07949], [29.94629, 10.29245], [30.00389, 10.28633], [30.53005, 9.95992], [30.82893, 9.71451], [30.84605, 9.7498], [31.28504, 9.75287], [31.77539, 10.28939], [31.99177, 10.65065], [32.46967, 11.04662], [32.39358, 11.18207], [32.39578, 11.70208], [32.10079, 11.95203], [32.73921, 11.95203], [32.73921, 12.22757], [33.25876, 12.22111], [33.13988, 11.43248], [33.26977, 10.83632], [33.24645, 10.77913], [33.52294, 10.64382], [33.66604, 10.44254], [33.80913, 10.32994], [33.90159, 10.17179], [33.96984, 10.15446], [33.99185, 9.99623], [33.96323, 9.80972], [33.9082, 9.762], [33.87958, 9.49937], [34.10229, 9.50238], [34.08717, 9.55243], [34.13186, 9.7492], [34.20484, 9.9033], [34.22718, 10.02506], [34.32102, 10.11599], [34.34783, 10.23914], [34.2823, 10.53508], [34.4372, 10.781], [34.59062, 10.89072], [34.77383, 10.74588], [34.77532, 10.69027], [34.86618, 10.74588], [34.86916, 10.78832], [34.97491, 10.86147], [34.97789, 10.91559], [34.93172, 10.95946], [35.01215, 11.19626], [34.95704, 11.24448], [35.09556, 11.56278], [35.05832, 11.71158], [35.11492, 11.85156], [35.24302, 11.91132], [35.70476, 12.67101], [36.01458, 12.72478], [36.14268, 12.70879], [36.16651, 12.88019], [36.13374, 12.92665], [36.24545, 13.36759], [36.38993, 13.56459], [36.48824, 13.83954], [36.44653, 13.95666], [36.54376, 14.25597], [36.44337, 15.14963], [36.54276, 15.23478], [36.69761, 15.75323], [36.76371, 15.80831], [36.92193, 16.23451], [36.99777, 17.07172], [37.42694, 17.04041], [37.50967, 17.32199], [38.13362, 17.53906], [38.37133, 17.66269], [38.45916, 17.87167], [38.57727, 17.98125], [39.63762, 18.37348], [37.8565, 22.00903]]]] } },
22811     { type: "Feature", properties: { iso1A2: "SE", iso1A3: "SWE", iso1N3: "752", wikidata: "Q34", nameEn: "Sweden", groups: ["EU", "154", "150", "UN"], callingCodes: ["46"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.15791, 65.85385], [23.90497, 66.15802], [23.71339, 66.21299], [23.64982, 66.30603], [23.67591, 66.3862], [23.63776, 66.43568], [23.85959, 66.56434], [23.89488, 66.772], [23.98059, 66.79585], [23.98563, 66.84149], [23.56214, 67.17038], [23.58735, 67.20752], [23.54701, 67.25435], [23.75372, 67.29914], [23.75372, 67.43688], [23.39577, 67.46974], [23.54701, 67.59306], [23.45627, 67.85297], [23.65793, 67.9497], [23.40081, 68.05545], [23.26469, 68.15134], [23.15377, 68.14759], [23.10336, 68.26551], [22.73028, 68.40881], [22.00429, 68.50692], [21.03001, 68.88969], [20.90649, 68.89696], [20.85104, 68.93142], [20.91658, 68.96764], [20.78802, 69.03087], [20.55258, 69.06069], [20.0695, 69.04469], [20.28444, 68.93283], [20.33435, 68.80174], [20.22027, 68.67246], [19.95647, 68.55546], [20.22027, 68.48759], [19.93508, 68.35911], [18.97255, 68.52416], [18.63032, 68.50849], [18.39503, 68.58672], [18.1241, 68.53721], [18.13836, 68.20874], [17.90787, 67.96537], [17.30416, 68.11591], [16.7409, 67.91037], [16.38441, 67.52923], [16.12774, 67.52106], [16.09922, 67.4364], [16.39154, 67.21653], [16.35589, 67.06419], [15.37197, 66.48217], [15.49318, 66.28509], [15.05113, 66.15572], [14.53778, 66.12399], [14.50926, 65.31786], [13.64276, 64.58402], [14.11117, 64.46674], [14.16051, 64.18725], [13.98222, 64.00953], [13.23411, 64.09087], [12.74105, 64.02171], [12.14928, 63.59373], [12.19919, 63.47935], [11.98529, 63.27487], [12.19919, 63.00104], [12.07085, 62.6297], [12.29187, 62.25699], [12.14746, 61.7147], [12.40595, 61.57226], [12.57707, 61.56547], [12.86939, 61.35427], [12.69115, 61.06584], [12.2277, 61.02442], [12.59133, 60.50559], [12.52003, 60.13846], [12.36317, 59.99259], [12.15641, 59.8926], [11.87121, 59.86039], [11.92112, 59.69531], [11.69297, 59.59442], [11.8213, 59.24985], [11.65732, 58.90177], [11.45199, 58.89604], [11.4601, 58.99022], [11.34459, 59.11672], [11.15367, 59.07862], [11.08911, 58.98745], [10.64958, 58.89391], [10.40861, 58.38489], [12.16597, 56.60205], [12.07466, 56.29488], [12.65312, 56.04345], [12.6372, 55.91371], [12.88472, 55.63369], [12.60345, 55.42675], [12.84405, 55.13257], [14.28399, 55.1553], [14.89259, 55.5623], [15.79951, 55.54655], [19.64795, 57.06466], [19.84909, 57.57876], [20.5104, 59.15546], [19.08191, 60.19152], [19.23413, 60.61414], [20.15877, 63.06556], [24.14112, 65.39731], [24.15107, 65.81427], [24.14798, 65.83466], [24.15791, 65.85385]]]] } },
22812     { type: "Feature", properties: { iso1A2: "SG", iso1A3: "SGP", iso1N3: "702", wikidata: "Q334", nameEn: "Singapore", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["65"] }, geometry: { type: "MultiPolygon", coordinates: [[[[104.00131, 1.42405], [103.93384, 1.42926], [103.89565, 1.42841], [103.86383, 1.46288], [103.81181, 1.47953], [103.76395, 1.45183], [103.74161, 1.4502], [103.7219, 1.46108], [103.67468, 1.43166], [103.62738, 1.35255], [103.56591, 1.19719], [103.66049, 1.18825], [103.74084, 1.12902], [104.03085, 1.26954], [104.12282, 1.27714], [104.08072, 1.35998], [104.09162, 1.39694], [104.08871, 1.42015], [104.07348, 1.43322], [104.04622, 1.44691], [104.02277, 1.4438], [104.00131, 1.42405]]]] } },
22813     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
22814     { type: "Feature", properties: { iso1A2: "SI", iso1A3: "SVN", iso1N3: "705", wikidata: "Q215", nameEn: "Slovenia", groups: ["EU", "039", "150", "UN"], callingCodes: ["386"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.50139, 46.56684], [16.39217, 46.63673], [16.38594, 46.6549], [16.41863, 46.66238], [16.42641, 46.69228], [16.37816, 46.69975], [16.30966, 46.7787], [16.31303, 46.79838], [16.3408, 46.80641], [16.34547, 46.83836], [16.2941, 46.87137], [16.2365, 46.87775], [16.21892, 46.86961], [16.15711, 46.85434], [16.14365, 46.8547], [16.10983, 46.867], [16.05786, 46.83927], [15.99054, 46.82772], [15.99126, 46.78199], [15.98432, 46.74991], [15.99769, 46.7266], [16.02808, 46.71094], [16.04347, 46.68694], [16.04036, 46.6549], [15.99988, 46.67947], [15.98512, 46.68463], [15.94864, 46.68769], [15.87691, 46.7211], [15.8162, 46.71897], [15.78518, 46.70712], [15.76771, 46.69863], [15.73823, 46.70011], [15.72279, 46.69548], [15.69523, 46.69823], [15.67411, 46.70735], [15.6543, 46.70616], [15.6543, 46.69228], [15.6365, 46.6894], [15.63255, 46.68069], [15.62317, 46.67947], [15.59826, 46.68908], [15.54533, 46.66985], [15.55333, 46.64988], [15.54431, 46.6312], [15.46906, 46.61321], [15.45514, 46.63697], [15.41235, 46.65556], [15.23711, 46.63994], [15.14215, 46.66131], [15.01451, 46.641], [14.98024, 46.6009], [14.96002, 46.63459], [14.92283, 46.60848], [14.87129, 46.61], [14.86419, 46.59411], [14.83549, 46.56614], [14.81836, 46.51046], [14.72185, 46.49974], [14.66892, 46.44936], [14.5942, 46.43434], [14.56463, 46.37208], [14.52176, 46.42617], [14.45877, 46.41717], [14.42608, 46.44614], [14.314, 46.43327], [14.28326, 46.44315], [14.15989, 46.43327], [14.12097, 46.47724], [14.04002, 46.49117], [14.00422, 46.48474], [13.89837, 46.52331], [13.7148, 46.5222], [13.68684, 46.43881], [13.59777, 46.44137], [13.5763, 46.42613], [13.5763, 46.40915], [13.47019, 46.3621], [13.43418, 46.35992], [13.44808, 46.33507], [13.37671, 46.29668], [13.42218, 46.20758], [13.47587, 46.22725], [13.56114, 46.2054], [13.56682, 46.18703], [13.64451, 46.18966], [13.66472, 46.17392], [13.64053, 46.13587], [13.57072, 46.09022], [13.50104, 46.05986], [13.49568, 46.04839], [13.50998, 46.04498], [13.49702, 46.01832], [13.47474, 46.00546], [13.50104, 45.98078], [13.52963, 45.96588], [13.56759, 45.96991], [13.58903, 45.99009], [13.62074, 45.98388], [13.63458, 45.98947], [13.64307, 45.98326], [13.6329, 45.94894], [13.63815, 45.93607], [13.61931, 45.91782], [13.60857, 45.89907], [13.59565, 45.89446], [13.58644, 45.88173], [13.57563, 45.8425], [13.58858, 45.83503], [13.59784, 45.8072], [13.66986, 45.79955], [13.8235, 45.7176], [13.83332, 45.70855], [13.83422, 45.68703], [13.87933, 45.65207], [13.9191, 45.6322], [13.8695, 45.60835], [13.86771, 45.59898], [13.84106, 45.58185], [13.78445, 45.5825], [13.74587, 45.59811], [13.7198, 45.59352], [13.6076, 45.64761], [13.45644, 45.59464], [13.56979, 45.4895], [13.62902, 45.45898], [13.67398, 45.4436], [13.7785, 45.46787], [13.81742, 45.43729], [13.88124, 45.42637], [13.90771, 45.45149], [13.97309, 45.45258], [13.99488, 45.47551], [13.96063, 45.50825], [14.00578, 45.52352], [14.07116, 45.48752], [14.20348, 45.46896], [14.22371, 45.50388], [14.24239, 45.50607], [14.26611, 45.48239], [14.27681, 45.4902], [14.32487, 45.47142], [14.36693, 45.48642], [14.49769, 45.54424], [14.5008, 45.60852], [14.53816, 45.6205], [14.57397, 45.67165], [14.60977, 45.66403], [14.59576, 45.62812], [14.69694, 45.57366], [14.68605, 45.53006], [14.71718, 45.53442], [14.80124, 45.49515], [14.81992, 45.45913], [14.90554, 45.47769], [14.92266, 45.52788], [15.02385, 45.48533], [15.05187, 45.49079], [15.16862, 45.42309], [15.27758, 45.46678], [15.33051, 45.45258], [15.38188, 45.48752], [15.30249, 45.53224], [15.29837, 45.5841], [15.27747, 45.60504], [15.31027, 45.6303], [15.34695, 45.63382], [15.34214, 45.64702], [15.38952, 45.63682], [15.4057, 45.64727], [15.34919, 45.71623], [15.30872, 45.69014], [15.25423, 45.72275], [15.40836, 45.79491], [15.47531, 45.79802], [15.47325, 45.8253], [15.52234, 45.82195], [15.57952, 45.84953], [15.64185, 45.82915], [15.66662, 45.84085], [15.70411, 45.8465], [15.68232, 45.86819], [15.68383, 45.88867], [15.67967, 45.90455], [15.70636, 45.92116], [15.70327, 46.00015], [15.71246, 46.01196], [15.72977, 46.04682], [15.62317, 46.09103], [15.6083, 46.11992], [15.59909, 46.14761], [15.64904, 46.19229], [15.6434, 46.21396], [15.67395, 46.22478], [15.75436, 46.21969], [15.75479, 46.20336], [15.78817, 46.21719], [15.79284, 46.25811], [15.97965, 46.30652], [16.07616, 46.3463], [16.07314, 46.36458], [16.05065, 46.3833], [16.05281, 46.39141], [16.14859, 46.40547], [16.18824, 46.38282], [16.30233, 46.37837], [16.30162, 46.40437], [16.27329, 46.41467], [16.27398, 46.42875], [16.25124, 46.48067], [16.23961, 46.49653], [16.26759, 46.50566], [16.26733, 46.51505], [16.29793, 46.5121], [16.37193, 46.55008], [16.38771, 46.53608], [16.44036, 46.5171], [16.5007, 46.49644], [16.52604, 46.47831], [16.59527, 46.47524], [16.52604, 46.5051], [16.52885, 46.53303], [16.50139, 46.56684]]]] } },
22815     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
22816     { type: "Feature", properties: { iso1A2: "SK", iso1A3: "SVK", iso1N3: "703", wikidata: "Q214", nameEn: "Slovakia", groups: ["EU", "151", "150", "UN"], callingCodes: ["421"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.82237, 49.27806], [19.78581, 49.41701], [19.72127, 49.39288], [19.6375, 49.40897], [19.64162, 49.45184], [19.57845, 49.46077], [19.53313, 49.52856], [19.52626, 49.57311], [19.45348, 49.61583], [19.37795, 49.574], [19.36009, 49.53747], [19.25435, 49.53391], [19.18019, 49.41165], [18.9742, 49.39557], [18.97283, 49.49914], [18.94536, 49.52143], [18.84521, 49.51672], [18.74761, 49.492], [18.67757, 49.50895], [18.6144, 49.49824], [18.57183, 49.51162], [18.53063, 49.49022], [18.54848, 49.47059], [18.44686, 49.39467], [18.4084, 49.40003], [18.4139, 49.36517], [18.36446, 49.3267], [18.18456, 49.28909], [18.15022, 49.24518], [18.1104, 49.08624], [18.06885, 49.03157], [17.91814, 49.01784], [17.87831, 48.92679], [17.77944, 48.92318], [17.73126, 48.87885], [17.7094, 48.86721], [17.5295, 48.81117], [17.45671, 48.85004], [17.3853, 48.80936], [17.29054, 48.85546], [17.19355, 48.87602], [17.11202, 48.82925], [17.00215, 48.70887], [16.93955, 48.60371], [16.94611, 48.53614], [16.85204, 48.44968], [16.8497, 48.38321], [16.83588, 48.3844], [16.83317, 48.38138], [16.84243, 48.35258], [16.90903, 48.32519], [16.89461, 48.31332], [16.97701, 48.17385], [17.02919, 48.13996], [17.05735, 48.14179], [17.09168, 48.09366], [17.07039, 48.0317], [17.16001, 48.00636], [17.23699, 48.02094], [17.71215, 47.7548], [18.02938, 47.75665], [18.29305, 47.73541], [18.56496, 47.76588], [18.66521, 47.76772], [18.74074, 47.8157], [18.8506, 47.82308], [18.76821, 47.87469], [18.76134, 47.97499], [18.82176, 48.04206], [19.01952, 48.07052], [19.23924, 48.0595], [19.28182, 48.08336], [19.47957, 48.09437], [19.52489, 48.19791], [19.63338, 48.25006], [19.92452, 48.1283], [20.24312, 48.2784], [20.29943, 48.26104], [20.5215, 48.53336], [20.83248, 48.5824], [21.11516, 48.49546], [21.44063, 48.58456], [21.6068, 48.50365], [21.67134, 48.3989], [21.72525, 48.34628], [21.8279, 48.33321], [21.83339, 48.36242], [22.14689, 48.4005], [22.16023, 48.56548], [22.21379, 48.6218], [22.34151, 48.68893], [22.42934, 48.92857], [22.48296, 48.99172], [22.54338, 49.01424], [22.56155, 49.08865], [22.04427, 49.22136], [21.96385, 49.3437], [21.82927, 49.39467], [21.77983, 49.35443], [21.62328, 49.4447], [21.43376, 49.41433], [21.27858, 49.45988], [21.19756, 49.4054], [21.12477, 49.43666], [21.041, 49.41791], [21.09799, 49.37176], [20.98733, 49.30774], [20.9229, 49.29626], [20.77971, 49.35383], [20.72274, 49.41813], [20.61666, 49.41791], [20.5631, 49.375], [20.46422, 49.41612], [20.39939, 49.3896], [20.31728, 49.39914], [20.31453, 49.34817], [20.21977, 49.35265], [20.13738, 49.31685], [20.08238, 49.1813], [19.98494, 49.22904], [19.90529, 49.23532], [19.86409, 49.19316], [19.75286, 49.20751], [19.82237, 49.27806]]]] } },
22817     { type: "Feature", properties: { iso1A2: "SL", iso1A3: "SLE", iso1N3: "694", wikidata: "Q1044", nameEn: "Sierra Leone", groups: ["011", "202", "002", "UN"], callingCodes: ["232"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.27575, 8.48711], [-10.37257, 8.48941], [-10.54891, 8.31174], [-10.63934, 8.35326], [-10.70565, 8.29235], [-10.61422, 8.5314], [-10.47707, 8.67669], [-10.56197, 8.81225], [-10.5783, 9.06386], [-10.74484, 9.07998], [-10.6534, 9.29919], [-11.2118, 10.00098], [-11.89624, 9.99763], [-11.91023, 9.93927], [-12.12634, 9.87203], [-12.24262, 9.92386], [-12.47254, 9.86834], [-12.76788, 9.3133], [-12.94095, 9.26335], [-13.08953, 9.0409], [-13.18586, 9.0925], [-13.29911, 9.04245], [-14.36218, 8.64107], [-12.15048, 6.15992], [-11.50429, 6.92704], [-11.4027, 6.97746], [-11.29417, 7.21576], [-10.60422, 7.7739], [-10.60492, 8.04072], [-10.57523, 8.04829], [-10.51554, 8.1393], [-10.45023, 8.15627], [-10.35227, 8.15223], [-10.29839, 8.21283], [-10.31635, 8.28554], [-10.30084, 8.30008], [-10.27575, 8.48711]]]] } },
22818     { type: "Feature", properties: { iso1A2: "SM", iso1A3: "SMR", iso1N3: "674", wikidata: "Q238", nameEn: "San Marino", groups: ["039", "150", "UN"], callingCodes: ["378"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45648, 43.89369], [12.48771, 43.89706], [12.49429, 43.90973], [12.49247, 43.91774], [12.49724, 43.92248], [12.50269, 43.92363], [12.50496, 43.93017], [12.51553, 43.94096], [12.51427, 43.94897], [12.50655, 43.95796], [12.50875, 43.96198], [12.50622, 43.97131], [12.51109, 43.97201], [12.51064, 43.98165], [12.5154, 43.98508], [12.51463, 43.99122], [12.50678, 43.99113], [12.49406, 43.98492], [12.47853, 43.98052], [12.46205, 43.97463], [12.44684, 43.96597], [12.43662, 43.95698], [12.42005, 43.9578], [12.41414, 43.95273], [12.40415, 43.95485], [12.40506, 43.94325], [12.41165, 43.93769], [12.41551, 43.92984], [12.40733, 43.92379], [12.41233, 43.90956], [12.40935, 43.9024], [12.41641, 43.89991], [12.44184, 43.90498], [12.45648, 43.89369]]]] } },
22819     { type: "Feature", properties: { iso1A2: "SN", iso1A3: "SEN", iso1N3: "686", wikidata: "Q1041", nameEn: "Senegal", groups: ["011", "202", "002", "UN"], callingCodes: ["221"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.32144, 16.61495], [-15.00557, 16.64997], [-15.6509, 16.50315], [-16.27016, 16.51565], [-16.4429, 16.20605], [-16.44814, 16.09753], [-16.48967, 16.0496], [-16.50854, 16.09032], [-17.15288, 16.07139], [-18.35085, 14.63444], [-17.43598, 13.59273], [-15.47902, 13.58758], [-15.36504, 13.79313], [-14.93719, 13.80173], [-14.34721, 13.46578], [-13.8955, 13.59126], [-13.79409, 13.34472], [-14.36795, 13.23033], [-15.14917, 13.57989], [-15.26908, 13.37768], [-15.80478, 13.34832], [-15.80355, 13.16729], [-16.69343, 13.16791], [-16.74676, 13.06025], [-17.43966, 13.04579], [-17.4623, 11.92379], [-16.70562, 12.34803], [-16.38191, 12.36449], [-16.20591, 12.46157], [-15.67302, 12.42974], [-15.17582, 12.6847], [-13.70523, 12.68013], [-13.05296, 12.64003], [-13.06603, 12.49342], [-12.87336, 12.51892], [-12.35415, 12.32758], [-11.91331, 12.42008], [-11.46267, 12.44559], [-11.37536, 12.40788], [-11.39935, 12.97808], [-11.63025, 13.39174], [-11.83345, 13.33333], [-12.06897, 13.71049], [-11.93043, 13.84505], [-12.23936, 14.76324], [-13.11029, 15.52116], [-13.43135, 16.09022], [-13.80075, 16.13961], [-14.32144, 16.61495]]]] } },
22820     { type: "Feature", properties: { iso1A2: "SO", iso1A3: "SOM", iso1N3: "706", wikidata: "Q1045", nameEn: "Somalia", groups: ["014", "202", "002", "UN"], callingCodes: ["252"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.12877, 12.56479], [43.90659, 12.3823], [42.95776, 10.98533], [42.69452, 10.62672], [42.87643, 10.18441], [43.0937, 9.90579], [43.23518, 9.84605], [43.32613, 9.59205], [44.19222, 8.93028], [46.99339, 7.9989], [47.92477, 8.00111], [47.97917, 8.00124], [44.98104, 4.91821], [44.02436, 4.9451], [43.40263, 4.79289], [43.04177, 4.57923], [42.97746, 4.44032], [42.84526, 4.28357], [42.55853, 4.20518], [42.07619, 4.17667], [41.89488, 3.97375], [41.31368, 3.14314], [40.98767, 2.82959], [41.00099, -0.83068], [41.56, -1.59812], [41.56362, -1.66375], [41.75542, -1.85308], [57.49095, 8.14549], [51.12877, 12.56479]]]] } },
22821     { type: "Feature", properties: { iso1A2: "SR", iso1A3: "SUR", iso1N3: "740", wikidata: "Q730", nameEn: "Suriname", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["597"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-54.26916, 5.26909], [-54.01877, 5.52789], [-54.01074, 5.68785], [-53.7094, 6.2264], [-56.84822, 6.73257], [-57.31629, 5.33714], [-57.22536, 5.15605], [-57.37442, 5.0208], [-57.8699, 4.89394], [-58.0307, 3.95513], [-57.35891, 3.32121], [-56.70519, 2.02964], [-56.55439, 2.02003], [-56.47045, 1.95135], [-55.99278, 1.83137], [-55.89863, 1.89861], [-55.92159, 2.05236], [-56.13054, 2.27723], [-55.96292, 2.53188], [-55.71493, 2.40342], [-55.01919, 2.564], [-54.6084, 2.32856], [-54.42864, 2.42442], [-54.28534, 2.67798], [-53.9849, 3.58697], [-53.98914, 3.627], [-54.05128, 3.63557], [-54.19367, 3.84387], [-54.38444, 4.13222], [-54.4717, 4.91964], [-54.26916, 5.26909]]]] } },
22822     { type: "Feature", properties: { iso1A2: "SS", iso1A3: "SSD", iso1N3: "728", wikidata: "Q958", nameEn: "South Sudan", groups: ["014", "202", "002", "UN"], callingCodes: ["211"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.10229, 9.50238], [33.87958, 9.49937], [33.9082, 9.762], [33.96323, 9.80972], [33.99185, 9.99623], [33.96984, 10.15446], [33.90159, 10.17179], [33.80913, 10.32994], [33.66604, 10.44254], [33.52294, 10.64382], [33.24645, 10.77913], [33.26977, 10.83632], [33.13988, 11.43248], [33.25876, 12.22111], [32.73921, 12.22757], [32.73921, 11.95203], [32.10079, 11.95203], [32.39578, 11.70208], [32.39358, 11.18207], [32.46967, 11.04662], [31.99177, 10.65065], [31.77539, 10.28939], [31.28504, 9.75287], [30.84605, 9.7498], [30.82893, 9.71451], [30.53005, 9.95992], [30.00389, 10.28633], [29.94629, 10.29245], [29.54, 10.07949], [29.53844, 9.75133], [29.06988, 9.74826], [28.99983, 9.67155], [27.90704, 9.61323], [27.14427, 9.62858], [26.70685, 9.48735], [26.35815, 9.57946], [26.21338, 9.91545], [25.93241, 10.17941], [25.93163, 10.38159], [25.78141, 10.42599], [25.0918, 10.33718], [25.05688, 10.06776], [24.97739, 9.9081], [24.84653, 9.80643], [24.49389, 9.79962], [24.12744, 9.73784], [24.09319, 9.66572], [23.69155, 9.67566], [23.62179, 9.53823], [23.64981, 9.44303], [23.64358, 9.28637], [23.56263, 9.19418], [23.4848, 9.16959], [23.44744, 8.99128], [23.59065, 8.99743], [23.51905, 8.71749], [24.25691, 8.69288], [24.13238, 8.36959], [24.35965, 8.26177], [24.85156, 8.16933], [24.98855, 7.96588], [25.25319, 7.8487], [25.29214, 7.66675], [25.20649, 7.61115], [25.20337, 7.50312], [25.35281, 7.42595], [25.37461, 7.33024], [25.90076, 7.09549], [26.38022, 6.63493], [26.32729, 6.36272], [26.58259, 6.1987], [26.51721, 6.09655], [27.22705, 5.71254], [27.22705, 5.62889], [27.28621, 5.56382], [27.23017, 5.37167], [27.26886, 5.25876], [27.44012, 5.07349], [27.56656, 4.89375], [27.65462, 4.89375], [27.76469, 4.79284], [27.79551, 4.59976], [28.20719, 4.35614], [28.6651, 4.42638], [28.8126, 4.48784], [29.03054, 4.48784], [29.22207, 4.34297], [29.43341, 4.50101], [29.49726, 4.7007], [29.82087, 4.56246], [29.79666, 4.37809], [30.06964, 4.13221], [30.1621, 4.10586], [30.22374, 3.93896], [30.27658, 3.95653], [30.47691, 3.83353], [30.55396, 3.84451], [30.57378, 3.74567], [30.56277, 3.62703], [30.78512, 3.67097], [30.80713, 3.60506], [30.85997, 3.5743], [30.85153, 3.48867], [30.97601, 3.693], [31.16666, 3.79853], [31.29476, 3.8015], [31.50478, 3.67814], [31.50776, 3.63652], [31.72075, 3.74354], [31.81459, 3.82083], [31.86821, 3.78664], [31.96205, 3.6499], [31.95907, 3.57408], [32.05187, 3.589], [32.08491, 3.56287], [32.08866, 3.53543], [32.19888, 3.50867], [32.20782, 3.6053], [32.41337, 3.748], [32.72021, 3.77327], [32.89746, 3.81339], [33.02852, 3.89296], [33.18356, 3.77812], [33.51264, 3.75068], [33.9873, 4.23316], [34.47601, 4.72162], [35.34151, 5.02364], [35.30992, 4.90402], [35.47843, 4.91872], [35.42366, 4.76969], [35.51424, 4.61643], [35.9419, 4.61933], [35.82118, 4.77382], [35.81968, 5.10757], [35.8576, 5.33413], [35.50792, 5.42431], [35.29938, 5.34042], [35.31188, 5.50106], [35.13058, 5.62118], [35.12611, 5.68937], [35.00546, 5.89387], [34.96227, 6.26415], [35.01738, 6.46991], [34.87736, 6.60161], [34.77459, 6.5957], [34.65096, 6.72589], [34.53776, 6.74808], [34.53925, 6.82794], [34.47669, 6.91076], [34.35753, 6.91963], [34.19369, 7.04382], [34.19369, 7.12807], [34.01495, 7.25664], [34.03878, 7.27437], [34.02984, 7.36449], [33.87642, 7.5491], [33.71407, 7.65983], [33.44745, 7.7543], [33.32531, 7.71297], [33.24637, 7.77939], [33.04944, 7.78989], [33.0006, 7.90333], [33.08401, 8.05822], [33.18083, 8.13047], [33.1853, 8.29264], [33.19721, 8.40317], [33.3119, 8.45474], [33.54575, 8.47094], [33.66938, 8.44442], [33.71407, 8.3678], [33.87195, 8.41938], [33.89579, 8.4842], [34.01346, 8.50041], [34.14453, 8.60204], [34.14304, 9.04654], [34.10229, 9.50238]]]] } },
22823     { type: "Feature", properties: { iso1A2: "ST", iso1A3: "STP", iso1N3: "678", wikidata: "Q1039", nameEn: "S\xE3o Tom\xE9 and Principe", groups: ["017", "202", "002", "UN"], callingCodes: ["239"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.34149, 1.91417], [6.6507, -0.28606], [7.9035, 1.92304], [4.34149, 1.91417]]]] } },
22824     { type: "Feature", properties: { iso1A2: "SV", iso1A3: "SLV", iso1N3: "222", wikidata: "Q792", nameEn: "El Salvador", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["503"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.34776, 14.43013], [-89.39028, 14.44561], [-89.57441, 14.41637], [-89.58814, 14.33165], [-89.50614, 14.26084], [-89.52397, 14.22628], [-89.61844, 14.21937], [-89.70756, 14.1537], [-89.75569, 14.07073], [-89.73251, 14.04133], [-89.76103, 14.02923], [-89.81807, 14.07073], [-89.88937, 14.0396], [-90.10505, 13.85104], [-90.11344, 13.73679], [-90.55276, 12.8866], [-88.11443, 12.63306], [-87.7346, 13.13228], [-87.55124, 13.12523], [-87.69751, 13.25228], [-87.73714, 13.32715], [-87.80177, 13.35689], [-87.84675, 13.41078], [-87.83467, 13.44655], [-87.77354, 13.45767], [-87.73841, 13.44169], [-87.72115, 13.46083], [-87.71657, 13.50577], [-87.78148, 13.52906], [-87.73106, 13.75443], [-87.68821, 13.80829], [-87.7966, 13.91353], [-88.00331, 13.86948], [-88.07641, 13.98447], [-88.23018, 13.99915], [-88.25791, 13.91108], [-88.48982, 13.86458], [-88.49738, 13.97224], [-88.70661, 14.04317], [-88.73182, 14.10919], [-88.815, 14.11652], [-88.85785, 14.17763], [-88.94608, 14.20207], [-89.04187, 14.33644], [-89.34776, 14.43013]]]] } },
22825     { type: "Feature", properties: { iso1A2: "SX", iso1A3: "SXM", iso1N3: "534", wikidata: "Q26273", nameEn: "Sint Maarten", aliases: ["NL-SX"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["1 721"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.33064, 17.9615], [-63.1055, 17.86651], [-62.93924, 18.02904], [-63.02323, 18.05757], [-63.04039, 18.05619], [-63.0579, 18.06614], [-63.07759, 18.04943], [-63.09686, 18.04608], [-63.11042, 18.05339], [-63.13502, 18.05445], [-63.33064, 17.9615]]]] } },
22826     { type: "Feature", properties: { iso1A2: "SY", iso1A3: "SYR", iso1N3: "760", wikidata: "Q858", nameEn: "Syria", groups: ["145", "142", "UN"], callingCodes: ["963"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.23683, 37.2863], [42.21548, 37.28026], [42.20454, 37.28715], [42.22381, 37.30238], [42.22257, 37.31395], [42.2112, 37.32491], [42.19301, 37.31323], [42.18225, 37.28569], [42.00894, 37.17209], [41.515, 37.08084], [41.21937, 37.07665], [40.90856, 37.13147], [40.69136, 37.0996], [39.81589, 36.75538], [39.21538, 36.66834], [39.03217, 36.70911], [38.74042, 36.70629], [38.55908, 36.84429], [38.38859, 36.90064], [38.21064, 36.91842], [37.81974, 36.76055], [37.68048, 36.75065], [37.49103, 36.66904], [37.47253, 36.63243], [37.21988, 36.6736], [37.16177, 36.66069], [37.10894, 36.6704], [37.08279, 36.63495], [37.02088, 36.66422], [37.01647, 36.69512], [37.04619, 36.71101], [37.04399, 36.73483], [36.99886, 36.74012], [36.99557, 36.75997], [36.66727, 36.82901], [36.61581, 36.74629], [36.62681, 36.71189], [36.57398, 36.65186], [36.58829, 36.58295], [36.54206, 36.49539], [36.6081, 36.33772], [36.65653, 36.33861], [36.68672, 36.23677], [36.6125, 36.22592], [36.50463, 36.2419], [36.4617, 36.20461], [36.39206, 36.22088], [36.37474, 36.01163], [36.33956, 35.98687], [36.30099, 36.00985], [36.28338, 36.00273], [36.29769, 35.96086], [36.27678, 35.94839], [36.25366, 35.96264], [36.19973, 35.95195], [36.17441, 35.92076], [36.1623, 35.80925], [36.14029, 35.81015], [36.13919, 35.83692], [36.11827, 35.85923], [35.99829, 35.88242], [36.01844, 35.92403], [36.00514, 35.94113], [35.98499, 35.94107], [35.931, 35.92109], [35.51152, 36.10954], [35.48515, 34.70851], [35.97386, 34.63322], [35.98718, 34.64977], [36.29165, 34.62991], [36.32399, 34.69334], [36.35135, 34.68516], [36.35384, 34.65447], [36.42941, 34.62505], [36.46003, 34.6378], [36.45299, 34.59438], [36.41429, 34.61175], [36.39846, 34.55672], [36.3369, 34.52629], [36.34745, 34.5002], [36.4442, 34.50165], [36.46179, 34.46541], [36.55853, 34.41609], [36.53039, 34.3798], [36.56556, 34.31881], [36.60778, 34.31009], [36.58667, 34.27667], [36.59195, 34.2316], [36.62537, 34.20251], [36.5128, 34.09916], [36.50576, 34.05982], [36.41078, 34.05253], [36.28589, 33.91981], [36.38263, 33.86579], [36.3967, 33.83365], [36.14517, 33.85118], [36.06778, 33.82927], [35.9341, 33.6596], [36.05723, 33.57904], [35.94465, 33.52774], [35.94816, 33.47886], [35.88668, 33.43183], [35.82577, 33.40479], [35.81324, 33.36354], [35.77477, 33.33609], [35.813, 33.3172], [35.77513, 33.27342], [35.81295, 33.24841], [35.81647, 33.2028], [35.83846, 33.19397], [35.84285, 33.16673], [35.81911, 33.1336], [35.81911, 33.11077], [35.84802, 33.1031], [35.87188, 32.98028], [35.89298, 32.9456], [35.87012, 32.91976], [35.84021, 32.8725], [35.83758, 32.82817], [35.78745, 32.77938], [35.75983, 32.74803], [35.88405, 32.71321], [35.93307, 32.71966], [35.96633, 32.66237], [36.02239, 32.65911], [36.08074, 32.51463], [36.20379, 32.52751], [36.20875, 32.49529], [36.23948, 32.50108], [36.40959, 32.37908], [36.83946, 32.31293], [38.79171, 33.37328], [40.64314, 34.31604], [40.97676, 34.39788], [41.12388, 34.65742], [41.2345, 34.80049], [41.21654, 35.1508], [41.26569, 35.42708], [41.38184, 35.62502], [41.37027, 35.84095], [41.2564, 36.06012], [41.28864, 36.35368], [41.40058, 36.52502], [41.81736, 36.58782], [42.36697, 37.0627], [42.35724, 37.10998], [42.32313, 37.17814], [42.34735, 37.22548], [42.2824, 37.2798], [42.26039, 37.27017], [42.23683, 37.2863]]]] } },
22827     { type: "Feature", properties: { iso1A2: "SZ", iso1A3: "SWZ", iso1N3: "748", wikidata: "Q1050", nameEn: "Eswatini", aliases: ["Swaziland"], groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.86881, -25.99973], [31.4175, -25.71886], [31.31237, -25.7431], [31.13073, -25.91558], [30.95819, -26.26303], [30.78927, -26.48271], [30.81101, -26.84722], [30.88826, -26.79622], [30.97757, -26.92706], [30.96088, -27.0245], [31.15027, -27.20151], [31.49834, -27.31549], [31.97592, -27.31675], [31.97463, -27.11057], [32.00893, -26.8096], [32.09664, -26.80721], [32.13315, -26.84345], [32.13409, -26.5317], [32.07352, -26.40185], [32.10435, -26.15656], [32.08599, -26.00978], [32.00916, -25.999], [31.974, -25.95387], [31.86881, -25.99973]]]] } },
22828     { type: "Feature", properties: { iso1A2: "TA", iso1A3: "TAA", wikidata: "Q220982", nameEn: "Tristan da Cunha", aliases: ["SH-TA"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290 8", "44 20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-13.38232, -34.07258], [-16.67337, -41.9188], [-5.88482, -41.4829], [-13.38232, -34.07258]]]] } },
22829     { type: "Feature", properties: { iso1A2: "TC", iso1A3: "TCA", iso1N3: "796", wikidata: "Q18221", nameEn: "Turks and Caicos Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 649"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.70065, 25.7637], [-72.98446, 20.4801], [-69.80718, 21.35956], [-71.70065, 25.7637]]]] } },
22830     { type: "Feature", properties: { iso1A2: "TD", iso1A3: "TCD", iso1N3: "148", wikidata: "Q657", nameEn: "Chad", groups: ["017", "202", "002", "UN"], callingCodes: ["235"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.99539, 19.49944], [15.99566, 23.49639], [14.99751, 23.00539], [15.19692, 21.99339], [15.20213, 21.49365], [15.28332, 21.44557], [15.62515, 20.95395], [15.57248, 20.92138], [15.55382, 20.86507], [15.56004, 20.79488], [15.59841, 20.74039], [15.6721, 20.70069], [15.99632, 20.35364], [15.75098, 19.93002], [15.6032, 18.77402], [15.50373, 16.89649], [14.37425, 15.72591], [13.86301, 15.04043], [13.78991, 14.87519], [13.809, 14.72915], [13.67878, 14.64013], [13.68573, 14.55276], [13.48259, 14.46704], [13.47559, 14.40881], [13.6302, 13.71094], [14.08251, 13.0797], [14.46881, 13.08259], [14.56101, 12.91036], [14.55058, 12.78256], [14.83314, 12.62963], [14.90827, 12.3269], [14.89019, 12.16593], [14.96952, 12.0925], [15.00146, 12.1223], [15.0349, 12.10698], [15.05786, 12.0608], [15.04808, 11.8731], [15.11579, 11.79313], [15.06595, 11.71126], [15.13149, 11.5537], [15.0585, 11.40481], [15.10021, 11.04101], [15.04957, 11.02347], [15.09127, 10.87431], [15.06737, 10.80921], [15.15532, 10.62846], [15.14936, 10.53915], [15.23724, 10.47764], [15.30874, 10.31063], [15.50535, 10.1098], [15.68761, 9.99344], [15.41408, 9.92876], [15.24618, 9.99246], [15.14043, 9.99246], [15.05999, 9.94845], [14.95722, 9.97926], [14.80082, 9.93818], [14.4673, 10.00264], [14.20411, 10.00055], [14.1317, 9.82413], [14.01793, 9.73169], [13.97544, 9.6365], [14.37094, 9.2954], [14.35707, 9.19611], [14.83566, 8.80557], [15.09484, 8.65982], [15.20426, 8.50892], [15.50743, 7.79302], [15.59272, 7.7696], [15.56964, 7.58936], [15.49743, 7.52179], [15.73118, 7.52006], [15.79942, 7.44149], [16.40703, 7.68809], [16.41583, 7.77971], [16.58315, 7.88657], [16.59415, 7.76444], [16.658, 7.75353], [16.6668, 7.67281], [16.8143, 7.53971], [17.67288, 7.98905], [17.93926, 7.95853], [18.02731, 8.01085], [18.6085, 8.05009], [18.64153, 8.08714], [18.62612, 8.14163], [18.67455, 8.22226], [18.79783, 8.25929], [19.11044, 8.68172], [18.86388, 8.87971], [19.06421, 9.00367], [20.36748, 9.11019], [20.82979, 9.44696], [21.26348, 9.97642], [21.34934, 9.95907], [21.52766, 10.2105], [21.63553, 10.217], [21.71479, 10.29932], [21.72139, 10.64136], [22.45889, 11.00246], [22.87758, 10.91915], [22.97249, 11.21955], [22.93124, 11.41645], [22.7997, 11.40424], [22.54907, 11.64372], [22.64092, 12.07485], [22.48369, 12.02766], [22.50548, 12.16769], [22.38873, 12.45514], [22.46345, 12.61925], [22.22684, 12.74682], [22.15679, 12.66634], [21.98711, 12.63292], [21.89371, 12.68001], [21.81432, 12.81362], [21.94819, 13.05637], [22.02914, 13.13976], [22.1599, 13.19281], [22.29689, 13.3731], [22.08674, 13.77863], [22.22995, 13.96754], [22.5553, 14.11704], [22.55997, 14.23024], [22.44944, 14.24986], [22.38562, 14.58907], [22.70474, 14.69149], [22.66115, 14.86308], [22.99584, 15.22989], [22.99584, 15.40105], [22.92579, 15.47007], [22.93201, 15.55107], [23.10792, 15.71297], [23.38812, 15.69649], [23.62785, 15.7804], [23.99997, 15.69575], [23.99539, 19.49944]]]] } },
22831     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
22832     { type: "Feature", properties: { iso1A2: "TG", iso1A3: "TGO", iso1N3: "768", wikidata: "Q945", nameEn: "Togo", groups: ["011", "202", "002", "UN"], callingCodes: ["228"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.50388, 11.01011], [-0.13493, 11.14075], [-0.14462, 11.10811], [-0.05733, 11.08628], [-0.0275, 11.11202], [-514e-5, 11.10763], [342e-5, 11.08317], [0.02395, 11.06229], [0.03355, 10.9807], [-63e-4, 10.96417], [-908e-5, 10.91644], [-0.02685, 10.8783], [-0.0228, 10.81916], [-0.07183, 10.76794], [-0.07327, 10.71845], [-0.09141, 10.7147], [-0.05945, 10.63458], [0.12886, 10.53149], [0.18846, 10.4096], [0.29453, 10.41546], [0.33028, 10.30408], [0.39584, 10.31112], [0.35293, 10.09412], [0.41371, 10.06361], [0.41252, 10.02018], [0.36366, 10.03309], [0.32075, 9.72781], [0.34816, 9.71607], [0.34816, 9.66907], [0.32313, 9.6491], [0.28261, 9.69022], [0.26712, 9.66437], [0.29334, 9.59387], [0.36008, 9.6256], [0.38153, 9.58682], [0.23851, 9.57389], [0.2409, 9.52335], [0.30406, 9.521], [0.31241, 9.50337], [0.2254, 9.47869], [0.25758, 9.42696], [0.33148, 9.44812], [0.36485, 9.49749], [0.49118, 9.48339], [0.56388, 9.40697], [0.45424, 9.04581], [0.52455, 8.87746], [0.37319, 8.75262], [0.47211, 8.59945], [0.64731, 8.48866], [0.73432, 8.29529], [0.63897, 8.25873], [0.5913, 8.19622], [0.61156, 8.18324], [0.6056, 8.13959], [0.58891, 8.12779], [0.62943, 7.85751], [0.58295, 7.62368], [0.51979, 7.58706], [0.52455, 7.45354], [0.57223, 7.39326], [0.62943, 7.41099], [0.65327, 7.31643], [0.59606, 7.01252], [0.52217, 6.9723], [0.52098, 6.94391], [0.56508, 6.92971], [0.52853, 6.82921], [0.57406, 6.80348], [0.58176, 6.76049], [0.6497, 6.73682], [0.63659, 6.63857], [0.74862, 6.56517], [0.71048, 6.53083], [0.89283, 6.33779], [0.99652, 6.33779], [1.03108, 6.24064], [1.05969, 6.22998], [1.09187, 6.17074], [1.19966, 6.17069], [1.19771, 6.11522], [1.27574, 5.93551], [1.67336, 6.02702], [1.62913, 6.24075], [1.79826, 6.28221], [1.76906, 6.43189], [1.58105, 6.68619], [1.61812, 6.74843], [1.55877, 6.99737], [1.64249, 6.99562], [1.61838, 9.0527], [1.5649, 9.16941], [1.41746, 9.3226], [1.33675, 9.54765], [1.36624, 9.5951], [1.35507, 9.99525], [0.77666, 10.37665], [0.80358, 10.71459], [0.8804, 10.803], [0.91245, 10.99597], [0.66104, 10.99964], [0.4958, 10.93269], [0.50521, 10.98035], [0.48852, 10.98561], [0.50388, 11.01011]]]] } },
22833     { type: "Feature", properties: { iso1A2: "TH", iso1A3: "THA", iso1N3: "764", wikidata: "Q869", nameEn: "Thailand", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["66"] }, geometry: { type: "MultiPolygon", coordinates: [[[[100.08404, 20.36626], [99.95721, 20.46301], [99.91616, 20.44986], [99.90499, 20.4487], [99.89692, 20.44789], [99.89301, 20.44311], [99.89168, 20.44548], [99.88451, 20.44596], [99.88211, 20.44488], [99.86383, 20.44371], [99.81096, 20.33687], [99.68255, 20.32077], [99.46008, 20.39673], [99.46077, 20.36198], [99.5569, 20.20676], [99.52943, 20.14811], [99.416, 20.08614], [99.20328, 20.12877], [99.0735, 20.10298], [98.98679, 19.7419], [98.83661, 19.80931], [98.56065, 19.67807], [98.51182, 19.71303], [98.24884, 19.67876], [98.13829, 19.78541], [98.03314, 19.80941], [98.04364, 19.65755], [97.84715, 19.55782], [97.88423, 19.5041], [97.78769, 19.39429], [97.84186, 19.29526], [97.78606, 19.26769], [97.84024, 19.22217], [97.83479, 19.09972], [97.73797, 19.04261], [97.73654, 18.9812], [97.66487, 18.9371], [97.73836, 18.88478], [97.76752, 18.58097], [97.5258, 18.4939], [97.36444, 18.57138], [97.34522, 18.54596], [97.50383, 18.26844], [97.56219, 18.33885], [97.64116, 18.29778], [97.60841, 18.23846], [97.73723, 17.97912], [97.66794, 17.88005], [97.76407, 17.71595], [97.91829, 17.54504], [98.11185, 17.36829], [98.10439, 17.33847], [98.34566, 17.04822], [98.39441, 17.06266], [98.52624, 16.89979], [98.49603, 16.8446], [98.53833, 16.81934], [98.46994, 16.73613], [98.50253, 16.7139], [98.49713, 16.69022], [98.51043, 16.70107], [98.51579, 16.69433], [98.51472, 16.68521], [98.51833, 16.676], [98.51113, 16.64503], [98.5695, 16.62826], [98.57912, 16.55983], [98.63817, 16.47424], [98.68074, 16.27068], [98.84485, 16.42354], [98.92656, 16.36425], [98.8376, 16.11706], [98.69585, 16.13353], [98.57019, 16.04578], [98.59853, 15.87197], [98.541, 15.65406], [98.58598, 15.46821], [98.56027, 15.33471], [98.4866, 15.39154], [98.39351, 15.34177], [98.41906, 15.27103], [98.40522, 15.25268], [98.30446, 15.30667], [98.22, 15.21327], [98.18821, 15.13125], [98.24874, 14.83013], [98.56762, 14.37701], [98.97356, 14.04868], [99.16695, 13.72621], [99.20617, 13.20575], [99.12225, 13.19847], [99.10646, 13.05804], [99.18748, 12.9898], [99.18905, 12.84799], [99.29254, 12.68921], [99.409, 12.60603], [99.47519, 12.1353], [99.56445, 12.14805], [99.53424, 12.02317], [99.64891, 11.82699], [99.64108, 11.78948], [99.5672, 11.62732], [99.47598, 11.62434], [99.39485, 11.3925], [99.31573, 11.32081], [99.32756, 11.28545], [99.06938, 10.94857], [99.02337, 10.97217], [98.99701, 10.92962], [99.0069, 10.85485], [98.86819, 10.78336], [98.78511, 10.68351], [98.77275, 10.62548], [98.81944, 10.52761], [98.7391, 10.31488], [98.55174, 9.92804], [98.52291, 9.92389], [98.47298, 9.95782], [98.33094, 9.91973], [98.12555, 9.44056], [97.63455, 9.60854], [97.19814, 8.18901], [99.31854, 5.99868], [99.50117, 6.44501], [99.91873, 6.50233], [100.0756, 6.4045], [100.12, 6.42105], [100.19511, 6.72559], [100.29651, 6.68439], [100.30828, 6.66462], [100.31618, 6.66781], [100.31884, 6.66423], [100.32671, 6.66526], [100.32607, 6.65933], [100.31929, 6.65413], [100.35413, 6.54932], [100.41152, 6.52299], [100.41791, 6.5189], [100.42351, 6.51762], [100.43027, 6.52389], [100.66986, 6.45086], [100.74361, 6.50811], [100.74822, 6.46231], [100.81045, 6.45086], [100.85884, 6.24929], [101.10313, 6.25617], [101.12618, 6.19431], [101.06165, 6.14161], [101.12388, 6.11411], [101.087, 5.9193], [101.02708, 5.91013], [100.98815, 5.79464], [101.14062, 5.61613], [101.25755, 5.71065], [101.25524, 5.78633], [101.58019, 5.93534], [101.69773, 5.75881], [101.75074, 5.79091], [101.80144, 5.74505], [101.89188, 5.8386], [101.91776, 5.84269], [101.92819, 5.85511], [101.94712, 5.98421], [101.9714, 6.00575], [101.97114, 6.01992], [101.99209, 6.04075], [102.01835, 6.05407], [102.09182, 6.14161], [102.07732, 6.193], [102.08127, 6.22679], [102.09086, 6.23546], [102.46318, 7.22462], [102.47649, 9.66162], [102.52395, 11.25257], [102.91449, 11.65512], [102.90973, 11.75613], [102.83957, 11.8519], [102.78427, 11.98746], [102.77026, 12.06815], [102.70176, 12.1686], [102.73134, 12.37091], [102.78116, 12.40284], [102.7796, 12.43781], [102.57567, 12.65358], [102.51963, 12.66117], [102.4994, 12.71736], [102.53053, 12.77506], [102.49335, 12.92711], [102.48694, 12.97537], [102.52275, 12.99813], [102.46011, 13.08057], [102.43422, 13.09061], [102.36146, 13.26006], [102.36001, 13.31142], [102.34611, 13.35618], [102.35692, 13.38274], [102.35563, 13.47307], [102.361, 13.50551], [102.33828, 13.55613], [102.36859, 13.57488], [102.44601, 13.5637], [102.5358, 13.56933], [102.57573, 13.60461], [102.62483, 13.60883], [102.58635, 13.6286], [102.5481, 13.6589], [102.56848, 13.69366], [102.72727, 13.77806], [102.77864, 13.93374], [102.91251, 14.01531], [102.93275, 14.19044], [103.16469, 14.33075], [103.39353, 14.35639], [103.53518, 14.42575], [103.71109, 14.4348], [103.70175, 14.38052], [103.93836, 14.3398], [104.27616, 14.39861], [104.55014, 14.36091], [104.69335, 14.42726], [104.97667, 14.38806], [105.02804, 14.23722], [105.08408, 14.20402], [105.14012, 14.23873], [105.17748, 14.34432], [105.20894, 14.34967], [105.43783, 14.43865], [105.53864, 14.55731], [105.5121, 14.80802], [105.61162, 15.00037], [105.46661, 15.13132], [105.58043, 15.32724], [105.50662, 15.32054], [105.4692, 15.33709], [105.47635, 15.3796], [105.58191, 15.41031], [105.60446, 15.53301], [105.61756, 15.68792], [105.46573, 15.74742], [105.42285, 15.76971], [105.37959, 15.84074], [105.34115, 15.92737], [105.38508, 15.987], [105.42001, 16.00657], [105.06204, 16.09792], [105.00262, 16.25627], [104.88057, 16.37311], [104.73349, 16.565], [104.76099, 16.69302], [104.7397, 16.81005], [104.76442, 16.84752], [104.7373, 16.91125], [104.73712, 17.01404], [104.80716, 17.19025], [104.80061, 17.39367], [104.69867, 17.53038], [104.45404, 17.66788], [104.35432, 17.82871], [104.2757, 17.86139], [104.21776, 17.99335], [104.10927, 18.10826], [104.06533, 18.21656], [103.97725, 18.33631], [103.93916, 18.33914], [103.85642, 18.28666], [103.82449, 18.33979], [103.699, 18.34125], [103.60957, 18.40528], [103.47773, 18.42841], [103.41044, 18.4486], [103.30977, 18.4341], [103.24779, 18.37807], [103.23818, 18.34875], [103.29757, 18.30475], [103.17093, 18.2618], [103.14994, 18.23172], [103.1493, 18.17799], [103.07343, 18.12351], [103.07823, 18.03833], [103.0566, 18.00144], [103.01998, 17.97095], [102.9912, 17.9949], [102.95812, 18.0054], [102.86323, 17.97531], [102.81988, 17.94233], [102.79044, 17.93612], [102.75954, 17.89561], [102.68538, 17.86653], [102.67543, 17.84529], [102.69946, 17.81686], [102.68194, 17.80151], [102.59485, 17.83537], [102.5896, 17.84889], [102.61432, 17.92273], [102.60971, 17.95411], [102.59234, 17.96127], [102.45523, 17.97106], [102.11359, 18.21532], [101.88485, 18.02474], [101.78087, 18.07559], [101.72294, 17.92867], [101.44667, 17.7392], [101.15108, 17.47586], [100.96541, 17.57926], [101.02185, 17.87637], [101.1793, 18.0544], [101.19118, 18.2125], [101.15108, 18.25624], [101.18227, 18.34367], [101.06047, 18.43247], [101.27585, 18.68875], [101.22832, 18.73377], [101.25803, 18.89545], [101.35606, 19.04716], [101.261, 19.12717], [101.24911, 19.33334], [101.20604, 19.35296], [101.21347, 19.46223], [101.26991, 19.48324], [101.26545, 19.59242], [101.08928, 19.59748], [100.90302, 19.61901], [100.77231, 19.48324], [100.64606, 19.55884], [100.58219, 19.49164], [100.49604, 19.53504], [100.398, 19.75047], [100.5094, 19.87904], [100.58808, 20.15791], [100.55218, 20.17741], [100.51052, 20.14928], [100.47567, 20.19133], [100.4537, 20.19971], [100.44992, 20.23644], [100.41473, 20.25625], [100.37439, 20.35156], [100.33383, 20.4028], [100.25769, 20.3992], [100.22076, 20.31598], [100.16668, 20.2986], [100.1712, 20.24324], [100.11785, 20.24787], [100.09337, 20.26293], [100.09999, 20.31614], [100.08404, 20.36626]]]] } },
22834     { type: "Feature", properties: { iso1A2: "TJ", iso1A3: "TJK", iso1N3: "762", wikidata: "Q863", nameEn: "Tajikistan", groups: ["143", "142", "UN"], callingCodes: ["992"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.45251, 41.04438], [70.38028, 41.02014], [70.36655, 40.90296], [69.69434, 40.62615], [69.59441, 40.70181], [69.53021, 40.77621], [69.38327, 40.7918], [69.32834, 40.70233], [69.3455, 40.57988], [69.2643, 40.57506], [69.21063, 40.54469], [69.27066, 40.49274], [69.28525, 40.41894], [69.30774, 40.36102], [69.33794, 40.34819], [69.32833, 40.29794], [69.30808, 40.2821], [69.24817, 40.30357], [69.25229, 40.26362], [69.30104, 40.24502], [69.30448, 40.18774], [69.2074, 40.21488], [69.15659, 40.2162], [69.04544, 40.22904], [68.85832, 40.20885], [68.84357, 40.18604], [68.79276, 40.17555], [68.77902, 40.20492], [68.5332, 40.14826], [68.52771, 40.11676], [68.62796, 40.07789], [69.01523, 40.15771], [69.01935, 40.11466], [68.96579, 40.06949], [68.84906, 40.04952], [68.93695, 39.91167], [68.88889, 39.87163], [68.63071, 39.85265], [68.61972, 39.68905], [68.54166, 39.53929], [68.12053, 39.56317], [67.70992, 39.66156], [67.62889, 39.60234], [67.44899, 39.57799], [67.46547, 39.53564], [67.39681, 39.52505], [67.46822, 39.46146], [67.45998, 39.315], [67.36522, 39.31287], [67.33226, 39.23739], [67.67833, 39.14479], [67.68915, 39.00775], [68.09704, 39.02589], [68.19743, 38.85985], [68.06948, 38.82115], [68.12877, 38.73677], [68.05598, 38.71641], [68.0807, 38.64136], [68.05873, 38.56087], [68.11366, 38.47169], [68.06274, 38.39435], [68.13289, 38.40822], [68.40343, 38.19484], [68.27159, 37.91477], [68.12635, 37.93], [67.81566, 37.43107], [67.8474, 37.31594], [67.78329, 37.1834], [67.7803, 37.08978], [67.87917, 37.0591], [68.02194, 36.91923], [68.18542, 37.02074], [68.27605, 37.00977], [68.29253, 37.10621], [68.41201, 37.10402], [68.41888, 37.13906], [68.61851, 37.19815], [68.6798, 37.27906], [68.81438, 37.23862], [68.80889, 37.32494], [68.91189, 37.26704], [68.88168, 37.33368], [68.96407, 37.32603], [69.03274, 37.25174], [69.25152, 37.09426], [69.39529, 37.16752], [69.45022, 37.23315], [69.36645, 37.40462], [69.44954, 37.4869], [69.51888, 37.5844], [69.80041, 37.5746], [69.84435, 37.60616], [69.93362, 37.61378], [69.95971, 37.5659], [70.15015, 37.52519], [70.28243, 37.66706], [70.27694, 37.81258], [70.1863, 37.84296], [70.17206, 37.93276], [70.4898, 38.12546], [70.54673, 38.24541], [70.60407, 38.28046], [70.61526, 38.34774], [70.64966, 38.34999], [70.69189, 38.37031], [70.6761, 38.39144], [70.67438, 38.40597], [70.69807, 38.41861], [70.72485, 38.4131], [70.75455, 38.4252], [70.77132, 38.45548], [70.78581, 38.45502], [70.78702, 38.45031], [70.79766, 38.44944], [70.80521, 38.44447], [70.81697, 38.44507], [70.82538, 38.45394], [70.84376, 38.44688], [70.88719, 38.46826], [70.92728, 38.43021], [70.98693, 38.48862], [71.03545, 38.44779], [71.0556, 38.40176], [71.09542, 38.42517], [71.10592, 38.42077], [71.10957, 38.40671], [71.1451, 38.40106], [71.21291, 38.32797], [71.33114, 38.30339], [71.33869, 38.27335], [71.37803, 38.25641], [71.36444, 38.15358], [71.29878, 38.04429], [71.28922, 38.01272], [71.27622, 37.99946], [71.27278, 37.96496], [71.24969, 37.93031], [71.2809, 37.91995], [71.296, 37.93403], [71.32871, 37.88564], [71.51565, 37.95349], [71.58843, 37.92425], [71.59255, 37.79956], [71.55752, 37.78677], [71.54324, 37.77104], [71.53053, 37.76534], [71.55234, 37.73209], [71.54186, 37.69691], [71.51972, 37.61945], [71.5065, 37.60912], [71.49693, 37.53527], [71.50616, 37.50733], [71.5256, 37.47971], [71.49612, 37.4279], [71.47685, 37.40281], [71.4862, 37.33405], [71.49821, 37.31975], [71.50674, 37.31502], [71.48536, 37.26017], [71.4824, 37.24921], [71.48339, 37.23937], [71.47386, 37.2269], [71.4555, 37.21418], [71.4494, 37.18137], [71.44127, 37.11856], [71.43097, 37.05855], [71.45578, 37.03094], [71.46923, 36.99925], [71.48481, 36.93218], [71.51502, 36.89128], [71.57195, 36.74943], [71.67083, 36.67346], [71.83229, 36.68084], [72.31676, 36.98115], [72.54095, 37.00007], [72.66381, 37.02014], [72.79693, 37.22222], [73.06884, 37.31729], [73.29633, 37.46495], [73.77197, 37.4417], [73.76647, 37.33913], [73.61129, 37.27469], [73.64974, 37.23643], [73.82552, 37.22659], [73.8564, 37.26158], [74.20308, 37.34208], [74.23339, 37.41116], [74.41055, 37.3948], [74.56161, 37.37734], [74.68383, 37.3948], [74.8294, 37.3435], [74.88887, 37.23275], [75.12328, 37.31839], [75.09719, 37.37297], [75.15899, 37.41443], [75.06011, 37.52779], [74.94338, 37.55501], [74.8912, 37.67576], [75.00935, 37.77486], [74.92416, 37.83428], [74.9063, 38.03033], [74.82665, 38.07359], [74.80331, 38.19889], [74.69894, 38.22155], [74.69619, 38.42947], [74.51217, 38.47034], [74.17022, 38.65504], [73.97933, 38.52945], [73.79806, 38.61106], [73.80656, 38.66449], [73.7033, 38.84782], [73.7445, 38.93867], [73.82964, 38.91517], [73.81728, 39.04007], [73.75823, 39.023], [73.60638, 39.24534], [73.54572, 39.27567], [73.55396, 39.3543], [73.5004, 39.38402], [73.59241, 39.40843], [73.59831, 39.46425], [73.45096, 39.46677], [73.31912, 39.38615], [73.18454, 39.35536], [72.85934, 39.35116], [72.62027, 39.39696], [72.33173, 39.33093], [72.23834, 39.17248], [72.17242, 39.2661], [72.09689, 39.26823], [72.04059, 39.36704], [71.90601, 39.27674], [71.79202, 39.27355], [71.7522, 39.32031], [71.80164, 39.40631], [71.76816, 39.45456], [71.62688, 39.44056], [71.5517, 39.45722], [71.55856, 39.57588], [71.49814, 39.61397], [71.08752, 39.50704], [71.06418, 39.41586], [70.7854, 39.38933], [70.64087, 39.58792], [70.44757, 39.60128], [70.2869, 39.53141], [70.11111, 39.58223], [69.87491, 39.53882], [69.68677, 39.59281], [69.3594, 39.52516], [69.26938, 39.8127], [69.35649, 40.01994], [69.43134, 39.98431], [69.43557, 39.92877], [69.53615, 39.93991], [69.5057, 40.03277], [69.53855, 40.0887], [69.53794, 40.11833], [69.55555, 40.12296], [69.57615, 40.10524], [69.64704, 40.12165], [69.67001, 40.10639], [70.01283, 40.23288], [70.58297, 40.00891], [70.57384, 39.99394], [70.47557, 39.93216], [70.55033, 39.96619], [70.58912, 39.95211], [70.65946, 39.9878], [70.65827, 40.0981], [70.7928, 40.12797], [70.80495, 40.16813], [70.9818, 40.22392], [70.8607, 40.217], [70.62342, 40.17396], [70.56394, 40.26421], [70.57149, 40.3442], [70.37511, 40.38605], [70.32626, 40.45174], [70.49871, 40.52503], [70.80009, 40.72825], [70.45251, 41.04438]]], [[[70.68112, 40.90612], [70.6158, 40.97661], [70.56077, 41.00642], [70.54223, 40.98787], [70.57501, 40.98941], [70.6721, 40.90555], [70.68112, 40.90612]]], [[[70.74189, 39.86319], [70.53651, 39.89155], [70.52631, 39.86989], [70.54998, 39.85137], [70.59667, 39.83542], [70.63105, 39.77923], [70.74189, 39.86319]]]] } },
22835     { type: "Feature", properties: { iso1A2: "TK", iso1A3: "TKL", iso1N3: "772", wikidata: "Q36823", nameEn: "Tokelau", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["690"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.251, -9.44289], [-174.18635, -7.80441], [-174.17993, -10.13616], [-168.251, -9.44289]]]] } },
22836     { type: "Feature", properties: { iso1A2: "TL", iso1A3: "TLS", iso1N3: "626", wikidata: "Q574", nameEn: "East Timor", aliases: ["Timor-Leste", "TP"], groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[124.46701, -9.13002], [124.94011, -8.85617], [124.97742, -9.08128], [125.11764, -8.96359], [125.18632, -9.03142], [125.18907, -9.16434], [125.09434, -9.19669], [125.04044, -9.17093], [124.97892, -9.19281], [125.09025, -9.46406], [125.68138, -9.85176], [127.55165, -9.05052], [127.42116, -8.22471], [125.87691, -8.31789], [125.58506, -7.95311], [124.92337, -8.75859], [124.33472, -9.11416], [124.04628, -9.22671], [124.04286, -9.34243], [124.10539, -9.41206], [124.14517, -9.42324], [124.21247, -9.36904], [124.28115, -9.42189], [124.28115, -9.50453], [124.3535, -9.48493], [124.35258, -9.43002], [124.38554, -9.3582], [124.45971, -9.30263], [124.46701, -9.13002]]]] } },
22837     { type: "Feature", properties: { iso1A2: "TM", iso1A3: "TKM", iso1N3: "795", wikidata: "Q874", nameEn: "Turkmenistan", groups: ["143", "142", "UN"], callingCodes: ["993"] }, geometry: { type: "MultiPolygon", coordinates: [[[[60.5078, 41.21694], [60.06581, 41.4363], [60.18117, 41.60082], [60.06032, 41.76287], [60.08504, 41.80997], [60.33223, 41.75058], [59.95046, 41.97966], [60.0356, 42.01028], [60.04659, 42.08982], [59.96419, 42.1428], [60.00539, 42.212], [59.94633, 42.27655], [59.4341, 42.29738], [59.2955, 42.37064], [59.17317, 42.52248], [58.93422, 42.5407], [58.6266, 42.79314], [58.57991, 42.64988], [58.27504, 42.69632], [58.14321, 42.62159], [58.29427, 42.56497], [58.51674, 42.30348], [58.40688, 42.29535], [58.3492, 42.43335], [57.99214, 42.50021], [57.90975, 42.4374], [57.92897, 42.24047], [57.84932, 42.18555], [57.6296, 42.16519], [57.30275, 42.14076], [57.03633, 41.92043], [56.96218, 41.80383], [57.03359, 41.41777], [57.13796, 41.36625], [57.03423, 41.25435], [56.00314, 41.32584], [55.45471, 41.25609], [54.95182, 41.92424], [54.20635, 42.38477], [52.97575, 42.1308], [52.47884, 41.78034], [52.26048, 41.69249], [51.7708, 40.29239], [53.89734, 37.3464], [54.24565, 37.32047], [54.36211, 37.34912], [54.58664, 37.45809], [54.67247, 37.43532], [54.77822, 37.51597], [54.81804, 37.61285], [54.77684, 37.62264], [54.851, 37.75739], [55.13412, 37.94705], [55.44152, 38.08564], [55.76561, 38.12238], [55.97847, 38.08024], [56.33278, 38.08132], [56.32454, 38.18502], [56.43303, 38.26054], [56.62255, 38.24005], [56.73928, 38.27887], [57.03453, 38.18717], [57.21169, 38.28965], [57.37236, 38.09321], [57.35042, 37.98546], [57.79534, 37.89299], [58.21399, 37.77281], [58.22999, 37.6856], [58.39959, 37.63134], [58.47786, 37.6433], [58.5479, 37.70526], [58.6921, 37.64548], [58.9338, 37.67374], [59.22905, 37.51161], [59.33507, 37.53146], [59.39797, 37.47892], [59.39385, 37.34257], [59.55178, 37.13594], [59.74678, 37.12499], [60.00768, 37.04102], [60.34767, 36.63214], [61.14516, 36.64644], [61.18187, 36.55348], [61.1393, 36.38782], [61.22719, 36.12759], [61.12007, 35.95992], [61.22444, 35.92879], [61.26152, 35.80749], [61.22719, 35.67038], [61.27371, 35.61482], [61.58742, 35.43803], [61.77693, 35.41341], [61.97743, 35.4604], [62.05709, 35.43803], [62.15871, 35.33278], [62.29191, 35.25964], [62.29878, 35.13312], [62.48006, 35.28796], [62.62288, 35.22067], [62.74098, 35.25432], [62.90853, 35.37086], [63.0898, 35.43131], [63.12276, 35.53196], [63.10079, 35.63024], [63.23262, 35.67487], [63.10318, 35.81782], [63.12276, 35.86208], [63.29579, 35.85985], [63.53475, 35.90881], [63.56496, 35.95106], [63.98519, 36.03773], [64.05385, 36.10433], [64.43288, 36.24401], [64.57295, 36.34362], [64.62514, 36.44311], [64.61141, 36.6351], [64.97945, 37.21913], [65.51778, 37.23881], [65.64263, 37.34388], [65.64137, 37.45061], [65.72274, 37.55438], [66.30993, 37.32409], [66.55743, 37.35409], [66.52303, 37.39827], [66.65761, 37.45497], [66.52852, 37.58568], [66.53676, 37.80084], [66.67684, 37.96776], [66.56697, 38.0435], [66.41042, 38.02403], [66.24013, 38.16238], [65.83913, 38.25733], [65.55873, 38.29052], [64.32576, 38.98691], [64.19086, 38.95561], [63.70778, 39.22349], [63.6913, 39.27666], [62.43337, 39.98528], [62.34273, 40.43206], [62.11751, 40.58242], [61.87856, 41.12257], [61.4446, 41.29407], [61.39732, 41.19873], [61.33199, 41.14946], [61.22212, 41.14946], [61.03261, 41.25691], [60.5078, 41.21694]]]] } },
22838     { type: "Feature", properties: { iso1A2: "TN", iso1A3: "TUN", iso1N3: "788", wikidata: "Q948", nameEn: "Tunisia", groups: ["015", "002", "UN"], callingCodes: ["216"] }, geometry: { type: "MultiPolygon", coordinates: [[[[11.2718, 37.6713], [7.89009, 38.19924], [8.59123, 37.14286], [8.64044, 36.9401], [8.62972, 36.86499], [8.67706, 36.8364], [8.57613, 36.78062], [8.46537, 36.7706], [8.47609, 36.66607], [8.16167, 36.48817], [8.18936, 36.44939], [8.40731, 36.42208], [8.2626, 35.91733], [8.26472, 35.73669], [8.35371, 35.66373], [8.36086, 35.47774], [8.30329, 35.29884], [8.47318, 35.23376], [8.3555, 35.10007], [8.30727, 34.95378], [8.25189, 34.92009], [8.29655, 34.72798], [8.20482, 34.57575], [7.86264, 34.3987], [7.81242, 34.21841], [7.74207, 34.16492], [7.66174, 34.20167], [7.52851, 34.06493], [7.54088, 33.7726], [7.73687, 33.42114], [7.83028, 33.18851], [8.11433, 33.10175], [8.1179, 33.05086], [8.31895, 32.83483], [8.35999, 32.50101], [9.07483, 32.07865], [9.55544, 30.23971], [9.76848, 30.34366], [9.88152, 30.34074], [10.29516, 30.90337], [10.12239, 31.42098], [10.31364, 31.72648], [10.48497, 31.72956], [10.62788, 31.96629], [10.7315, 31.97235], [11.04234, 32.2145], [11.53898, 32.4138], [11.57828, 32.48013], [11.46037, 32.6307], [11.51549, 33.09826], [11.55852, 33.1409], [11.58941, 33.36891], [11.2718, 37.6713]]]] } },
22839     { type: "Feature", properties: { iso1A2: "TO", iso1A3: "TON", iso1N3: "776", wikidata: "Q678", nameEn: "Tonga", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["676"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.74538, -22.89767], [-180, -22.90585], [-180, -24.21376], [-173.10761, -24.19665], [-173.13438, -14.94228], [-176.76826, -14.95183], [-176.74538, -22.89767]]]] } },
22840     { type: "Feature", properties: { iso1A2: "TR", iso1A3: "TUR", iso1N3: "792", wikidata: "Q43", nameEn: "Turkey", groups: ["145", "142", "UN"], callingCodes: ["90"] }, geometry: { type: "MultiPolygon", coordinates: [[[[41.54366, 41.52185], [40.89217, 41.72528], [34.8305, 42.4581], [28.32297, 41.98371], [28.02971, 41.98066], [27.91479, 41.97902], [27.83492, 41.99709], [27.81235, 41.94803], [27.69949, 41.97515], [27.55191, 41.90928], [27.52379, 41.93756], [27.45478, 41.96591], [27.27411, 42.10409], [27.22376, 42.10152], [27.19251, 42.06028], [27.08486, 42.08735], [27.03277, 42.0809], [26.95638, 42.00741], [26.79143, 41.97386], [26.62996, 41.97644], [26.56051, 41.92995], [26.57961, 41.90024], [26.53968, 41.82653], [26.36952, 41.82265], [26.33589, 41.76802], [26.32952, 41.73637], [26.35957, 41.71149], [26.47958, 41.67037], [26.5209, 41.62592], [26.59196, 41.60491], [26.59742, 41.48058], [26.61767, 41.42281], [26.62997, 41.34613], [26.5837, 41.32131], [26.5209, 41.33993], [26.39861, 41.25053], [26.32259, 41.24929], [26.31928, 41.07386], [26.3606, 41.02027], [26.33297, 40.98388], [26.35894, 40.94292], [26.32259, 40.94042], [26.28623, 40.93005], [26.29441, 40.89119], [26.26169, 40.9168], [26.20856, 40.86048], [26.21351, 40.83298], [26.15685, 40.80709], [26.12854, 40.77339], [26.12495, 40.74283], [26.08638, 40.73214], [26.0754, 40.72772], [26.03489, 40.73051], [25.94795, 40.72797], [26.04292, 40.3958], [25.61285, 40.17161], [25.94257, 39.39358], [26.43357, 39.43096], [26.70773, 39.0312], [26.61814, 38.81372], [26.21136, 38.65436], [26.32173, 38.48731], [26.24183, 38.44695], [26.21136, 38.17558], [27.05537, 37.9131], [27.16428, 37.72343], [26.99377, 37.69034], [26.95583, 37.64989], [27.14757, 37.32], [27.20312, 36.94571], [27.45627, 36.9008], [27.24613, 36.71622], [27.46117, 36.53789], [27.89482, 36.69898], [27.95037, 36.46155], [28.23708, 36.56812], [29.30783, 36.01033], [29.48192, 36.18377], [29.61002, 36.1731], [29.61805, 36.14179], [29.69611, 36.10365], [29.73302, 35.92555], [32.82353, 35.70297], [35.51152, 36.10954], [35.931, 35.92109], [35.98499, 35.94107], [36.00514, 35.94113], [36.01844, 35.92403], [35.99829, 35.88242], [36.11827, 35.85923], [36.13919, 35.83692], [36.14029, 35.81015], [36.1623, 35.80925], [36.17441, 35.92076], [36.19973, 35.95195], [36.25366, 35.96264], [36.27678, 35.94839], [36.29769, 35.96086], [36.28338, 36.00273], [36.30099, 36.00985], [36.33956, 35.98687], [36.37474, 36.01163], [36.39206, 36.22088], [36.4617, 36.20461], [36.50463, 36.2419], [36.6125, 36.22592], [36.68672, 36.23677], [36.65653, 36.33861], [36.6081, 36.33772], [36.54206, 36.49539], [36.58829, 36.58295], [36.57398, 36.65186], [36.62681, 36.71189], [36.61581, 36.74629], [36.66727, 36.82901], [36.99557, 36.75997], [36.99886, 36.74012], [37.04399, 36.73483], [37.04619, 36.71101], [37.01647, 36.69512], [37.02088, 36.66422], [37.08279, 36.63495], [37.10894, 36.6704], [37.16177, 36.66069], [37.21988, 36.6736], [37.47253, 36.63243], [37.49103, 36.66904], [37.68048, 36.75065], [37.81974, 36.76055], [38.21064, 36.91842], [38.38859, 36.90064], [38.55908, 36.84429], [38.74042, 36.70629], [39.03217, 36.70911], [39.21538, 36.66834], [39.81589, 36.75538], [40.69136, 37.0996], [40.90856, 37.13147], [41.21937, 37.07665], [41.515, 37.08084], [42.00894, 37.17209], [42.18225, 37.28569], [42.19301, 37.31323], [42.2112, 37.32491], [42.22257, 37.31395], [42.22381, 37.30238], [42.20454, 37.28715], [42.21548, 37.28026], [42.23683, 37.2863], [42.26039, 37.27017], [42.2824, 37.2798], [42.34735, 37.22548], [42.32313, 37.17814], [42.35724, 37.10998], [42.56725, 37.14878], [42.78887, 37.38615], [42.93705, 37.32015], [43.11403, 37.37436], [43.30083, 37.30629], [43.33508, 37.33105], [43.50787, 37.24436], [43.56702, 37.25675], [43.63085, 37.21957], [43.7009, 37.23692], [43.8052, 37.22825], [43.82699, 37.19477], [43.84878, 37.22205], [43.90949, 37.22453], [44.02002, 37.33229], [44.13521, 37.32486], [44.2613, 37.25055], [44.27998, 37.16501], [44.22239, 37.15756], [44.18503, 37.09551], [44.25975, 36.98119], [44.30645, 36.97373], [44.35937, 37.02843], [44.35315, 37.04955], [44.38117, 37.05825], [44.42631, 37.05825], [44.63179, 37.19229], [44.76698, 37.16162], [44.78319, 37.1431], [44.7868, 37.16644], [44.75986, 37.21549], [44.81021, 37.2915], [44.58449, 37.45018], [44.61401, 37.60165], [44.56887, 37.6429], [44.62096, 37.71985], [44.55498, 37.783], [44.45948, 37.77065], [44.3883, 37.85433], [44.22509, 37.88859], [44.42476, 38.25763], [44.50115, 38.33939], [44.44386, 38.38295], [44.38309, 38.36117], [44.3119, 38.37887], [44.3207, 38.49799], [44.32058, 38.62752], [44.28065, 38.6465], [44.26155, 38.71427], [44.30322, 38.81581], [44.18863, 38.93881], [44.20946, 39.13975], [44.1043, 39.19842], [44.03667, 39.39223], [44.22452, 39.4169], [44.29818, 39.378], [44.37921, 39.4131], [44.42832, 39.4131], [44.41849, 39.56659], [44.48111, 39.61579], [44.47298, 39.68788], [44.6137, 39.78393], [44.65422, 39.72163], [44.71806, 39.71124], [44.81043, 39.62677], [44.80977, 39.65768], [44.75779, 39.7148], [44.61845, 39.8281], [44.46635, 39.97733], [44.26973, 40.04866], [44.1778, 40.02845], [44.1057, 40.03555], [43.92307, 40.01787], [43.65688, 40.11199], [43.65221, 40.14889], [43.71136, 40.16673], [43.59928, 40.34019], [43.60862, 40.43267], [43.54791, 40.47413], [43.63664, 40.54159], [43.7425, 40.66805], [43.74872, 40.7365], [43.67712, 40.84846], [43.67712, 40.93084], [43.58683, 40.98961], [43.47319, 41.02251], [43.44984, 41.0988], [43.4717, 41.12611], [43.44973, 41.17666], [43.36118, 41.2028], [43.23096, 41.17536], [43.1945, 41.25242], [43.13373, 41.25503], [43.21707, 41.30331], [43.02956, 41.37891], [42.8785, 41.50516], [42.84899, 41.47265], [42.78995, 41.50126], [42.84471, 41.58912], [42.72794, 41.59714], [42.59202, 41.58183], [42.51772, 41.43606], [42.26387, 41.49346], [41.95134, 41.52466], [41.81939, 41.43621], [41.7124, 41.47417], [41.7148, 41.4932], [41.54366, 41.52185]]]] } },
22841     { type: "Feature", properties: { iso1A2: "TT", iso1A3: "TTO", iso1N3: "780", wikidata: "Q754", nameEn: "Trinidad and Tobago", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 868"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.62505, 11.18974], [-62.08693, 10.04435], [-60.89962, 9.81445], [-60.07172, 11.77667], [-61.62505, 11.18974]]]] } },
22842     { type: "Feature", properties: { iso1A2: "TV", iso1A3: "TUV", iso1N3: "798", wikidata: "Q672", nameEn: "Tuvalu", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["688"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174, -5], [174, -11.5], [179.99999, -11.5], [179.99999, -5], [174, -5]]]] } },
22843     { type: "Feature", properties: { iso1A2: "TW", iso1A3: "TWN", iso1N3: "158", wikidata: "Q865", nameEn: "Taiwan", aliases: ["RC"], groups: ["030", "142"], callingCodes: ["886"] }, geometry: { type: "MultiPolygon", coordinates: [[[[121.8109, 21.77688], [122.26612, 25.98197], [120.49232, 25.22863], [118.56434, 24.49266], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
22844     { type: "Feature", properties: { iso1A2: "TZ", iso1A3: "TZA", iso1N3: "834", wikidata: "Q924", nameEn: "Tanzania", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["255"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.80408, -0.99911], [30.76635, -0.9852], [30.70631, -1.01175], [30.64166, -1.06601], [30.47194, -1.0555], [30.45116, -1.10641], [30.50889, -1.16412], [30.57123, -1.33264], [30.71974, -1.43244], [30.84079, -1.64652], [30.80802, -1.91477], [30.89303, -2.08223], [30.83915, -2.35795], [30.54501, -2.41404], [30.41789, -2.66266], [30.52747, -2.65841], [30.40662, -2.86151], [30.4987, -2.9573], [30.57926, -2.89791], [30.6675, -2.98987], [30.83823, -2.97837], [30.84165, -3.25152], [30.45915, -3.56532], [30.22042, -4.01738], [30.03323, -4.26631], [29.88172, -4.35743], [29.82885, -4.36153], [29.77289, -4.41733], [29.75109, -4.45836], [29.63827, -4.44681], [29.43673, -4.44845], [29.52552, -6.2731], [30.2567, -7.14121], [30.79243, -8.27382], [31.00796, -8.58615], [31.37533, -8.60769], [31.57147, -8.70619], [31.57147, -8.81388], [31.71158, -8.91386], [31.81587, -8.88618], [31.94663, -8.93846], [31.94196, -9.02303], [31.98866, -9.07069], [32.08206, -9.04609], [32.16146, -9.05993], [32.25486, -9.13371], [32.43543, -9.11988], [32.49147, -9.14754], [32.53661, -9.24281], [32.75611, -9.28583], [32.76233, -9.31963], [32.95389, -9.40138], [32.99397, -9.36712], [33.14925, -9.49322], [33.31581, -9.48554], [33.48052, -9.62442], [33.76677, -9.58516], [33.93298, -9.71647], [33.9638, -9.62206], [33.95829, -9.54066], [34.03865, -9.49398], [34.54499, -10.0678], [34.51911, -10.12279], [34.57581, -10.56271], [34.65946, -10.6828], [34.67047, -10.93796], [34.61161, -11.01611], [34.63305, -11.11731], [34.79375, -11.32245], [34.91153, -11.39799], [34.96296, -11.57354], [35.63599, -11.55927], [35.82767, -11.41081], [36.19094, -11.57593], [36.19094, -11.70008], [36.62068, -11.72884], [36.80309, -11.56836], [37.3936, -11.68949], [37.76614, -11.53352], [37.8388, -11.3123], [37.93618, -11.26228], [38.21598, -11.27289], [38.47258, -11.4199], [38.88996, -11.16978], [39.24395, -11.17433], [39.58249, -10.96043], [40.00295, -10.80255], [40.44265, -10.4618], [40.74206, -10.25691], [40.14328, -4.64201], [39.62121, -4.68136], [39.44306, -4.93877], [39.21631, -4.67835], [37.81321, -3.69179], [37.75036, -3.54243], [37.63099, -3.50723], [37.5903, -3.42735], [37.71745, -3.304], [37.67199, -3.06222], [34.0824, -1.02264], [34.03084, -1.05101], [34.02286, -1.00779], [33.93107, -0.99298], [30.80408, -0.99911]]]] } },
22845     { type: "Feature", properties: { iso1A2: "UA", iso1A3: "UKR", iso1N3: "804", wikidata: "Q212", nameEn: "Ukraine", groups: ["151", "150", "UN"], callingCodes: ["380"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.57318, 46.10317], [33.61467, 46.13561], [33.63854, 46.14147], [33.61517, 46.22615], [33.646, 46.23028], [33.74047, 46.18555], [33.79715, 46.20482], [33.85234, 46.19863], [33.91549, 46.15938], [34.05272, 46.10838], [34.07311, 46.11769], [34.12929, 46.10494], [34.181, 46.06804], [34.25111, 46.0532], [34.33912, 46.06114], [34.41221, 46.00245], [34.44155, 45.95995], [34.48729, 45.94267], [34.52011, 45.95097], [34.55889, 45.99347], [34.60861, 45.99347], [34.66679, 45.97136], [34.75479, 45.90705], [34.80153, 45.90047], [34.79905, 45.81009], [34.96015, 45.75634], [35.23066, 45.79231], [37.62608, 46.82615], [38.12112, 46.86078], [38.3384, 46.98085], [38.22955, 47.12069], [38.23049, 47.2324], [38.32112, 47.2585], [38.33074, 47.30508], [38.22225, 47.30788], [38.28954, 47.39255], [38.28679, 47.53552], [38.35062, 47.61631], [38.76379, 47.69346], [38.79628, 47.81109], [38.87979, 47.87719], [39.73935, 47.82876], [39.82213, 47.96396], [39.77544, 48.04206], [39.88256, 48.04482], [39.83724, 48.06501], [39.94847, 48.22811], [40.00752, 48.22445], [39.99241, 48.31768], [39.97325, 48.31399], [39.9693, 48.29904], [39.95248, 48.29972], [39.91465, 48.26743], [39.90041, 48.3049], [39.84273, 48.30947], [39.84136, 48.33321], [39.94847, 48.35055], [39.88794, 48.44226], [39.86196, 48.46633], [39.84548, 48.57821], [39.79764, 48.58668], [39.67226, 48.59368], [39.71765, 48.68673], [39.73104, 48.7325], [39.79466, 48.83739], [39.97182, 48.79398], [40.08168, 48.87443], [40.03636, 48.91957], [39.98967, 48.86901], [39.78368, 48.91596], [39.74874, 48.98675], [39.72649, 48.9754], [39.71353, 48.98959], [39.6683, 48.99454], [39.6836, 49.05121], [39.93437, 49.05709], [40.01988, 49.1761], [40.22176, 49.25683], [40.18331, 49.34996], [40.14912, 49.37681], [40.1141, 49.38798], [40.03087, 49.45452], [40.03636, 49.52321], [40.16683, 49.56865], [40.13249, 49.61672], [39.84548, 49.56064], [39.65047, 49.61761], [39.59142, 49.73758], [39.44496, 49.76067], [39.27968, 49.75976], [39.1808, 49.88911], [38.9391, 49.79524], [38.90477, 49.86787], [38.73311, 49.90238], [38.68677, 50.00904], [38.65688, 49.97176], [38.35408, 50.00664], [38.32524, 50.08866], [38.18517, 50.08161], [38.21675, 49.98104], [38.02999, 49.90592], [38.02999, 49.94482], [37.90776, 50.04194], [37.79515, 50.08425], [37.75807, 50.07896], [37.61113, 50.21976], [37.62879, 50.24481], [37.62486, 50.29966], [37.47243, 50.36277], [37.48204, 50.46079], [37.08468, 50.34935], [36.91762, 50.34963], [36.69377, 50.26982], [36.64571, 50.218], [36.56655, 50.2413], [36.58371, 50.28563], [36.47817, 50.31457], [36.30101, 50.29088], [36.20763, 50.3943], [36.06893, 50.45205], [35.8926, 50.43829], [35.80388, 50.41356], [35.73659, 50.35489], [35.61711, 50.35707], [35.58003, 50.45117], [35.47463, 50.49247], [35.39464, 50.64751], [35.48116, 50.66405], [35.47704, 50.77274], [35.41367, 50.80227], [35.39307, 50.92145], [35.32598, 50.94524], [35.40837, 51.04119], [35.31774, 51.08434], [35.20375, 51.04723], [35.12685, 51.16191], [35.14058, 51.23162], [34.97304, 51.2342], [34.82472, 51.17483], [34.6874, 51.18], [34.6613, 51.25053], [34.38802, 51.2746], [34.31661, 51.23936], [34.23009, 51.26429], [34.33446, 51.363], [34.22048, 51.4187], [34.30562, 51.5205], [34.17599, 51.63253], [34.07765, 51.67065], [34.42922, 51.72852], [34.41136, 51.82793], [34.09413, 52.00835], [34.11199, 52.14087], [34.05239, 52.20132], [33.78789, 52.37204], [33.55718, 52.30324], [33.48027, 52.31499], [33.51323, 52.35779], [33.18913, 52.3754], [32.89937, 52.2461], [32.85405, 52.27888], [32.69475, 52.25535], [32.54781, 52.32423], [32.3528, 52.32842], [32.38988, 52.24946], [32.33083, 52.23685], [32.34044, 52.1434], [32.2777, 52.10266], [32.23331, 52.08085], [32.08813, 52.03319], [31.92159, 52.05144], [31.96141, 52.08015], [31.85018, 52.11305], [31.81722, 52.09955], [31.7822, 52.11406], [31.38326, 52.12991], [31.25142, 52.04131], [31.13332, 52.1004], [30.95589, 52.07775], [30.90897, 52.00699], [30.76443, 51.89739], [30.68804, 51.82806], [30.51946, 51.59649], [30.64992, 51.35014], [30.56203, 51.25655], [30.36153, 51.33984], [30.34642, 51.42555], [30.17888, 51.51025], [29.77376, 51.4461], [29.7408, 51.53417], [29.54372, 51.48372], [29.49773, 51.39814], [29.42357, 51.4187], [29.32881, 51.37843], [29.25191, 51.49828], [29.25603, 51.57089], [29.20659, 51.56918], [29.16402, 51.64679], [29.1187, 51.65872], [28.99098, 51.56833], [28.95528, 51.59222], [28.81795, 51.55552], [28.76027, 51.48802], [28.78224, 51.45294], [28.75615, 51.41442], [28.73143, 51.46236], [28.69161, 51.44695], [28.64429, 51.5664], [28.47051, 51.59734], [28.37592, 51.54505], [28.23452, 51.66988], [28.10658, 51.57857], [27.95827, 51.56065], [27.91844, 51.61952], [27.85253, 51.62293], [27.76052, 51.47604], [27.67125, 51.50854], [27.71932, 51.60672], [27.55727, 51.63486], [27.51058, 51.5854], [27.47212, 51.61184], [27.24828, 51.60161], [27.26613, 51.65957], [27.20948, 51.66713], [27.20602, 51.77291], [26.99422, 51.76933], [26.9489, 51.73788], [26.80043, 51.75777], [26.69759, 51.82284], [26.46962, 51.80501], [26.39367, 51.87315], [26.19084, 51.86781], [26.00408, 51.92967], [25.83217, 51.92587], [25.80574, 51.94556], [25.73673, 51.91973], [25.46163, 51.92205], [25.20228, 51.97143], [24.98784, 51.91273], [24.37123, 51.88222], [24.29021, 51.80841], [24.3163, 51.75063], [24.13075, 51.66979], [23.99907, 51.58369], [23.8741, 51.59734], [23.91118, 51.63316], [23.7766, 51.66809], [23.60906, 51.62122], [23.6736, 51.50255], [23.62751, 51.50512], [23.69905, 51.40871], [23.63858, 51.32182], [23.80678, 51.18405], [23.90376, 51.07697], [23.92217, 51.00836], [24.04576, 50.90196], [24.14524, 50.86128], [24.0952, 50.83262], [23.99254, 50.83847], [23.95925, 50.79271], [24.0595, 50.71625], [24.0996, 50.60752], [24.07048, 50.5071], [24.03668, 50.44507], [23.99563, 50.41289], [23.79445, 50.40481], [23.71382, 50.38248], [23.67635, 50.33385], [23.28221, 50.0957], [22.99329, 49.84249], [22.83179, 49.69875], [22.80261, 49.69098], [22.78304, 49.65543], [22.64534, 49.53094], [22.69444, 49.49378], [22.748, 49.32759], [22.72009, 49.20288], [22.86336, 49.10513], [22.89122, 49.00725], [22.56155, 49.08865], [22.54338, 49.01424], [22.48296, 48.99172], [22.42934, 48.92857], [22.34151, 48.68893], [22.21379, 48.6218], [22.16023, 48.56548], [22.14689, 48.4005], [22.2083, 48.42534], [22.38133, 48.23726], [22.49806, 48.25189], [22.59007, 48.15121], [22.58733, 48.10813], [22.66835, 48.09162], [22.73427, 48.12005], [22.81804, 48.11363], [22.87847, 48.04665], [22.84276, 47.98602], [22.89849, 47.95851], [22.94301, 47.96672], [22.92241, 48.02002], [23.0158, 47.99338], [23.08858, 48.00716], [23.1133, 48.08061], [23.15999, 48.12188], [23.27397, 48.08245], [23.33577, 48.0237], [23.4979, 47.96858], [23.52803, 48.01818], [23.5653, 48.00499], [23.63894, 48.00293], [23.66262, 47.98786], [23.75188, 47.99705], [23.80904, 47.98142], [23.8602, 47.9329], [23.89352, 47.94512], [23.94192, 47.94868], [23.96337, 47.96672], [23.98553, 47.96076], [24.00801, 47.968], [24.02999, 47.95087], [24.06466, 47.95317], [24.11281, 47.91487], [24.22566, 47.90231], [24.34926, 47.9244], [24.43578, 47.97131], [24.61994, 47.95062], [24.70632, 47.84428], [24.81893, 47.82031], [24.88896, 47.7234], [25.11144, 47.75203], [25.23778, 47.89403], [25.63878, 47.94924], [25.77723, 47.93919], [26.05901, 47.9897], [26.17711, 47.99246], [26.33504, 48.18418], [26.55202, 48.22445], [26.62823, 48.25804], [26.6839, 48.35828], [26.79239, 48.29071], [26.82809, 48.31629], [26.71274, 48.40388], [26.85556, 48.41095], [26.93384, 48.36558], [27.03821, 48.37653], [27.0231, 48.42485], [27.08078, 48.43214], [27.13434, 48.37288], [27.27855, 48.37534], [27.32159, 48.4434], [27.37604, 48.44398], [27.37741, 48.41026], [27.44333, 48.41209], [27.46942, 48.454], [27.5889, 48.49224], [27.59027, 48.46311], [27.6658, 48.44034], [27.74422, 48.45926], [27.79225, 48.44244], [27.81902, 48.41874], [27.87533, 48.4037], [27.88391, 48.36699], [27.95883, 48.32368], [28.04527, 48.32661], [28.09873, 48.3124], [28.07504, 48.23494], [28.17666, 48.25963], [28.19314, 48.20749], [28.2856, 48.23202], [28.32508, 48.23384], [28.35519, 48.24957], [28.36996, 48.20543], [28.34912, 48.1787], [28.30586, 48.1597], [28.30609, 48.14018], [28.34009, 48.13147], [28.38712, 48.17567], [28.43701, 48.15832], [28.42454, 48.12047], [28.48428, 48.0737], [28.53921, 48.17453], [28.69896, 48.13106], [28.85232, 48.12506], [28.8414, 48.03392], [28.9306, 47.96255], [29.1723, 47.99013], [29.19839, 47.89261], [29.27804, 47.88893], [29.20663, 47.80367], [29.27255, 47.79953], [29.22242, 47.73607], [29.22414, 47.60012], [29.11743, 47.55001], [29.18603, 47.43387], [29.3261, 47.44664], [29.39889, 47.30179], [29.47854, 47.30366], [29.48678, 47.36043], [29.5733, 47.36508], [29.59665, 47.25521], [29.54996, 47.24962], [29.57696, 47.13581], [29.49732, 47.12878], [29.53044, 47.07851], [29.61038, 47.09932], [29.62137, 47.05069], [29.57056, 46.94766], [29.72986, 46.92234], [29.75458, 46.8604], [29.87405, 46.88199], [29.98814, 46.82358], [29.94522, 46.80055], [29.9743, 46.75325], [29.94409, 46.56002], [29.88916, 46.54302], [30.02511, 46.45132], [30.16794, 46.40967], [30.09103, 46.38694], [29.94114, 46.40114], [29.88329, 46.35851], [29.74496, 46.45605], [29.66359, 46.4215], [29.6763, 46.36041], [29.5939, 46.35472], [29.49914, 46.45889], [29.35357, 46.49505], [29.24886, 46.37912], [29.23547, 46.55435], [29.02409, 46.49582], [29.01241, 46.46177], [28.9306, 46.45699], [29.004, 46.31495], [28.98478, 46.31803], [28.94953, 46.25852], [29.06656, 46.19716], [28.94643, 46.09176], [29.00613, 46.04962], [28.98004, 46.00385], [28.74383, 45.96664], [28.78503, 45.83475], [28.69852, 45.81753], [28.70401, 45.78019], [28.52823, 45.73803], [28.47879, 45.66994], [28.51587, 45.6613], [28.54196, 45.58062], [28.49252, 45.56716], [28.51449, 45.49982], [28.43072, 45.48538], [28.41836, 45.51715], [28.30201, 45.54744], [28.21139, 45.46895], [28.28504, 45.43907], [28.34554, 45.32102], [28.5735, 45.24759], [28.71358, 45.22631], [28.78911, 45.24179], [28.81383, 45.3384], [28.94292, 45.28045], [28.96077, 45.33164], [29.24779, 45.43388], [29.42632, 45.44545], [29.59798, 45.38857], [29.68175, 45.26885], [29.65428, 45.25629], [29.69272, 45.19227], [30.04414, 45.08461], [31.62627, 45.50633], [33.54017, 46.0123], [33.59087, 46.06013], [33.57318, 46.10317]]]] } },
22846     { type: "Feature", properties: { iso1A2: "UG", iso1A3: "UGA", iso1N3: "800", wikidata: "Q1036", nameEn: "Uganda", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["256"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.93107, -0.99298], [33.9264, -0.54188], [33.98449, -0.13079], [33.90936, 0.10581], [34.10067, 0.36372], [34.08727, 0.44713], [34.11408, 0.48884], [34.13493, 0.58118], [34.20196, 0.62289], [34.27345, 0.63182], [34.31516, 0.75693], [34.40041, 0.80266], [34.43349, 0.85254], [34.52369, 1.10692], [34.57427, 1.09868], [34.58029, 1.14712], [34.67562, 1.21265], [34.80223, 1.22754], [34.82606, 1.26626], [34.82606, 1.30944], [34.7918, 1.36752], [34.87819, 1.5596], [34.92734, 1.56109], [34.9899, 1.6668], [34.98692, 1.97348], [34.90947, 2.42447], [34.95267, 2.47209], [34.77244, 2.70272], [34.78137, 2.76223], [34.73967, 2.85447], [34.65774, 2.8753], [34.60114, 2.93034], [34.56242, 3.11478], [34.45815, 3.18319], [34.40006, 3.37949], [34.41794, 3.44342], [34.39112, 3.48802], [34.44922, 3.51627], [34.45815, 3.67385], [34.15429, 3.80464], [34.06046, 4.15235], [33.9873, 4.23316], [33.51264, 3.75068], [33.18356, 3.77812], [33.02852, 3.89296], [32.89746, 3.81339], [32.72021, 3.77327], [32.41337, 3.748], [32.20782, 3.6053], [32.19888, 3.50867], [32.08866, 3.53543], [32.08491, 3.56287], [32.05187, 3.589], [31.95907, 3.57408], [31.96205, 3.6499], [31.86821, 3.78664], [31.81459, 3.82083], [31.72075, 3.74354], [31.50776, 3.63652], [31.50478, 3.67814], [31.29476, 3.8015], [31.16666, 3.79853], [30.97601, 3.693], [30.85153, 3.48867], [30.94081, 3.50847], [30.93486, 3.40737], [30.84251, 3.26908], [30.77101, 3.04897], [30.8574, 2.9508], [30.8857, 2.83923], [30.75612, 2.5863], [30.74271, 2.43601], [30.83059, 2.42559], [30.91102, 2.33332], [30.96911, 2.41071], [31.06593, 2.35862], [31.07934, 2.30207], [31.12104, 2.27676], [31.1985, 2.29462], [31.20148, 2.2217], [31.28042, 2.17853], [31.30127, 2.11006], [30.48503, 1.21675], [30.24671, 1.14974], [30.22139, 0.99635], [30.1484, 0.89805], [29.98307, 0.84295], [29.95477, 0.64486], [29.97413, 0.52124], [29.87284, 0.39166], [29.81922, 0.16824], [29.77454, 0.16675], [29.7224, 0.07291], [29.72687, -0.08051], [29.65091, -0.46777], [29.67474, -0.47969], [29.67176, -0.55714], [29.62708, -0.71055], [29.63006, -0.8997], [29.58388, -0.89821], [29.59061, -1.39016], [29.82657, -1.31187], [29.912, -1.48269], [30.16369, -1.34303], [30.35212, -1.06896], [30.47194, -1.0555], [30.64166, -1.06601], [30.70631, -1.01175], [30.76635, -0.9852], [30.80408, -0.99911], [33.93107, -0.99298]]]] } },
22847     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
22848     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
22849     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
22850     { type: "Feature", properties: { iso1A2: "UY", iso1A3: "URY", iso1N3: "858", wikidata: "Q77", nameEn: "Uruguay", groups: ["005", "419", "019", "UN"], callingCodes: ["598"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-57.65132, -30.19229], [-57.61478, -30.25165], [-57.64859, -30.35095], [-57.89115, -30.49572], [-57.8024, -30.77193], [-57.89476, -30.95994], [-57.86729, -31.06352], [-57.9908, -31.34924], [-57.98127, -31.3872], [-58.07569, -31.44916], [-58.0023, -31.53084], [-58.00076, -31.65016], [-58.20252, -31.86966], [-58.10036, -32.25338], [-58.22362, -32.52416], [-58.1224, -32.98842], [-58.40475, -33.11777], [-58.44442, -33.84033], [-58.34425, -34.15035], [-57.83001, -34.69099], [-54.78916, -36.21945], [-52.83257, -34.01481], [-53.37138, -33.74313], [-53.39593, -33.75169], [-53.44031, -33.69344], [-53.52794, -33.68908], [-53.53459, -33.16843], [-53.1111, -32.71147], [-53.37671, -32.57005], [-53.39572, -32.58596], [-53.76024, -32.0751], [-54.17384, -31.86168], [-55.50821, -30.91349], [-55.50841, -30.9027], [-55.51862, -30.89828], [-55.52712, -30.89997], [-55.53276, -30.90218], [-55.53431, -30.89714], [-55.54572, -30.89051], [-55.55218, -30.88193], [-55.55373, -30.8732], [-55.5634, -30.8686], [-55.58866, -30.84117], [-55.87388, -31.05053], [-56.4619, -30.38457], [-56.4795, -30.3899], [-56.49267, -30.39471], [-56.90236, -30.02578], [-57.22502, -30.26121], [-57.65132, -30.19229]]]] } },
22851     { type: "Feature", properties: { iso1A2: "UZ", iso1A3: "UZB", iso1N3: "860", wikidata: "Q265", nameEn: "Uzbekistan", groups: ["143", "142", "UN"], callingCodes: ["998"] }, geometry: { type: "MultiPolygon", coordinates: [[[[65.85194, 42.85481], [65.53277, 43.31856], [65.18666, 43.48835], [64.96464, 43.74748], [64.53885, 43.56941], [63.34656, 43.64003], [62.01711, 43.51008], [61.01475, 44.41383], [58.59711, 45.58671], [55.97842, 44.99622], [55.97832, 44.99622], [55.97822, 44.99617], [55.97811, 44.99617], [55.97801, 44.99612], [55.97801, 44.99607], [55.97791, 44.99607], [55.9778, 44.99607], [55.9777, 44.99601], [55.9777, 44.99596], [55.9776, 44.99591], [55.97749, 44.99591], [55.97739, 44.99591], [55.97739, 44.99586], [55.97729, 44.99586], [55.97718, 44.99581], [55.97708, 44.99576], [55.97698, 44.9957], [55.97698, 44.99565], [55.97687, 44.9956], [55.97677, 44.9956], [55.97677, 44.99555], [55.97677, 44.9955], [55.97667, 44.99545], [55.97656, 44.99539], [55.97646, 44.99534], [55.97646, 44.99529], [55.97636, 44.99524], [55.97636, 44.99519], [55.97625, 44.99514], [55.97615, 44.99508], [55.97615, 44.99503], [55.97615, 44.99498], [55.97615, 44.99493], [55.97615, 44.99483], [55.97615, 44.99477], [55.97605, 44.99477], [55.97605, 44.99467], [55.97605, 44.99462], [55.97605, 44.99457], [55.97605, 44.99452], [55.97594, 44.99446], [55.97584, 44.99441], [55.97584, 44.99436], [55.97584, 44.99431], [55.97584, 44.99426], [55.97584, 44.99421], [55.97584, 44.99415], [55.97584, 44.99405], [55.97584, 44.994], [55.97584, 44.9939], [55.97584, 44.99384], [55.97584, 44.99374], [55.97584, 44.99369], [55.97584, 44.99359], [55.97584, 44.99353], [55.97584, 44.99348], [55.97584, 44.99343], [55.97584, 44.99338], [55.97584, 44.99328], [55.97584, 44.99322], [56.00314, 41.32584], [57.03423, 41.25435], [57.13796, 41.36625], [57.03359, 41.41777], [56.96218, 41.80383], [57.03633, 41.92043], [57.30275, 42.14076], [57.6296, 42.16519], [57.84932, 42.18555], [57.92897, 42.24047], [57.90975, 42.4374], [57.99214, 42.50021], [58.3492, 42.43335], [58.40688, 42.29535], [58.51674, 42.30348], [58.29427, 42.56497], [58.14321, 42.62159], [58.27504, 42.69632], [58.57991, 42.64988], [58.6266, 42.79314], [58.93422, 42.5407], [59.17317, 42.52248], [59.2955, 42.37064], [59.4341, 42.29738], [59.94633, 42.27655], [60.00539, 42.212], [59.96419, 42.1428], [60.04659, 42.08982], [60.0356, 42.01028], [59.95046, 41.97966], [60.33223, 41.75058], [60.08504, 41.80997], [60.06032, 41.76287], [60.18117, 41.60082], [60.06581, 41.4363], [60.5078, 41.21694], [61.03261, 41.25691], [61.22212, 41.14946], [61.33199, 41.14946], [61.39732, 41.19873], [61.4446, 41.29407], [61.87856, 41.12257], [62.11751, 40.58242], [62.34273, 40.43206], [62.43337, 39.98528], [63.6913, 39.27666], [63.70778, 39.22349], [64.19086, 38.95561], [64.32576, 38.98691], [65.55873, 38.29052], [65.83913, 38.25733], [66.24013, 38.16238], [66.41042, 38.02403], [66.56697, 38.0435], [66.67684, 37.96776], [66.53676, 37.80084], [66.52852, 37.58568], [66.65761, 37.45497], [66.52303, 37.39827], [66.55743, 37.35409], [66.64699, 37.32958], [66.95598, 37.40162], [67.08232, 37.35469], [67.13039, 37.27168], [67.2224, 37.24545], [67.2581, 37.17216], [67.51868, 37.26102], [67.78329, 37.1834], [67.8474, 37.31594], [67.81566, 37.43107], [68.12635, 37.93], [68.27159, 37.91477], [68.40343, 38.19484], [68.13289, 38.40822], [68.06274, 38.39435], [68.11366, 38.47169], [68.05873, 38.56087], [68.0807, 38.64136], [68.05598, 38.71641], [68.12877, 38.73677], [68.06948, 38.82115], [68.19743, 38.85985], [68.09704, 39.02589], [67.68915, 39.00775], [67.67833, 39.14479], [67.33226, 39.23739], [67.36522, 39.31287], [67.45998, 39.315], [67.46822, 39.46146], [67.39681, 39.52505], [67.46547, 39.53564], [67.44899, 39.57799], [67.62889, 39.60234], [67.70992, 39.66156], [68.12053, 39.56317], [68.54166, 39.53929], [68.61972, 39.68905], [68.63071, 39.85265], [68.88889, 39.87163], [68.93695, 39.91167], [68.84906, 40.04952], [68.96579, 40.06949], [69.01935, 40.11466], [69.01523, 40.15771], [68.62796, 40.07789], [68.52771, 40.11676], [68.5332, 40.14826], [68.77902, 40.20492], [68.79276, 40.17555], [68.84357, 40.18604], [68.85832, 40.20885], [69.04544, 40.22904], [69.15659, 40.2162], [69.2074, 40.21488], [69.30448, 40.18774], [69.30104, 40.24502], [69.25229, 40.26362], [69.24817, 40.30357], [69.30808, 40.2821], [69.32833, 40.29794], [69.33794, 40.34819], [69.30774, 40.36102], [69.28525, 40.41894], [69.27066, 40.49274], [69.21063, 40.54469], [69.2643, 40.57506], [69.3455, 40.57988], [69.32834, 40.70233], [69.38327, 40.7918], [69.53021, 40.77621], [69.59441, 40.70181], [69.69434, 40.62615], [70.36655, 40.90296], [70.38028, 41.02014], [70.45251, 41.04438], [70.80009, 40.72825], [70.49871, 40.52503], [70.32626, 40.45174], [70.37511, 40.38605], [70.57149, 40.3442], [70.56394, 40.26421], [70.62342, 40.17396], [70.8607, 40.217], [70.9818, 40.22392], [70.95789, 40.28761], [71.05901, 40.28765], [71.13042, 40.34106], [71.36663, 40.31593], [71.4246, 40.28619], [71.51215, 40.26943], [71.51549, 40.22986], [71.61725, 40.20615], [71.61931, 40.26775], [71.68386, 40.26984], [71.70569, 40.20391], [71.69621, 40.18492], [71.71719, 40.17886], [71.73054, 40.14818], [71.82646, 40.21872], [71.85002, 40.25647], [72.05464, 40.27586], [71.96401, 40.31907], [72.18648, 40.49893], [72.24368, 40.46091], [72.40346, 40.4007], [72.44191, 40.48222], [72.41513, 40.50856], [72.38384, 40.51535], [72.41714, 40.55736], [72.34406, 40.60144], [72.40517, 40.61917], [72.47795, 40.5532], [72.66713, 40.5219], [72.66713, 40.59076], [72.69579, 40.59778], [72.73995, 40.58409], [72.74768, 40.58051], [72.74862, 40.57131], [72.75982, 40.57273], [72.74894, 40.59592], [72.74866, 40.60873], [72.80137, 40.67856], [72.84754, 40.67229], [72.85372, 40.7116], [72.8722, 40.71111], [72.93296, 40.73089], [72.99133, 40.76457], [73.0612, 40.76678], [73.13412, 40.79122], [73.13267, 40.83512], [73.01869, 40.84681], [72.94454, 40.8094], [72.84291, 40.85512], [72.68157, 40.84942], [72.59136, 40.86947], [72.55109, 40.96046], [72.48742, 40.97136], [72.45206, 41.03018], [72.38511, 41.02785], [72.36138, 41.04384], [72.34757, 41.06104], [72.34026, 41.04539], [72.324, 41.03381], [72.18339, 40.99571], [72.17594, 41.02377], [72.21061, 41.05607], [72.1792, 41.10621], [72.14864, 41.13363], [72.17594, 41.15522], [72.16433, 41.16483], [72.10745, 41.15483], [72.07249, 41.11739], [71.85964, 41.19081], [71.91457, 41.2982], [71.83914, 41.3546], [71.76625, 41.4466], [71.71132, 41.43012], [71.73054, 41.54713], [71.65914, 41.49599], [71.6787, 41.42111], [71.57227, 41.29175], [71.46688, 41.31883], [71.43814, 41.19644], [71.46148, 41.13958], [71.40198, 41.09436], [71.34877, 41.16807], [71.27187, 41.11015], [71.25813, 41.18796], [71.11806, 41.15359], [71.02193, 41.19494], [70.9615, 41.16393], [70.86263, 41.23833], [70.77885, 41.24813], [70.78572, 41.36419], [70.67586, 41.47953], [70.48909, 41.40335], [70.17682, 41.5455], [70.69777, 41.92554], [71.28719, 42.18033], [71.13263, 42.28356], [70.94483, 42.26238], [69.49545, 41.545], [69.45751, 41.56863], [69.39485, 41.51518], [69.45081, 41.46246], [69.37468, 41.46555], [69.35554, 41.47211], [69.29778, 41.43673], [69.25059, 41.46693], [69.23332, 41.45847], [69.22671, 41.46298], [69.20439, 41.45391], [69.18528, 41.45175], [69.17701, 41.43769], [69.15137, 41.43078], [69.05006, 41.36183], [69.01308, 41.22804], [68.7217, 41.05025], [68.73945, 40.96989], [68.65662, 40.93861], [68.62221, 41.03019], [68.49983, 40.99669], [68.58444, 40.91447], [68.63, 40.59358], [68.49983, 40.56437], [67.96736, 40.83798], [68.1271, 41.0324], [68.08273, 41.08148], [67.98511, 41.02794], [67.9644, 41.14611], [66.69129, 41.1311], [66.53302, 41.87388], [66.00546, 41.94455], [66.09482, 42.93426], [65.85194, 42.85481]], [[70.68112, 40.90612], [70.6721, 40.90555], [70.57501, 40.98941], [70.54223, 40.98787], [70.56077, 41.00642], [70.6158, 40.97661], [70.68112, 40.90612]]], [[[71.21139, 40.03369], [71.12218, 40.03052], [71.06305, 40.1771], [71.00236, 40.18154], [71.01035, 40.05481], [71.11037, 40.01984], [71.11668, 39.99291], [71.09063, 39.99], [71.10501, 39.95568], [71.04979, 39.89808], [71.10531, 39.91354], [71.16101, 39.88423], [71.23067, 39.93581], [71.1427, 39.95026], [71.21139, 40.03369]]], [[[71.86463, 39.98598], [71.78838, 40.01404], [71.71511, 39.96348], [71.7504, 39.93701], [71.84316, 39.95582], [71.86463, 39.98598]]]] } },
22852     { type: "Feature", properties: { iso1A2: "VA", iso1A3: "VAT", iso1N3: "336", wikidata: "Q237", nameEn: "Vatican City", aliases: ["Holy See"], groups: ["039", "150"], callingCodes: ["379", "39 06"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45181, 41.90056], [12.45446, 41.90028], [12.45435, 41.90143], [12.45626, 41.90172], [12.45691, 41.90125], [12.4577, 41.90115], [12.45834, 41.90174], [12.45826, 41.90281], [12.45755, 41.9033], [12.45762, 41.9058], [12.45561, 41.90629], [12.45543, 41.90738], [12.45091, 41.90625], [12.44984, 41.90545], [12.44815, 41.90326], [12.44582, 41.90194], [12.44834, 41.90095], [12.45181, 41.90056]]]] } },
22853     { type: "Feature", properties: { iso1A2: "VC", iso1A3: "VCT", iso1N3: "670", wikidata: "Q757", nameEn: "St. Vincent and the Grenadines", aliases: ["WV"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 784"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-59.94058, 12.34011], [-61.69315, 14.26451], [-62.64026, 12.69984]]]] } },
22854     { type: "Feature", properties: { iso1A2: "VE", iso1A3: "VEN", iso1N3: "862", wikidata: "Q717", nameEn: "Venezuela", aliases: ["YV"], groups: ["005", "419", "019", "UN"], callingCodes: ["58"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.22331, 13.01387], [-70.92579, 11.96275], [-71.3275, 11.85], [-71.9675, 11.65536], [-72.24983, 11.14138], [-72.4767, 11.1117], [-72.88002, 10.44309], [-72.98085, 9.85253], [-73.36905, 9.16636], [-73.02119, 9.27584], [-72.94052, 9.10663], [-72.77415, 9.10165], [-72.65474, 8.61428], [-72.4042, 8.36513], [-72.36987, 8.19976], [-72.35163, 8.01163], [-72.39137, 8.03534], [-72.47213, 7.96106], [-72.48801, 7.94329], [-72.48183, 7.92909], [-72.47042, 7.92306], [-72.45806, 7.91141], [-72.46183, 7.90682], [-72.44454, 7.86031], [-72.46763, 7.79518], [-72.47827, 7.65604], [-72.45321, 7.57232], [-72.47415, 7.48928], [-72.43132, 7.40034], [-72.19437, 7.37034], [-72.04895, 7.03837], [-71.82441, 7.04314], [-71.44118, 7.02116], [-71.42212, 7.03854], [-71.37234, 7.01588], [-71.03941, 6.98163], [-70.7596, 7.09799], [-70.10716, 6.96516], [-69.41843, 6.1072], [-67.60654, 6.2891], [-67.4625, 6.20625], [-67.43513, 5.98835], [-67.58558, 5.84537], [-67.63914, 5.64963], [-67.59141, 5.5369], [-67.83341, 5.31104], [-67.85358, 4.53249], [-67.62671, 3.74303], [-67.50067, 3.75812], [-67.30945, 3.38393], [-67.85862, 2.86727], [-67.85862, 2.79173], [-67.65696, 2.81691], [-67.21967, 2.35778], [-66.85795, 1.22998], [-66.28507, 0.74585], [-65.6727, 1.01353], [-65.50158, 0.92086], [-65.57288, 0.62856], [-65.11657, 1.12046], [-64.38932, 1.5125], [-64.34654, 1.35569], [-64.08274, 1.64792], [-64.06135, 1.94722], [-63.39827, 2.16098], [-63.39114, 2.4317], [-64.0257, 2.48156], [-64.02908, 2.79797], [-64.48379, 3.7879], [-64.84028, 4.24665], [-64.72977, 4.28931], [-64.57648, 4.12576], [-64.14512, 4.12932], [-63.99183, 3.90172], [-63.86082, 3.94796], [-63.70218, 3.91417], [-63.67099, 4.01731], [-63.50611, 3.83592], [-63.42233, 3.89995], [-63.4464, 3.9693], [-63.21111, 3.96219], [-62.98296, 3.59935], [-62.7655, 3.73099], [-62.74411, 4.03331], [-62.57656, 4.04754], [-62.44822, 4.18621], [-62.13094, 4.08309], [-61.54629, 4.2822], [-61.48569, 4.43149], [-61.29675, 4.44216], [-61.31457, 4.54167], [-61.15703, 4.49839], [-60.98303, 4.54167], [-60.86539, 4.70512], [-60.5802, 4.94312], [-60.73204, 5.20931], [-61.4041, 5.95304], [-61.15058, 6.19558], [-61.20762, 6.58174], [-61.13632, 6.70922], [-60.54873, 6.8631], [-60.39419, 6.94847], [-60.28074, 7.1162], [-60.44116, 7.20817], [-60.54098, 7.14804], [-60.63367, 7.25061], [-60.59802, 7.33194], [-60.71923, 7.55817], [-60.64793, 7.56877], [-60.51959, 7.83373], [-60.38056, 7.8302], [-60.02407, 8.04557], [-59.97059, 8.20791], [-59.83156, 8.23261], [-59.80661, 8.28906], [-59.85562, 8.35213], [-59.98508, 8.53046], [-59.54058, 8.6862], [-60.89962, 9.81445], [-62.08693, 10.04435], [-61.62505, 11.18974], [-63.73917, 11.92623], [-63.19938, 16.44103], [-67.89186, 12.4116], [-68.01417, 11.77722], [-68.33524, 11.78151], [-68.99639, 11.79035], [-71.22331, 13.01387]]]] } },
22855     { type: "Feature", properties: { iso1A2: "VG", iso1A3: "VGB", iso1N3: "092", wikidata: "Q25305", nameEn: "British Virgin Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 284"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-64.47127, 17.55688], [-63.88746, 19.15706], [-65.02435, 18.73231], [-64.86027, 18.39056], [-64.64673, 18.36549], [-64.47127, 17.55688]]]] } },
22856     { type: "Feature", properties: { iso1A2: "VI", iso1A3: "VIR", iso1N3: "850", wikidata: "Q11703", nameEn: "United States Virgin Islands", aliases: ["US-VI"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 340"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.02435, 18.73231], [-65.27974, 17.56928], [-64.47127, 17.55688], [-64.64673, 18.36549], [-64.86027, 18.39056], [-65.02435, 18.73231]]]] } },
22857     { type: "Feature", properties: { iso1A2: "VN", iso1A3: "VNM", iso1N3: "704", wikidata: "Q881", nameEn: "Vietnam", groups: ["035", "142", "UN"], callingCodes: ["84"] }, geometry: { type: "MultiPolygon", coordinates: [[[[108.10003, 21.47338], [108.0569, 21.53604], [108.02926, 21.54997], [107.97932, 21.54503], [107.97383, 21.53961], [107.97074, 21.54072], [107.96774, 21.53601], [107.95232, 21.5388], [107.92652, 21.58906], [107.90006, 21.5905], [107.86114, 21.65128], [107.80355, 21.66141], [107.66967, 21.60787], [107.56537, 21.61945], [107.54047, 21.5934], [107.49065, 21.59774], [107.49532, 21.62958], [107.47197, 21.6672], [107.41593, 21.64839], [107.38636, 21.59774], [107.35989, 21.60063], [107.35834, 21.6672], [107.29296, 21.74674], [107.24625, 21.7077], [107.20734, 21.71493], [107.10771, 21.79879], [107.02615, 21.81981], [107.00964, 21.85948], [107.06101, 21.88982], [107.05634, 21.92303], [106.99252, 21.95191], [106.97228, 21.92592], [106.92714, 21.93459], [106.9178, 21.97357], [106.81038, 21.97934], [106.74345, 22.00965], [106.72551, 21.97923], [106.69276, 21.96013], [106.68274, 21.99811], [106.70142, 22.02409], [106.6983, 22.15102], [106.67495, 22.1885], [106.69986, 22.22309], [106.6516, 22.33977], [106.55976, 22.34841], [106.57221, 22.37], [106.55665, 22.46498], [106.58395, 22.474], [106.61269, 22.60301], [106.65316, 22.5757], [106.71698, 22.58432], [106.72321, 22.63606], [106.76293, 22.73491], [106.82404, 22.7881], [106.83685, 22.8098], [106.81271, 22.8226], [106.78422, 22.81532], [106.71128, 22.85982], [106.71387, 22.88296], [106.6734, 22.89587], [106.6516, 22.86862], [106.60179, 22.92884], [106.55976, 22.92311], [106.51306, 22.94891], [106.49749, 22.91164], [106.34961, 22.86718], [106.27022, 22.87722], [106.19705, 22.98475], [106.00179, 22.99049], [105.99568, 22.94178], [105.90119, 22.94168], [105.8726, 22.92756], [105.72382, 23.06641], [105.57594, 23.075], [105.56037, 23.16806], [105.49966, 23.20669], [105.42805, 23.30824], [105.40782, 23.28107], [105.32376, 23.39684], [105.22569, 23.27249], [105.17276, 23.28679], [105.11672, 23.25247], [105.07002, 23.26248], [104.98712, 23.19176], [104.96532, 23.20463], [104.9486, 23.17235], [104.91435, 23.18666], [104.87992, 23.17141], [104.87382, 23.12854], [104.79478, 23.12934], [104.8334, 23.01484], [104.86765, 22.95178], [104.84942, 22.93631], [104.77114, 22.90017], [104.72755, 22.81984], [104.65283, 22.83419], [104.60457, 22.81841], [104.58122, 22.85571], [104.47225, 22.75813], [104.35593, 22.69353], [104.25683, 22.76534], [104.27084, 22.8457], [104.11384, 22.80363], [104.03734, 22.72945], [104.01088, 22.51823], [103.99247, 22.51958], [103.97384, 22.50634], [103.96783, 22.51173], [103.96352, 22.50584], [103.95191, 22.5134], [103.94513, 22.52553], [103.93286, 22.52703], [103.87904, 22.56683], [103.64506, 22.79979], [103.56255, 22.69499], [103.57812, 22.65764], [103.52675, 22.59155], [103.43646, 22.70648], [103.43179, 22.75816], [103.32282, 22.8127], [103.28079, 22.68063], [103.18895, 22.64471], [103.15782, 22.59873], [103.17961, 22.55705], [103.07843, 22.50097], [103.0722, 22.44775], [102.9321, 22.48659], [102.8636, 22.60735], [102.60675, 22.73376], [102.57095, 22.7036], [102.51802, 22.77969], [102.46665, 22.77108], [102.42618, 22.69212], [102.38415, 22.67919], [102.41061, 22.64184], [102.25339, 22.4607], [102.26428, 22.41321], [102.16621, 22.43336], [102.14099, 22.40092], [102.18712, 22.30403], [102.51734, 22.02676], [102.49092, 21.99002], [102.62301, 21.91447], [102.67145, 21.65894], [102.74189, 21.66713], [102.82115, 21.73667], [102.81894, 21.83888], [102.85637, 21.84501], [102.86077, 21.71213], [102.97965, 21.74076], [102.98846, 21.58936], [102.86297, 21.4255], [102.94223, 21.46034], [102.88939, 21.3107], [102.80794, 21.25736], [102.89825, 21.24707], [102.97745, 21.05821], [103.03469, 21.05821], [103.12055, 20.89994], [103.21497, 20.89832], [103.38032, 20.79501], [103.45737, 20.82382], [103.68633, 20.66324], [103.73478, 20.6669], [103.82282, 20.8732], [103.98024, 20.91531], [104.11121, 20.96779], [104.27412, 20.91433], [104.63957, 20.6653], [104.38199, 20.47155], [104.40621, 20.3849], [104.47886, 20.37459], [104.66158, 20.47774], [104.72102, 20.40554], [104.62195, 20.36633], [104.61315, 20.24452], [104.86852, 20.14121], [104.91695, 20.15567], [104.9874, 20.09573], [104.8465, 19.91783], [104.8355, 19.80395], [104.68359, 19.72729], [104.64837, 19.62365], [104.53169, 19.61743], [104.41281, 19.70035], [104.23229, 19.70242], [104.06498, 19.66926], [104.05617, 19.61743], [104.10832, 19.51575], [104.06058, 19.43484], [103.87125, 19.31854], [104.5361, 18.97747], [104.64617, 18.85668], [105.12829, 18.70453], [105.19654, 18.64196], [105.1327, 18.58355], [105.10408, 18.43533], [105.15942, 18.38691], [105.38366, 18.15315], [105.46292, 18.22008], [105.64784, 17.96687], [105.60381, 17.89356], [105.76612, 17.67147], [105.85744, 17.63221], [106.09019, 17.36399], [106.18991, 17.28227], [106.24444, 17.24714], [106.29287, 17.3018], [106.31929, 17.20509], [106.43597, 17.01362], [106.50862, 16.9673], [106.55045, 17.0031], [106.54824, 16.92729], [106.51963, 16.92097], [106.52183, 16.87884], [106.55265, 16.86831], [106.55485, 16.68704], [106.59013, 16.62259], [106.58267, 16.6012], [106.61477, 16.60713], [106.66052, 16.56892], [106.65832, 16.47816], [106.74418, 16.41904], [106.84104, 16.55415], [106.88727, 16.52671], [106.88067, 16.43594], [106.96638, 16.34938], [106.97385, 16.30204], [107.02597, 16.31132], [107.09091, 16.3092], [107.15035, 16.26271], [107.14595, 16.17816], [107.25822, 16.13587], [107.33968, 16.05549], [107.44975, 16.08511], [107.46296, 16.01106], [107.39471, 15.88829], [107.34188, 15.89464], [107.21419, 15.83747], [107.21859, 15.74638], [107.27143, 15.71459], [107.27583, 15.62769], [107.34408, 15.62345], [107.3815, 15.49832], [107.50699, 15.48771], [107.53341, 15.40496], [107.62367, 15.42193], [107.60605, 15.37524], [107.62587, 15.2266], [107.58844, 15.20111], [107.61926, 15.13949], [107.61486, 15.0566], [107.46516, 15.00982], [107.48277, 14.93751], [107.59285, 14.87795], [107.51579, 14.79282], [107.54361, 14.69092], [107.55371, 14.628], [107.52102, 14.59034], [107.52569, 14.54665], [107.48521, 14.40346], [107.44941, 14.41552], [107.39493, 14.32655], [107.40427, 14.24509], [107.33577, 14.11832], [107.37158, 14.07906], [107.35757, 14.02319], [107.38247, 13.99147], [107.44318, 13.99751], [107.46498, 13.91593], [107.45252, 13.78897], [107.53503, 13.73908], [107.61909, 13.52577], [107.62843, 13.3668], [107.49144, 13.01215], [107.49611, 12.88926], [107.55993, 12.7982], [107.5755, 12.52177], [107.55059, 12.36824], [107.4463, 12.29373], [107.42917, 12.24657], [107.34511, 12.33327], [107.15831, 12.27547], [106.99953, 12.08983], [106.92325, 12.06548], [106.79405, 12.0807], [106.70687, 11.96956], [106.4111, 11.97413], [106.4687, 11.86751], [106.44068, 11.86294], [106.44535, 11.8279], [106.41577, 11.76999], [106.45158, 11.68616], [106.44691, 11.66787], [106.37219, 11.69836], [106.30525, 11.67549], [106.26478, 11.72122], [106.18539, 11.75171], [106.13158, 11.73283], [106.06708, 11.77761], [106.02038, 11.77457], [106.00792, 11.7197], [105.95188, 11.63738], [105.88962, 11.67854], [105.8507, 11.66635], [105.80867, 11.60536], [105.81645, 11.56876], [105.87328, 11.55953], [105.88962, 11.43605], [105.86782, 11.28343], [106.10444, 11.07879], [106.1527, 11.10476], [106.1757, 11.07301], [106.20095, 10.97795], [106.14301, 10.98176], [106.18539, 10.79451], [106.06708, 10.8098], [105.94535, 10.9168], [105.93403, 10.83853], [105.84603, 10.85873], [105.86376, 10.89839], [105.77751, 11.03671], [105.50045, 10.94586], [105.42884, 10.96878], [105.34011, 10.86179], [105.11449, 10.96332], [105.08326, 10.95656], [105.02722, 10.89236], [105.09571, 10.72722], [104.95094, 10.64003], [104.87933, 10.52833], [104.59018, 10.53073], [104.49869, 10.4057], [104.47963, 10.43046], [104.43778, 10.42386], [103.99198, 10.48391], [102.47649, 9.66162], [104.81582, 8.03101], [109.55486, 8.10026], [111.60491, 13.57105], [108.00365, 17.98159], [108.10003, 21.47338]]]] } },
22858     { type: "Feature", properties: { iso1A2: "VU", iso1A3: "VUT", iso1N3: "548", wikidata: "Q686", nameEn: "Vanuatu", groups: ["054", "009", "UN"], callingCodes: ["678"] }, geometry: { type: "MultiPolygon", coordinates: [[[[156.73836, -14.50464], [174.245, -23.1974], [172.71443, -12.01327], [156.73836, -14.50464]]]] } },
22859     { type: "Feature", properties: { iso1A2: "WF", iso1A3: "WLF", iso1N3: "876", wikidata: "Q35555", nameEn: "Wallis and Futuna", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["681"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-178.66551, -14.32452], [-176.76826, -14.95183], [-175.59809, -12.61507], [-178.66551, -14.32452]]]] } },
22860     { type: "Feature", properties: { iso1A2: "WS", iso1A3: "WSM", iso1N3: "882", wikidata: "Q683", nameEn: "Samoa", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["685"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-173.74402, -14.26669], [-170.99605, -15.1275], [-171.39864, -10.21587], [-173.74402, -14.26669]]]] } },
22861     { type: "Feature", properties: { iso1A2: "XK", iso1A3: "XKX", wikidata: "Q1246", nameEn: "Kosovo", aliases: ["KV"], groups: ["039", "150"], isoStatus: "usrAssn", callingCodes: ["383"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.39045, 42.74888], [21.44047, 42.87276], [21.36941, 42.87397], [21.32974, 42.90424], [21.2719, 42.8994], [21.23534, 42.95523], [21.23877, 43.00848], [21.2041, 43.02277], [21.16734, 42.99694], [21.14465, 43.11089], [21.08952, 43.13471], [21.05378, 43.10707], [21.00749, 43.13984], [20.96287, 43.12416], [20.83727, 43.17842], [20.88685, 43.21697], [20.82145, 43.26769], [20.73811, 43.25068], [20.68688, 43.21335], [20.59929, 43.20492], [20.69515, 43.09641], [20.64557, 43.00826], [20.59929, 43.01067], [20.48692, 42.93208], [20.53484, 42.8885], [20.43734, 42.83157], [20.40594, 42.84853], [20.35692, 42.8335], [20.27869, 42.81945], [20.2539, 42.76245], [20.04898, 42.77701], [20.02088, 42.74789], [20.02915, 42.71147], [20.0969, 42.65559], [20.07761, 42.55582], [20.17127, 42.50469], [20.21797, 42.41237], [20.24399, 42.32168], [20.34479, 42.32656], [20.3819, 42.3029], [20.48857, 42.25444], [20.56955, 42.12097], [20.55633, 42.08173], [20.59434, 42.03879], [20.63069, 41.94913], [20.57946, 41.91593], [20.59524, 41.8818], [20.68523, 41.85318], [20.76786, 41.91839], [20.75464, 42.05229], [21.11491, 42.20794], [21.16614, 42.19815], [21.22728, 42.08909], [21.31983, 42.10993], [21.29913, 42.13954], [21.30496, 42.1418], [21.38428, 42.24465], [21.43882, 42.23609], [21.43882, 42.2789], [21.50823, 42.27156], [21.52145, 42.24465], [21.58992, 42.25915], [21.56772, 42.30946], [21.5264, 42.33634], [21.53467, 42.36809], [21.57021, 42.3647], [21.59029, 42.38042], [21.62887, 42.37664], [21.64209, 42.41081], [21.62556, 42.45106], [21.7035, 42.51899], [21.70522, 42.54176], [21.7327, 42.55041], [21.75672, 42.62695], [21.79413, 42.65923], [21.75025, 42.70125], [21.6626, 42.67813], [21.58755, 42.70418], [21.59154, 42.72643], [21.47498, 42.74695], [21.39045, 42.74888]]]] } },
22862     { type: "Feature", properties: { iso1A2: "YE", iso1A3: "YEM", iso1N3: "887", wikidata: "Q805", nameEn: "Yemen", groups: ["145", "142", "UN"], callingCodes: ["967"] }, geometry: { type: "MultiPolygon", coordinates: [[[[57.49095, 8.14549], [52.81185, 17.28568], [52.74267, 17.29519], [52.78009, 17.35124], [52.00311, 19.00083], [49.04884, 18.59899], [48.19996, 18.20584], [47.58351, 17.50366], [47.48245, 17.10808], [47.00571, 16.94765], [46.76494, 17.29151], [46.31018, 17.20464], [44.50126, 17.47475], [43.70631, 17.35762], [43.43005, 17.56148], [43.29185, 17.53224], [43.22533, 17.38343], [43.32653, 17.31179], [43.20156, 17.25901], [43.17787, 17.14717], [43.23967, 17.03428], [43.18233, 17.02673], [43.1813, 16.98438], [43.19328, 16.94703], [43.1398, 16.90696], [43.18338, 16.84852], [43.22012, 16.83932], [43.22956, 16.80613], [43.24801, 16.80613], [43.26303, 16.79479], [43.25857, 16.75304], [43.21325, 16.74416], [43.22066, 16.65179], [43.15274, 16.67248], [43.11601, 16.53166], [42.97215, 16.51093], [42.94351, 16.49467], [42.94625, 16.39721], [42.76801, 16.40371], [42.15205, 16.40211], [40.99158, 15.81743], [43.29075, 12.79154], [43.32909, 12.59711], [43.90659, 12.3823], [51.12877, 12.56479], [57.49095, 8.14549]]]] } },
22863     { type: "Feature", properties: { iso1A2: "YT", iso1A3: "MYT", iso1N3: "175", wikidata: "Q17063", nameEn: "Mayotte", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.28731, -13.97126], [45.54824, -13.22353], [45.4971, -11.75965], [43.28731, -13.97126]]]] } },
22864     { type: "Feature", properties: { iso1A2: "ZA", iso1A3: "ZAF", iso1N3: "710", wikidata: "Q258", nameEn: "South Africa", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["27"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.30611, -22.422], [31.16344, -22.32599], [31.08932, -22.34884], [30.86696, -22.28907], [30.6294, -22.32599], [30.48686, -22.31368], [30.38614, -22.34533], [30.28351, -22.35587], [30.2265, -22.2961], [30.13147, -22.30841], [29.92242, -22.19408], [29.76848, -22.14128], [29.64609, -22.12917], [29.37703, -22.19581], [29.21955, -22.17771], [29.18974, -22.18599], [29.15268, -22.21399], [29.10881, -22.21202], [29.0151, -22.22907], [28.91889, -22.44299], [28.63287, -22.55887], [28.34874, -22.5694], [28.04562, -22.8394], [28.04752, -22.90243], [27.93729, -22.96194], [27.93539, -23.04941], [27.74154, -23.2137], [27.6066, -23.21894], [27.52393, -23.37952], [27.33768, -23.40917], [26.99749, -23.65486], [26.84165, -24.24885], [26.51667, -24.47219], [26.46346, -24.60358], [26.39409, -24.63468], [25.8515, -24.75727], [25.84295, -24.78661], [25.88571, -24.87802], [25.72702, -25.25503], [25.69661, -25.29284], [25.6643, -25.4491], [25.58543, -25.6343], [25.33076, -25.76616], [25.12266, -25.75931], [25.01718, -25.72507], [24.8946, -25.80723], [24.67319, -25.81749], [24.44703, -25.73021], [24.36531, -25.773], [24.18287, -25.62916], [23.9244, -25.64286], [23.47588, -25.29971], [23.03497, -25.29971], [22.86012, -25.50572], [22.70808, -25.99186], [22.56365, -26.19668], [22.41921, -26.23078], [22.21206, -26.3773], [22.06192, -26.61882], [21.90703, -26.66808], [21.83291, -26.65959], [21.77114, -26.69015], [21.7854, -26.79199], [21.69322, -26.86152], [21.37869, -26.82083], [21.13353, -26.86661], [20.87031, -26.80047], [20.68596, -26.9039], [20.63275, -26.78181], [20.61754, -26.4692], [20.86081, -26.14892], [20.64795, -25.47827], [20.29826, -24.94869], [20.03678, -24.81004], [20.02809, -24.78725], [19.99817, -24.76768], [19.99882, -28.42622], [18.99885, -28.89165], [17.4579, -28.68718], [17.15405, -28.08573], [16.90446, -28.057], [16.59922, -28.53246], [16.46592, -28.57126], [16.45332, -28.63117], [12.51595, -32.27486], [38.88176, -48.03306], [34.51034, -26.91792], [32.35222, -26.86027], [32.29584, -26.852], [32.22302, -26.84136], [32.19409, -26.84032], [32.13315, -26.84345], [32.09664, -26.80721], [32.00893, -26.8096], [31.97463, -27.11057], [31.97592, -27.31675], [31.49834, -27.31549], [31.15027, -27.20151], [30.96088, -27.0245], [30.97757, -26.92706], [30.88826, -26.79622], [30.81101, -26.84722], [30.78927, -26.48271], [30.95819, -26.26303], [31.13073, -25.91558], [31.31237, -25.7431], [31.4175, -25.71886], [31.86881, -25.99973], [31.974, -25.95387], [31.92649, -25.84216], [32.00631, -25.65044], [31.97875, -25.46356], [32.01676, -25.38117], [32.03196, -25.10785], [31.9835, -24.29983], [31.90368, -24.18892], [31.87707, -23.95293], [31.77445, -23.90082], [31.70223, -23.72695], [31.67942, -23.60858], [31.56539, -23.47268], [31.55779, -23.176], [31.30611, -22.422]], [[29.33204, -29.45598], [29.28545, -29.58456], [29.12553, -29.76266], [29.16548, -29.91706], [28.9338, -30.05072], [28.80222, -30.10579], [28.68627, -30.12885], [28.399, -30.1592], [28.2319, -30.28476], [28.12073, -30.68072], [27.74814, -30.60635], [27.69467, -30.55862], [27.67819, -30.53437], [27.6521, -30.51707], [27.62137, -30.50509], [27.56781, -30.44562], [27.56901, -30.42504], [27.45452, -30.32239], [27.38108, -30.33456], [27.36649, -30.27246], [27.37293, -30.19401], [27.40778, -30.14577], [27.32555, -30.14785], [27.29603, -30.05473], [27.22719, -30.00718], [27.09489, -29.72796], [27.01016, -29.65439], [27.33464, -29.48161], [27.4358, -29.33465], [27.47254, -29.31968], [27.45125, -29.29708], [27.48679, -29.29349], [27.54258, -29.25575], [27.5158, -29.2261], [27.55974, -29.18954], [27.75458, -28.89839], [27.8907, -28.91612], [27.88933, -28.88156], [27.9392, -28.84864], [27.98675, -28.8787], [28.02503, -28.85991], [28.1317, -28.7293], [28.2348, -28.69471], [28.30518, -28.69531], [28.40612, -28.6215], [28.65091, -28.57025], [28.68043, -28.58744], [29.40524, -29.21246], [29.44883, -29.3772], [29.33204, -29.45598]]]] } },
22865     { type: "Feature", properties: { iso1A2: "ZM", iso1A3: "ZMB", iso1N3: "894", wikidata: "Q953", nameEn: "Zambia", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["260"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.95389, -9.40138], [32.76233, -9.31963], [32.75611, -9.28583], [32.53661, -9.24281], [32.49147, -9.14754], [32.43543, -9.11988], [32.25486, -9.13371], [32.16146, -9.05993], [32.08206, -9.04609], [31.98866, -9.07069], [31.94196, -9.02303], [31.94663, -8.93846], [31.81587, -8.88618], [31.71158, -8.91386], [31.57147, -8.81388], [31.57147, -8.70619], [31.37533, -8.60769], [31.00796, -8.58615], [30.79243, -8.27382], [28.88917, -8.4831], [28.9711, -8.66935], [28.38526, -9.23393], [28.36562, -9.30091], [28.52636, -9.35379], [28.51627, -9.44726], [28.56208, -9.49122], [28.68532, -9.78], [28.62795, -9.92942], [28.65032, -10.65133], [28.37241, -11.57848], [28.48357, -11.87532], [29.18592, -12.37921], [29.4992, -12.43843], [29.48404, -12.23604], [29.8139, -12.14898], [29.81551, -13.44683], [29.65078, -13.41844], [29.60531, -13.21685], [29.01918, -13.41353], [28.33199, -12.41375], [27.59932, -12.22123], [27.21025, -11.76157], [27.22541, -11.60323], [27.04351, -11.61312], [26.88687, -12.01868], [26.01777, -11.91488], [25.33058, -11.65767], [25.34069, -11.19707], [24.42612, -11.44975], [24.34528, -11.06816], [24.00027, -10.89356], [24.02603, -11.15368], [23.98804, -12.13149], [24.06672, -12.29058], [23.90937, -12.844], [24.03339, -12.99091], [21.97988, -13.00148], [22.00323, -16.18028], [22.17217, -16.50269], [23.20038, -17.47563], [23.47474, -17.62877], [24.23619, -17.47489], [24.32811, -17.49082], [24.38712, -17.46818], [24.5621, -17.52963], [24.70864, -17.49501], [25.00198, -17.58221], [25.26433, -17.79571], [25.51646, -17.86232], [25.6827, -17.81987], [25.85738, -17.91403], [25.85892, -17.97726], [26.08925, -17.98168], [26.0908, -17.93021], [26.21601, -17.88608], [26.55918, -17.99638], [26.68403, -18.07411], [26.74314, -18.0199], [26.89926, -17.98756], [27.14196, -17.81398], [27.30736, -17.60487], [27.61377, -17.34378], [27.62795, -17.24365], [27.83141, -16.96274], [28.73725, -16.5528], [28.76199, -16.51575], [28.81454, -16.48611], [28.8501, -16.04537], [28.9243, -15.93987], [29.01298, -15.93805], [29.21955, -15.76589], [29.4437, -15.68702], [29.8317, -15.6126], [30.35574, -15.6513], [30.41902, -15.62269], [30.22098, -14.99447], [33.24249, -14.00019], [33.16749, -13.93992], [33.07568, -13.98447], [33.02977, -14.05022], [32.99042, -13.95689], [32.88985, -13.82956], [32.79015, -13.80755], [32.76962, -13.77224], [32.84528, -13.71576], [32.7828, -13.64805], [32.68654, -13.64268], [32.66468, -13.60019], [32.68436, -13.55769], [32.73683, -13.57682], [32.84176, -13.52794], [32.86113, -13.47292], [33.0078, -13.19492], [32.98289, -13.12671], [33.02181, -12.88707], [32.96733, -12.88251], [32.94397, -12.76868], [33.05917, -12.59554], [33.18837, -12.61377], [33.28177, -12.54692], [33.37517, -12.54085], [33.54485, -12.35996], [33.47636, -12.32498], [33.3705, -12.34931], [33.25998, -12.14242], [33.33937, -11.91252], [33.32692, -11.59248], [33.24252, -11.59302], [33.23663, -11.40637], [33.29267, -11.43536], [33.29267, -11.3789], [33.39697, -11.15296], [33.25998, -10.88862], [33.28022, -10.84428], [33.47636, -10.78465], [33.70675, -10.56896], [33.54797, -10.36077], [33.53863, -10.20148], [33.31297, -10.05133], [33.37902, -9.9104], [33.36581, -9.81063], [33.31517, -9.82364], [33.2095, -9.61099], [33.12144, -9.58929], [33.10163, -9.66525], [33.05485, -9.61316], [33.00256, -9.63053], [33.00476, -9.5133], [32.95389, -9.40138]]]] } },
22866     { type: "Feature", properties: { iso1A2: "ZW", iso1A3: "ZWE", iso1N3: "716", wikidata: "Q954", nameEn: "Zimbabwe", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["263"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.41902, -15.62269], [30.35574, -15.6513], [29.8317, -15.6126], [29.4437, -15.68702], [29.21955, -15.76589], [29.01298, -15.93805], [28.9243, -15.93987], [28.8501, -16.04537], [28.81454, -16.48611], [28.76199, -16.51575], [28.73725, -16.5528], [27.83141, -16.96274], [27.62795, -17.24365], [27.61377, -17.34378], [27.30736, -17.60487], [27.14196, -17.81398], [26.89926, -17.98756], [26.74314, -18.0199], [26.68403, -18.07411], [26.55918, -17.99638], [26.21601, -17.88608], [26.0908, -17.93021], [26.08925, -17.98168], [25.85892, -17.97726], [25.85738, -17.91403], [25.6827, -17.81987], [25.51646, -17.86232], [25.26433, -17.79571], [25.23909, -17.90832], [25.31799, -18.07091], [25.39972, -18.12691], [25.53465, -18.39041], [25.68859, -18.56165], [25.79217, -18.6355], [25.82353, -18.82808], [25.94326, -18.90362], [25.99837, -19.02943], [25.96226, -19.08152], [26.17227, -19.53709], [26.72246, -19.92707], [27.21278, -20.08244], [27.29831, -20.28935], [27.28865, -20.49873], [27.69361, -20.48531], [27.72972, -20.51735], [27.69171, -21.08409], [27.91407, -21.31621], [28.01669, -21.57624], [28.29416, -21.59037], [28.49942, -21.66634], [28.58114, -21.63455], [29.07763, -21.81877], [29.04023, -21.85864], [29.02191, -21.90647], [29.02191, -21.95665], [29.04108, -22.00563], [29.08495, -22.04867], [29.14501, -22.07275], [29.1974, -22.07472], [29.24648, -22.05967], [29.3533, -22.18363], [29.37703, -22.19581], [29.64609, -22.12917], [29.76848, -22.14128], [29.92242, -22.19408], [30.13147, -22.30841], [30.2265, -22.2961], [30.28351, -22.35587], [30.38614, -22.34533], [30.48686, -22.31368], [30.6294, -22.32599], [30.86696, -22.28907], [31.08932, -22.34884], [31.16344, -22.32599], [31.30611, -22.422], [31.38336, -22.36919], [32.41234, -21.31246], [32.48236, -21.32873], [32.37115, -21.133], [32.51644, -20.91929], [32.48122, -20.63319], [32.55167, -20.56312], [32.66174, -20.56106], [32.85987, -20.27841], [32.85987, -20.16686], [32.93032, -20.03868], [33.01178, -20.02007], [33.06461, -19.77787], [32.95013, -19.67219], [32.84666, -19.68462], [32.84446, -19.48343], [32.78282, -19.47513], [32.77966, -19.36098], [32.85107, -19.29238], [32.87088, -19.09279], [32.84006, -19.0262], [32.72118, -19.02204], [32.69917, -18.94293], [32.73439, -18.92628], [32.70137, -18.84712], [32.82465, -18.77419], [32.9017, -18.7992], [32.95013, -18.69079], [32.88629, -18.58023], [32.88629, -18.51344], [33.02278, -18.4696], [33.03159, -18.35054], [32.94133, -17.99705], [33.0492, -17.60298], [32.98536, -17.55891], [32.96554, -17.48964], [33.0426, -17.3468], [33.00517, -17.30477], [32.96554, -17.11971], [32.84113, -16.92259], [32.91051, -16.89446], [32.97655, -16.70689], [32.78943, -16.70267], [32.69917, -16.66893], [32.71017, -16.59932], [32.42838, -16.4727], [32.28529, -16.43892], [32.02772, -16.43892], [31.91324, -16.41569], [31.90223, -16.34388], [31.67988, -16.19595], [31.42451, -16.15154], [31.30563, -16.01193], [31.13171, -15.98019], [30.97761, -16.05848], [30.91597, -15.99924], [30.42568, -15.9962], [30.41902, -15.62269]]]] } }
22867   ];
22868   var borders_default = { type, features };
22869   var borders = borders_default;
22870   var whichPolygonGetter = {};
22871   var featuresByCode = {};
22872   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
22873   function canonicalID(id2) {
22874     const s = id2 || "";
22875     if (s.charAt(0) === ".") {
22876       return s.toUpperCase();
22877     } else {
22878       return s.replace(idFilterRegex, "").toUpperCase();
22879     }
22880   }
22881   var levels = [
22882     "subterritory",
22883     "territory",
22884     "subcountryGroup",
22885     "country",
22886     "sharedLandform",
22887     "intermediateRegion",
22888     "subregion",
22889     "region",
22890     "subunion",
22891     "union",
22892     "unitedNations",
22893     "world"
22894   ];
22895   loadDerivedDataAndCaches(borders);
22896   function loadDerivedDataAndCaches(borders2) {
22897     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
22898     let geometryFeatures = [];
22899     borders2.features.forEach((feature22) => {
22900       feature22.properties.id = feature22.properties.iso1A2 || feature22.properties.m49 || feature22.properties.wikidata;
22901       loadM49(feature22);
22902       loadTLD(feature22);
22903       loadIsoStatus(feature22);
22904       loadLevel(feature22);
22905       loadGroups(feature22);
22906       loadFlag(feature22);
22907       cacheFeatureByIDs(feature22);
22908       if (feature22.geometry)
22909         geometryFeatures.push(feature22);
22910     });
22911     borders2.features.forEach((feature22) => {
22912       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
22913         return featuresByCode[groupID].properties.id;
22914       });
22915       loadMembersForGroupsOf(feature22);
22916     });
22917     borders2.features.forEach((feature22) => {
22918       loadRoadSpeedUnit(feature22);
22919       loadRoadHeightUnit(feature22);
22920       loadDriveSide(feature22);
22921       loadCallingCodes(feature22);
22922       loadGroupGroups(feature22);
22923     });
22924     borders2.features.forEach((feature22) => {
22925       feature22.properties.groups.sort((groupID1, groupID2) => {
22926         return levels.indexOf(featuresByCode[groupID1].properties.level) - levels.indexOf(featuresByCode[groupID2].properties.level);
22927       });
22928       if (feature22.properties.members)
22929         feature22.properties.members.sort((id1, id2) => {
22930           const diff = levels.indexOf(featuresByCode[id1].properties.level) - levels.indexOf(featuresByCode[id2].properties.level);
22931           if (diff === 0) {
22932             return borders2.features.indexOf(featuresByCode[id1]) - borders2.features.indexOf(featuresByCode[id2]);
22933           }
22934           return diff;
22935         });
22936     });
22937     const geometryOnlyCollection = {
22938       type: "FeatureCollection",
22939       features: geometryFeatures
22940     };
22941     whichPolygonGetter = (0, import_which_polygon.default)(geometryOnlyCollection);
22942     function loadGroups(feature22) {
22943       const props = feature22.properties;
22944       if (!props.groups) {
22945         props.groups = [];
22946       }
22947       if (feature22.geometry && props.country) {
22948         props.groups.push(props.country);
22949       }
22950       if (props.m49 !== "001") {
22951         props.groups.push("001");
22952       }
22953     }
22954     function loadM49(feature22) {
22955       const props = feature22.properties;
22956       if (!props.m49 && props.iso1N3) {
22957         props.m49 = props.iso1N3;
22958       }
22959     }
22960     function loadTLD(feature22) {
22961       const props = feature22.properties;
22962       if (props.level === "unitedNations")
22963         return;
22964       if (!props.ccTLD && props.iso1A2) {
22965         props.ccTLD = "." + props.iso1A2.toLowerCase();
22966       }
22967     }
22968     function loadIsoStatus(feature22) {
22969       const props = feature22.properties;
22970       if (!props.isoStatus && props.iso1A2) {
22971         props.isoStatus = "official";
22972       }
22973     }
22974     function loadLevel(feature22) {
22975       const props = feature22.properties;
22976       if (props.level)
22977         return;
22978       if (!props.country) {
22979         props.level = "country";
22980       } else if (!props.iso1A2 || props.isoStatus === "official") {
22981         props.level = "territory";
22982       } else {
22983         props.level = "subterritory";
22984       }
22985     }
22986     function loadGroupGroups(feature22) {
22987       const props = feature22.properties;
22988       if (feature22.geometry || !props.members)
22989         return;
22990       const featureLevelIndex = levels.indexOf(props.level);
22991       let sharedGroups = [];
22992       props.members.forEach((memberID, index) => {
22993         const member = featuresByCode[memberID];
22994         const memberGroups = member.properties.groups.filter((groupID) => {
22995           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(featuresByCode[groupID].properties.level);
22996         });
22997         if (index === 0) {
22998           sharedGroups = memberGroups;
22999         } else {
23000           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23001         }
23002       });
23003       props.groups = props.groups.concat(sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1));
23004       sharedGroups.forEach((groupID) => {
23005         const groupFeature = featuresByCode[groupID];
23006         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23007           groupFeature.properties.members.push(props.id);
23008         }
23009       });
23010     }
23011     function loadRoadSpeedUnit(feature22) {
23012       const props = feature22.properties;
23013       if (feature22.geometry) {
23014         if (!props.roadSpeedUnit)
23015           props.roadSpeedUnit = "km/h";
23016       } else if (props.members) {
23017         const vals = Array.from(new Set(props.members.map((id2) => {
23018           const member = featuresByCode[id2];
23019           if (member.geometry)
23020             return member.properties.roadSpeedUnit || "km/h";
23021         }).filter(Boolean)));
23022         if (vals.length === 1)
23023           props.roadSpeedUnit = vals[0];
23024       }
23025     }
23026     function loadRoadHeightUnit(feature22) {
23027       const props = feature22.properties;
23028       if (feature22.geometry) {
23029         if (!props.roadHeightUnit)
23030           props.roadHeightUnit = "m";
23031       } else if (props.members) {
23032         const vals = Array.from(new Set(props.members.map((id2) => {
23033           const member = featuresByCode[id2];
23034           if (member.geometry)
23035             return member.properties.roadHeightUnit || "m";
23036         }).filter(Boolean)));
23037         if (vals.length === 1)
23038           props.roadHeightUnit = vals[0];
23039       }
23040     }
23041     function loadDriveSide(feature22) {
23042       const props = feature22.properties;
23043       if (feature22.geometry) {
23044         if (!props.driveSide)
23045           props.driveSide = "right";
23046       } else if (props.members) {
23047         const vals = Array.from(new Set(props.members.map((id2) => {
23048           const member = featuresByCode[id2];
23049           if (member.geometry)
23050             return member.properties.driveSide || "right";
23051         }).filter(Boolean)));
23052         if (vals.length === 1)
23053           props.driveSide = vals[0];
23054       }
23055     }
23056     function loadCallingCodes(feature22) {
23057       const props = feature22.properties;
23058       if (!feature22.geometry && props.members) {
23059         props.callingCodes = Array.from(new Set(props.members.reduce((array2, id2) => {
23060           const member = featuresByCode[id2];
23061           if (member.geometry && member.properties.callingCodes) {
23062             return array2.concat(member.properties.callingCodes);
23063           }
23064           return array2;
23065         }, [])));
23066       }
23067     }
23068     function loadFlag(feature22) {
23069       if (!feature22.properties.iso1A2)
23070         return;
23071       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23072         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23073       });
23074       feature22.properties.emojiFlag = flag;
23075     }
23076     function loadMembersForGroupsOf(feature22) {
23077       feature22.properties.groups.forEach((groupID) => {
23078         const groupFeature = featuresByCode[groupID];
23079         if (!groupFeature.properties.members) {
23080           groupFeature.properties.members = [];
23081         }
23082         groupFeature.properties.members.push(feature22.properties.id);
23083       });
23084     }
23085     function cacheFeatureByIDs(feature22) {
23086       let ids = [];
23087       identifierProps.forEach((prop) => {
23088         const id2 = feature22.properties[prop];
23089         if (id2)
23090           ids.push(id2);
23091       });
23092       (feature22.properties.aliases || []).forEach((alias) => {
23093         ids.push(alias);
23094       });
23095       ids.forEach((id2) => {
23096         let cid = canonicalID(id2);
23097         featuresByCode[cid] = feature22;
23098       });
23099     }
23100   }
23101   function locArray(loc) {
23102     if (Array.isArray(loc)) {
23103       return loc;
23104     } else if (loc.coordinates) {
23105       return loc.coordinates;
23106     }
23107     return loc.geometry.coordinates;
23108   }
23109   function smallestFeature(loc) {
23110     const query = locArray(loc);
23111     const featureProperties = whichPolygonGetter(query);
23112     if (!featureProperties)
23113       return null;
23114     return featuresByCode[featureProperties.id];
23115   }
23116   function countryFeature(loc) {
23117     const feature22 = smallestFeature(loc);
23118     if (!feature22)
23119       return null;
23120     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23121     return featuresByCode[countryCode] || null;
23122   }
23123   var defaultOpts = {
23124     level: void 0,
23125     maxLevel: void 0,
23126     withProp: void 0
23127   };
23128   function featureForLoc(loc, opts) {
23129     const targetLevel = opts.level || "country";
23130     const maxLevel = opts.maxLevel || "world";
23131     const withProp = opts.withProp;
23132     const targetLevelIndex = levels.indexOf(targetLevel);
23133     if (targetLevelIndex === -1)
23134       return null;
23135     const maxLevelIndex = levels.indexOf(maxLevel);
23136     if (maxLevelIndex === -1)
23137       return null;
23138     if (maxLevelIndex < targetLevelIndex)
23139       return null;
23140     if (targetLevel === "country") {
23141       const fastFeature = countryFeature(loc);
23142       if (fastFeature) {
23143         if (!withProp || fastFeature.properties[withProp]) {
23144           return fastFeature;
23145         }
23146       }
23147     }
23148     const features2 = featuresContaining(loc);
23149     const match = features2.find((feature22) => {
23150       let levelIndex = levels.indexOf(feature22.properties.level);
23151       if (feature22.properties.level === targetLevel || levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23152         if (!withProp || feature22.properties[withProp]) {
23153           return feature22;
23154         }
23155       }
23156       return false;
23157     });
23158     return match || null;
23159   }
23160   function featureForID(id2) {
23161     let stringID;
23162     if (typeof id2 === "number") {
23163       stringID = id2.toString();
23164       if (stringID.length === 1) {
23165         stringID = "00" + stringID;
23166       } else if (stringID.length === 2) {
23167         stringID = "0" + stringID;
23168       }
23169     } else {
23170       stringID = canonicalID(id2);
23171     }
23172     return featuresByCode[stringID] || null;
23173   }
23174   function smallestFeaturesForBbox(bbox) {
23175     return whichPolygonGetter.bbox(bbox).map((props) => featuresByCode[props.id]);
23176   }
23177   function smallestOrMatchingFeature(query) {
23178     if (typeof query === "object") {
23179       return smallestFeature(query);
23180     }
23181     return featureForID(query);
23182   }
23183   function feature(query, opts = defaultOpts) {
23184     if (typeof query === "object") {
23185       return featureForLoc(query, opts);
23186     }
23187     return featureForID(query);
23188   }
23189   function iso1A2Code(query, opts = defaultOpts) {
23190     opts.withProp = "iso1A2";
23191     const match = feature(query, opts);
23192     if (!match)
23193       return null;
23194     return match.properties.iso1A2 || null;
23195   }
23196   function featuresContaining(query, strict) {
23197     let matchingFeatures;
23198     if (Array.isArray(query) && query.length === 4) {
23199       matchingFeatures = smallestFeaturesForBbox(query);
23200     } else {
23201       const smallestOrMatching = smallestOrMatchingFeature(query);
23202       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23203     }
23204     if (!matchingFeatures.length)
23205       return [];
23206     let returnFeatures;
23207     if (!strict || typeof query === "object") {
23208       returnFeatures = matchingFeatures.slice();
23209     } else {
23210       returnFeatures = [];
23211     }
23212     matchingFeatures.forEach((feature22) => {
23213       const properties = feature22.properties;
23214       properties.groups.forEach((groupID) => {
23215         const groupFeature = featuresByCode[groupID];
23216         if (returnFeatures.indexOf(groupFeature) === -1) {
23217           returnFeatures.push(groupFeature);
23218         }
23219       });
23220     });
23221     return returnFeatures;
23222   }
23223   function featuresIn(id2, strict) {
23224     const feature22 = featureForID(id2);
23225     if (!feature22)
23226       return [];
23227     let features2 = [];
23228     if (!strict) {
23229       features2.push(feature22);
23230     }
23231     const properties = feature22.properties;
23232     (properties.members || []).forEach((memberID) => {
23233       features2.push(featuresByCode[memberID]);
23234     });
23235     return features2;
23236   }
23237   function aggregateFeature(id2) {
23238     const features2 = featuresIn(id2, false);
23239     if (features2.length === 0)
23240       return null;
23241     let aggregateCoordinates = [];
23242     features2.forEach((feature22) => {
23243       if (feature22.geometry && feature22.geometry.type === "MultiPolygon" && feature22.geometry.coordinates) {
23244         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23245       }
23246     });
23247     return {
23248       type: "Feature",
23249       properties: features2[0].properties,
23250       geometry: {
23251         type: "MultiPolygon",
23252         coordinates: aggregateCoordinates
23253       }
23254     };
23255   }
23256   function roadSpeedUnit(query) {
23257     const feature22 = smallestOrMatchingFeature(query);
23258     return feature22 && feature22.properties.roadSpeedUnit || null;
23259   }
23260   function roadHeightUnit(query) {
23261     const feature22 = smallestOrMatchingFeature(query);
23262     return feature22 && feature22.properties.roadHeightUnit || null;
23263   }
23264
23265   // node_modules/@ideditor/location-conflation/index.mjs
23266   var import_geojson_area = __toESM(require_geojson_area(), 1);
23267   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23268   var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23269   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23270   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23271   var location_conflation_default = class {
23272     constructor(fc) {
23273       this._cache = {};
23274       this._strict = true;
23275       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23276         fc.features.forEach((feature3) => {
23277           feature3.properties = feature3.properties || {};
23278           let props = feature3.properties;
23279           let id2 = feature3.id || props.id;
23280           if (!id2 || !/^\S+\.geojson$/i.test(id2))
23281             return;
23282           id2 = id2.toLowerCase();
23283           feature3.id = id2;
23284           props.id = id2;
23285           if (!props.area) {
23286             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23287             props.area = Number(area.toFixed(2));
23288           }
23289           this._cache[id2] = feature3;
23290         });
23291       }
23292       let world = _cloneDeep(feature("Q2"));
23293       world.geometry = {
23294         type: "Polygon",
23295         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
23296       };
23297       world.id = "Q2";
23298       world.properties.id = "Q2";
23299       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
23300       this._cache.Q2 = world;
23301     }
23302     validateLocation(location) {
23303       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
23304         const lon = location[0];
23305         const lat = location[1];
23306         const radius = location[2];
23307         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
23308           const id2 = "[" + location.toString() + "]";
23309           return { type: "point", location, id: id2 };
23310         }
23311       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
23312         const id2 = location.toLowerCase();
23313         if (this._cache[id2]) {
23314           return { type: "geojson", location, id: id2 };
23315         }
23316       } else if (typeof location === "string" || typeof location === "number") {
23317         const feature3 = feature(location);
23318         if (feature3) {
23319           const id2 = feature3.properties.wikidata;
23320           return { type: "countrycoder", location, id: id2 };
23321         }
23322       }
23323       if (this._strict) {
23324         throw new Error(`validateLocation:  Invalid location: "${location}".`);
23325       } else {
23326         return null;
23327       }
23328     }
23329     resolveLocation(location) {
23330       const valid = this.validateLocation(location);
23331       if (!valid)
23332         return null;
23333       const id2 = valid.id;
23334       if (this._cache[id2]) {
23335         return Object.assign(valid, { feature: this._cache[id2] });
23336       }
23337       if (valid.type === "point") {
23338         const lon = location[0];
23339         const lat = location[1];
23340         const radius = location[2] || 25;
23341         const EDGES = 10;
23342         const PRECISION = 3;
23343         const area = Math.PI * radius * radius;
23344         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
23345           type: "Feature",
23346           id: id2,
23347           properties: { id: id2, area: Number(area.toFixed(2)) },
23348           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
23349         }, PRECISION);
23350         return Object.assign(valid, { feature: feature3 });
23351       } else if (valid.type === "geojson") {
23352       } else if (valid.type === "countrycoder") {
23353         let feature3 = _cloneDeep(feature(id2));
23354         let props = feature3.properties;
23355         if (Array.isArray(props.members)) {
23356           let aggregate = aggregateFeature(id2);
23357           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
23358           feature3.geometry = aggregate.geometry;
23359         }
23360         if (!props.area) {
23361           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23362           props.area = Number(area.toFixed(2));
23363         }
23364         feature3.id = id2;
23365         props.id = id2;
23366         this._cache[id2] = feature3;
23367         return Object.assign(valid, { feature: feature3 });
23368       }
23369       if (this._strict) {
23370         throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
23371       } else {
23372         return null;
23373       }
23374     }
23375     validateLocationSet(locationSet) {
23376       locationSet = locationSet || {};
23377       const validator = this.validateLocation.bind(this);
23378       let include = (locationSet.include || []).map(validator).filter(Boolean);
23379       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
23380       if (!include.length) {
23381         if (this._strict) {
23382           throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
23383         } else {
23384           locationSet.include = ["Q2"];
23385           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
23386         }
23387       }
23388       include.sort(_sortLocations);
23389       let id2 = "+[" + include.map((d) => d.id).join(",") + "]";
23390       if (exclude.length) {
23391         exclude.sort(_sortLocations);
23392         id2 += "-[" + exclude.map((d) => d.id).join(",") + "]";
23393       }
23394       return { type: "locationset", locationSet, id: id2 };
23395     }
23396     resolveLocationSet(locationSet) {
23397       locationSet = locationSet || {};
23398       const valid = this.validateLocationSet(locationSet);
23399       if (!valid)
23400         return null;
23401       const id2 = valid.id;
23402       if (this._cache[id2]) {
23403         return Object.assign(valid, { feature: this._cache[id2] });
23404       }
23405       const resolver = this.resolveLocation.bind(this);
23406       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
23407       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
23408       if (includes.length === 1 && excludes.length === 0) {
23409         return Object.assign(valid, { feature: includes[0].feature });
23410       }
23411       const includeGeoJSON = _clip(includes.map((d) => d.feature), "UNION");
23412       const excludeGeoJSON = _clip(excludes.map((d) => d.feature), "UNION");
23413       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
23414       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
23415       resultGeoJSON.id = id2;
23416       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
23417       this._cache[id2] = resultGeoJSON;
23418       return Object.assign(valid, { feature: resultGeoJSON });
23419     }
23420     strict(val) {
23421       if (val === void 0) {
23422         return this._strict;
23423       } else {
23424         this._strict = val;
23425         return this;
23426       }
23427     }
23428     cache() {
23429       return this._cache;
23430     }
23431     stringify(obj, options2) {
23432       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
23433     }
23434   };
23435   function _clip(features2, which) {
23436     if (!Array.isArray(features2) || !features2.length)
23437       return null;
23438     const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
23439     const args = features2.map((feature3) => feature3.geometry.coordinates);
23440     const coords = fn.apply(null, args);
23441     return {
23442       type: "Feature",
23443       properties: {},
23444       geometry: {
23445         type: whichType(coords),
23446         coordinates: coords
23447       }
23448     };
23449     function whichType(coords2) {
23450       const a = Array.isArray(coords2);
23451       const b = a && Array.isArray(coords2[0]);
23452       const c = b && Array.isArray(coords2[0][0]);
23453       const d = c && Array.isArray(coords2[0][0][0]);
23454       return d ? "MultiPolygon" : "Polygon";
23455     }
23456   }
23457   function _cloneDeep(obj) {
23458     return JSON.parse(JSON.stringify(obj));
23459   }
23460   function _sortLocations(a, b) {
23461     const rank = { countrycoder: 1, geojson: 2, point: 3 };
23462     const aRank = rank[a.type];
23463     const bRank = rank[b.type];
23464     return aRank > bRank ? 1 : aRank < bRank ? -1 : a.id.localeCompare(b.id);
23465   }
23466
23467   // modules/core/locations.js
23468   var import_which_polygon2 = __toESM(require_which_polygon());
23469   var import_geojson_area2 = __toESM(require_geojson_area());
23470
23471   // modules/util/aes.js
23472   var import_aes_js = __toESM(require_aes_js());
23473   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
23474   function utilAesEncrypt(text2, key) {
23475     key = key || DEFAULT_128;
23476     const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
23477     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
23478     const encryptedBytes = aesCtr.encrypt(textBytes);
23479     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
23480     return encryptedHex;
23481   }
23482   function utilAesDecrypt(encryptedHex, key) {
23483     key = key || DEFAULT_128;
23484     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
23485     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
23486     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
23487     const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
23488     return text2;
23489   }
23490
23491   // modules/util/clean_tags.js
23492   function utilCleanTags(tags) {
23493     var out = {};
23494     for (var k in tags) {
23495       if (!k)
23496         continue;
23497       var v = tags[k];
23498       if (v !== void 0) {
23499         out[k] = cleanValue(k, v);
23500       }
23501     }
23502     return out;
23503     function cleanValue(k2, v2) {
23504       function keepSpaces(k3) {
23505         return /_hours|_times|:conditional$/.test(k3);
23506       }
23507       function skip(k3) {
23508         return /^(description|note|fixme)$/.test(k3);
23509       }
23510       if (skip(k2))
23511         return v2;
23512       var cleaned = v2.split(";").map(function(s) {
23513         return s.trim();
23514       }).join(keepSpaces(k2) ? "; " : ";");
23515       if (k2.indexOf("website") !== -1 || k2.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
23516         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
23517       }
23518       return cleaned;
23519     }
23520   }
23521
23522   // modules/util/detect.js
23523   var _detected;
23524   function utilDetect(refresh2) {
23525     if (_detected && !refresh2)
23526       return _detected;
23527     _detected = {};
23528     const ua = navigator.userAgent;
23529     let m = null;
23530     m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
23531     if (m !== null) {
23532       _detected.browser = m[1];
23533       _detected.version = m[2];
23534     }
23535     if (!_detected.browser) {
23536       m = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
23537       if (m !== null) {
23538         _detected.browser = "msie";
23539         _detected.version = m[1];
23540       }
23541     }
23542     if (!_detected.browser) {
23543       m = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
23544       if (m !== null) {
23545         _detected.browser = "Opera";
23546         _detected.version = m[2];
23547       }
23548     }
23549     if (!_detected.browser) {
23550       m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
23551       if (m !== null) {
23552         _detected.browser = m[1];
23553         _detected.version = m[2];
23554         m = ua.match(/version\/([\.\d]+)/i);
23555         if (m !== null)
23556           _detected.version = m[1];
23557       }
23558     }
23559     if (!_detected.browser) {
23560       _detected.browser = navigator.appName;
23561       _detected.version = navigator.appVersion;
23562     }
23563     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
23564     _detected.opera = _detected.browser.toLowerCase() === "opera" && parseFloat(_detected.version) < 15;
23565     if (_detected.browser.toLowerCase() === "msie") {
23566       _detected.ie = true;
23567       _detected.browser = "Internet Explorer";
23568       _detected.support = false;
23569     } else {
23570       _detected.ie = false;
23571       _detected.support = true;
23572     }
23573     _detected.filedrop = window.FileReader && "ondrop" in window;
23574     if (/Win/.test(ua)) {
23575       _detected.os = "win";
23576       _detected.platform = "Windows";
23577     } else if (/Mac/.test(ua)) {
23578       _detected.os = "mac";
23579       _detected.platform = "Macintosh";
23580     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
23581       _detected.os = "linux";
23582       _detected.platform = "Linux";
23583     } else {
23584       _detected.os = "win";
23585       _detected.platform = "Unknown";
23586     }
23587     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
23588     _detected.browserLocales = Array.from(new Set([navigator.language].concat(navigator.languages || []).concat([
23589       navigator.userLanguage
23590     ]).filter(Boolean)));
23591     const loc = window.top.location;
23592     let origin = loc.origin;
23593     if (!origin) {
23594       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
23595     }
23596     _detected.host = origin + loc.pathname;
23597     return _detected;
23598   }
23599
23600   // modules/util/get_set_value.js
23601   function utilGetSetValue(selection2, value) {
23602     function d3_selection_value(value2) {
23603       function valueNull() {
23604         delete this.value;
23605       }
23606       function valueConstant() {
23607         if (this.value !== value2) {
23608           this.value = value2;
23609         }
23610       }
23611       function valueFunction() {
23612         var x = value2.apply(this, arguments);
23613         if (x === null || x === void 0) {
23614           delete this.value;
23615         } else if (this.value !== x) {
23616           this.value = x;
23617         }
23618       }
23619       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
23620     }
23621     if (arguments.length === 1) {
23622       return selection2.property("value");
23623     }
23624     return selection2.each(d3_selection_value(value));
23625   }
23626
23627   // modules/util/keybinding.js
23628   function utilKeybinding(namespace) {
23629     var _keybindings = {};
23630     function testBindings(d3_event, isCapturing) {
23631       var didMatch = false;
23632       var bindings = Object.keys(_keybindings).map(function(id2) {
23633         return _keybindings[id2];
23634       });
23635       var i2, binding;
23636       for (i2 = 0; i2 < bindings.length; i2++) {
23637         binding = bindings[i2];
23638         if (!binding.event.modifiers.shiftKey)
23639           continue;
23640         if (!!binding.capture !== isCapturing)
23641           continue;
23642         if (matches(d3_event, binding, true)) {
23643           binding.callback(d3_event);
23644           didMatch = true;
23645           break;
23646         }
23647       }
23648       if (didMatch)
23649         return;
23650       for (i2 = 0; i2 < bindings.length; i2++) {
23651         binding = bindings[i2];
23652         if (binding.event.modifiers.shiftKey)
23653           continue;
23654         if (!!binding.capture !== isCapturing)
23655           continue;
23656         if (matches(d3_event, binding, false)) {
23657           binding.callback(d3_event);
23658           break;
23659         }
23660       }
23661       function matches(d3_event2, binding2, testShift) {
23662         var event = d3_event2;
23663         var isMatch = false;
23664         var tryKeyCode = true;
23665         if (event.key !== void 0) {
23666           tryKeyCode = event.key.charCodeAt(0) > 127;
23667           isMatch = true;
23668           if (binding2.event.key === void 0) {
23669             isMatch = false;
23670           } else if (Array.isArray(binding2.event.key)) {
23671             if (binding2.event.key.map(function(s) {
23672               return s.toLowerCase();
23673             }).indexOf(event.key.toLowerCase()) === -1) {
23674               isMatch = false;
23675             }
23676           } else {
23677             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
23678               isMatch = false;
23679             }
23680           }
23681         }
23682         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
23683           isMatch = event.keyCode === binding2.event.keyCode;
23684         }
23685         if (!isMatch)
23686           return false;
23687         if (!(event.ctrlKey && event.altKey)) {
23688           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
23689             return false;
23690           if (event.altKey !== binding2.event.modifiers.altKey)
23691             return false;
23692         }
23693         if (event.metaKey !== binding2.event.modifiers.metaKey)
23694           return false;
23695         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
23696           return false;
23697         return true;
23698       }
23699     }
23700     function capture(d3_event) {
23701       testBindings(d3_event, true);
23702     }
23703     function bubble(d3_event) {
23704       var tagName = select_default2(d3_event.target).node().tagName;
23705       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
23706         return;
23707       }
23708       testBindings(d3_event, false);
23709     }
23710     function keybinding(selection2) {
23711       selection2 = selection2 || select_default2(document);
23712       selection2.on("keydown.capture." + namespace, capture, true);
23713       selection2.on("keydown.bubble." + namespace, bubble, false);
23714       return keybinding;
23715     }
23716     keybinding.unbind = function(selection2) {
23717       _keybindings = [];
23718       selection2 = selection2 || select_default2(document);
23719       selection2.on("keydown.capture." + namespace, null);
23720       selection2.on("keydown.bubble." + namespace, null);
23721       return keybinding;
23722     };
23723     keybinding.clear = function() {
23724       _keybindings = {};
23725       return keybinding;
23726     };
23727     keybinding.off = function(codes, capture2) {
23728       var arr = utilArrayUniq([].concat(codes));
23729       for (var i2 = 0; i2 < arr.length; i2++) {
23730         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
23731         delete _keybindings[id2];
23732       }
23733       return keybinding;
23734     };
23735     keybinding.on = function(codes, callback, capture2) {
23736       if (typeof callback !== "function") {
23737         return keybinding.off(codes, capture2);
23738       }
23739       var arr = utilArrayUniq([].concat(codes));
23740       for (var i2 = 0; i2 < arr.length; i2++) {
23741         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
23742         var binding = {
23743           id: id2,
23744           capture: capture2,
23745           callback,
23746           event: {
23747             key: void 0,
23748             keyCode: 0,
23749             modifiers: {
23750               shiftKey: false,
23751               ctrlKey: false,
23752               altKey: false,
23753               metaKey: false
23754             }
23755           }
23756         };
23757         if (_keybindings[id2]) {
23758           console.warn('warning: duplicate keybinding for "' + id2 + '"');
23759         }
23760         _keybindings[id2] = binding;
23761         var matches = arr[i2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
23762         for (var j2 = 0; j2 < matches.length; j2++) {
23763           if (matches[j2] === "++")
23764             matches[j2] = "+";
23765           if (matches[j2] in utilKeybinding.modifierCodes) {
23766             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
23767             binding.event.modifiers[prop] = true;
23768           } else {
23769             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
23770             if (matches[j2] in utilKeybinding.keyCodes) {
23771               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
23772             }
23773           }
23774         }
23775       }
23776       return keybinding;
23777     };
23778     return keybinding;
23779   }
23780   utilKeybinding.modifierCodes = {
23781     "\u21E7": 16,
23782     shift: 16,
23783     "\u2303": 17,
23784     ctrl: 17,
23785     "\u2325": 18,
23786     alt: 18,
23787     option: 18,
23788     "\u2318": 91,
23789     meta: 91,
23790     cmd: 91,
23791     "super": 91,
23792     win: 91
23793   };
23794   utilKeybinding.modifierProperties = {
23795     16: "shiftKey",
23796     17: "ctrlKey",
23797     18: "altKey",
23798     91: "metaKey"
23799   };
23800   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
23801   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
23802   utilKeybinding.keys = {
23803     "\u232B": "Backspace",
23804     backspace: "Backspace",
23805     "\u21E5": "Tab",
23806     "\u21C6": "Tab",
23807     tab: "Tab",
23808     "\u21A9": "Enter",
23809     "\u21B5": "Enter",
23810     "\u23CE": "Enter",
23811     "return": "Enter",
23812     enter: "Enter",
23813     "\u2305": "Enter",
23814     "pause": "Pause",
23815     "pause-break": "Pause",
23816     "\u21EA": "CapsLock",
23817     caps: "CapsLock",
23818     "caps-lock": "CapsLock",
23819     "\u238B": ["Escape", "Esc"],
23820     escape: ["Escape", "Esc"],
23821     esc: ["Escape", "Esc"],
23822     space: [" ", "Spacebar"],
23823     "\u2196": "PageUp",
23824     pgup: "PageUp",
23825     "page-up": "PageUp",
23826     "\u2198": "PageDown",
23827     pgdown: "PageDown",
23828     "page-down": "PageDown",
23829     "\u21DF": "End",
23830     end: "End",
23831     "\u21DE": "Home",
23832     home: "Home",
23833     ins: "Insert",
23834     insert: "Insert",
23835     "\u2326": ["Delete", "Del"],
23836     del: ["Delete", "Del"],
23837     "delete": ["Delete", "Del"],
23838     "\u2190": ["ArrowLeft", "Left"],
23839     left: ["ArrowLeft", "Left"],
23840     "arrow-left": ["ArrowLeft", "Left"],
23841     "\u2191": ["ArrowUp", "Up"],
23842     up: ["ArrowUp", "Up"],
23843     "arrow-up": ["ArrowUp", "Up"],
23844     "\u2192": ["ArrowRight", "Right"],
23845     right: ["ArrowRight", "Right"],
23846     "arrow-right": ["ArrowRight", "Right"],
23847     "\u2193": ["ArrowDown", "Down"],
23848     down: ["ArrowDown", "Down"],
23849     "arrow-down": ["ArrowDown", "Down"],
23850     "*": ["*", "Multiply"],
23851     star: ["*", "Multiply"],
23852     asterisk: ["*", "Multiply"],
23853     multiply: ["*", "Multiply"],
23854     "+": ["+", "Add"],
23855     "plus": ["+", "Add"],
23856     "-": ["-", "Subtract"],
23857     subtract: ["-", "Subtract"],
23858     "dash": ["-", "Subtract"],
23859     semicolon: ";",
23860     equals: "=",
23861     comma: ",",
23862     period: ".",
23863     "full-stop": ".",
23864     slash: "/",
23865     "forward-slash": "/",
23866     tick: "`",
23867     "back-quote": "`",
23868     "open-bracket": "[",
23869     "back-slash": "\\",
23870     "close-bracket": "]",
23871     quote: "'",
23872     apostrophe: "'",
23873     "num-0": "0",
23874     "num-1": "1",
23875     "num-2": "2",
23876     "num-3": "3",
23877     "num-4": "4",
23878     "num-5": "5",
23879     "num-6": "6",
23880     "num-7": "7",
23881     "num-8": "8",
23882     "num-9": "9",
23883     f1: "F1",
23884     f2: "F2",
23885     f3: "F3",
23886     f4: "F4",
23887     f5: "F5",
23888     f6: "F6",
23889     f7: "F7",
23890     f8: "F8",
23891     f9: "F9",
23892     f10: "F10",
23893     f11: "F11",
23894     f12: "F12",
23895     f13: "F13",
23896     f14: "F14",
23897     f15: "F15",
23898     f16: "F16",
23899     f17: "F17",
23900     f18: "F18",
23901     f19: "F19",
23902     f20: "F20",
23903     f21: "F21",
23904     f22: "F22",
23905     f23: "F23",
23906     f24: "F24",
23907     f25: "F25"
23908   };
23909   utilKeybinding.keyCodes = {
23910     "\u232B": 8,
23911     backspace: 8,
23912     "\u21E5": 9,
23913     "\u21C6": 9,
23914     tab: 9,
23915     "\u21A9": 13,
23916     "\u21B5": 13,
23917     "\u23CE": 13,
23918     "return": 13,
23919     enter: 13,
23920     "\u2305": 13,
23921     "pause": 19,
23922     "pause-break": 19,
23923     "\u21EA": 20,
23924     caps: 20,
23925     "caps-lock": 20,
23926     "\u238B": 27,
23927     escape: 27,
23928     esc: 27,
23929     space: 32,
23930     "\u2196": 33,
23931     pgup: 33,
23932     "page-up": 33,
23933     "\u2198": 34,
23934     pgdown: 34,
23935     "page-down": 34,
23936     "\u21DF": 35,
23937     end: 35,
23938     "\u21DE": 36,
23939     home: 36,
23940     ins: 45,
23941     insert: 45,
23942     "\u2326": 46,
23943     del: 46,
23944     "delete": 46,
23945     "\u2190": 37,
23946     left: 37,
23947     "arrow-left": 37,
23948     "\u2191": 38,
23949     up: 38,
23950     "arrow-up": 38,
23951     "\u2192": 39,
23952     right: 39,
23953     "arrow-right": 39,
23954     "\u2193": 40,
23955     down: 40,
23956     "arrow-down": 40,
23957     "ffequals": 61,
23958     "*": 106,
23959     star: 106,
23960     asterisk: 106,
23961     multiply: 106,
23962     "+": 107,
23963     "plus": 107,
23964     "-": 109,
23965     subtract: 109,
23966     "|": 124,
23967     "ffplus": 171,
23968     "ffminus": 173,
23969     ";": 186,
23970     semicolon: 186,
23971     "=": 187,
23972     "equals": 187,
23973     ",": 188,
23974     comma: 188,
23975     "dash": 189,
23976     ".": 190,
23977     period: 190,
23978     "full-stop": 190,
23979     "/": 191,
23980     slash: 191,
23981     "forward-slash": 191,
23982     "`": 192,
23983     tick: 192,
23984     "back-quote": 192,
23985     "[": 219,
23986     "open-bracket": 219,
23987     "\\": 220,
23988     "back-slash": 220,
23989     "]": 221,
23990     "close-bracket": 221,
23991     "'": 222,
23992     quote: 222,
23993     apostrophe: 222
23994   };
23995   var i = 95;
23996   var n = 0;
23997   while (++i < 106) {
23998     utilKeybinding.keyCodes["num-" + n] = i;
23999     ++n;
24000   }
24001   i = 47;
24002   n = 0;
24003   while (++i < 58) {
24004     utilKeybinding.keyCodes[n] = i;
24005     ++n;
24006   }
24007   i = 111;
24008   n = 1;
24009   while (++i < 136) {
24010     utilKeybinding.keyCodes["f" + n] = i;
24011     ++n;
24012   }
24013   i = 64;
24014   while (++i < 91) {
24015     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
24016   }
24017
24018   // modules/util/object.js
24019   function utilObjectOmit(obj, omitKeys) {
24020     return Object.keys(obj).reduce(function(result, key) {
24021       if (omitKeys.indexOf(key) === -1) {
24022         result[key] = obj[key];
24023       }
24024       return result;
24025     }, {});
24026   }
24027
24028   // modules/util/rebind.js
24029   function utilRebind(target, source) {
24030     var i2 = 1, n2 = arguments.length, method;
24031     while (++i2 < n2) {
24032       target[method = arguments[i2]] = d3_rebind(target, source, source[method]);
24033     }
24034     return target;
24035   }
24036   function d3_rebind(target, source, method) {
24037     return function() {
24038       var value = method.apply(source, arguments);
24039       return value === source ? target : value;
24040     };
24041   }
24042
24043   // modules/util/session_mutex.js
24044   function utilSessionMutex(name2) {
24045     var mutex = {};
24046     var intervalID;
24047     function renew() {
24048       var expires = new Date();
24049       expires.setSeconds(expires.getSeconds() + 5);
24050       document.cookie = name2 + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
24051     }
24052     mutex.lock = function() {
24053       if (intervalID)
24054         return true;
24055       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name2 + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
24056       if (cookie)
24057         return false;
24058       renew();
24059       intervalID = window.setInterval(renew, 4e3);
24060       return true;
24061     };
24062     mutex.unlock = function() {
24063       if (!intervalID)
24064         return;
24065       document.cookie = name2 + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
24066       clearInterval(intervalID);
24067       intervalID = null;
24068     };
24069     mutex.locked = function() {
24070       return !!intervalID;
24071     };
24072     return mutex;
24073   }
24074
24075   // modules/util/tiler.js
24076   function utilTiler() {
24077     var _size = [256, 256];
24078     var _scale = 256;
24079     var _tileSize = 256;
24080     var _zoomExtent = [0, 20];
24081     var _translate = [_size[0] / 2, _size[1] / 2];
24082     var _margin = 0;
24083     var _skipNullIsland = false;
24084     function clamp3(num, min3, max3) {
24085       return Math.max(min3, Math.min(num, max3));
24086     }
24087     function nearNullIsland(tile) {
24088       var x = tile[0];
24089       var y = tile[1];
24090       var z = tile[2];
24091       if (z >= 7) {
24092         var center = Math.pow(2, z - 1);
24093         var width = Math.pow(2, z - 6);
24094         var min3 = center - width / 2;
24095         var max3 = center + width / 2 - 1;
24096         return x >= min3 && x <= max3 && y >= min3 && y <= max3;
24097       }
24098       return false;
24099     }
24100     function tiler8() {
24101       var z = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
24102       var z0 = clamp3(Math.round(z), _zoomExtent[0], _zoomExtent[1]);
24103       var tileMin = 0;
24104       var tileMax = Math.pow(2, z0) - 1;
24105       var log2ts = Math.log(_tileSize) * Math.LOG2E;
24106       var k = Math.pow(2, z - z0 + log2ts);
24107       var origin = [
24108         (_translate[0] - _scale / 2) / k,
24109         (_translate[1] - _scale / 2) / k
24110       ];
24111       var cols = range(clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1), clamp3(Math.ceil(_size[0] / k - origin[0]) + _margin, tileMin, tileMax + 1));
24112       var rows = range(clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1), clamp3(Math.ceil(_size[1] / k - origin[1]) + _margin, tileMin, tileMax + 1));
24113       var tiles = [];
24114       for (var i2 = 0; i2 < rows.length; i2++) {
24115         var y = rows[i2];
24116         for (var j2 = 0; j2 < cols.length; j2++) {
24117           var x = cols[j2];
24118           if (i2 >= _margin && i2 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
24119             tiles.unshift([x, y, z0]);
24120           } else {
24121             tiles.push([x, y, z0]);
24122           }
24123         }
24124       }
24125       tiles.translate = origin;
24126       tiles.scale = k;
24127       return tiles;
24128     }
24129     tiler8.getTiles = function(projection2) {
24130       var origin = [
24131         projection2.scale() * Math.PI - projection2.translate()[0],
24132         projection2.scale() * Math.PI - projection2.translate()[1]
24133       ];
24134       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
24135       var tiles = tiler8();
24136       var ts = tiles.scale;
24137       return tiles.map(function(tile) {
24138         if (_skipNullIsland && nearNullIsland(tile)) {
24139           return false;
24140         }
24141         var x = tile[0] * ts - origin[0];
24142         var y = tile[1] * ts - origin[1];
24143         return {
24144           id: tile.toString(),
24145           xyz: tile,
24146           extent: geoExtent(projection2.invert([x, y + ts]), projection2.invert([x + ts, y]))
24147         };
24148       }).filter(Boolean);
24149     };
24150     tiler8.getGeoJSON = function(projection2) {
24151       var features2 = tiler8.getTiles(projection2).map(function(tile) {
24152         return {
24153           type: "Feature",
24154           properties: {
24155             id: tile.id,
24156             name: tile.id
24157           },
24158           geometry: {
24159             type: "Polygon",
24160             coordinates: [tile.extent.polygon()]
24161           }
24162         };
24163       });
24164       return {
24165         type: "FeatureCollection",
24166         features: features2
24167       };
24168     };
24169     tiler8.tileSize = function(val) {
24170       if (!arguments.length)
24171         return _tileSize;
24172       _tileSize = val;
24173       return tiler8;
24174     };
24175     tiler8.zoomExtent = function(val) {
24176       if (!arguments.length)
24177         return _zoomExtent;
24178       _zoomExtent = val;
24179       return tiler8;
24180     };
24181     tiler8.size = function(val) {
24182       if (!arguments.length)
24183         return _size;
24184       _size = val;
24185       return tiler8;
24186     };
24187     tiler8.scale = function(val) {
24188       if (!arguments.length)
24189         return _scale;
24190       _scale = val;
24191       return tiler8;
24192     };
24193     tiler8.translate = function(val) {
24194       if (!arguments.length)
24195         return _translate;
24196       _translate = val;
24197       return tiler8;
24198     };
24199     tiler8.margin = function(val) {
24200       if (!arguments.length)
24201         return _margin;
24202       _margin = +val;
24203       return tiler8;
24204     };
24205     tiler8.skipNullIsland = function(val) {
24206       if (!arguments.length)
24207         return _skipNullIsland;
24208       _skipNullIsland = val;
24209       return tiler8;
24210     };
24211     return tiler8;
24212   }
24213
24214   // modules/util/trigger_event.js
24215   function utilTriggerEvent(target, type3) {
24216     target.each(function() {
24217       var evt = document.createEvent("HTMLEvents");
24218       evt.initEvent(type3, true, true);
24219       this.dispatchEvent(evt);
24220     });
24221   }
24222
24223   // modules/core/locations.js
24224   var _mainLocations = coreLocations();
24225   function coreLocations() {
24226     let _this = {};
24227     let _resolvedFeatures = {};
24228     let _loco = new location_conflation_default();
24229     let _wp;
24230     const world = { locationSet: { include: ["Q2"] } };
24231     resolveLocationSet(world);
24232     rebuildIndex();
24233     let _queue = [];
24234     let _deferred2 = /* @__PURE__ */ new Set();
24235     let _inProcess;
24236     function processQueue() {
24237       if (!_queue.length)
24238         return Promise.resolve();
24239       const chunk = _queue.pop();
24240       return new Promise((resolvePromise) => {
24241         const handle = window.requestIdleCallback(() => {
24242           _deferred2.delete(handle);
24243           chunk.forEach(resolveLocationSet);
24244           resolvePromise();
24245         });
24246         _deferred2.add(handle);
24247       }).then(() => processQueue());
24248     }
24249     function resolveLocationSet(obj) {
24250       if (obj.locationSetID)
24251         return;
24252       try {
24253         let locationSet = obj.locationSet;
24254         if (!locationSet) {
24255           throw new Error("object missing locationSet property");
24256         }
24257         if (!locationSet.include) {
24258           locationSet.include = ["Q2"];
24259         }
24260         const resolved = _loco.resolveLocationSet(locationSet);
24261         const locationSetID = resolved.id;
24262         obj.locationSetID = locationSetID;
24263         if (!resolved.feature.geometry.coordinates.length || !resolved.feature.properties.area) {
24264           throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
24265         }
24266         if (!_resolvedFeatures[locationSetID]) {
24267           let feature3 = JSON.parse(JSON.stringify(resolved.feature));
24268           feature3.id = locationSetID;
24269           feature3.properties.id = locationSetID;
24270           _resolvedFeatures[locationSetID] = feature3;
24271         }
24272       } catch (err) {
24273         obj.locationSet = { include: ["Q2"] };
24274         obj.locationSetID = "+[Q2]";
24275       }
24276     }
24277     function rebuildIndex() {
24278       _wp = (0, import_which_polygon2.default)({ features: Object.values(_resolvedFeatures) });
24279     }
24280     _this.mergeCustomGeoJSON = (fc) => {
24281       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
24282         fc.features.forEach((feature3) => {
24283           feature3.properties = feature3.properties || {};
24284           let props = feature3.properties;
24285           let id2 = feature3.id || props.id;
24286           if (!id2 || !/^\S+\.geojson$/i.test(id2))
24287             return;
24288           id2 = id2.toLowerCase();
24289           feature3.id = id2;
24290           props.id = id2;
24291           if (!props.area) {
24292             const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24293             props.area = Number(area.toFixed(2));
24294           }
24295           _loco._cache[id2] = feature3;
24296         });
24297       }
24298     };
24299     _this.mergeLocationSets = (objects) => {
24300       if (!Array.isArray(objects))
24301         return Promise.reject("nothing to do");
24302       _queue = _queue.concat(utilArrayChunk(objects, 200));
24303       if (!_inProcess) {
24304         _inProcess = processQueue().then(() => {
24305           rebuildIndex();
24306           _inProcess = null;
24307           return objects;
24308         });
24309       }
24310       return _inProcess;
24311     };
24312     _this.locationSetID = (locationSet) => {
24313       let locationSetID;
24314       try {
24315         locationSetID = _loco.validateLocationSet(locationSet).id;
24316       } catch (err) {
24317         locationSetID = "+[Q2]";
24318       }
24319       return locationSetID;
24320     };
24321     _this.feature = (locationSetID) => _resolvedFeatures[locationSetID] || _resolvedFeatures["+[Q2]"];
24322     _this.locationsAt = (loc) => {
24323       let result = {};
24324       (_wp(loc, true) || []).forEach((prop) => result[prop.id] = prop.area);
24325       return result;
24326     };
24327     _this.query = (loc, multi) => _wp(loc, multi);
24328     _this.loco = () => _loco;
24329     _this.wp = () => _wp;
24330     return _this;
24331   }
24332
24333   // node_modules/lodash-es/_freeGlobal.js
24334   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24335   var freeGlobal_default = freeGlobal;
24336
24337   // node_modules/lodash-es/_root.js
24338   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
24339   var root2 = freeGlobal_default || freeSelf || Function("return this")();
24340   var root_default = root2;
24341
24342   // node_modules/lodash-es/_Symbol.js
24343   var Symbol2 = root_default.Symbol;
24344   var Symbol_default = Symbol2;
24345
24346   // node_modules/lodash-es/_getRawTag.js
24347   var objectProto = Object.prototype;
24348   var hasOwnProperty = objectProto.hasOwnProperty;
24349   var nativeObjectToString = objectProto.toString;
24350   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
24351   function getRawTag(value) {
24352     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
24353     try {
24354       value[symToStringTag] = void 0;
24355       var unmasked = true;
24356     } catch (e) {
24357     }
24358     var result = nativeObjectToString.call(value);
24359     if (unmasked) {
24360       if (isOwn) {
24361         value[symToStringTag] = tag;
24362       } else {
24363         delete value[symToStringTag];
24364       }
24365     }
24366     return result;
24367   }
24368   var getRawTag_default = getRawTag;
24369
24370   // node_modules/lodash-es/_objectToString.js
24371   var objectProto2 = Object.prototype;
24372   var nativeObjectToString2 = objectProto2.toString;
24373   function objectToString(value) {
24374     return nativeObjectToString2.call(value);
24375   }
24376   var objectToString_default = objectToString;
24377
24378   // node_modules/lodash-es/_baseGetTag.js
24379   var nullTag = "[object Null]";
24380   var undefinedTag = "[object Undefined]";
24381   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
24382   function baseGetTag(value) {
24383     if (value == null) {
24384       return value === void 0 ? undefinedTag : nullTag;
24385     }
24386     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
24387   }
24388   var baseGetTag_default = baseGetTag;
24389
24390   // node_modules/lodash-es/isObjectLike.js
24391   function isObjectLike(value) {
24392     return value != null && typeof value == "object";
24393   }
24394   var isObjectLike_default = isObjectLike;
24395
24396   // node_modules/lodash-es/isSymbol.js
24397   var symbolTag = "[object Symbol]";
24398   function isSymbol(value) {
24399     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
24400   }
24401   var isSymbol_default = isSymbol;
24402
24403   // node_modules/lodash-es/_arrayMap.js
24404   function arrayMap(array2, iteratee) {
24405     var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
24406     while (++index < length) {
24407       result[index] = iteratee(array2[index], index, array2);
24408     }
24409     return result;
24410   }
24411   var arrayMap_default = arrayMap;
24412
24413   // node_modules/lodash-es/isArray.js
24414   var isArray = Array.isArray;
24415   var isArray_default = isArray;
24416
24417   // node_modules/lodash-es/_baseToString.js
24418   var INFINITY = 1 / 0;
24419   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
24420   var symbolToString = symbolProto ? symbolProto.toString : void 0;
24421   function baseToString(value) {
24422     if (typeof value == "string") {
24423       return value;
24424     }
24425     if (isArray_default(value)) {
24426       return arrayMap_default(value, baseToString) + "";
24427     }
24428     if (isSymbol_default(value)) {
24429       return symbolToString ? symbolToString.call(value) : "";
24430     }
24431     var result = value + "";
24432     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
24433   }
24434   var baseToString_default = baseToString;
24435
24436   // node_modules/lodash-es/_trimmedEndIndex.js
24437   var reWhitespace = /\s/;
24438   function trimmedEndIndex(string) {
24439     var index = string.length;
24440     while (index-- && reWhitespace.test(string.charAt(index))) {
24441     }
24442     return index;
24443   }
24444   var trimmedEndIndex_default = trimmedEndIndex;
24445
24446   // node_modules/lodash-es/_baseTrim.js
24447   var reTrimStart = /^\s+/;
24448   function baseTrim(string) {
24449     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
24450   }
24451   var baseTrim_default = baseTrim;
24452
24453   // node_modules/lodash-es/isObject.js
24454   function isObject(value) {
24455     var type3 = typeof value;
24456     return value != null && (type3 == "object" || type3 == "function");
24457   }
24458   var isObject_default = isObject;
24459
24460   // node_modules/lodash-es/toNumber.js
24461   var NAN = 0 / 0;
24462   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24463   var reIsBinary = /^0b[01]+$/i;
24464   var reIsOctal = /^0o[0-7]+$/i;
24465   var freeParseInt = parseInt;
24466   function toNumber(value) {
24467     if (typeof value == "number") {
24468       return value;
24469     }
24470     if (isSymbol_default(value)) {
24471       return NAN;
24472     }
24473     if (isObject_default(value)) {
24474       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
24475       value = isObject_default(other) ? other + "" : other;
24476     }
24477     if (typeof value != "string") {
24478       return value === 0 ? value : +value;
24479     }
24480     value = baseTrim_default(value);
24481     var isBinary = reIsBinary.test(value);
24482     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24483   }
24484   var toNumber_default = toNumber;
24485
24486   // node_modules/lodash-es/toString.js
24487   function toString(value) {
24488     return value == null ? "" : baseToString_default(value);
24489   }
24490   var toString_default = toString;
24491
24492   // node_modules/lodash-es/_basePropertyOf.js
24493   function basePropertyOf(object) {
24494     return function(key) {
24495       return object == null ? void 0 : object[key];
24496     };
24497   }
24498   var basePropertyOf_default = basePropertyOf;
24499
24500   // node_modules/lodash-es/now.js
24501   var now2 = function() {
24502     return root_default.Date.now();
24503   };
24504   var now_default = now2;
24505
24506   // node_modules/lodash-es/debounce.js
24507   var FUNC_ERROR_TEXT = "Expected a function";
24508   var nativeMax = Math.max;
24509   var nativeMin = Math.min;
24510   function debounce(func, wait, options2) {
24511     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
24512     if (typeof func != "function") {
24513       throw new TypeError(FUNC_ERROR_TEXT);
24514     }
24515     wait = toNumber_default(wait) || 0;
24516     if (isObject_default(options2)) {
24517       leading = !!options2.leading;
24518       maxing = "maxWait" in options2;
24519       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
24520       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24521     }
24522     function invokeFunc(time) {
24523       var args = lastArgs, thisArg = lastThis;
24524       lastArgs = lastThis = void 0;
24525       lastInvokeTime = time;
24526       result = func.apply(thisArg, args);
24527       return result;
24528     }
24529     function leadingEdge(time) {
24530       lastInvokeTime = time;
24531       timerId = setTimeout(timerExpired, wait);
24532       return leading ? invokeFunc(time) : result;
24533     }
24534     function remainingWait(time) {
24535       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
24536       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
24537     }
24538     function shouldInvoke(time) {
24539       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
24540       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
24541     }
24542     function timerExpired() {
24543       var time = now_default();
24544       if (shouldInvoke(time)) {
24545         return trailingEdge(time);
24546       }
24547       timerId = setTimeout(timerExpired, remainingWait(time));
24548     }
24549     function trailingEdge(time) {
24550       timerId = void 0;
24551       if (trailing && lastArgs) {
24552         return invokeFunc(time);
24553       }
24554       lastArgs = lastThis = void 0;
24555       return result;
24556     }
24557     function cancel() {
24558       if (timerId !== void 0) {
24559         clearTimeout(timerId);
24560       }
24561       lastInvokeTime = 0;
24562       lastArgs = lastCallTime = lastThis = timerId = void 0;
24563     }
24564     function flush() {
24565       return timerId === void 0 ? result : trailingEdge(now_default());
24566     }
24567     function debounced() {
24568       var time = now_default(), isInvoking = shouldInvoke(time);
24569       lastArgs = arguments;
24570       lastThis = this;
24571       lastCallTime = time;
24572       if (isInvoking) {
24573         if (timerId === void 0) {
24574           return leadingEdge(lastCallTime);
24575         }
24576         if (maxing) {
24577           clearTimeout(timerId);
24578           timerId = setTimeout(timerExpired, wait);
24579           return invokeFunc(lastCallTime);
24580         }
24581       }
24582       if (timerId === void 0) {
24583         timerId = setTimeout(timerExpired, wait);
24584       }
24585       return result;
24586     }
24587     debounced.cancel = cancel;
24588     debounced.flush = flush;
24589     return debounced;
24590   }
24591   var debounce_default = debounce;
24592
24593   // node_modules/lodash-es/_escapeHtmlChar.js
24594   var htmlEscapes = {
24595     "&": "&amp;",
24596     "<": "&lt;",
24597     ">": "&gt;",
24598     '"': "&quot;",
24599     "'": "&#39;"
24600   };
24601   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
24602   var escapeHtmlChar_default = escapeHtmlChar;
24603
24604   // node_modules/lodash-es/escape.js
24605   var reUnescapedHtml = /[&<>"']/g;
24606   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
24607   function escape2(string) {
24608     string = toString_default(string);
24609     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
24610   }
24611   var escape_default = escape2;
24612
24613   // node_modules/lodash-es/throttle.js
24614   var FUNC_ERROR_TEXT2 = "Expected a function";
24615   function throttle(func, wait, options2) {
24616     var leading = true, trailing = true;
24617     if (typeof func != "function") {
24618       throw new TypeError(FUNC_ERROR_TEXT2);
24619     }
24620     if (isObject_default(options2)) {
24621       leading = "leading" in options2 ? !!options2.leading : leading;
24622       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24623     }
24624     return debounce_default(func, wait, {
24625       "leading": leading,
24626       "maxWait": wait,
24627       "trailing": trailing
24628     });
24629   }
24630   var throttle_default = throttle;
24631
24632   // node_modules/lodash-es/_unescapeHtmlChar.js
24633   var htmlUnescapes = {
24634     "&amp;": "&",
24635     "&lt;": "<",
24636     "&gt;": ">",
24637     "&quot;": '"',
24638     "&#39;": "'"
24639   };
24640   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
24641   var unescapeHtmlChar_default = unescapeHtmlChar;
24642
24643   // node_modules/lodash-es/unescape.js
24644   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
24645   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
24646   function unescape2(string) {
24647     string = toString_default(string);
24648     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
24649   }
24650   var unescape_default = unescape2;
24651
24652   // modules/core/localizer.js
24653   var _mainLocalizer = coreLocalizer();
24654   var _t = _mainLocalizer.t;
24655   function coreLocalizer() {
24656     let localizer = {};
24657     let _dataLanguages = {};
24658     let _dataLocales = {};
24659     let _localeStrings = {};
24660     let _localeCode = "en-US";
24661     let _localeCodes = ["en-US", "en"];
24662     let _languageCode = "en";
24663     let _textDirection = "ltr";
24664     let _usesMetric = false;
24665     let _languageNames = {};
24666     let _scriptNames = {};
24667     localizer.localeCode = () => _localeCode;
24668     localizer.localeCodes = () => _localeCodes;
24669     localizer.languageCode = () => _languageCode;
24670     localizer.textDirection = () => _textDirection;
24671     localizer.usesMetric = () => _usesMetric;
24672     localizer.languageNames = () => _languageNames;
24673     localizer.scriptNames = () => _scriptNames;
24674     let _preferredLocaleCodes = [];
24675     localizer.preferredLocaleCodes = function(codes) {
24676       if (!arguments.length)
24677         return _preferredLocaleCodes;
24678       if (typeof codes === "string") {
24679         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
24680       } else {
24681         _preferredLocaleCodes = codes;
24682       }
24683       return localizer;
24684     };
24685     var _loadPromise;
24686     localizer.ensureLoaded = () => {
24687       if (_loadPromise)
24688         return _loadPromise;
24689       let filesToFetch = [
24690         "languages",
24691         "locales"
24692       ];
24693       const localeDirs = {
24694         general: "locales",
24695         tagging: "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/translations"
24696       };
24697       let fileMap = _mainFileFetcher.fileMap();
24698       for (let scopeId in localeDirs) {
24699         const key = `locales_index_${scopeId}`;
24700         if (!fileMap[key]) {
24701           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
24702         }
24703         filesToFetch.push(key);
24704       }
24705       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
24706         _dataLanguages = results[0];
24707         _dataLocales = results[1];
24708         let indexes = results.slice(2);
24709         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
24710         _localeCodes = localesToUseFrom(requestedLocales);
24711         _localeCode = _localeCodes[0];
24712         let loadStringsPromises = [];
24713         indexes.forEach((index, i2) => {
24714           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
24715             return index[locale2] && index[locale2].pct === 1;
24716           });
24717           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
24718             let scopeId = Object.keys(localeDirs)[i2];
24719             let directory = Object.values(localeDirs)[i2];
24720             if (index[code])
24721               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
24722           });
24723         });
24724         return Promise.all(loadStringsPromises);
24725       }).then(() => {
24726         updateForCurrentLocale();
24727       }).catch((err) => console.error(err));
24728     };
24729     function localesToUseFrom(requestedLocales) {
24730       let supportedLocales = _dataLocales;
24731       let toUse = [];
24732       for (let i2 in requestedLocales) {
24733         let locale2 = requestedLocales[i2];
24734         if (supportedLocales[locale2])
24735           toUse.push(locale2);
24736         if (locale2.includes("-")) {
24737           let langPart = locale2.split("-")[0];
24738           if (supportedLocales[langPart])
24739             toUse.push(langPart);
24740         }
24741       }
24742       return utilArrayUniq(toUse);
24743     }
24744     function updateForCurrentLocale() {
24745       if (!_localeCode)
24746         return;
24747       _languageCode = _localeCode.split("-")[0];
24748       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
24749       const hash = utilStringQs(window.location.hash);
24750       if (hash.rtl === "true") {
24751         _textDirection = "rtl";
24752       } else if (hash.rtl === "false") {
24753         _textDirection = "ltr";
24754       } else {
24755         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
24756       }
24757       let locale2 = _localeCode;
24758       if (locale2.toLowerCase() === "en-us")
24759         locale2 = "en";
24760       _languageNames = _localeStrings.general[locale2].languageNames;
24761       _scriptNames = _localeStrings.general[locale2].scriptNames;
24762       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
24763     }
24764     localizer.loadLocale = (locale2, scopeId, directory) => {
24765       if (locale2.toLowerCase() === "en-us")
24766         locale2 = "en";
24767       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
24768         return Promise.resolve(locale2);
24769       }
24770       let fileMap = _mainFileFetcher.fileMap();
24771       const key = `locale_${scopeId}_${locale2}`;
24772       if (!fileMap[key]) {
24773         fileMap[key] = `${directory}/${locale2}.min.json`;
24774       }
24775       return _mainFileFetcher.get(key).then((d) => {
24776         if (!_localeStrings[scopeId])
24777           _localeStrings[scopeId] = {};
24778         _localeStrings[scopeId][locale2] = d[locale2];
24779         return locale2;
24780       });
24781     };
24782     localizer.pluralRule = function(number3) {
24783       return pluralRule(number3, _localeCode);
24784     };
24785     function pluralRule(number3, localeCode) {
24786       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
24787       if (rules) {
24788         return rules.select(number3);
24789       }
24790       if (number3 === 1)
24791         return "one";
24792       return "other";
24793     }
24794     localizer.tInfo = function(origStringId, replacements, locale2) {
24795       let stringId = origStringId.trim();
24796       let scopeId = "general";
24797       if (stringId[0] === "_") {
24798         let split = stringId.split(".");
24799         scopeId = split[0].slice(1);
24800         stringId = split.slice(1).join(".");
24801       }
24802       locale2 = locale2 || _localeCode;
24803       let path = stringId.split(".").map((s) => s.replace(/<TX_DOT>/g, ".")).reverse();
24804       let stringsKey = locale2;
24805       if (stringsKey.toLowerCase() === "en-us")
24806         stringsKey = "en";
24807       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
24808       while (result !== void 0 && path.length) {
24809         result = result[path.pop()];
24810       }
24811       if (result !== void 0) {
24812         if (replacements) {
24813           if (typeof result === "object" && Object.keys(result).length) {
24814             const number3 = Object.values(replacements).find(function(value) {
24815               return typeof value === "number";
24816             });
24817             if (number3 !== void 0) {
24818               const rule = pluralRule(number3, locale2);
24819               if (result[rule]) {
24820                 result = result[rule];
24821               } else {
24822                 result = Object.values(result)[0];
24823               }
24824             }
24825           }
24826           if (typeof result === "string") {
24827             for (let key in replacements) {
24828               let value = replacements[key];
24829               if (typeof value === "number") {
24830                 if (value.toLocaleString) {
24831                   value = value.toLocaleString(locale2, {
24832                     style: "decimal",
24833                     useGrouping: true,
24834                     minimumFractionDigits: 0
24835                   });
24836                 } else {
24837                   value = value.toString();
24838                 }
24839               }
24840               const token = `{${key}}`;
24841               const regex = new RegExp(token, "g");
24842               result = result.replace(regex, value);
24843             }
24844           }
24845         }
24846         if (typeof result === "string") {
24847           return {
24848             text: result,
24849             locale: locale2
24850           };
24851         }
24852       }
24853       let index = _localeCodes.indexOf(locale2);
24854       if (index >= 0 && index < _localeCodes.length - 1) {
24855         let fallback = _localeCodes[index + 1];
24856         return localizer.tInfo(origStringId, replacements, fallback);
24857       }
24858       if (replacements && "default" in replacements) {
24859         return {
24860           text: replacements.default,
24861           locale: null
24862         };
24863       }
24864       const missing = `Missing ${locale2} translation: ${origStringId}`;
24865       if (typeof console !== "undefined")
24866         console.error(missing);
24867       return {
24868         text: missing,
24869         locale: "en"
24870       };
24871     };
24872     localizer.hasTextForStringId = function(stringId) {
24873       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
24874     };
24875     localizer.t = function(stringId, replacements, locale2) {
24876       return localizer.tInfo(stringId, replacements, locale2).text;
24877     };
24878     localizer.t.html = function(stringId, replacements, locale2) {
24879       replacements = Object.assign({}, replacements);
24880       for (var k in replacements) {
24881         if (typeof replacements[k] === "string") {
24882           replacements[k] = escape_default(replacements[k]);
24883         }
24884         if (typeof replacements[k] === "object" && typeof replacements[k].html === "string") {
24885           replacements[k] = replacements[k].html;
24886         }
24887       }
24888       const info = localizer.tInfo(stringId, replacements, locale2);
24889       if (info.text) {
24890         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
24891       } else {
24892         return "";
24893       }
24894     };
24895     localizer.t.append = function(stringId, replacements, locale2) {
24896       return function(selection2) {
24897         const info = localizer.tInfo(stringId, replacements, locale2);
24898         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
24899       };
24900     };
24901     localizer.languageName = (code, options2) => {
24902       if (_languageNames[code]) {
24903         return _languageNames[code];
24904       }
24905       if (options2 && options2.localOnly)
24906         return null;
24907       const langInfo = _dataLanguages[code];
24908       if (langInfo) {
24909         if (langInfo.nativeName) {
24910           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
24911         } else if (langInfo.base && langInfo.script) {
24912           const base = langInfo.base;
24913           if (_languageNames[base]) {
24914             const scriptCode = langInfo.script;
24915             const script = _scriptNames[scriptCode] || scriptCode;
24916             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
24917           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
24918             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
24919           }
24920         }
24921       }
24922       return code;
24923     };
24924     return localizer;
24925   }
24926
24927   // modules/presets/collection.js
24928   function presetCollection(collection) {
24929     const MAXRESULTS = 50;
24930     let _this = {};
24931     let _memo = {};
24932     _this.collection = collection;
24933     _this.item = (id2) => {
24934       if (_memo[id2])
24935         return _memo[id2];
24936       const found = _this.collection.find((d) => d.id === id2);
24937       if (found)
24938         _memo[id2] = found;
24939       return found;
24940     };
24941     _this.index = (id2) => _this.collection.findIndex((d) => d.id === id2);
24942     _this.matchGeometry = (geometry) => {
24943       return presetCollection(_this.collection.filter((d) => d.matchGeometry(geometry)));
24944     };
24945     _this.matchAllGeometry = (geometries) => {
24946       return presetCollection(_this.collection.filter((d) => d && d.matchAllGeometry(geometries)));
24947     };
24948     _this.matchAnyGeometry = (geometries) => {
24949       return presetCollection(_this.collection.filter((d) => geometries.some((geom) => d.matchGeometry(geom))));
24950     };
24951     _this.fallback = (geometry) => {
24952       let id2 = geometry;
24953       if (id2 === "vertex")
24954         id2 = "point";
24955       return _this.item(id2);
24956     };
24957     _this.search = (value, geometry, loc) => {
24958       if (!value)
24959         return _this;
24960       value = value.toLowerCase().trim();
24961       function leading(a) {
24962         const index = a.indexOf(value);
24963         return index === 0 || a[index - 1] === " ";
24964       }
24965       function leadingStrict(a) {
24966         const index = a.indexOf(value);
24967         return index === 0;
24968       }
24969       function sortPresets(nameProp, aliasesProp) {
24970         return function sortNames(a, b) {
24971           let aCompare = a[nameProp]();
24972           let bCompare = b[nameProp]();
24973           if (aliasesProp) {
24974             const findMatchingAlias = (strings) => {
24975               if (strings.some((s) => s === value)) {
24976                 return strings.find((s) => s === value);
24977               } else {
24978                 return strings.find((s) => s.includes(value));
24979               }
24980             };
24981             aCompare = findMatchingAlias([aCompare].concat(a[aliasesProp]()));
24982             bCompare = findMatchingAlias([bCompare].concat(b[aliasesProp]()));
24983           }
24984           if (value === aCompare)
24985             return -1;
24986           if (value === bCompare)
24987             return 1;
24988           let i2 = b.originalScore - a.originalScore;
24989           if (i2 !== 0)
24990             return i2;
24991           i2 = aCompare.indexOf(value) - bCompare.indexOf(value);
24992           if (i2 !== 0)
24993             return i2;
24994           return aCompare.length - bCompare.length;
24995         };
24996       }
24997       let pool = _this.collection;
24998       if (Array.isArray(loc)) {
24999         const validLocations = _mainLocations.locationsAt(loc);
25000         pool = pool.filter((a) => !a.locationSetID || validLocations[a.locationSetID]);
25001       }
25002       const searchable = pool.filter((a) => a.searchable !== false && a.suggestion !== true);
25003       const suggestions = pool.filter((a) => a.suggestion === true);
25004       const leadingNames = searchable.filter((a) => leading(a.searchName()) || a.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
25005       const leadingSuggestions = suggestions.filter((a) => leadingStrict(a.searchName())).sort(sortPresets("searchName"));
25006       const leadingNamesStripped = searchable.filter((a) => leading(a.searchNameStripped()) || a.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
25007       const leadingSuggestionsStripped = suggestions.filter((a) => leadingStrict(a.searchNameStripped())).sort(sortPresets("searchNameStripped"));
25008       const leadingTerms = searchable.filter((a) => (a.terms() || []).some(leading));
25009       const leadingSuggestionTerms = suggestions.filter((a) => (a.terms() || []).some(leading));
25010       const leadingTagValues = searchable.filter((a) => Object.values(a.tags || {}).filter((val) => val !== "*").some(leading));
25011       const similarName = searchable.map((a) => ({ preset: a, dist: utilEditDistance(value, a.searchName()) })).filter((a) => a.dist + Math.min(value.length - a.preset.searchName().length, 0) < 3).sort((a, b) => a.dist - b.dist).map((a) => a.preset);
25012       const similarSuggestions = suggestions.map((a) => ({ preset: a, dist: utilEditDistance(value, a.searchName()) })).filter((a) => a.dist + Math.min(value.length - a.preset.searchName().length, 0) < 1).sort((a, b) => a.dist - b.dist).map((a) => a.preset);
25013       const similarTerms = searchable.filter((a) => {
25014         return (a.terms() || []).some((b) => {
25015           return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
25016         });
25017       });
25018       let leadingTagKeyValues = [];
25019       if (value.includes("=")) {
25020         leadingTagKeyValues = searchable.filter((a) => a.tags && Object.keys(a.tags).some((key) => key + "=" + a.tags[key] === value)).concat(searchable.filter((a) => a.tags && Object.keys(a.tags).some((key) => leading(key + "=" + a.tags[key]))));
25021       }
25022       let results = leadingNames.concat(leadingSuggestions, leadingNamesStripped, leadingSuggestionsStripped, leadingTerms, leadingSuggestionTerms, leadingTagValues, similarName, similarSuggestions, similarTerms, leadingTagKeyValues).slice(0, MAXRESULTS - 1);
25023       if (geometry) {
25024         if (typeof geometry === "string") {
25025           results.push(_this.fallback(geometry));
25026         } else {
25027           geometry.forEach((geom) => results.push(_this.fallback(geom)));
25028         }
25029       }
25030       return presetCollection(utilArrayUniq(results));
25031     };
25032     return _this;
25033   }
25034
25035   // modules/presets/category.js
25036   function presetCategory(categoryID, category, allPresets) {
25037     let _this = Object.assign({}, category);
25038     let _searchName;
25039     let _searchNameStripped;
25040     _this.id = categoryID;
25041     _this.members = presetCollection((category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean));
25042     _this.geometry = _this.members.collection.reduce((acc, preset) => {
25043       for (let i2 in preset.geometry) {
25044         const geometry = preset.geometry[i2];
25045         if (acc.indexOf(geometry) === -1) {
25046           acc.push(geometry);
25047         }
25048       }
25049       return acc;
25050     }, []);
25051     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25052     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
25053     _this.matchScore = () => -1;
25054     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25055     _this.nameLabel = () => _t.html(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25056     _this.terms = () => [];
25057     _this.searchName = () => {
25058       if (!_searchName) {
25059         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25060       }
25061       return _searchName;
25062     };
25063     _this.searchNameStripped = () => {
25064       if (!_searchNameStripped) {
25065         _searchNameStripped = _this.searchName();
25066         if (_searchNameStripped.normalize)
25067           _searchNameStripped = _searchNameStripped.normalize("NFD");
25068         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
25069       }
25070       return _searchNameStripped;
25071     };
25072     _this.searchAliases = () => [];
25073     _this.searchAliasesStripped = () => [];
25074     return _this;
25075   }
25076
25077   // modules/presets/field.js
25078   function presetField(fieldID, field) {
25079     let _this = Object.assign({}, field);
25080     _this.id = fieldID;
25081     _this.safeid = utilSafeClassName(fieldID);
25082     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
25083     _this.matchAllGeometry = (geometries) => {
25084       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
25085     };
25086     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25087     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25088     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
25089     _this.title = () => _this.overrideLabel || _this.t("label", { "default": fieldID });
25090     _this.label = () => _this.overrideLabel || _this.t.html("label", { "default": fieldID });
25091     const _placeholder = _this.placeholder;
25092     _this.placeholder = () => _this.t("placeholder", { "default": _placeholder });
25093     _this.originalTerms = (_this.terms || []).join();
25094     _this.terms = () => _this.t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25095     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
25096     return _this;
25097   }
25098
25099   // modules/presets/preset.js
25100   function presetPreset(presetID, preset, addable, allFields, allPresets) {
25101     allFields = allFields || {};
25102     allPresets = allPresets || {};
25103     let _this = Object.assign({}, preset);
25104     let _addable = addable || false;
25105     let _resolvedFields;
25106     let _resolvedMoreFields;
25107     let _searchName;
25108     let _searchNameStripped;
25109     let _searchAliases;
25110     let _searchAliasesStripped;
25111     _this.id = presetID;
25112     _this.safeid = utilSafeClassName(presetID);
25113     _this.originalTerms = (_this.terms || []).join();
25114     _this.originalName = _this.name || "";
25115     _this.originalAliases = (_this.aliases || []).join("\n");
25116     _this.originalScore = _this.matchScore || 1;
25117     _this.originalReference = _this.reference || {};
25118     _this.originalFields = _this.fields || [];
25119     _this.originalMoreFields = _this.moreFields || [];
25120     _this.fields = () => _resolvedFields || (_resolvedFields = resolve("fields"));
25121     _this.moreFields = () => _resolvedMoreFields || (_resolvedMoreFields = resolve("moreFields"));
25122     _this.resetFields = () => _resolvedFields = _resolvedMoreFields = null;
25123     _this.tags = _this.tags || {};
25124     _this.addTags = _this.addTags || _this.tags;
25125     _this.removeTags = _this.removeTags || _this.addTags;
25126     _this.geometry = _this.geometry || [];
25127     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25128     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
25129     _this.matchScore = (entityTags) => {
25130       const tags = _this.tags;
25131       let seen = {};
25132       let score = 0;
25133       for (let k in tags) {
25134         seen[k] = true;
25135         if (entityTags[k] === tags[k]) {
25136           score += _this.originalScore;
25137         } else if (tags[k] === "*" && k in entityTags) {
25138           score += _this.originalScore / 2;
25139         } else {
25140           return -1;
25141         }
25142       }
25143       const addTags = _this.addTags;
25144       for (let k in addTags) {
25145         if (!seen[k] && entityTags[k] === addTags[k]) {
25146           score += _this.originalScore;
25147         }
25148       }
25149       if (_this.searchable === false) {
25150         score *= 0.999;
25151       }
25152       return score;
25153     };
25154     _this.t = (scope, options2) => {
25155       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25156       return _t(textID, options2);
25157     };
25158     _this.t.html = (scope, options2) => {
25159       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25160       return _t.html(textID, options2);
25161     };
25162     _this.name = () => {
25163       return _this.t("name", { "default": _this.originalName });
25164     };
25165     _this.nameLabel = () => {
25166       return _this.t.html("name", { "default": _this.originalName });
25167     };
25168     _this.subtitle = () => {
25169       if (_this.suggestion) {
25170         let path = presetID.split("/");
25171         path.pop();
25172         return _t("_tagging.presets.presets." + path.join("/") + ".name");
25173       }
25174       return null;
25175     };
25176     _this.subtitleLabel = () => {
25177       if (_this.suggestion) {
25178         let path = presetID.split("/");
25179         path.pop();
25180         return _t.html("_tagging.presets.presets." + path.join("/") + ".name");
25181       }
25182       return null;
25183     };
25184     _this.aliases = () => {
25185       return _this.t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
25186     };
25187     _this.terms = () => _this.t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25188     _this.searchName = () => {
25189       if (!_searchName) {
25190         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25191       }
25192       return _searchName;
25193     };
25194     _this.searchNameStripped = () => {
25195       if (!_searchNameStripped) {
25196         _searchNameStripped = stripDiacritics(_this.searchName());
25197       }
25198       return _searchNameStripped;
25199     };
25200     _this.searchAliases = () => {
25201       if (!_searchAliases) {
25202         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
25203       }
25204       return _searchAliases;
25205     };
25206     _this.searchAliasesStripped = () => {
25207       if (!_searchAliasesStripped) {
25208         _searchAliasesStripped = _this.searchAliases();
25209         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
25210       }
25211       return _searchAliasesStripped;
25212     };
25213     _this.isFallback = () => {
25214       const tagCount = Object.keys(_this.tags).length;
25215       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
25216     };
25217     _this.addable = function(val) {
25218       if (!arguments.length)
25219         return _addable;
25220       _addable = val;
25221       return _this;
25222     };
25223     _this.reference = () => {
25224       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
25225       if (qid) {
25226         return { qid };
25227       }
25228       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
25229       let value = _this.originalReference.value || _this.tags[key];
25230       if (value === "*") {
25231         return { key };
25232       } else {
25233         return { key, value };
25234       }
25235     };
25236     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults) => {
25237       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
25238       tags = utilObjectOmit(tags, Object.keys(removeTags));
25239       if (geometry && !skipFieldDefaults) {
25240         _this.fields().forEach((field) => {
25241           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key]) {
25242             delete tags[field.key];
25243           }
25244         });
25245       }
25246       delete tags.area;
25247       return tags;
25248     };
25249     _this.setTags = (tags, geometry, skipFieldDefaults) => {
25250       const addTags = _this.addTags;
25251       tags = Object.assign({}, tags);
25252       for (let k in addTags) {
25253         if (addTags[k] === "*") {
25254           if (_this.tags[k] || !tags[k]) {
25255             tags[k] = "yes";
25256           }
25257         } else {
25258           tags[k] = addTags[k];
25259         }
25260       }
25261       if (!addTags.hasOwnProperty("area")) {
25262         delete tags.area;
25263         if (geometry === "area") {
25264           let needsAreaTag = true;
25265           for (let k in addTags) {
25266             if (_this.geometry.indexOf("line") === -1 && k in osmAreaKeys || k in osmAreaKeysExceptions && addTags[k] in osmAreaKeysExceptions[k]) {
25267               needsAreaTag = false;
25268               break;
25269             }
25270           }
25271           if (needsAreaTag) {
25272             tags.area = "yes";
25273           }
25274         }
25275       }
25276       if (geometry && !skipFieldDefaults) {
25277         _this.fields().forEach((field) => {
25278           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
25279             tags[field.key] = field.default;
25280           }
25281         });
25282       }
25283       return tags;
25284     };
25285     function resolve(which) {
25286       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
25287       let resolved = [];
25288       fieldIDs.forEach((fieldID) => {
25289         const match = fieldID.match(/\{(.*)\}/);
25290         if (match !== null) {
25291           resolved = resolved.concat(inheritFields(match[1], which));
25292         } else if (allFields[fieldID]) {
25293           resolved.push(allFields[fieldID]);
25294         } else {
25295           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
25296         }
25297       });
25298       if (!resolved.length) {
25299         const endIndex = _this.id.lastIndexOf("/");
25300         const parentID = endIndex && _this.id.substring(0, endIndex);
25301         if (parentID) {
25302           resolved = inheritFields(parentID, which);
25303         }
25304       }
25305       return utilArrayUniq(resolved);
25306       function inheritFields(presetID2, which2) {
25307         const parent = allPresets[presetID2];
25308         if (!parent)
25309           return [];
25310         if (which2 === "fields") {
25311           return parent.fields().filter(shouldInherit);
25312         } else if (which2 === "moreFields") {
25313           return parent.moreFields();
25314         } else {
25315           return [];
25316         }
25317       }
25318       function shouldInherit(f2) {
25319         if (f2.key && _this.tags[f2.key] !== void 0 && f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check")
25320           return false;
25321         return true;
25322       }
25323     }
25324     function stripDiacritics(s) {
25325       if (s.normalize)
25326         s = s.normalize("NFD");
25327       s = s.replace(/[\u0300-\u036f]/g, "");
25328       return s;
25329     }
25330     return _this;
25331   }
25332
25333   // modules/presets/index.js
25334   var _mainPresetIndex = presetIndex();
25335   function presetIndex() {
25336     const dispatch10 = dispatch_default("favoritePreset", "recentsChange");
25337     const MAXRECENTS = 30;
25338     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
25339     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
25340     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
25341     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
25342     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
25343     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
25344     let _defaults = {
25345       point: presetCollection([POINT]),
25346       vertex: presetCollection([POINT]),
25347       line: presetCollection([LINE]),
25348       area: presetCollection([AREA]),
25349       relation: presetCollection([RELATION])
25350     };
25351     let _fields = {};
25352     let _categories = {};
25353     let _universal = [];
25354     let _addablePresetIDs = null;
25355     let _recents;
25356     let _favorites;
25357     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25358     let _loadPromise;
25359     _this.ensureLoaded = () => {
25360       if (_loadPromise)
25361         return _loadPromise;
25362       return _loadPromise = Promise.all([
25363         _mainFileFetcher.get("preset_categories"),
25364         _mainFileFetcher.get("preset_defaults"),
25365         _mainFileFetcher.get("preset_presets"),
25366         _mainFileFetcher.get("preset_fields")
25367       ]).then((vals) => {
25368         _this.merge({
25369           categories: vals[0],
25370           defaults: vals[1],
25371           presets: vals[2],
25372           fields: vals[3]
25373         });
25374         osmSetAreaKeys(_this.areaKeys());
25375         osmSetPointTags(_this.pointTags());
25376         osmSetVertexTags(_this.vertexTags());
25377       });
25378     };
25379     _this.merge = (d) => {
25380       let newLocationSets = [];
25381       if (d.fields) {
25382         Object.keys(d.fields).forEach((fieldID) => {
25383           let f2 = d.fields[fieldID];
25384           if (f2) {
25385             f2 = presetField(fieldID, f2);
25386             if (f2.locationSet)
25387               newLocationSets.push(f2);
25388             _fields[fieldID] = f2;
25389           } else {
25390             delete _fields[fieldID];
25391           }
25392         });
25393       }
25394       if (d.presets) {
25395         Object.keys(d.presets).forEach((presetID) => {
25396           let p = d.presets[presetID];
25397           if (p) {
25398             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
25399             p = presetPreset(presetID, p, isAddable, _fields, _presets);
25400             if (p.locationSet)
25401               newLocationSets.push(p);
25402             _presets[presetID] = p;
25403           } else {
25404             const existing = _presets[presetID];
25405             if (existing && !existing.isFallback()) {
25406               delete _presets[presetID];
25407             }
25408           }
25409         });
25410       }
25411       if (d.categories) {
25412         Object.keys(d.categories).forEach((categoryID) => {
25413           let c = d.categories[categoryID];
25414           if (c) {
25415             c = presetCategory(categoryID, c, _presets);
25416             if (c.locationSet)
25417               newLocationSets.push(c);
25418             _categories[categoryID] = c;
25419           } else {
25420             delete _categories[categoryID];
25421           }
25422         });
25423       }
25424       _this.collection = Object.values(_presets).concat(Object.values(_categories));
25425       if (d.defaults) {
25426         Object.keys(d.defaults).forEach((geometry) => {
25427           const def = d.defaults[geometry];
25428           if (Array.isArray(def)) {
25429             _defaults[geometry] = presetCollection(def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean));
25430           } else {
25431             delete _defaults[geometry];
25432           }
25433         });
25434       }
25435       _universal = Object.values(_fields).filter((field) => field.universal);
25436       Object.values(_presets).forEach((preset) => preset.resetFields());
25437       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25438       _this.collection.forEach((preset) => {
25439         (preset.geometry || []).forEach((geometry) => {
25440           let g = _geometryIndex[geometry];
25441           for (let key in preset.tags) {
25442             g[key] = g[key] || {};
25443             let value = preset.tags[key];
25444             (g[key][value] = g[key][value] || []).push(preset);
25445           }
25446         });
25447       });
25448       if (d.featureCollection && Array.isArray(d.featureCollection.features)) {
25449         _mainLocations.mergeCustomGeoJSON(d.featureCollection);
25450       }
25451       if (newLocationSets.length) {
25452         _mainLocations.mergeLocationSets(newLocationSets);
25453       }
25454       return _this;
25455     };
25456     _this.match = (entity, resolver) => {
25457       return resolver.transient(entity, "presetMatch", () => {
25458         let geometry = entity.geometry(resolver);
25459         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
25460           geometry = "point";
25461         }
25462         const entityExtent = entity.extent(resolver);
25463         return _this.matchTags(entity.tags, geometry, entityExtent.center());
25464       });
25465     };
25466     _this.matchTags = (tags, geometry, loc) => {
25467       const keyIndex = _geometryIndex[geometry];
25468       let bestScore = -1;
25469       let bestMatch;
25470       let matchCandidates = [];
25471       for (let k in tags) {
25472         let indexMatches = [];
25473         let valueIndex = keyIndex[k];
25474         if (!valueIndex)
25475           continue;
25476         let keyValueMatches = valueIndex[tags[k]];
25477         if (keyValueMatches)
25478           indexMatches.push(...keyValueMatches);
25479         let keyStarMatches = valueIndex["*"];
25480         if (keyStarMatches)
25481           indexMatches.push(...keyStarMatches);
25482         if (indexMatches.length === 0)
25483           continue;
25484         for (let i2 = 0; i2 < indexMatches.length; i2++) {
25485           const candidate = indexMatches[i2];
25486           const score = candidate.matchScore(tags);
25487           if (score === -1) {
25488             continue;
25489           }
25490           matchCandidates.push({ score, candidate });
25491           if (score > bestScore) {
25492             bestScore = score;
25493             bestMatch = candidate;
25494           }
25495         }
25496       }
25497       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
25498         let validLocations = _mainLocations.locationsAt(loc);
25499         if (!validLocations[bestMatch.locationSetID]) {
25500           matchCandidates.sort((a, b) => a.score < b.score ? 1 : -1);
25501           for (let i2 = 0; i2 < matchCandidates.length; i2++) {
25502             const candidateScore = matchCandidates[i2];
25503             if (!candidateScore.candidate.locationSetID || validLocations[candidateScore.candidate.locationSetID]) {
25504               bestMatch = candidateScore.candidate;
25505               bestScore = candidateScore.score;
25506               break;
25507             }
25508           }
25509         }
25510       }
25511       if (!bestMatch || bestMatch.isFallback()) {
25512         for (let k in tags) {
25513           if (/^addr:/.test(k) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
25514             bestMatch = keyIndex["addr:*"]["*"][0];
25515             break;
25516           }
25517         }
25518       }
25519       return bestMatch || _this.fallback(geometry);
25520     };
25521     _this.allowsVertex = (entity, resolver) => {
25522       if (entity.type !== "node")
25523         return false;
25524       if (Object.keys(entity.tags).length === 0)
25525         return true;
25526       return resolver.transient(entity, "vertexMatch", () => {
25527         if (entity.isOnAddressLine(resolver))
25528           return true;
25529         const geometries = osmNodeGeometriesForTags(entity.tags);
25530         if (geometries.vertex)
25531           return true;
25532         if (geometries.point)
25533           return false;
25534         return true;
25535       });
25536     };
25537     _this.areaKeys = () => {
25538       const ignore = {
25539         barrier: true,
25540         highway: true,
25541         footway: true,
25542         railway: true,
25543         junction: true,
25544         type: true
25545       };
25546       let areaKeys = {};
25547       const presets = _this.collection.filter((p) => !p.suggestion && !p.replacement);
25548       presets.forEach((p) => {
25549         const keys = p.tags && Object.keys(p.tags);
25550         const key = keys && keys.length && keys[0];
25551         if (!key)
25552           return;
25553         if (ignore[key])
25554           return;
25555         if (p.geometry.indexOf("area") !== -1) {
25556           areaKeys[key] = areaKeys[key] || {};
25557         }
25558       });
25559       presets.forEach((p) => {
25560         let key;
25561         for (key in p.addTags) {
25562           const value = p.addTags[key];
25563           if (key in areaKeys && p.geometry.indexOf("line") !== -1 && value !== "*") {
25564             areaKeys[key][value] = true;
25565           }
25566         }
25567       });
25568       return areaKeys;
25569     };
25570     _this.pointTags = () => {
25571       return _this.collection.reduce((pointTags, d) => {
25572         if (d.suggestion || d.replacement || d.searchable === false)
25573           return pointTags;
25574         const keys = d.tags && Object.keys(d.tags);
25575         const key = keys && keys.length && keys[0];
25576         if (!key)
25577           return pointTags;
25578         if (d.geometry.indexOf("point") !== -1) {
25579           pointTags[key] = pointTags[key] || {};
25580           pointTags[key][d.tags[key]] = true;
25581         }
25582         return pointTags;
25583       }, {});
25584     };
25585     _this.vertexTags = () => {
25586       return _this.collection.reduce((vertexTags, d) => {
25587         if (d.suggestion || d.replacement || d.searchable === false)
25588           return vertexTags;
25589         const keys = d.tags && Object.keys(d.tags);
25590         const key = keys && keys.length && keys[0];
25591         if (!key)
25592           return vertexTags;
25593         if (d.geometry.indexOf("vertex") !== -1) {
25594           vertexTags[key] = vertexTags[key] || {};
25595           vertexTags[key][d.tags[key]] = true;
25596         }
25597         return vertexTags;
25598       }, {});
25599     };
25600     _this.field = (id2) => _fields[id2];
25601     _this.universal = () => _universal;
25602     _this.defaults = (geometry, n2, startWithRecents, loc) => {
25603       let recents = [];
25604       if (startWithRecents) {
25605         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
25606       }
25607       let defaults2;
25608       if (_addablePresetIDs) {
25609         defaults2 = Array.from(_addablePresetIDs).map(function(id2) {
25610           var preset = _this.item(id2);
25611           if (preset && preset.matchGeometry(geometry))
25612             return preset;
25613           return null;
25614         }).filter(Boolean);
25615       } else {
25616         defaults2 = _defaults[geometry].collection.concat(_this.fallback(geometry));
25617       }
25618       let result = presetCollection(utilArrayUniq(recents.concat(defaults2)).slice(0, n2 - 1));
25619       if (Array.isArray(loc)) {
25620         const validLocations = _mainLocations.locationsAt(loc);
25621         result.collection = result.collection.filter((a) => !a.locationSetID || validLocations[a.locationSetID]);
25622       }
25623       return result;
25624     };
25625     _this.addablePresetIDs = function(val) {
25626       if (!arguments.length)
25627         return _addablePresetIDs;
25628       if (Array.isArray(val))
25629         val = new Set(val);
25630       _addablePresetIDs = val;
25631       if (_addablePresetIDs) {
25632         _this.collection.forEach((p) => {
25633           if (p.addable)
25634             p.addable(_addablePresetIDs.has(p.id));
25635         });
25636       } else {
25637         _this.collection.forEach((p) => {
25638           if (p.addable)
25639             p.addable(true);
25640         });
25641       }
25642       return _this;
25643     };
25644     _this.recent = () => {
25645       return presetCollection(utilArrayUniq(_this.getRecents().map((d) => d.preset)));
25646     };
25647     function RibbonItem(preset, source) {
25648       let item = {};
25649       item.preset = preset;
25650       item.source = source;
25651       item.isFavorite = () => item.source === "favorite";
25652       item.isRecent = () => item.source === "recent";
25653       item.matches = (preset2) => item.preset.id === preset2.id;
25654       item.minified = () => ({ pID: item.preset.id });
25655       return item;
25656     }
25657     function ribbonItemForMinified(d, source) {
25658       if (d && d.pID) {
25659         const preset = _this.item(d.pID);
25660         if (!preset)
25661           return null;
25662         return RibbonItem(preset, source);
25663       }
25664       return null;
25665     }
25666     _this.getGenericRibbonItems = () => {
25667       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
25668     };
25669     _this.getAddable = () => {
25670       if (!_addablePresetIDs)
25671         return [];
25672       return _addablePresetIDs.map((id2) => {
25673         const preset = _this.item(id2);
25674         if (preset)
25675           return RibbonItem(preset, "addable");
25676         return null;
25677       }).filter(Boolean);
25678     };
25679     function setRecents(items) {
25680       _recents = items;
25681       const minifiedItems = items.map((d) => d.minified());
25682       corePreferences("preset_recents", JSON.stringify(minifiedItems));
25683       dispatch10.call("recentsChange");
25684     }
25685     _this.getRecents = () => {
25686       if (!_recents) {
25687         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d) => {
25688           let item = ribbonItemForMinified(d, "recent");
25689           if (item && item.preset.addable())
25690             acc.push(item);
25691           return acc;
25692         }, []);
25693       }
25694       return _recents;
25695     };
25696     _this.addRecent = (preset, besidePreset, after) => {
25697       const recents = _this.getRecents();
25698       const beforeItem = _this.recentMatching(besidePreset);
25699       let toIndex = recents.indexOf(beforeItem);
25700       if (after)
25701         toIndex += 1;
25702       const newItem = RibbonItem(preset, "recent");
25703       recents.splice(toIndex, 0, newItem);
25704       setRecents(recents);
25705     };
25706     _this.removeRecent = (preset) => {
25707       const item = _this.recentMatching(preset);
25708       if (item) {
25709         let items = _this.getRecents();
25710         items.splice(items.indexOf(item), 1);
25711         setRecents(items);
25712       }
25713     };
25714     _this.recentMatching = (preset) => {
25715       const items = _this.getRecents();
25716       for (let i2 in items) {
25717         if (items[i2].matches(preset)) {
25718           return items[i2];
25719         }
25720       }
25721       return null;
25722     };
25723     _this.moveItem = (items, fromIndex, toIndex) => {
25724       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
25725         return null;
25726       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
25727       return items;
25728     };
25729     _this.moveRecent = (item, beforeItem) => {
25730       const recents = _this.getRecents();
25731       const fromIndex = recents.indexOf(item);
25732       const toIndex = recents.indexOf(beforeItem);
25733       const items = _this.moveItem(recents, fromIndex, toIndex);
25734       if (items)
25735         setRecents(items);
25736     };
25737     _this.setMostRecent = (preset) => {
25738       if (preset.searchable === false)
25739         return;
25740       let items = _this.getRecents();
25741       let item = _this.recentMatching(preset);
25742       if (item) {
25743         items.splice(items.indexOf(item), 1);
25744       } else {
25745         item = RibbonItem(preset, "recent");
25746       }
25747       while (items.length >= MAXRECENTS) {
25748         items.pop();
25749       }
25750       items.unshift(item);
25751       setRecents(items);
25752     };
25753     function setFavorites(items) {
25754       _favorites = items;
25755       const minifiedItems = items.map((d) => d.minified());
25756       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
25757       dispatch10.call("favoritePreset");
25758     }
25759     _this.addFavorite = (preset, besidePreset, after) => {
25760       const favorites = _this.getFavorites();
25761       const beforeItem = _this.favoriteMatching(besidePreset);
25762       let toIndex = favorites.indexOf(beforeItem);
25763       if (after)
25764         toIndex += 1;
25765       const newItem = RibbonItem(preset, "favorite");
25766       favorites.splice(toIndex, 0, newItem);
25767       setFavorites(favorites);
25768     };
25769     _this.toggleFavorite = (preset) => {
25770       const favs = _this.getFavorites();
25771       const favorite = _this.favoriteMatching(preset);
25772       if (favorite) {
25773         favs.splice(favs.indexOf(favorite), 1);
25774       } else {
25775         if (favs.length === 10) {
25776           favs.pop();
25777         }
25778         favs.push(RibbonItem(preset, "favorite"));
25779       }
25780       setFavorites(favs);
25781     };
25782     _this.removeFavorite = (preset) => {
25783       const item = _this.favoriteMatching(preset);
25784       if (item) {
25785         const items = _this.getFavorites();
25786         items.splice(items.indexOf(item), 1);
25787         setFavorites(items);
25788       }
25789     };
25790     _this.getFavorites = () => {
25791       if (!_favorites) {
25792         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
25793         if (!rawFavorites) {
25794           rawFavorites = [];
25795           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
25796         }
25797         _favorites = rawFavorites.reduce((output, d) => {
25798           const item = ribbonItemForMinified(d, "favorite");
25799           if (item && item.preset.addable())
25800             output.push(item);
25801           return output;
25802         }, []);
25803       }
25804       return _favorites;
25805     };
25806     _this.favoriteMatching = (preset) => {
25807       const favs = _this.getFavorites();
25808       for (let index in favs) {
25809         if (favs[index].matches(preset)) {
25810           return favs[index];
25811         }
25812       }
25813       return null;
25814     };
25815     return utilRebind(_this, dispatch10, "on");
25816   }
25817
25818   // modules/util/util.js
25819   function utilTagText(entity) {
25820     var obj = entity && entity.tags || {};
25821     return Object.keys(obj).map(function(k) {
25822       return k + "=" + obj[k];
25823     }).join(", ");
25824   }
25825   function utilTotalExtent(array2, graph) {
25826     var extent = geoExtent();
25827     var val, entity;
25828     for (var i2 = 0; i2 < array2.length; i2++) {
25829       val = array2[i2];
25830       entity = typeof val === "string" ? graph.hasEntity(val) : val;
25831       if (entity) {
25832         extent._extend(entity.extent(graph));
25833       }
25834     }
25835     return extent;
25836   }
25837   function utilTagDiff(oldTags, newTags) {
25838     var tagDiff = [];
25839     var keys = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
25840     keys.forEach(function(k) {
25841       var oldVal = oldTags[k];
25842       var newVal = newTags[k];
25843       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
25844         tagDiff.push({
25845           type: "-",
25846           key: k,
25847           oldVal,
25848           newVal,
25849           display: "- " + k + "=" + oldVal
25850         });
25851       }
25852       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
25853         tagDiff.push({
25854           type: "+",
25855           key: k,
25856           oldVal,
25857           newVal,
25858           display: "+ " + k + "=" + newVal
25859         });
25860       }
25861     });
25862     return tagDiff;
25863   }
25864   function utilEntitySelector(ids) {
25865     return ids.length ? "." + ids.join(",.") : "nothing";
25866   }
25867   function utilEntityOrMemberSelector(ids, graph) {
25868     var seen = new Set(ids);
25869     ids.forEach(collectShallowDescendants);
25870     return utilEntitySelector(Array.from(seen));
25871     function collectShallowDescendants(id2) {
25872       var entity = graph.hasEntity(id2);
25873       if (!entity || entity.type !== "relation")
25874         return;
25875       entity.members.map(function(member) {
25876         return member.id;
25877       }).forEach(function(id3) {
25878         seen.add(id3);
25879       });
25880     }
25881   }
25882   function utilEntityOrDeepMemberSelector(ids, graph) {
25883     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
25884   }
25885   function utilEntityAndDeepMemberIDs(ids, graph) {
25886     var seen = /* @__PURE__ */ new Set();
25887     ids.forEach(collectDeepDescendants);
25888     return Array.from(seen);
25889     function collectDeepDescendants(id2) {
25890       if (seen.has(id2))
25891         return;
25892       seen.add(id2);
25893       var entity = graph.hasEntity(id2);
25894       if (!entity || entity.type !== "relation")
25895         return;
25896       entity.members.map(function(member) {
25897         return member.id;
25898       }).forEach(collectDeepDescendants);
25899     }
25900   }
25901   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
25902     var idsSet = new Set(ids);
25903     var seen = /* @__PURE__ */ new Set();
25904     var returners = /* @__PURE__ */ new Set();
25905     ids.forEach(collectDeepDescendants);
25906     return utilEntitySelector(Array.from(returners));
25907     function collectDeepDescendants(id2) {
25908       if (seen.has(id2))
25909         return;
25910       seen.add(id2);
25911       if (!idsSet.has(id2)) {
25912         returners.add(id2);
25913       }
25914       var entity = graph.hasEntity(id2);
25915       if (!entity || entity.type !== "relation")
25916         return;
25917       if (skipMultipolgonMembers && entity.isMultipolygon())
25918         return;
25919       entity.members.map(function(member) {
25920         return member.id;
25921       }).forEach(collectDeepDescendants);
25922     }
25923   }
25924   function utilHighlightEntities(ids, highlighted, context) {
25925     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
25926   }
25927   function utilGetAllNodes(ids, graph) {
25928     var seen = /* @__PURE__ */ new Set();
25929     var nodes = /* @__PURE__ */ new Set();
25930     ids.forEach(collectNodes);
25931     return Array.from(nodes);
25932     function collectNodes(id2) {
25933       if (seen.has(id2))
25934         return;
25935       seen.add(id2);
25936       var entity = graph.hasEntity(id2);
25937       if (!entity)
25938         return;
25939       if (entity.type === "node") {
25940         nodes.add(entity);
25941       } else if (entity.type === "way") {
25942         entity.nodes.forEach(collectNodes);
25943       } else {
25944         entity.members.map(function(member) {
25945           return member.id;
25946         }).forEach(collectNodes);
25947       }
25948     }
25949   }
25950   function utilDisplayName(entity) {
25951     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
25952     var name2 = entity.tags[localizedNameKey] || entity.tags.name || "";
25953     if (name2)
25954       return name2;
25955     var tags = {
25956       direction: entity.tags.direction,
25957       from: entity.tags.from,
25958       network: entity.tags.cycle_network || entity.tags.network,
25959       ref: entity.tags.ref,
25960       to: entity.tags.to,
25961       via: entity.tags.via
25962     };
25963     var keyComponents = [];
25964     if (tags.network) {
25965       keyComponents.push("network");
25966     }
25967     if (tags.ref) {
25968       keyComponents.push("ref");
25969     }
25970     if (entity.tags.route) {
25971       if (tags.direction) {
25972         keyComponents.push("direction");
25973       } else if (tags.from && tags.to) {
25974         keyComponents.push("from");
25975         keyComponents.push("to");
25976         if (tags.via) {
25977           keyComponents.push("via");
25978         }
25979       }
25980     }
25981     if (keyComponents.length) {
25982       name2 = _t("inspector.display_name." + keyComponents.join("_"), tags);
25983     }
25984     return name2;
25985   }
25986   function utilDisplayNameForPath(entity) {
25987     var name2 = utilDisplayName(entity);
25988     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
25989     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
25990     if (!isFirefox && !isNewChromium && name2 && rtlRegex.test(name2)) {
25991       name2 = fixRTLTextForSvg(name2);
25992     }
25993     return name2;
25994   }
25995   function utilDisplayType(id2) {
25996     return {
25997       n: _t("inspector.node"),
25998       w: _t("inspector.way"),
25999       r: _t("inspector.relation")
26000     }[id2.charAt(0)];
26001   }
26002   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
26003     var result;
26004     var displayName = utilDisplayName(entity);
26005     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
26006     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
26007     if (verbose) {
26008       result = [presetName, displayName].filter(Boolean).join(" ");
26009     } else {
26010       result = displayName || presetName;
26011     }
26012     return result || utilDisplayType(entity.id);
26013   }
26014   function utilEntityRoot(entityType) {
26015     return {
26016       node: "n",
26017       way: "w",
26018       relation: "r"
26019     }[entityType];
26020   }
26021   function utilCombinedTags(entityIDs, graph) {
26022     var tags = {};
26023     var tagCounts = {};
26024     var allKeys = /* @__PURE__ */ new Set();
26025     var entities = entityIDs.map(function(entityID) {
26026       return graph.hasEntity(entityID);
26027     }).filter(Boolean);
26028     entities.forEach(function(entity) {
26029       var keys = Object.keys(entity.tags).filter(Boolean);
26030       keys.forEach(function(key2) {
26031         allKeys.add(key2);
26032       });
26033     });
26034     entities.forEach(function(entity) {
26035       allKeys.forEach(function(key2) {
26036         var value = entity.tags[key2];
26037         if (!tags.hasOwnProperty(key2)) {
26038           tags[key2] = value;
26039         } else {
26040           if (!Array.isArray(tags[key2])) {
26041             if (tags[key2] !== value) {
26042               tags[key2] = [tags[key2], value];
26043             }
26044           } else {
26045             if (tags[key2].indexOf(value) === -1) {
26046               tags[key2].push(value);
26047             }
26048           }
26049         }
26050         var tagHash = key2 + "=" + value;
26051         if (!tagCounts[tagHash])
26052           tagCounts[tagHash] = 0;
26053         tagCounts[tagHash] += 1;
26054       });
26055     });
26056     for (var key in tags) {
26057       if (!Array.isArray(tags[key]))
26058         continue;
26059       tags[key] = tags[key].sort(function(val1, val2) {
26060         var key2 = key2;
26061         var count2 = tagCounts[key2 + "=" + val2];
26062         var count1 = tagCounts[key2 + "=" + val1];
26063         if (count2 !== count1) {
26064           return count2 - count1;
26065         }
26066         if (val2 && val1) {
26067           return val1.localeCompare(val2);
26068         }
26069         return val1 ? 1 : -1;
26070       });
26071     }
26072     return tags;
26073   }
26074   function utilStringQs(str2) {
26075     var i2 = 0;
26076     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
26077       i2++;
26078     str2 = str2.slice(i2);
26079     return str2.split("&").reduce(function(obj, pair2) {
26080       var parts = pair2.split("=");
26081       if (parts.length === 2) {
26082         obj[parts[0]] = parts[1] === null ? "" : decodeURIComponent(parts[1]);
26083       }
26084       return obj;
26085     }, {});
26086   }
26087   function utilQsString(obj, noencode) {
26088     function softEncode(s) {
26089       return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
26090     }
26091     return Object.keys(obj).sort().map(function(key) {
26092       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
26093     }).join("&");
26094   }
26095   function utilPrefixDOMProperty(property) {
26096     var prefixes2 = ["webkit", "ms", "moz", "o"];
26097     var i2 = -1;
26098     var n2 = prefixes2.length;
26099     var s = document.body;
26100     if (property in s)
26101       return property;
26102     property = property.substr(0, 1).toUpperCase() + property.substr(1);
26103     while (++i2 < n2) {
26104       if (prefixes2[i2] + property in s) {
26105         return prefixes2[i2] + property;
26106       }
26107     }
26108     return false;
26109   }
26110   function utilPrefixCSSProperty(property) {
26111     var prefixes2 = ["webkit", "ms", "Moz", "O"];
26112     var i2 = -1;
26113     var n2 = prefixes2.length;
26114     var s = document.body.style;
26115     if (property.toLowerCase() in s) {
26116       return property.toLowerCase();
26117     }
26118     while (++i2 < n2) {
26119       if (prefixes2[i2] + property in s) {
26120         return "-" + prefixes2[i2].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
26121       }
26122     }
26123     return false;
26124   }
26125   var transformProperty;
26126   function utilSetTransform(el, x, y, scale) {
26127     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
26128     var translate = utilDetect().opera ? "translate(" + x + "px," + y + "px)" : "translate3d(" + x + "px," + y + "px,0)";
26129     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
26130   }
26131   function utilEditDistance(a, b) {
26132     a = (0, import_diacritics.remove)(a.toLowerCase());
26133     b = (0, import_diacritics.remove)(b.toLowerCase());
26134     if (a.length === 0)
26135       return b.length;
26136     if (b.length === 0)
26137       return a.length;
26138     var matrix = [];
26139     var i2, j2;
26140     for (i2 = 0; i2 <= b.length; i2++) {
26141       matrix[i2] = [i2];
26142     }
26143     for (j2 = 0; j2 <= a.length; j2++) {
26144       matrix[0][j2] = j2;
26145     }
26146     for (i2 = 1; i2 <= b.length; i2++) {
26147       for (j2 = 1; j2 <= a.length; j2++) {
26148         if (b.charAt(i2 - 1) === a.charAt(j2 - 1)) {
26149           matrix[i2][j2] = matrix[i2 - 1][j2 - 1];
26150         } else {
26151           matrix[i2][j2] = Math.min(matrix[i2 - 1][j2 - 1] + 1, Math.min(matrix[i2][j2 - 1] + 1, matrix[i2 - 1][j2] + 1));
26152         }
26153       }
26154     }
26155     return matrix[b.length][a.length];
26156   }
26157   function utilFastMouse(container) {
26158     var rect = container.getBoundingClientRect();
26159     var rectLeft = rect.left;
26160     var rectTop = rect.top;
26161     var clientLeft = +container.clientLeft;
26162     var clientTop = +container.clientTop;
26163     return function(e) {
26164       return [
26165         e.clientX - rectLeft - clientLeft,
26166         e.clientY - rectTop - clientTop
26167       ];
26168     };
26169   }
26170   function utilAsyncMap(inputs, func, callback) {
26171     var remaining = inputs.length;
26172     var results = [];
26173     var errors = [];
26174     inputs.forEach(function(d, i2) {
26175       func(d, function done(err, data) {
26176         errors[i2] = err;
26177         results[i2] = data;
26178         remaining--;
26179         if (!remaining)
26180           callback(errors, results);
26181       });
26182     });
26183   }
26184   function utilWrap(index, length) {
26185     if (index < 0) {
26186       index += Math.ceil(-index / length) * length;
26187     }
26188     return index % length;
26189   }
26190   function utilFunctor(value) {
26191     if (typeof value === "function")
26192       return value;
26193     return function() {
26194       return value;
26195     };
26196   }
26197   function utilNoAuto(selection2) {
26198     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
26199     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
26200   }
26201   function utilHashcode(str2) {
26202     var hash = 0;
26203     if (str2.length === 0) {
26204       return hash;
26205     }
26206     for (var i2 = 0; i2 < str2.length; i2++) {
26207       var char = str2.charCodeAt(i2);
26208       hash = (hash << 5) - hash + char;
26209       hash = hash & hash;
26210     }
26211     return hash;
26212   }
26213   function utilSafeClassName(str2) {
26214     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
26215   }
26216   function utilUniqueDomId(val) {
26217     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + new Date().getTime().toString();
26218   }
26219   function utilUnicodeCharsCount(str2) {
26220     return Array.from(str2).length;
26221   }
26222   function utilUnicodeCharsTruncated(str2, limit) {
26223     return Array.from(str2).slice(0, limit).join("");
26224   }
26225   function toNumericID(id2) {
26226     var match = id2.match(/^[cnwr](-?\d+)$/);
26227     if (match) {
26228       return parseInt(match[1], 10);
26229     }
26230     return NaN;
26231   }
26232   function compareNumericIDs(left, right) {
26233     if (isNaN(left) && isNaN(right))
26234       return -1;
26235     if (isNaN(left))
26236       return 1;
26237     if (isNaN(right))
26238       return -1;
26239     if (Math.sign(left) !== Math.sign(right))
26240       return -Math.sign(left);
26241     if (Math.sign(left) < 0)
26242       return Math.sign(right - left);
26243     return Math.sign(left - right);
26244   }
26245   function utilCompareIDs(left, right) {
26246     return compareNumericIDs(toNumericID(left), toNumericID(right));
26247   }
26248   function utilOldestID(ids) {
26249     if (ids.length === 0) {
26250       return void 0;
26251     }
26252     var oldestIDIndex = 0;
26253     var oldestID = toNumericID(ids[0]);
26254     for (var i2 = 1; i2 < ids.length; i2++) {
26255       var num = toNumericID(ids[i2]);
26256       if (compareNumericIDs(oldestID, num) === 1) {
26257         oldestIDIndex = i2;
26258         oldestID = num;
26259       }
26260     }
26261     return ids[oldestIDIndex];
26262   }
26263
26264   // modules/osm/entity.js
26265   function osmEntity(attrs) {
26266     if (this instanceof osmEntity)
26267       return;
26268     if (attrs && attrs.type) {
26269       return osmEntity[attrs.type].apply(this, arguments);
26270     } else if (attrs && attrs.id) {
26271       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
26272     }
26273     return new osmEntity().initialize(arguments);
26274   }
26275   osmEntity.id = function(type3) {
26276     return osmEntity.id.fromOSM(type3, osmEntity.id.next[type3]--);
26277   };
26278   osmEntity.id.next = {
26279     changeset: -1,
26280     node: -1,
26281     way: -1,
26282     relation: -1
26283   };
26284   osmEntity.id.fromOSM = function(type3, id2) {
26285     return type3[0] + id2;
26286   };
26287   osmEntity.id.toOSM = function(id2) {
26288     var match = id2.match(/^[cnwr](-?\d+)$/);
26289     if (match) {
26290       return match[1];
26291     }
26292     return "";
26293   };
26294   osmEntity.id.type = function(id2) {
26295     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
26296   };
26297   osmEntity.key = function(entity) {
26298     return entity.id + "v" + (entity.v || 0);
26299   };
26300   var _deprecatedTagValuesByKey;
26301   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
26302     if (!_deprecatedTagValuesByKey) {
26303       _deprecatedTagValuesByKey = {};
26304       dataDeprecated.forEach(function(d) {
26305         var oldKeys = Object.keys(d.old);
26306         if (oldKeys.length === 1) {
26307           var oldKey = oldKeys[0];
26308           var oldValue = d.old[oldKey];
26309           if (oldValue !== "*") {
26310             if (!_deprecatedTagValuesByKey[oldKey]) {
26311               _deprecatedTagValuesByKey[oldKey] = [oldValue];
26312             } else {
26313               _deprecatedTagValuesByKey[oldKey].push(oldValue);
26314             }
26315           }
26316         }
26317       });
26318     }
26319     return _deprecatedTagValuesByKey;
26320   };
26321   osmEntity.prototype = {
26322     tags: {},
26323     initialize: function(sources) {
26324       for (var i2 = 0; i2 < sources.length; ++i2) {
26325         var source = sources[i2];
26326         for (var prop in source) {
26327           if (Object.prototype.hasOwnProperty.call(source, prop)) {
26328             if (source[prop] === void 0) {
26329               delete this[prop];
26330             } else {
26331               this[prop] = source[prop];
26332             }
26333           }
26334         }
26335       }
26336       if (!this.id && this.type) {
26337         this.id = osmEntity.id(this.type);
26338       }
26339       if (!this.hasOwnProperty("visible")) {
26340         this.visible = true;
26341       }
26342       if (debug) {
26343         Object.freeze(this);
26344         Object.freeze(this.tags);
26345         if (this.loc)
26346           Object.freeze(this.loc);
26347         if (this.nodes)
26348           Object.freeze(this.nodes);
26349         if (this.members)
26350           Object.freeze(this.members);
26351       }
26352       return this;
26353     },
26354     copy: function(resolver, copies) {
26355       if (copies[this.id])
26356         return copies[this.id];
26357       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
26358       copies[this.id] = copy2;
26359       return copy2;
26360     },
26361     osmId: function() {
26362       return osmEntity.id.toOSM(this.id);
26363     },
26364     isNew: function() {
26365       var osmId = osmEntity.id.toOSM(this.id);
26366       return osmId.length === 0 || osmId[0] === "-";
26367     },
26368     update: function(attrs) {
26369       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
26370     },
26371     mergeTags: function(tags) {
26372       var merged = Object.assign({}, this.tags);
26373       var changed = false;
26374       for (var k in tags) {
26375         var t1 = merged[k];
26376         var t2 = tags[k];
26377         if (!t1) {
26378           changed = true;
26379           merged[k] = t2;
26380         } else if (t1 !== t2) {
26381           changed = true;
26382           merged[k] = utilUnicodeCharsTruncated(utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"), 255);
26383         }
26384       }
26385       return changed ? this.update({ tags: merged }) : this;
26386     },
26387     intersects: function(extent, resolver) {
26388       return this.extent(resolver).intersects(extent);
26389     },
26390     hasNonGeometryTags: function() {
26391       return Object.keys(this.tags).some(function(k) {
26392         return k !== "area";
26393       });
26394     },
26395     hasParentRelations: function(resolver) {
26396       return resolver.parentRelations(this).length > 0;
26397     },
26398     hasInterestingTags: function() {
26399       return Object.keys(this.tags).some(osmIsInterestingTag);
26400     },
26401     isHighwayIntersection: function() {
26402       return false;
26403     },
26404     isDegenerate: function() {
26405       return true;
26406     },
26407     deprecatedTags: function(dataDeprecated) {
26408       var tags = this.tags;
26409       if (Object.keys(tags).length === 0)
26410         return [];
26411       var deprecated = [];
26412       dataDeprecated.forEach(function(d) {
26413         var oldKeys = Object.keys(d.old);
26414         if (d.replace) {
26415           var hasExistingValues = Object.keys(d.replace).some(function(replaceKey) {
26416             if (!tags[replaceKey] || d.old[replaceKey])
26417               return false;
26418             var replaceValue = d.replace[replaceKey];
26419             if (replaceValue === "*")
26420               return false;
26421             if (replaceValue === tags[replaceKey])
26422               return false;
26423             return true;
26424           });
26425           if (hasExistingValues)
26426             return;
26427         }
26428         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
26429           if (!tags[oldKey])
26430             return false;
26431           if (d.old[oldKey] === "*")
26432             return true;
26433           if (d.old[oldKey] === tags[oldKey])
26434             return true;
26435           var vals = tags[oldKey].split(";").filter(Boolean);
26436           if (vals.length === 0) {
26437             return false;
26438           } else if (vals.length > 1) {
26439             return vals.indexOf(d.old[oldKey]) !== -1;
26440           } else {
26441             if (tags[oldKey] === d.old[oldKey]) {
26442               if (d.replace && d.old[oldKey] === d.replace[oldKey]) {
26443                 var replaceKeys = Object.keys(d.replace);
26444                 return !replaceKeys.every(function(replaceKey) {
26445                   return tags[replaceKey] === d.replace[replaceKey];
26446                 });
26447               } else {
26448                 return true;
26449               }
26450             }
26451           }
26452           return false;
26453         });
26454         if (matchesDeprecatedTags) {
26455           deprecated.push(d);
26456         }
26457       });
26458       return deprecated;
26459     }
26460   };
26461
26462   // modules/osm/lanes.js
26463   function osmLanes(entity) {
26464     if (entity.type !== "way")
26465       return null;
26466     if (!entity.tags.highway)
26467       return null;
26468     var tags = entity.tags;
26469     var isOneWay = entity.isOneWay();
26470     var laneCount = getLaneCount(tags, isOneWay);
26471     var maxspeed = parseMaxspeed(tags);
26472     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
26473     var forward = laneDirections.forward;
26474     var backward = laneDirections.backward;
26475     var bothways = laneDirections.bothways;
26476     var turnLanes = {};
26477     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
26478     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
26479     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
26480     var maxspeedLanes = {};
26481     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
26482     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
26483     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
26484     var psvLanes = {};
26485     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
26486     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
26487     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
26488     var busLanes = {};
26489     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
26490     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
26491     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
26492     var taxiLanes = {};
26493     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
26494     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
26495     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
26496     var hovLanes = {};
26497     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
26498     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
26499     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
26500     var hgvLanes = {};
26501     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
26502     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
26503     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
26504     var bicyclewayLanes = {};
26505     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
26506     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
26507     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
26508     var lanesObj = {
26509       forward: [],
26510       backward: [],
26511       unspecified: []
26512     };
26513     mapToLanesObj(lanesObj, turnLanes, "turnLane");
26514     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
26515     mapToLanesObj(lanesObj, psvLanes, "psv");
26516     mapToLanesObj(lanesObj, busLanes, "bus");
26517     mapToLanesObj(lanesObj, taxiLanes, "taxi");
26518     mapToLanesObj(lanesObj, hovLanes, "hov");
26519     mapToLanesObj(lanesObj, hgvLanes, "hgv");
26520     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
26521     return {
26522       metadata: {
26523         count: laneCount,
26524         oneway: isOneWay,
26525         forward,
26526         backward,
26527         bothways,
26528         turnLanes,
26529         maxspeed,
26530         maxspeedLanes,
26531         psvLanes,
26532         busLanes,
26533         taxiLanes,
26534         hovLanes,
26535         hgvLanes,
26536         bicyclewayLanes
26537       },
26538       lanes: lanesObj
26539     };
26540   }
26541   function getLaneCount(tags, isOneWay) {
26542     var count;
26543     if (tags.lanes) {
26544       count = parseInt(tags.lanes, 10);
26545       if (count > 0) {
26546         return count;
26547       }
26548     }
26549     switch (tags.highway) {
26550       case "trunk":
26551       case "motorway":
26552         count = isOneWay ? 2 : 4;
26553         break;
26554       default:
26555         count = isOneWay ? 1 : 2;
26556         break;
26557     }
26558     return count;
26559   }
26560   function parseMaxspeed(tags) {
26561     var maxspeed = tags.maxspeed;
26562     if (!maxspeed)
26563       return;
26564     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
26565     if (!maxspeedRegex.test(maxspeed))
26566       return;
26567     return parseInt(maxspeed, 10);
26568   }
26569   function parseLaneDirections(tags, isOneWay, laneCount) {
26570     var forward = parseInt(tags["lanes:forward"], 10);
26571     var backward = parseInt(tags["lanes:backward"], 10);
26572     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
26573     if (parseInt(tags.oneway, 10) === -1) {
26574       forward = 0;
26575       bothways = 0;
26576       backward = laneCount;
26577     } else if (isOneWay) {
26578       forward = laneCount;
26579       bothways = 0;
26580       backward = 0;
26581     } else if (isNaN(forward) && isNaN(backward)) {
26582       backward = Math.floor((laneCount - bothways) / 2);
26583       forward = laneCount - bothways - backward;
26584     } else if (isNaN(forward)) {
26585       if (backward > laneCount - bothways) {
26586         backward = laneCount - bothways;
26587       }
26588       forward = laneCount - bothways - backward;
26589     } else if (isNaN(backward)) {
26590       if (forward > laneCount - bothways) {
26591         forward = laneCount - bothways;
26592       }
26593       backward = laneCount - bothways - forward;
26594     }
26595     return {
26596       forward,
26597       backward,
26598       bothways
26599     };
26600   }
26601   function parseTurnLanes(tag) {
26602     if (!tag)
26603       return;
26604     var validValues = [
26605       "left",
26606       "slight_left",
26607       "sharp_left",
26608       "through",
26609       "right",
26610       "slight_right",
26611       "sharp_right",
26612       "reverse",
26613       "merge_to_left",
26614       "merge_to_right",
26615       "none"
26616     ];
26617     return tag.split("|").map(function(s) {
26618       if (s === "")
26619         s = "none";
26620       return s.split(";").map(function(d) {
26621         return validValues.indexOf(d) === -1 ? "unknown" : d;
26622       });
26623     });
26624   }
26625   function parseMaxspeedLanes(tag, maxspeed) {
26626     if (!tag)
26627       return;
26628     return tag.split("|").map(function(s) {
26629       if (s === "none")
26630         return s;
26631       var m = parseInt(s, 10);
26632       if (s === "" || m === maxspeed)
26633         return null;
26634       return isNaN(m) ? "unknown" : m;
26635     });
26636   }
26637   function parseMiscLanes(tag) {
26638     if (!tag)
26639       return;
26640     var validValues = [
26641       "yes",
26642       "no",
26643       "designated"
26644     ];
26645     return tag.split("|").map(function(s) {
26646       if (s === "")
26647         s = "no";
26648       return validValues.indexOf(s) === -1 ? "unknown" : s;
26649     });
26650   }
26651   function parseBicycleWay(tag) {
26652     if (!tag)
26653       return;
26654     var validValues = [
26655       "yes",
26656       "no",
26657       "designated",
26658       "lane"
26659     ];
26660     return tag.split("|").map(function(s) {
26661       if (s === "")
26662         s = "no";
26663       return validValues.indexOf(s) === -1 ? "unknown" : s;
26664     });
26665   }
26666   function mapToLanesObj(lanesObj, data, key) {
26667     if (data.forward) {
26668       data.forward.forEach(function(l, i2) {
26669         if (!lanesObj.forward[i2])
26670           lanesObj.forward[i2] = {};
26671         lanesObj.forward[i2][key] = l;
26672       });
26673     }
26674     if (data.backward) {
26675       data.backward.forEach(function(l, i2) {
26676         if (!lanesObj.backward[i2])
26677           lanesObj.backward[i2] = {};
26678         lanesObj.backward[i2][key] = l;
26679       });
26680     }
26681     if (data.unspecified) {
26682       data.unspecified.forEach(function(l, i2) {
26683         if (!lanesObj.unspecified[i2])
26684           lanesObj.unspecified[i2] = {};
26685         lanesObj.unspecified[i2][key] = l;
26686       });
26687     }
26688   }
26689
26690   // modules/osm/way.js
26691   function osmWay() {
26692     if (!(this instanceof osmWay)) {
26693       return new osmWay().initialize(arguments);
26694     } else if (arguments.length) {
26695       this.initialize(arguments);
26696     }
26697   }
26698   osmEntity.way = osmWay;
26699   osmWay.prototype = Object.create(osmEntity.prototype);
26700   Object.assign(osmWay.prototype, {
26701     type: "way",
26702     nodes: [],
26703     copy: function(resolver, copies) {
26704       if (copies[this.id])
26705         return copies[this.id];
26706       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
26707       var nodes = this.nodes.map(function(id2) {
26708         return resolver.entity(id2).copy(resolver, copies).id;
26709       });
26710       copy2 = copy2.update({ nodes });
26711       copies[this.id] = copy2;
26712       return copy2;
26713     },
26714     extent: function(resolver) {
26715       return resolver.transient(this, "extent", function() {
26716         var extent = geoExtent();
26717         for (var i2 = 0; i2 < this.nodes.length; i2++) {
26718           var node = resolver.hasEntity(this.nodes[i2]);
26719           if (node) {
26720             extent._extend(node.extent());
26721           }
26722         }
26723         return extent;
26724       });
26725     },
26726     first: function() {
26727       return this.nodes[0];
26728     },
26729     last: function() {
26730       return this.nodes[this.nodes.length - 1];
26731     },
26732     contains: function(node) {
26733       return this.nodes.indexOf(node) >= 0;
26734     },
26735     affix: function(node) {
26736       if (this.nodes[0] === node)
26737         return "prefix";
26738       if (this.nodes[this.nodes.length - 1] === node)
26739         return "suffix";
26740     },
26741     layer: function() {
26742       if (isFinite(this.tags.layer)) {
26743         return Math.max(-10, Math.min(+this.tags.layer, 10));
26744       }
26745       if (this.tags.covered === "yes")
26746         return -1;
26747       if (this.tags.location === "overground")
26748         return 1;
26749       if (this.tags.location === "underground")
26750         return -1;
26751       if (this.tags.location === "underwater")
26752         return -10;
26753       if (this.tags.power === "line")
26754         return 10;
26755       if (this.tags.power === "minor_line")
26756         return 10;
26757       if (this.tags.aerialway)
26758         return 10;
26759       if (this.tags.bridge)
26760         return 1;
26761       if (this.tags.cutting)
26762         return -1;
26763       if (this.tags.tunnel)
26764         return -1;
26765       if (this.tags.waterway)
26766         return -1;
26767       if (this.tags.man_made === "pipeline")
26768         return -10;
26769       if (this.tags.boundary)
26770         return -10;
26771       return 0;
26772     },
26773     impliedLineWidthMeters: function() {
26774       var averageWidths = {
26775         highway: {
26776           motorway: 5,
26777           motorway_link: 5,
26778           trunk: 4.5,
26779           trunk_link: 4.5,
26780           primary: 4,
26781           secondary: 4,
26782           tertiary: 4,
26783           primary_link: 4,
26784           secondary_link: 4,
26785           tertiary_link: 4,
26786           unclassified: 4,
26787           road: 4,
26788           living_street: 4,
26789           bus_guideway: 4,
26790           pedestrian: 4,
26791           residential: 3.5,
26792           service: 3.5,
26793           track: 3,
26794           cycleway: 2.5,
26795           bridleway: 2,
26796           corridor: 2,
26797           steps: 2,
26798           path: 1.5,
26799           footway: 1.5
26800         },
26801         railway: {
26802           rail: 2.5,
26803           light_rail: 2.5,
26804           tram: 2.5,
26805           subway: 2.5,
26806           monorail: 2.5,
26807           funicular: 2.5,
26808           disused: 2.5,
26809           preserved: 2.5,
26810           miniature: 1.5,
26811           narrow_gauge: 1.5
26812         },
26813         waterway: {
26814           river: 50,
26815           canal: 25,
26816           stream: 5,
26817           tidal_channel: 5,
26818           fish_pass: 2.5,
26819           drain: 2.5,
26820           ditch: 1.5
26821         }
26822       };
26823       for (var key in averageWidths) {
26824         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
26825           var width = averageWidths[key][this.tags[key]];
26826           if (key === "highway") {
26827             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
26828             if (!laneCount)
26829               laneCount = this.isOneWay() ? 1 : 2;
26830             return width * laneCount;
26831           }
26832           return width;
26833         }
26834       }
26835       return null;
26836     },
26837     isOneWay: function() {
26838       var values = {
26839         "yes": true,
26840         "1": true,
26841         "-1": true,
26842         "reversible": true,
26843         "alternating": true,
26844         "no": false,
26845         "0": false
26846       };
26847       if (values[this.tags.oneway] !== void 0) {
26848         return values[this.tags.oneway];
26849       }
26850       for (var key in this.tags) {
26851         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
26852           return true;
26853         }
26854       }
26855       return false;
26856     },
26857     sidednessIdentifier: function() {
26858       for (var key in this.tags) {
26859         var value = this.tags[key];
26860         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
26861           if (osmRightSideIsInsideTags[key][value] === true) {
26862             return key;
26863           } else {
26864             return osmRightSideIsInsideTags[key][value];
26865           }
26866         }
26867       }
26868       return null;
26869     },
26870     isSided: function() {
26871       if (this.tags.two_sided === "yes") {
26872         return false;
26873       }
26874       return this.sidednessIdentifier() !== null;
26875     },
26876     lanes: function() {
26877       return osmLanes(this);
26878     },
26879     isClosed: function() {
26880       return this.nodes.length > 1 && this.first() === this.last();
26881     },
26882     isConvex: function(resolver) {
26883       if (!this.isClosed() || this.isDegenerate())
26884         return null;
26885       var nodes = utilArrayUniq(resolver.childNodes(this));
26886       var coords = nodes.map(function(n2) {
26887         return n2.loc;
26888       });
26889       var curr = 0;
26890       var prev = 0;
26891       for (var i2 = 0; i2 < coords.length; i2++) {
26892         var o = coords[(i2 + 1) % coords.length];
26893         var a = coords[i2];
26894         var b = coords[(i2 + 2) % coords.length];
26895         var res = geoVecCross(a, b, o);
26896         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
26897         if (curr === 0) {
26898           continue;
26899         } else if (prev && curr !== prev) {
26900           return false;
26901         }
26902         prev = curr;
26903       }
26904       return true;
26905     },
26906     tagSuggestingArea: function() {
26907       return osmTagSuggestingArea(this.tags);
26908     },
26909     isArea: function() {
26910       if (this.tags.area === "yes")
26911         return true;
26912       if (!this.isClosed() || this.tags.area === "no")
26913         return false;
26914       return this.tagSuggestingArea() !== null;
26915     },
26916     isDegenerate: function() {
26917       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
26918     },
26919     areAdjacent: function(n1, n2) {
26920       for (var i2 = 0; i2 < this.nodes.length; i2++) {
26921         if (this.nodes[i2] === n1) {
26922           if (this.nodes[i2 - 1] === n2)
26923             return true;
26924           if (this.nodes[i2 + 1] === n2)
26925             return true;
26926         }
26927       }
26928       return false;
26929     },
26930     geometry: function(graph) {
26931       return graph.transient(this, "geometry", function() {
26932         return this.isArea() ? "area" : "line";
26933       });
26934     },
26935     segments: function(graph) {
26936       function segmentExtent(graph2) {
26937         var n1 = graph2.hasEntity(this.nodes[0]);
26938         var n2 = graph2.hasEntity(this.nodes[1]);
26939         return n1 && n2 && geoExtent([
26940           [
26941             Math.min(n1.loc[0], n2.loc[0]),
26942             Math.min(n1.loc[1], n2.loc[1])
26943           ],
26944           [
26945             Math.max(n1.loc[0], n2.loc[0]),
26946             Math.max(n1.loc[1], n2.loc[1])
26947           ]
26948         ]);
26949       }
26950       return graph.transient(this, "segments", function() {
26951         var segments = [];
26952         for (var i2 = 0; i2 < this.nodes.length - 1; i2++) {
26953           segments.push({
26954             id: this.id + "-" + i2,
26955             wayId: this.id,
26956             index: i2,
26957             nodes: [this.nodes[i2], this.nodes[i2 + 1]],
26958             extent: segmentExtent
26959           });
26960         }
26961         return segments;
26962       });
26963     },
26964     close: function() {
26965       if (this.isClosed() || !this.nodes.length)
26966         return this;
26967       var nodes = this.nodes.slice();
26968       nodes = nodes.filter(noRepeatNodes);
26969       nodes.push(nodes[0]);
26970       return this.update({ nodes });
26971     },
26972     unclose: function() {
26973       if (!this.isClosed())
26974         return this;
26975       var nodes = this.nodes.slice();
26976       var connector = this.first();
26977       var i2 = nodes.length - 1;
26978       while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
26979         nodes.splice(i2, 1);
26980         i2 = nodes.length - 1;
26981       }
26982       nodes = nodes.filter(noRepeatNodes);
26983       return this.update({ nodes });
26984     },
26985     addNode: function(id2, index) {
26986       var nodes = this.nodes.slice();
26987       var isClosed = this.isClosed();
26988       var max3 = isClosed ? nodes.length - 1 : nodes.length;
26989       if (index === void 0) {
26990         index = max3;
26991       }
26992       if (index < 0 || index > max3) {
26993         throw new RangeError("index " + index + " out of range 0.." + max3);
26994       }
26995       if (isClosed) {
26996         var connector = this.first();
26997         var i2 = 1;
26998         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
26999           nodes.splice(i2, 1);
27000           if (index > i2)
27001             index--;
27002         }
27003         i2 = nodes.length - 1;
27004         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27005           nodes.splice(i2, 1);
27006           if (index > i2)
27007             index--;
27008           i2 = nodes.length - 1;
27009         }
27010       }
27011       nodes.splice(index, 0, id2);
27012       nodes = nodes.filter(noRepeatNodes);
27013       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27014         nodes.push(nodes[0]);
27015       }
27016       return this.update({ nodes });
27017     },
27018     updateNode: function(id2, index) {
27019       var nodes = this.nodes.slice();
27020       var isClosed = this.isClosed();
27021       var max3 = nodes.length - 1;
27022       if (index === void 0 || index < 0 || index > max3) {
27023         throw new RangeError("index " + index + " out of range 0.." + max3);
27024       }
27025       if (isClosed) {
27026         var connector = this.first();
27027         var i2 = 1;
27028         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
27029           nodes.splice(i2, 1);
27030           if (index > i2)
27031             index--;
27032         }
27033         i2 = nodes.length - 1;
27034         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27035           nodes.splice(i2, 1);
27036           if (index === i2)
27037             index = 0;
27038           i2 = nodes.length - 1;
27039         }
27040       }
27041       nodes.splice(index, 1, id2);
27042       nodes = nodes.filter(noRepeatNodes);
27043       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27044         nodes.push(nodes[0]);
27045       }
27046       return this.update({ nodes });
27047     },
27048     replaceNode: function(needleID, replacementID) {
27049       var nodes = this.nodes.slice();
27050       var isClosed = this.isClosed();
27051       for (var i2 = 0; i2 < nodes.length; i2++) {
27052         if (nodes[i2] === needleID) {
27053           nodes[i2] = replacementID;
27054         }
27055       }
27056       nodes = nodes.filter(noRepeatNodes);
27057       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27058         nodes.push(nodes[0]);
27059       }
27060       return this.update({ nodes });
27061     },
27062     removeNode: function(id2) {
27063       var nodes = this.nodes.slice();
27064       var isClosed = this.isClosed();
27065       nodes = nodes.filter(function(node) {
27066         return node !== id2;
27067       }).filter(noRepeatNodes);
27068       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27069         nodes.push(nodes[0]);
27070       }
27071       return this.update({ nodes });
27072     },
27073     asJXON: function(changeset_id) {
27074       var r = {
27075         way: {
27076           "@id": this.osmId(),
27077           "@version": this.version || 0,
27078           nd: this.nodes.map(function(id2) {
27079             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
27080           }, this),
27081           tag: Object.keys(this.tags).map(function(k) {
27082             return { keyAttributes: { k, v: this.tags[k] } };
27083           }, this)
27084         }
27085       };
27086       if (changeset_id) {
27087         r.way["@changeset"] = changeset_id;
27088       }
27089       return r;
27090     },
27091     asGeoJSON: function(resolver) {
27092       return resolver.transient(this, "GeoJSON", function() {
27093         var coordinates = resolver.childNodes(this).map(function(n2) {
27094           return n2.loc;
27095         });
27096         if (this.isArea() && this.isClosed()) {
27097           return {
27098             type: "Polygon",
27099             coordinates: [coordinates]
27100           };
27101         } else {
27102           return {
27103             type: "LineString",
27104             coordinates
27105           };
27106         }
27107       });
27108     },
27109     area: function(resolver) {
27110       return resolver.transient(this, "area", function() {
27111         var nodes = resolver.childNodes(this);
27112         var json = {
27113           type: "Polygon",
27114           coordinates: [nodes.map(function(n2) {
27115             return n2.loc;
27116           })]
27117         };
27118         if (!this.isClosed() && nodes.length) {
27119           json.coordinates[0].push(nodes[0].loc);
27120         }
27121         var area = area_default(json);
27122         if (area > 2 * Math.PI) {
27123           json.coordinates[0] = json.coordinates[0].reverse();
27124           area = area_default(json);
27125         }
27126         return isNaN(area) ? 0 : area;
27127       });
27128     }
27129   });
27130   function noRepeatNodes(node, i2, arr) {
27131     return i2 === 0 || node !== arr[i2 - 1];
27132   }
27133
27134   // modules/osm/multipolygon.js
27135   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
27136     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
27137       return false;
27138     }
27139     var outerMember;
27140     for (var memberIndex in entity.members) {
27141       var member = entity.members[memberIndex];
27142       if (!member.role || member.role === "outer") {
27143         if (outerMember)
27144           return false;
27145         if (member.type !== "way")
27146           return false;
27147         if (!graph.hasEntity(member.id))
27148           return false;
27149         outerMember = graph.entity(member.id);
27150         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
27151           return false;
27152         }
27153       }
27154     }
27155     return outerMember;
27156   }
27157   function osmIsOldMultipolygonOuterMember(entity, graph) {
27158     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
27159       return false;
27160     }
27161     var parents = graph.parentRelations(entity);
27162     if (parents.length !== 1)
27163       return false;
27164     var parent = parents[0];
27165     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27166       return false;
27167     }
27168     var members = parent.members, member;
27169     for (var i2 = 0; i2 < members.length; i2++) {
27170       member = members[i2];
27171       if (member.id === entity.id && member.role && member.role !== "outer") {
27172         return false;
27173       }
27174       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
27175         return false;
27176       }
27177     }
27178     return parent;
27179   }
27180   function osmOldMultipolygonOuterMember(entity, graph) {
27181     if (entity.type !== "way")
27182       return false;
27183     var parents = graph.parentRelations(entity);
27184     if (parents.length !== 1)
27185       return false;
27186     var parent = parents[0];
27187     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27188       return false;
27189     }
27190     var members = parent.members, member, outerMember;
27191     for (var i2 = 0; i2 < members.length; i2++) {
27192       member = members[i2];
27193       if (!member.role || member.role === "outer") {
27194         if (outerMember)
27195           return false;
27196         outerMember = member;
27197       }
27198     }
27199     if (!outerMember)
27200       return false;
27201     var outerEntity = graph.hasEntity(outerMember.id);
27202     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
27203       return false;
27204     }
27205     return outerEntity;
27206   }
27207   function osmJoinWays(toJoin, graph) {
27208     function resolve(member) {
27209       return graph.childNodes(graph.entity(member.id));
27210     }
27211     function reverse(item2) {
27212       var action = actionReverse(item2.id, { reverseOneway: true });
27213       sequences.actions.push(action);
27214       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
27215     }
27216     toJoin = toJoin.filter(function(member) {
27217       return member.type === "way" && graph.hasEntity(member.id);
27218     });
27219     var i2;
27220     var joinAsMembers = true;
27221     for (i2 = 0; i2 < toJoin.length; i2++) {
27222       if (toJoin[i2] instanceof osmWay) {
27223         joinAsMembers = false;
27224         break;
27225       }
27226     }
27227     var sequences = [];
27228     sequences.actions = [];
27229     while (toJoin.length) {
27230       var item = toJoin.shift();
27231       var currWays = [item];
27232       var currNodes = resolve(item).slice();
27233       while (toJoin.length) {
27234         var start2 = currNodes[0];
27235         var end = currNodes[currNodes.length - 1];
27236         var fn = null;
27237         var nodes = null;
27238         for (i2 = 0; i2 < toJoin.length; i2++) {
27239           item = toJoin[i2];
27240           nodes = resolve(item);
27241           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
27242             currWays[0] = reverse(currWays[0]);
27243             currNodes.reverse();
27244             start2 = currNodes[0];
27245             end = currNodes[currNodes.length - 1];
27246           }
27247           if (nodes[0] === end) {
27248             fn = currNodes.push;
27249             nodes = nodes.slice(1);
27250             break;
27251           } else if (nodes[nodes.length - 1] === end) {
27252             fn = currNodes.push;
27253             nodes = nodes.slice(0, -1).reverse();
27254             item = reverse(item);
27255             break;
27256           } else if (nodes[nodes.length - 1] === start2) {
27257             fn = currNodes.unshift;
27258             nodes = nodes.slice(0, -1);
27259             break;
27260           } else if (nodes[0] === start2) {
27261             fn = currNodes.unshift;
27262             nodes = nodes.slice(1).reverse();
27263             item = reverse(item);
27264             break;
27265           } else {
27266             fn = nodes = null;
27267           }
27268         }
27269         if (!nodes) {
27270           break;
27271         }
27272         fn.apply(currWays, [item]);
27273         fn.apply(currNodes, nodes);
27274         toJoin.splice(i2, 1);
27275       }
27276       currWays.nodes = currNodes;
27277       sequences.push(currWays);
27278     }
27279     return sequences;
27280   }
27281
27282   // modules/actions/add_member.js
27283   function actionAddMember(relationId, member, memberIndex, insertPair) {
27284     return function action(graph) {
27285       var relation = graph.entity(relationId);
27286       var isPTv2 = /stop|platform/.test(member.role);
27287       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
27288         graph = addWayMember(relation, graph);
27289       } else {
27290         if (isPTv2 && isNaN(memberIndex)) {
27291           memberIndex = 0;
27292         }
27293         graph = graph.replace(relation.addMember(member, memberIndex));
27294       }
27295       return graph;
27296     };
27297     function addWayMember(relation, graph) {
27298       var groups, tempWay, insertPairIsReversed, item, i2, j2, k;
27299       var PTv2members = [];
27300       var members = [];
27301       for (i2 = 0; i2 < relation.members.length; i2++) {
27302         var m = relation.members[i2];
27303         if (/stop|platform/.test(m.role)) {
27304           PTv2members.push(m);
27305         } else {
27306           members.push(m);
27307         }
27308       }
27309       relation = relation.update({ members });
27310       if (insertPair) {
27311         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
27312         graph = graph.replace(tempWay);
27313         var tempMember = { id: tempWay.id, type: "way", role: member.role };
27314         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
27315         groups = utilArrayGroupBy(tempRelation.members, "type");
27316         groups.way = groups.way || [];
27317         var originalWay = graph.entity(insertPair.originalID);
27318         var insertedWay = graph.entity(insertPair.insertedID);
27319         insertPairIsReversed = originalWay.nodes.length > 0 && insertedWay.nodes.length > 0 && insertedWay.nodes[insertedWay.nodes.length - 1] === originalWay.nodes[0] && originalWay.nodes[originalWay.nodes.length - 1] !== insertedWay.nodes[0];
27320       } else {
27321         groups = utilArrayGroupBy(relation.members, "type");
27322         groups.way = groups.way || [];
27323         groups.way.push(member);
27324       }
27325       members = withIndex(groups.way);
27326       var joined = osmJoinWays(members, graph);
27327       for (i2 = 0; i2 < joined.length; i2++) {
27328         var segment = joined[i2];
27329         var nodes = segment.nodes.slice();
27330         var startIndex = segment[0].index;
27331         for (j2 = 0; j2 < members.length; j2++) {
27332           if (members[j2].index === startIndex) {
27333             break;
27334           }
27335         }
27336         for (k = 0; k < segment.length; k++) {
27337           item = segment[k];
27338           var way = graph.entity(item.id);
27339           if (tempWay && item.id === tempWay.id) {
27340             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
27341             if (reverse) {
27342               item.pair = [
27343                 { id: insertPair.insertedID, type: "way", role: item.role },
27344                 { id: insertPair.originalID, type: "way", role: item.role }
27345               ];
27346             } else {
27347               item.pair = [
27348                 { id: insertPair.originalID, type: "way", role: item.role },
27349                 { id: insertPair.insertedID, type: "way", role: item.role }
27350               ];
27351             }
27352           }
27353           if (k > 0) {
27354             if (j2 + k >= members.length || item.index !== members[j2 + k].index) {
27355               moveMember(members, item.index, j2 + k);
27356             }
27357           }
27358           nodes.splice(0, way.nodes.length - 1);
27359         }
27360       }
27361       if (tempWay) {
27362         graph = graph.remove(tempWay);
27363       }
27364       var wayMembers = [];
27365       for (i2 = 0; i2 < members.length; i2++) {
27366         item = members[i2];
27367         if (item.index === -1)
27368           continue;
27369         if (item.pair) {
27370           wayMembers.push(item.pair[0]);
27371           wayMembers.push(item.pair[1]);
27372         } else {
27373           wayMembers.push(utilObjectOmit(item, ["index"]));
27374         }
27375       }
27376       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
27377       return graph.replace(relation.update({ members: newMembers }));
27378       function moveMember(arr, findIndex, toIndex) {
27379         var i3;
27380         for (i3 = 0; i3 < arr.length; i3++) {
27381           if (arr[i3].index === findIndex) {
27382             break;
27383           }
27384         }
27385         var item2 = Object.assign({}, arr[i3]);
27386         arr[i3].index = -1;
27387         item2.index = toIndex;
27388         arr.splice(toIndex, 0, item2);
27389       }
27390       function withIndex(arr) {
27391         var result = new Array(arr.length);
27392         for (var i3 = 0; i3 < arr.length; i3++) {
27393           result[i3] = Object.assign({}, arr[i3]);
27394           result[i3].index = i3;
27395         }
27396         return result;
27397       }
27398     }
27399   }
27400
27401   // modules/actions/add_midpoint.js
27402   function actionAddMidpoint(midpoint, node) {
27403     return function(graph) {
27404       graph = graph.replace(node.move(midpoint.loc));
27405       var parents = utilArrayIntersection(graph.parentWays(graph.entity(midpoint.edge[0])), graph.parentWays(graph.entity(midpoint.edge[1])));
27406       parents.forEach(function(way) {
27407         for (var i2 = 0; i2 < way.nodes.length - 1; i2++) {
27408           if (geoEdgeEqual([way.nodes[i2], way.nodes[i2 + 1]], midpoint.edge)) {
27409             graph = graph.replace(graph.entity(way.id).addNode(node.id, i2 + 1));
27410             return;
27411           }
27412         }
27413       });
27414       return graph;
27415     };
27416   }
27417
27418   // modules/actions/add_vertex.js
27419   function actionAddVertex(wayId, nodeId, index) {
27420     return function(graph) {
27421       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
27422     };
27423   }
27424
27425   // modules/actions/change_member.js
27426   function actionChangeMember(relationId, member, memberIndex) {
27427     return function(graph) {
27428       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
27429     };
27430   }
27431
27432   // modules/actions/change_preset.js
27433   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
27434     return function action(graph) {
27435       var entity = graph.entity(entityID);
27436       var geometry = entity.geometry(graph);
27437       var tags = entity.tags;
27438       if (oldPreset)
27439         tags = oldPreset.unsetTags(tags, geometry, newPreset && newPreset.addTags ? Object.keys(newPreset.addTags) : null);
27440       if (newPreset)
27441         tags = newPreset.setTags(tags, geometry, skipFieldDefaults);
27442       return graph.replace(entity.update({ tags }));
27443     };
27444   }
27445
27446   // modules/actions/change_tags.js
27447   function actionChangeTags(entityId, tags) {
27448     return function(graph) {
27449       var entity = graph.entity(entityId);
27450       return graph.replace(entity.update({ tags }));
27451     };
27452   }
27453
27454   // modules/osm/node.js
27455   function osmNode() {
27456     if (!(this instanceof osmNode)) {
27457       return new osmNode().initialize(arguments);
27458     } else if (arguments.length) {
27459       this.initialize(arguments);
27460     }
27461   }
27462   osmEntity.node = osmNode;
27463   osmNode.prototype = Object.create(osmEntity.prototype);
27464   Object.assign(osmNode.prototype, {
27465     type: "node",
27466     loc: [9999, 9999],
27467     extent: function() {
27468       return new geoExtent(this.loc);
27469     },
27470     geometry: function(graph) {
27471       return graph.transient(this, "geometry", function() {
27472         return graph.isPoi(this) ? "point" : "vertex";
27473       });
27474     },
27475     move: function(loc) {
27476       return this.update({ loc });
27477     },
27478     isDegenerate: function() {
27479       return !(Array.isArray(this.loc) && this.loc.length === 2 && this.loc[0] >= -180 && this.loc[0] <= 180 && this.loc[1] >= -90 && this.loc[1] <= 90);
27480     },
27481     directions: function(resolver, projection2) {
27482       var val;
27483       var i2;
27484       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
27485         val = "all";
27486       } else {
27487         val = (this.tags.direction || "").toLowerCase();
27488         var re2 = /:direction$/i;
27489         var keys = Object.keys(this.tags);
27490         for (i2 = 0; i2 < keys.length; i2++) {
27491           if (re2.test(keys[i2])) {
27492             val = this.tags[keys[i2]].toLowerCase();
27493             break;
27494           }
27495         }
27496       }
27497       if (val === "")
27498         return [];
27499       var cardinal = {
27500         north: 0,
27501         n: 0,
27502         northnortheast: 22,
27503         nne: 22,
27504         northeast: 45,
27505         ne: 45,
27506         eastnortheast: 67,
27507         ene: 67,
27508         east: 90,
27509         e: 90,
27510         eastsoutheast: 112,
27511         ese: 112,
27512         southeast: 135,
27513         se: 135,
27514         southsoutheast: 157,
27515         sse: 157,
27516         south: 180,
27517         s: 180,
27518         southsouthwest: 202,
27519         ssw: 202,
27520         southwest: 225,
27521         sw: 225,
27522         westsouthwest: 247,
27523         wsw: 247,
27524         west: 270,
27525         w: 270,
27526         westnorthwest: 292,
27527         wnw: 292,
27528         northwest: 315,
27529         nw: 315,
27530         northnorthwest: 337,
27531         nnw: 337
27532       };
27533       var values = val.split(";");
27534       var results = [];
27535       values.forEach(function(v) {
27536         if (cardinal[v] !== void 0) {
27537           v = cardinal[v];
27538         }
27539         if (v !== "" && !isNaN(+v)) {
27540           results.push(+v);
27541           return;
27542         }
27543         var lookBackward = this.tags["traffic_sign:backward"] || v === "backward" || v === "both" || v === "all";
27544         var lookForward = this.tags["traffic_sign:forward"] || v === "forward" || v === "both" || v === "all";
27545         if (!lookForward && !lookBackward)
27546           return;
27547         var nodeIds = {};
27548         resolver.parentWays(this).forEach(function(parent) {
27549           var nodes = parent.nodes;
27550           for (i2 = 0; i2 < nodes.length; i2++) {
27551             if (nodes[i2] === this.id) {
27552               if (lookForward && i2 > 0) {
27553                 nodeIds[nodes[i2 - 1]] = true;
27554               }
27555               if (lookBackward && i2 < nodes.length - 1) {
27556                 nodeIds[nodes[i2 + 1]] = true;
27557               }
27558             }
27559           }
27560         }, this);
27561         Object.keys(nodeIds).forEach(function(nodeId) {
27562           results.push(geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90);
27563         }, this);
27564       }, this);
27565       return utilArrayUniq(results);
27566     },
27567     isCrossing: function() {
27568       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
27569     },
27570     isEndpoint: function(resolver) {
27571       return resolver.transient(this, "isEndpoint", function() {
27572         var id2 = this.id;
27573         return resolver.parentWays(this).filter(function(parent) {
27574           return !parent.isClosed() && !!parent.affix(id2);
27575         }).length > 0;
27576       });
27577     },
27578     isConnected: function(resolver) {
27579       return resolver.transient(this, "isConnected", function() {
27580         var parents = resolver.parentWays(this);
27581         if (parents.length > 1) {
27582           for (var i2 in parents) {
27583             if (parents[i2].geometry(resolver) === "line" && parents[i2].hasInterestingTags())
27584               return true;
27585           }
27586         } else if (parents.length === 1) {
27587           var way = parents[0];
27588           var nodes = way.nodes.slice();
27589           if (way.isClosed()) {
27590             nodes.pop();
27591           }
27592           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
27593         }
27594         return false;
27595       });
27596     },
27597     parentIntersectionWays: function(resolver) {
27598       return resolver.transient(this, "parentIntersectionWays", function() {
27599         return resolver.parentWays(this).filter(function(parent) {
27600           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
27601         });
27602       });
27603     },
27604     isIntersection: function(resolver) {
27605       return this.parentIntersectionWays(resolver).length > 1;
27606     },
27607     isHighwayIntersection: function(resolver) {
27608       return resolver.transient(this, "isHighwayIntersection", function() {
27609         return resolver.parentWays(this).filter(function(parent) {
27610           return parent.tags.highway && parent.geometry(resolver) === "line";
27611         }).length > 1;
27612       });
27613     },
27614     isOnAddressLine: function(resolver) {
27615       return resolver.transient(this, "isOnAddressLine", function() {
27616         return resolver.parentWays(this).filter(function(parent) {
27617           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
27618         }).length > 0;
27619       });
27620     },
27621     asJXON: function(changeset_id) {
27622       var r = {
27623         node: {
27624           "@id": this.osmId(),
27625           "@lon": this.loc[0],
27626           "@lat": this.loc[1],
27627           "@version": this.version || 0,
27628           tag: Object.keys(this.tags).map(function(k) {
27629             return { keyAttributes: { k, v: this.tags[k] } };
27630           }, this)
27631         }
27632       };
27633       if (changeset_id)
27634         r.node["@changeset"] = changeset_id;
27635       return r;
27636     },
27637     asGeoJSON: function() {
27638       return {
27639         type: "Point",
27640         coordinates: this.loc
27641       };
27642     }
27643   });
27644
27645   // modules/actions/circularize.js
27646   function actionCircularize(wayId, projection2, maxAngle) {
27647     maxAngle = (maxAngle || 20) * Math.PI / 180;
27648     var action = function(graph, t) {
27649       if (t === null || !isFinite(t))
27650         t = 1;
27651       t = Math.min(Math.max(+t, 0), 1);
27652       var way = graph.entity(wayId);
27653       var origNodes = {};
27654       graph.childNodes(way).forEach(function(node2) {
27655         if (!origNodes[node2.id])
27656           origNodes[node2.id] = node2;
27657       });
27658       if (!way.isConvex(graph)) {
27659         graph = action.makeConvex(graph);
27660       }
27661       var nodes = utilArrayUniq(graph.childNodes(way));
27662       var keyNodes = nodes.filter(function(n2) {
27663         return graph.parentWays(n2).length !== 1;
27664       });
27665       var points = nodes.map(function(n2) {
27666         return projection2(n2.loc);
27667       });
27668       var keyPoints = keyNodes.map(function(n2) {
27669         return projection2(n2.loc);
27670       });
27671       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
27672       var radius = median(points, function(p) {
27673         return geoVecLength(centroid, p);
27674       });
27675       var sign2 = area_default3(points) > 0 ? 1 : -1;
27676       var ids, i2, j2, k;
27677       if (!keyNodes.length) {
27678         keyNodes = [nodes[0]];
27679         keyPoints = [points[0]];
27680       }
27681       if (keyNodes.length === 1) {
27682         var index = nodes.indexOf(keyNodes[0]);
27683         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
27684         keyNodes.push(nodes[oppositeIndex]);
27685         keyPoints.push(points[oppositeIndex]);
27686       }
27687       for (i2 = 0; i2 < keyPoints.length; i2++) {
27688         var nextKeyNodeIndex = (i2 + 1) % keyNodes.length;
27689         var startNode = keyNodes[i2];
27690         var endNode = keyNodes[nextKeyNodeIndex];
27691         var startNodeIndex = nodes.indexOf(startNode);
27692         var endNodeIndex = nodes.indexOf(endNode);
27693         var numberNewPoints = -1;
27694         var indexRange = endNodeIndex - startNodeIndex;
27695         var nearNodes = {};
27696         var inBetweenNodes = [];
27697         var startAngle, endAngle, totalAngle, eachAngle;
27698         var angle2, loc, node, origNode;
27699         if (indexRange < 0) {
27700           indexRange += nodes.length;
27701         }
27702         var distance = geoVecLength(centroid, keyPoints[i2]) || 1e-4;
27703         keyPoints[i2] = [
27704           centroid[0] + (keyPoints[i2][0] - centroid[0]) / distance * radius,
27705           centroid[1] + (keyPoints[i2][1] - centroid[1]) / distance * radius
27706         ];
27707         loc = projection2.invert(keyPoints[i2]);
27708         node = keyNodes[i2];
27709         origNode = origNodes[node.id];
27710         node = node.move(geoVecInterp(origNode.loc, loc, t));
27711         graph = graph.replace(node);
27712         startAngle = Math.atan2(keyPoints[i2][1] - centroid[1], keyPoints[i2][0] - centroid[0]);
27713         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
27714         totalAngle = endAngle - startAngle;
27715         if (totalAngle * sign2 > 0) {
27716           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
27717         }
27718         do {
27719           numberNewPoints++;
27720           eachAngle = totalAngle / (indexRange + numberNewPoints);
27721         } while (Math.abs(eachAngle) > maxAngle);
27722         for (j2 = 1; j2 < indexRange; j2++) {
27723           angle2 = startAngle + j2 * eachAngle;
27724           loc = projection2.invert([
27725             centroid[0] + Math.cos(angle2) * radius,
27726             centroid[1] + Math.sin(angle2) * radius
27727           ]);
27728           node = nodes[(j2 + startNodeIndex) % nodes.length];
27729           origNode = origNodes[node.id];
27730           nearNodes[node.id] = angle2;
27731           node = node.move(geoVecInterp(origNode.loc, loc, t));
27732           graph = graph.replace(node);
27733         }
27734         for (j2 = 0; j2 < numberNewPoints; j2++) {
27735           angle2 = startAngle + (indexRange + j2) * eachAngle;
27736           loc = projection2.invert([
27737             centroid[0] + Math.cos(angle2) * radius,
27738             centroid[1] + Math.sin(angle2) * radius
27739           ]);
27740           var min3 = Infinity;
27741           for (var nodeId in nearNodes) {
27742             var nearAngle = nearNodes[nodeId];
27743             var dist = Math.abs(nearAngle - angle2);
27744             if (dist < min3) {
27745               min3 = dist;
27746               origNode = origNodes[nodeId];
27747             }
27748           }
27749           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t) });
27750           graph = graph.replace(node);
27751           nodes.splice(endNodeIndex + j2, 0, node);
27752           inBetweenNodes.push(node.id);
27753         }
27754         if (indexRange === 1 && inBetweenNodes.length) {
27755           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
27756           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
27757           var wayDirection1 = endIndex1 - startIndex1;
27758           if (wayDirection1 < -1) {
27759             wayDirection1 = 1;
27760           }
27761           var parentWays = graph.parentWays(keyNodes[i2]);
27762           for (j2 = 0; j2 < parentWays.length; j2++) {
27763             var sharedWay = parentWays[j2];
27764             if (sharedWay === way)
27765               continue;
27766             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
27767               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
27768               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
27769               var wayDirection2 = endIndex2 - startIndex2;
27770               var insertAt = endIndex2;
27771               if (wayDirection2 < -1) {
27772                 wayDirection2 = 1;
27773               }
27774               if (wayDirection1 !== wayDirection2) {
27775                 inBetweenNodes.reverse();
27776                 insertAt = startIndex2;
27777               }
27778               for (k = 0; k < inBetweenNodes.length; k++) {
27779                 sharedWay = sharedWay.addNode(inBetweenNodes[k], insertAt + k);
27780               }
27781               graph = graph.replace(sharedWay);
27782             }
27783           }
27784         }
27785       }
27786       ids = nodes.map(function(n2) {
27787         return n2.id;
27788       });
27789       ids.push(ids[0]);
27790       way = way.update({ nodes: ids });
27791       graph = graph.replace(way);
27792       return graph;
27793     };
27794     action.makeConvex = function(graph) {
27795       var way = graph.entity(wayId);
27796       var nodes = utilArrayUniq(graph.childNodes(way));
27797       var points = nodes.map(function(n2) {
27798         return projection2(n2.loc);
27799       });
27800       var sign2 = area_default3(points) > 0 ? 1 : -1;
27801       var hull = hull_default(points);
27802       var i2, j2;
27803       if (sign2 === -1) {
27804         nodes.reverse();
27805         points.reverse();
27806       }
27807       for (i2 = 0; i2 < hull.length - 1; i2++) {
27808         var startIndex = points.indexOf(hull[i2]);
27809         var endIndex = points.indexOf(hull[i2 + 1]);
27810         var indexRange = endIndex - startIndex;
27811         if (indexRange < 0) {
27812           indexRange += nodes.length;
27813         }
27814         for (j2 = 1; j2 < indexRange; j2++) {
27815           var point = geoVecInterp(hull[i2], hull[i2 + 1], j2 / indexRange);
27816           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
27817           graph = graph.replace(node);
27818         }
27819       }
27820       return graph;
27821     };
27822     action.disabled = function(graph) {
27823       if (!graph.entity(wayId).isClosed()) {
27824         return "not_closed";
27825       }
27826       var way = graph.entity(wayId);
27827       var nodes = utilArrayUniq(graph.childNodes(way));
27828       var points = nodes.map(function(n2) {
27829         return projection2(n2.loc);
27830       });
27831       var hull = hull_default(points);
27832       var epsilonAngle = Math.PI / 180;
27833       if (hull.length !== points.length || hull.length < 3) {
27834         return false;
27835       }
27836       var centroid = centroid_default2(points);
27837       var radius = geoVecLengthSquare(centroid, points[0]);
27838       var i2, actualPoint;
27839       for (i2 = 0; i2 < hull.length; i2++) {
27840         actualPoint = hull[i2];
27841         var actualDist = geoVecLengthSquare(actualPoint, centroid);
27842         var diff = Math.abs(actualDist - radius);
27843         if (diff > 0.05 * radius) {
27844           return false;
27845         }
27846       }
27847       for (i2 = 0; i2 < hull.length; i2++) {
27848         actualPoint = hull[i2];
27849         var nextPoint = hull[(i2 + 1) % hull.length];
27850         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
27851         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
27852         var angle2 = endAngle - startAngle;
27853         if (angle2 < 0) {
27854           angle2 = -angle2;
27855         }
27856         if (angle2 > Math.PI) {
27857           angle2 = 2 * Math.PI - angle2;
27858         }
27859         if (angle2 > maxAngle + epsilonAngle) {
27860           return false;
27861         }
27862       }
27863       return "already_circular";
27864     };
27865     action.transitionable = true;
27866     return action;
27867   }
27868
27869   // modules/actions/delete_way.js
27870   function actionDeleteWay(wayID) {
27871     function canDeleteNode(node, graph) {
27872       if (graph.parentWays(node).length || graph.parentRelations(node).length)
27873         return false;
27874       var geometries = osmNodeGeometriesForTags(node.tags);
27875       if (geometries.point)
27876         return false;
27877       if (geometries.vertex)
27878         return true;
27879       return !node.hasInterestingTags();
27880     }
27881     var action = function(graph) {
27882       var way = graph.entity(wayID);
27883       graph.parentRelations(way).forEach(function(parent) {
27884         parent = parent.removeMembersWithID(wayID);
27885         graph = graph.replace(parent);
27886         if (parent.isDegenerate()) {
27887           graph = actionDeleteRelation(parent.id)(graph);
27888         }
27889       });
27890       new Set(way.nodes).forEach(function(nodeID) {
27891         graph = graph.replace(way.removeNode(nodeID));
27892         var node = graph.entity(nodeID);
27893         if (canDeleteNode(node, graph)) {
27894           graph = graph.remove(node);
27895         }
27896       });
27897       return graph.remove(way);
27898     };
27899     return action;
27900   }
27901
27902   // modules/actions/delete_multiple.js
27903   function actionDeleteMultiple(ids) {
27904     var actions = {
27905       way: actionDeleteWay,
27906       node: actionDeleteNode,
27907       relation: actionDeleteRelation
27908     };
27909     var action = function(graph) {
27910       ids.forEach(function(id2) {
27911         if (graph.hasEntity(id2)) {
27912           graph = actions[graph.entity(id2).type](id2)(graph);
27913         }
27914       });
27915       return graph;
27916     };
27917     return action;
27918   }
27919
27920   // modules/actions/delete_relation.js
27921   function actionDeleteRelation(relationID, allowUntaggedMembers) {
27922     function canDeleteEntity(entity, graph) {
27923       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
27924     }
27925     var action = function(graph) {
27926       var relation = graph.entity(relationID);
27927       graph.parentRelations(relation).forEach(function(parent) {
27928         parent = parent.removeMembersWithID(relationID);
27929         graph = graph.replace(parent);
27930         if (parent.isDegenerate()) {
27931           graph = actionDeleteRelation(parent.id)(graph);
27932         }
27933       });
27934       var memberIDs = utilArrayUniq(relation.members.map(function(m) {
27935         return m.id;
27936       }));
27937       memberIDs.forEach(function(memberID) {
27938         graph = graph.replace(relation.removeMembersWithID(memberID));
27939         var entity = graph.entity(memberID);
27940         if (canDeleteEntity(entity, graph)) {
27941           graph = actionDeleteMultiple([memberID])(graph);
27942         }
27943       });
27944       return graph.remove(relation);
27945     };
27946     return action;
27947   }
27948
27949   // modules/actions/delete_node.js
27950   function actionDeleteNode(nodeId) {
27951     var action = function(graph) {
27952       var node = graph.entity(nodeId);
27953       graph.parentWays(node).forEach(function(parent) {
27954         parent = parent.removeNode(nodeId);
27955         graph = graph.replace(parent);
27956         if (parent.isDegenerate()) {
27957           graph = actionDeleteWay(parent.id)(graph);
27958         }
27959       });
27960       graph.parentRelations(node).forEach(function(parent) {
27961         parent = parent.removeMembersWithID(nodeId);
27962         graph = graph.replace(parent);
27963         if (parent.isDegenerate()) {
27964           graph = actionDeleteRelation(parent.id)(graph);
27965         }
27966       });
27967       return graph.remove(node);
27968     };
27969     return action;
27970   }
27971
27972   // modules/actions/connect.js
27973   function actionConnect(nodeIDs) {
27974     var action = function(graph) {
27975       var survivor;
27976       var node;
27977       var parents;
27978       var i2, j2;
27979       nodeIDs.reverse();
27980       var interestingIDs = [];
27981       for (i2 = 0; i2 < nodeIDs.length; i2++) {
27982         node = graph.entity(nodeIDs[i2]);
27983         if (node.hasInterestingTags()) {
27984           if (!node.isNew()) {
27985             interestingIDs.push(node.id);
27986           }
27987         }
27988       }
27989       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
27990       for (i2 = 0; i2 < nodeIDs.length; i2++) {
27991         node = graph.entity(nodeIDs[i2]);
27992         if (node.id === survivor.id)
27993           continue;
27994         parents = graph.parentWays(node);
27995         for (j2 = 0; j2 < parents.length; j2++) {
27996           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
27997         }
27998         parents = graph.parentRelations(node);
27999         for (j2 = 0; j2 < parents.length; j2++) {
28000           graph = graph.replace(parents[j2].replaceMember(node, survivor));
28001         }
28002         survivor = survivor.mergeTags(node.tags);
28003         graph = actionDeleteNode(node.id)(graph);
28004       }
28005       graph = graph.replace(survivor);
28006       parents = graph.parentWays(survivor);
28007       for (i2 = 0; i2 < parents.length; i2++) {
28008         if (parents[i2].isDegenerate()) {
28009           graph = actionDeleteWay(parents[i2].id)(graph);
28010         }
28011       }
28012       return graph;
28013     };
28014     action.disabled = function(graph) {
28015       var seen = {};
28016       var restrictionIDs = [];
28017       var survivor;
28018       var node, way;
28019       var relations, relation, role;
28020       var i2, j2, k;
28021       survivor = graph.entity(utilOldestID(nodeIDs));
28022       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28023         node = graph.entity(nodeIDs[i2]);
28024         relations = graph.parentRelations(node);
28025         for (j2 = 0; j2 < relations.length; j2++) {
28026           relation = relations[j2];
28027           role = relation.memberById(node.id).role || "";
28028           if (relation.hasFromViaTo()) {
28029             restrictionIDs.push(relation.id);
28030           }
28031           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
28032             return "relation";
28033           } else {
28034             seen[relation.id] = role;
28035           }
28036         }
28037       }
28038       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28039         node = graph.entity(nodeIDs[i2]);
28040         var parents = graph.parentWays(node);
28041         for (j2 = 0; j2 < parents.length; j2++) {
28042           var parent = parents[j2];
28043           relations = graph.parentRelations(parent);
28044           for (k = 0; k < relations.length; k++) {
28045             relation = relations[k];
28046             if (relation.hasFromViaTo()) {
28047               restrictionIDs.push(relation.id);
28048             }
28049           }
28050         }
28051       }
28052       restrictionIDs = utilArrayUniq(restrictionIDs);
28053       for (i2 = 0; i2 < restrictionIDs.length; i2++) {
28054         relation = graph.entity(restrictionIDs[i2]);
28055         if (!relation.isComplete(graph))
28056           continue;
28057         var memberWays = relation.members.filter(function(m) {
28058           return m.type === "way";
28059         }).map(function(m) {
28060           return graph.entity(m.id);
28061         });
28062         memberWays = utilArrayUniq(memberWays);
28063         var f2 = relation.memberByRole("from");
28064         var t = relation.memberByRole("to");
28065         var isUturn = f2.id === t.id;
28066         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
28067         for (j2 = 0; j2 < relation.members.length; j2++) {
28068           collectNodes(relation.members[j2], nodes);
28069         }
28070         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
28071         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
28072         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
28073         nodes.from = nodes.from.filter(filter2);
28074         nodes.via = nodes.via.filter(filter2);
28075         nodes.to = nodes.to.filter(filter2);
28076         var connectFrom = false;
28077         var connectVia = false;
28078         var connectTo = false;
28079         var connectKeyFrom = false;
28080         var connectKeyTo = false;
28081         for (j2 = 0; j2 < nodeIDs.length; j2++) {
28082           var n2 = nodeIDs[j2];
28083           if (nodes.from.indexOf(n2) !== -1) {
28084             connectFrom = true;
28085           }
28086           if (nodes.via.indexOf(n2) !== -1) {
28087             connectVia = true;
28088           }
28089           if (nodes.to.indexOf(n2) !== -1) {
28090             connectTo = true;
28091           }
28092           if (nodes.keyfrom.indexOf(n2) !== -1) {
28093             connectKeyFrom = true;
28094           }
28095           if (nodes.keyto.indexOf(n2) !== -1) {
28096             connectKeyTo = true;
28097           }
28098         }
28099         if (connectFrom && connectTo && !isUturn) {
28100           return "restriction";
28101         }
28102         if (connectFrom && connectVia) {
28103           return "restriction";
28104         }
28105         if (connectTo && connectVia) {
28106           return "restriction";
28107         }
28108         if (connectKeyFrom || connectKeyTo) {
28109           if (nodeIDs.length !== 2) {
28110             return "restriction";
28111           }
28112           var n0 = null;
28113           var n1 = null;
28114           for (j2 = 0; j2 < memberWays.length; j2++) {
28115             way = memberWays[j2];
28116             if (way.contains(nodeIDs[0])) {
28117               n0 = nodeIDs[0];
28118             }
28119             if (way.contains(nodeIDs[1])) {
28120               n1 = nodeIDs[1];
28121             }
28122           }
28123           if (n0 && n1) {
28124             var ok = false;
28125             for (j2 = 0; j2 < memberWays.length; j2++) {
28126               way = memberWays[j2];
28127               if (way.areAdjacent(n0, n1)) {
28128                 ok = true;
28129                 break;
28130               }
28131             }
28132             if (!ok) {
28133               return "restriction";
28134             }
28135           }
28136         }
28137         for (j2 = 0; j2 < memberWays.length; j2++) {
28138           way = memberWays[j2].update({});
28139           for (k = 0; k < nodeIDs.length; k++) {
28140             if (nodeIDs[k] === survivor.id)
28141               continue;
28142             if (way.areAdjacent(nodeIDs[k], survivor.id)) {
28143               way = way.removeNode(nodeIDs[k]);
28144             } else {
28145               way = way.replaceNode(nodeIDs[k], survivor.id);
28146             }
28147           }
28148           if (way.isDegenerate()) {
28149             return "restriction";
28150           }
28151         }
28152       }
28153       return false;
28154       function hasDuplicates(n3, i3, arr) {
28155         return arr.indexOf(n3) !== arr.lastIndexOf(n3);
28156       }
28157       function keyNodeFilter(froms, tos) {
28158         return function(n3) {
28159           return froms.indexOf(n3) === -1 && tos.indexOf(n3) === -1;
28160         };
28161       }
28162       function collectNodes(member, collection) {
28163         var entity = graph.hasEntity(member.id);
28164         if (!entity)
28165           return;
28166         var role2 = member.role || "";
28167         if (!collection[role2]) {
28168           collection[role2] = [];
28169         }
28170         if (member.type === "node") {
28171           collection[role2].push(member.id);
28172           if (role2 === "via") {
28173             collection.keyfrom.push(member.id);
28174             collection.keyto.push(member.id);
28175           }
28176         } else if (member.type === "way") {
28177           collection[role2].push.apply(collection[role2], entity.nodes);
28178           if (role2 === "from" || role2 === "via") {
28179             collection.keyfrom.push(entity.first());
28180             collection.keyfrom.push(entity.last());
28181           }
28182           if (role2 === "to" || role2 === "via") {
28183             collection.keyto.push(entity.first());
28184             collection.keyto.push(entity.last());
28185           }
28186         }
28187       }
28188     };
28189     return action;
28190   }
28191
28192   // modules/actions/copy_entities.js
28193   function actionCopyEntities(ids, fromGraph) {
28194     var _copies = {};
28195     var action = function(graph) {
28196       ids.forEach(function(id3) {
28197         fromGraph.entity(id3).copy(fromGraph, _copies);
28198       });
28199       for (var id2 in _copies) {
28200         graph = graph.replace(_copies[id2]);
28201       }
28202       return graph;
28203     };
28204     action.copies = function() {
28205       return _copies;
28206     };
28207     return action;
28208   }
28209
28210   // modules/actions/delete_member.js
28211   function actionDeleteMember(relationId, memberIndex) {
28212     return function(graph) {
28213       var relation = graph.entity(relationId).removeMember(memberIndex);
28214       graph = graph.replace(relation);
28215       if (relation.isDegenerate()) {
28216         graph = actionDeleteRelation(relation.id)(graph);
28217       }
28218       return graph;
28219     };
28220   }
28221
28222   // modules/actions/discard_tags.js
28223   function actionDiscardTags(difference, discardTags) {
28224     discardTags = discardTags || {};
28225     return (graph) => {
28226       difference.modified().forEach(checkTags);
28227       difference.created().forEach(checkTags);
28228       return graph;
28229       function checkTags(entity) {
28230         const keys = Object.keys(entity.tags);
28231         let didDiscard = false;
28232         let tags = {};
28233         for (let i2 = 0; i2 < keys.length; i2++) {
28234           const k = keys[i2];
28235           if (discardTags[k] || !entity.tags[k]) {
28236             didDiscard = true;
28237           } else {
28238             tags[k] = entity.tags[k];
28239           }
28240         }
28241         if (didDiscard) {
28242           graph = graph.replace(entity.update({ tags }));
28243         }
28244       }
28245     };
28246   }
28247
28248   // modules/actions/disconnect.js
28249   function actionDisconnect(nodeId, newNodeId) {
28250     var wayIds;
28251     var disconnectableRelationTypes = {
28252       "associatedStreet": true,
28253       "enforcement": true,
28254       "site": true
28255     };
28256     var action = function(graph) {
28257       var node = graph.entity(nodeId);
28258       var connections = action.connections(graph);
28259       connections.forEach(function(connection) {
28260         var way = graph.entity(connection.wayID);
28261         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
28262         graph = graph.replace(newNode);
28263         if (connection.index === 0 && way.isArea()) {
28264           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
28265         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
28266           graph = graph.replace(way.unclose().addNode(newNode.id));
28267         } else {
28268           graph = graph.replace(way.updateNode(newNode.id, connection.index));
28269         }
28270       });
28271       return graph;
28272     };
28273     action.connections = function(graph) {
28274       var candidates = [];
28275       var keeping = false;
28276       var parentWays = graph.parentWays(graph.entity(nodeId));
28277       var way, waynode;
28278       for (var i2 = 0; i2 < parentWays.length; i2++) {
28279         way = parentWays[i2];
28280         if (wayIds && wayIds.indexOf(way.id) === -1) {
28281           keeping = true;
28282           continue;
28283         }
28284         if (way.isArea() && way.nodes[0] === nodeId) {
28285           candidates.push({ wayID: way.id, index: 0 });
28286         } else {
28287           for (var j2 = 0; j2 < way.nodes.length; j2++) {
28288             waynode = way.nodes[j2];
28289             if (waynode === nodeId) {
28290               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
28291                 continue;
28292               }
28293               candidates.push({ wayID: way.id, index: j2 });
28294             }
28295           }
28296         }
28297       }
28298       return keeping ? candidates : candidates.slice(1);
28299     };
28300     action.disabled = function(graph) {
28301       var connections = action.connections(graph);
28302       if (connections.length === 0)
28303         return "not_connected";
28304       var parentWays = graph.parentWays(graph.entity(nodeId));
28305       var seenRelationIds = {};
28306       var sharedRelation;
28307       parentWays.forEach(function(way) {
28308         var relations = graph.parentRelations(way);
28309         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
28310           if (relation.id in seenRelationIds) {
28311             if (wayIds) {
28312               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
28313                 sharedRelation = relation;
28314               }
28315             } else {
28316               sharedRelation = relation;
28317             }
28318           } else {
28319             seenRelationIds[relation.id] = way.id;
28320           }
28321         });
28322       });
28323       if (sharedRelation)
28324         return "relation";
28325     };
28326     action.limitWays = function(val) {
28327       if (!arguments.length)
28328         return wayIds;
28329       wayIds = val;
28330       return action;
28331     };
28332     return action;
28333   }
28334
28335   // modules/actions/extract.js
28336   function actionExtract(entityID, projection2) {
28337     var extractedNodeID;
28338     var action = function(graph) {
28339       var entity = graph.entity(entityID);
28340       if (entity.type === "node") {
28341         return extractFromNode(entity, graph);
28342       }
28343       return extractFromWayOrRelation(entity, graph);
28344     };
28345     function extractFromNode(node, graph) {
28346       extractedNodeID = node.id;
28347       var replacement = osmNode({ loc: node.loc });
28348       graph = graph.replace(replacement);
28349       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
28350         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
28351       }, graph);
28352       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
28353         return accGraph.replace(parentRel.replaceMember(node, replacement));
28354       }, graph);
28355     }
28356     function extractFromWayOrRelation(entity, graph) {
28357       var fromGeometry = entity.geometry(graph);
28358       var keysToCopyAndRetain = ["source", "wheelchair"];
28359       var keysToRetain = ["area"];
28360       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
28361       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
28362       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
28363       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
28364         extractedLoc = entity.extent(graph).center();
28365       }
28366       var indoorAreaValues = {
28367         area: true,
28368         corridor: true,
28369         elevator: true,
28370         level: true,
28371         room: true
28372       };
28373       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
28374       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
28375       var entityTags = Object.assign({}, entity.tags);
28376       var pointTags = {};
28377       for (var key in entityTags) {
28378         if (entity.type === "relation" && key === "type") {
28379           continue;
28380         }
28381         if (keysToRetain.indexOf(key) !== -1) {
28382           continue;
28383         }
28384         if (isBuilding) {
28385           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
28386             continue;
28387         }
28388         if (isIndoorArea && key === "indoor") {
28389           continue;
28390         }
28391         pointTags[key] = entityTags[key];
28392         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
28393           continue;
28394         } else if (isIndoorArea && key === "level") {
28395           continue;
28396         }
28397         delete entityTags[key];
28398       }
28399       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
28400         entityTags.area = "yes";
28401       }
28402       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
28403       graph = graph.replace(replacement);
28404       extractedNodeID = replacement.id;
28405       return graph.replace(entity.update({ tags: entityTags }));
28406     }
28407     action.getExtractedNodeID = function() {
28408       return extractedNodeID;
28409     };
28410     return action;
28411   }
28412
28413   // modules/actions/join.js
28414   function actionJoin(ids) {
28415     function groupEntitiesByGeometry(graph) {
28416       var entities = ids.map(function(id2) {
28417         return graph.entity(id2);
28418       });
28419       return Object.assign({ line: [] }, utilArrayGroupBy(entities, function(entity) {
28420         return entity.geometry(graph);
28421       }));
28422     }
28423     var action = function(graph) {
28424       var ways = ids.map(graph.entity, graph);
28425       var survivorID = utilOldestID(ways.map((way) => way.id));
28426       ways.sort(function(a, b) {
28427         var aSided = a.isSided();
28428         var bSided = b.isSided();
28429         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
28430       });
28431       var sequences = osmJoinWays(ways, graph);
28432       var joined = sequences[0];
28433       graph = sequences.actions.reduce(function(g, action2) {
28434         return action2(g);
28435       }, graph);
28436       var survivor = graph.entity(survivorID);
28437       survivor = survivor.update({ nodes: joined.nodes.map(function(n2) {
28438         return n2.id;
28439       }) });
28440       graph = graph.replace(survivor);
28441       joined.forEach(function(way) {
28442         if (way.id === survivorID)
28443           return;
28444         graph.parentRelations(way).forEach(function(parent) {
28445           graph = graph.replace(parent.replaceMember(way, survivor));
28446         });
28447         survivor = survivor.mergeTags(way.tags);
28448         graph = graph.replace(survivor);
28449         graph = actionDeleteWay(way.id)(graph);
28450       });
28451       function checkForSimpleMultipolygon() {
28452         if (!survivor.isClosed())
28453           return;
28454         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
28455           return multipolygon2.members.length === 1;
28456         });
28457         if (multipolygons.length !== 1)
28458           return;
28459         var multipolygon = multipolygons[0];
28460         for (var key in survivor.tags) {
28461           if (multipolygon.tags[key] && multipolygon.tags[key] !== survivor.tags[key])
28462             return;
28463         }
28464         survivor = survivor.mergeTags(multipolygon.tags);
28465         graph = graph.replace(survivor);
28466         graph = actionDeleteRelation(multipolygon.id, true)(graph);
28467         var tags = Object.assign({}, survivor.tags);
28468         if (survivor.geometry(graph) !== "area") {
28469           tags.area = "yes";
28470         }
28471         delete tags.type;
28472         survivor = survivor.update({ tags });
28473         graph = graph.replace(survivor);
28474       }
28475       checkForSimpleMultipolygon();
28476       return graph;
28477     };
28478     action.resultingWayNodesLength = function(graph) {
28479       return ids.reduce(function(count, id2) {
28480         return count + graph.entity(id2).nodes.length;
28481       }, 0) - ids.length - 1;
28482     };
28483     action.disabled = function(graph) {
28484       var geometries = groupEntitiesByGeometry(graph);
28485       if (ids.length < 2 || ids.length !== geometries.line.length) {
28486         return "not_eligible";
28487       }
28488       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
28489       if (joined.length > 1) {
28490         return "not_adjacent";
28491       }
28492       var i2;
28493       var sortedParentRelations = function(id2) {
28494         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a, b) => a.id - b.id);
28495       };
28496       var relsA = sortedParentRelations(ids[0]);
28497       for (i2 = 1; i2 < ids.length; i2++) {
28498         var relsB = sortedParentRelations(ids[i2]);
28499         if (!utilArrayIdentical(relsA, relsB)) {
28500           return "conflicting_relations";
28501         }
28502       }
28503       for (i2 = 0; i2 < ids.length - 1; i2++) {
28504         for (var j2 = i2 + 1; j2 < ids.length; j2++) {
28505           var path1 = graph.childNodes(graph.entity(ids[i2])).map(function(e) {
28506             return e.loc;
28507           });
28508           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e) {
28509             return e.loc;
28510           });
28511           var intersections = geoPathIntersections(path1, path2);
28512           var common = utilArrayIntersection(joined[0].nodes.map(function(n2) {
28513             return n2.loc.toString();
28514           }), intersections.map(function(n2) {
28515             return n2.toString();
28516           }));
28517           if (common.length !== intersections.length) {
28518             return "paths_intersect";
28519           }
28520         }
28521       }
28522       var nodeIds = joined[0].nodes.map(function(n2) {
28523         return n2.id;
28524       }).slice(1, -1);
28525       var relation;
28526       var tags = {};
28527       var conflicting = false;
28528       joined[0].forEach(function(way) {
28529         var parents = graph.parentRelations(way);
28530         parents.forEach(function(parent) {
28531           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m) {
28532             return nodeIds.indexOf(m.id) >= 0;
28533           })) {
28534             relation = parent;
28535           }
28536         });
28537         for (var k in way.tags) {
28538           if (!(k in tags)) {
28539             tags[k] = way.tags[k];
28540           } else if (tags[k] && osmIsInterestingTag(k) && tags[k] !== way.tags[k]) {
28541             conflicting = true;
28542           }
28543         }
28544       });
28545       if (relation) {
28546         return relation.isRestriction() ? "restriction" : "connectivity";
28547       }
28548       if (conflicting) {
28549         return "conflicting_tags";
28550       }
28551     };
28552     return action;
28553   }
28554
28555   // modules/actions/merge.js
28556   function actionMerge(ids) {
28557     function groupEntitiesByGeometry(graph) {
28558       var entities = ids.map(function(id2) {
28559         return graph.entity(id2);
28560       });
28561       return Object.assign({ point: [], area: [], line: [], relation: [] }, utilArrayGroupBy(entities, function(entity) {
28562         return entity.geometry(graph);
28563       }));
28564     }
28565     var action = function(graph) {
28566       var geometries = groupEntitiesByGeometry(graph);
28567       var target = geometries.area[0] || geometries.line[0];
28568       var points = geometries.point;
28569       points.forEach(function(point) {
28570         target = target.mergeTags(point.tags);
28571         graph = graph.replace(target);
28572         graph.parentRelations(point).forEach(function(parent) {
28573           graph = graph.replace(parent.replaceMember(point, target));
28574         });
28575         var nodes = utilArrayUniq(graph.childNodes(target));
28576         var removeNode = point;
28577         if (!point.isNew()) {
28578           var inserted = false;
28579           var canBeReplaced = function(node2) {
28580             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
28581           };
28582           var replaceNode = function(node2) {
28583             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
28584             target = target.replaceNode(node2.id, point.id);
28585             graph = graph.replace(target);
28586             removeNode = node2;
28587             inserted = true;
28588           };
28589           var i2;
28590           var node;
28591           for (i2 = 0; i2 < nodes.length; i2++) {
28592             node = nodes[i2];
28593             if (canBeReplaced(node) && node.isNew()) {
28594               replaceNode(node);
28595               break;
28596             }
28597           }
28598           if (!inserted && point.hasInterestingTags()) {
28599             for (i2 = 0; i2 < nodes.length; i2++) {
28600               node = nodes[i2];
28601               if (canBeReplaced(node) && !node.hasInterestingTags()) {
28602                 replaceNode(node);
28603                 break;
28604               }
28605             }
28606             if (!inserted) {
28607               for (i2 = 0; i2 < nodes.length; i2++) {
28608                 node = nodes[i2];
28609                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
28610                   replaceNode(node);
28611                   break;
28612                 }
28613               }
28614             }
28615           }
28616         }
28617         graph = graph.remove(removeNode);
28618       });
28619       if (target.tags.area === "yes") {
28620         var tags = Object.assign({}, target.tags);
28621         delete tags.area;
28622         if (osmTagSuggestingArea(tags)) {
28623           target = target.update({ tags });
28624           graph = graph.replace(target);
28625         }
28626       }
28627       return graph;
28628     };
28629     action.disabled = function(graph) {
28630       var geometries = groupEntitiesByGeometry(graph);
28631       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
28632         return "not_eligible";
28633       }
28634     };
28635     return action;
28636   }
28637
28638   // modules/actions/merge_nodes.js
28639   function actionMergeNodes(nodeIDs, loc) {
28640     function chooseLoc(graph) {
28641       if (!nodeIDs.length)
28642         return null;
28643       var sum = [0, 0];
28644       var interestingCount = 0;
28645       var interestingLoc;
28646       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28647         var node = graph.entity(nodeIDs[i2]);
28648         if (node.hasInterestingTags()) {
28649           interestingLoc = ++interestingCount === 1 ? node.loc : null;
28650         }
28651         sum = geoVecAdd(sum, node.loc);
28652       }
28653       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
28654     }
28655     var action = function(graph) {
28656       if (nodeIDs.length < 2)
28657         return graph;
28658       var toLoc = loc;
28659       if (!toLoc) {
28660         toLoc = chooseLoc(graph);
28661       }
28662       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28663         var node = graph.entity(nodeIDs[i2]);
28664         if (node.loc !== toLoc) {
28665           graph = graph.replace(node.move(toLoc));
28666         }
28667       }
28668       return actionConnect(nodeIDs)(graph);
28669     };
28670     action.disabled = function(graph) {
28671       if (nodeIDs.length < 2)
28672         return "not_eligible";
28673       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28674         var entity = graph.entity(nodeIDs[i2]);
28675         if (entity.type !== "node")
28676           return "not_eligible";
28677       }
28678       return actionConnect(nodeIDs).disabled(graph);
28679     };
28680     return action;
28681   }
28682
28683   // modules/osm/changeset.js
28684   function osmChangeset() {
28685     if (!(this instanceof osmChangeset)) {
28686       return new osmChangeset().initialize(arguments);
28687     } else if (arguments.length) {
28688       this.initialize(arguments);
28689     }
28690   }
28691   osmEntity.changeset = osmChangeset;
28692   osmChangeset.prototype = Object.create(osmEntity.prototype);
28693   Object.assign(osmChangeset.prototype, {
28694     type: "changeset",
28695     extent: function() {
28696       return new geoExtent();
28697     },
28698     geometry: function() {
28699       return "changeset";
28700     },
28701     asJXON: function() {
28702       return {
28703         osm: {
28704           changeset: {
28705             tag: Object.keys(this.tags).map(function(k) {
28706               return { "@k": k, "@v": this.tags[k] };
28707             }, this),
28708             "@version": 0.6,
28709             "@generator": "iD"
28710           }
28711         }
28712       };
28713     },
28714     osmChangeJXON: function(changes) {
28715       var changeset_id = this.id;
28716       function nest(x, order) {
28717         var groups = {};
28718         for (var i2 = 0; i2 < x.length; i2++) {
28719           var tagName = Object.keys(x[i2])[0];
28720           if (!groups[tagName])
28721             groups[tagName] = [];
28722           groups[tagName].push(x[i2][tagName]);
28723         }
28724         var ordered = {};
28725         order.forEach(function(o) {
28726           if (groups[o])
28727             ordered[o] = groups[o];
28728         });
28729         return ordered;
28730       }
28731       function sort(changes2) {
28732         function resolve(item) {
28733           return relations.find(function(relation2) {
28734             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
28735           });
28736         }
28737         function isNew(item) {
28738           return !sorted[item["@id"]] && !processing.find(function(proc) {
28739             return proc["@id"] === item["@id"];
28740           });
28741         }
28742         var processing = [];
28743         var sorted = {};
28744         var relations = changes2.relation;
28745         if (!relations)
28746           return changes2;
28747         for (var i2 = 0; i2 < relations.length; i2++) {
28748           var relation = relations[i2];
28749           if (!sorted[relation["@id"]]) {
28750             processing.push(relation);
28751           }
28752           while (processing.length > 0) {
28753             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
28754             if (deps.length === 0) {
28755               sorted[next["@id"]] = next;
28756               processing.shift();
28757             } else {
28758               processing = deps.concat(processing);
28759             }
28760           }
28761         }
28762         changes2.relation = Object.values(sorted);
28763         return changes2;
28764       }
28765       function rep2(entity) {
28766         return entity.asJXON(changeset_id);
28767       }
28768       return {
28769         osmChange: {
28770           "@version": 0.6,
28771           "@generator": "iD",
28772           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
28773           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
28774           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
28775         }
28776       };
28777     },
28778     asGeoJSON: function() {
28779       return {};
28780     }
28781   });
28782
28783   // modules/osm/note.js
28784   function osmNote() {
28785     if (!(this instanceof osmNote)) {
28786       return new osmNote().initialize(arguments);
28787     } else if (arguments.length) {
28788       this.initialize(arguments);
28789     }
28790   }
28791   osmNote.id = function() {
28792     return osmNote.id.next--;
28793   };
28794   osmNote.id.next = -1;
28795   Object.assign(osmNote.prototype, {
28796     type: "note",
28797     initialize: function(sources) {
28798       for (var i2 = 0; i2 < sources.length; ++i2) {
28799         var source = sources[i2];
28800         for (var prop in source) {
28801           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28802             if (source[prop] === void 0) {
28803               delete this[prop];
28804             } else {
28805               this[prop] = source[prop];
28806             }
28807           }
28808         }
28809       }
28810       if (!this.id) {
28811         this.id = osmNote.id().toString();
28812       }
28813       return this;
28814     },
28815     extent: function() {
28816       return new geoExtent(this.loc);
28817     },
28818     update: function(attrs) {
28819       return osmNote(this, attrs);
28820     },
28821     isNew: function() {
28822       return this.id < 0;
28823     },
28824     move: function(loc) {
28825       return this.update({ loc });
28826     }
28827   });
28828
28829   // modules/osm/relation.js
28830   function osmRelation() {
28831     if (!(this instanceof osmRelation)) {
28832       return new osmRelation().initialize(arguments);
28833     } else if (arguments.length) {
28834       this.initialize(arguments);
28835     }
28836   }
28837   osmEntity.relation = osmRelation;
28838   osmRelation.prototype = Object.create(osmEntity.prototype);
28839   osmRelation.creationOrder = function(a, b) {
28840     var aId = parseInt(osmEntity.id.toOSM(a.id), 10);
28841     var bId = parseInt(osmEntity.id.toOSM(b.id), 10);
28842     if (aId < 0 || bId < 0)
28843       return aId - bId;
28844     return bId - aId;
28845   };
28846   Object.assign(osmRelation.prototype, {
28847     type: "relation",
28848     members: [],
28849     copy: function(resolver, copies) {
28850       if (copies[this.id])
28851         return copies[this.id];
28852       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
28853       var members = this.members.map(function(member) {
28854         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
28855       });
28856       copy2 = copy2.update({ members });
28857       copies[this.id] = copy2;
28858       return copy2;
28859     },
28860     extent: function(resolver, memo) {
28861       return resolver.transient(this, "extent", function() {
28862         if (memo && memo[this.id])
28863           return geoExtent();
28864         memo = memo || {};
28865         memo[this.id] = true;
28866         var extent = geoExtent();
28867         for (var i2 = 0; i2 < this.members.length; i2++) {
28868           var member = resolver.hasEntity(this.members[i2].id);
28869           if (member) {
28870             extent._extend(member.extent(resolver, memo));
28871           }
28872         }
28873         return extent;
28874       });
28875     },
28876     geometry: function(graph) {
28877       return graph.transient(this, "geometry", function() {
28878         return this.isMultipolygon() ? "area" : "relation";
28879       });
28880     },
28881     isDegenerate: function() {
28882       return this.members.length === 0;
28883     },
28884     indexedMembers: function() {
28885       var result = new Array(this.members.length);
28886       for (var i2 = 0; i2 < this.members.length; i2++) {
28887         result[i2] = Object.assign({}, this.members[i2], { index: i2 });
28888       }
28889       return result;
28890     },
28891     memberByRole: function(role) {
28892       for (var i2 = 0; i2 < this.members.length; i2++) {
28893         if (this.members[i2].role === role) {
28894           return Object.assign({}, this.members[i2], { index: i2 });
28895         }
28896       }
28897     },
28898     membersByRole: function(role) {
28899       var result = [];
28900       for (var i2 = 0; i2 < this.members.length; i2++) {
28901         if (this.members[i2].role === role) {
28902           result.push(Object.assign({}, this.members[i2], { index: i2 }));
28903         }
28904       }
28905       return result;
28906     },
28907     memberById: function(id2) {
28908       for (var i2 = 0; i2 < this.members.length; i2++) {
28909         if (this.members[i2].id === id2) {
28910           return Object.assign({}, this.members[i2], { index: i2 });
28911         }
28912       }
28913     },
28914     memberByIdAndRole: function(id2, role) {
28915       for (var i2 = 0; i2 < this.members.length; i2++) {
28916         if (this.members[i2].id === id2 && this.members[i2].role === role) {
28917           return Object.assign({}, this.members[i2], { index: i2 });
28918         }
28919       }
28920     },
28921     addMember: function(member, index) {
28922       var members = this.members.slice();
28923       members.splice(index === void 0 ? members.length : index, 0, member);
28924       return this.update({ members });
28925     },
28926     updateMember: function(member, index) {
28927       var members = this.members.slice();
28928       members.splice(index, 1, Object.assign({}, members[index], member));
28929       return this.update({ members });
28930     },
28931     removeMember: function(index) {
28932       var members = this.members.slice();
28933       members.splice(index, 1);
28934       return this.update({ members });
28935     },
28936     removeMembersWithID: function(id2) {
28937       var members = this.members.filter(function(m) {
28938         return m.id !== id2;
28939       });
28940       return this.update({ members });
28941     },
28942     moveMember: function(fromIndex, toIndex) {
28943       var members = this.members.slice();
28944       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
28945       return this.update({ members });
28946     },
28947     replaceMember: function(needle, replacement, keepDuplicates) {
28948       if (!this.memberById(needle.id))
28949         return this;
28950       var members = [];
28951       for (var i2 = 0; i2 < this.members.length; i2++) {
28952         var member = this.members[i2];
28953         if (member.id !== needle.id) {
28954           members.push(member);
28955         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
28956           members.push({ id: replacement.id, type: replacement.type, role: member.role });
28957         }
28958       }
28959       return this.update({ members });
28960     },
28961     asJXON: function(changeset_id) {
28962       var r = {
28963         relation: {
28964           "@id": this.osmId(),
28965           "@version": this.version || 0,
28966           member: this.members.map(function(member) {
28967             return {
28968               keyAttributes: {
28969                 type: member.type,
28970                 role: member.role,
28971                 ref: osmEntity.id.toOSM(member.id)
28972               }
28973             };
28974           }, this),
28975           tag: Object.keys(this.tags).map(function(k) {
28976             return { keyAttributes: { k, v: this.tags[k] } };
28977           }, this)
28978         }
28979       };
28980       if (changeset_id) {
28981         r.relation["@changeset"] = changeset_id;
28982       }
28983       return r;
28984     },
28985     asGeoJSON: function(resolver) {
28986       return resolver.transient(this, "GeoJSON", function() {
28987         if (this.isMultipolygon()) {
28988           return {
28989             type: "MultiPolygon",
28990             coordinates: this.multipolygon(resolver)
28991           };
28992         } else {
28993           return {
28994             type: "FeatureCollection",
28995             properties: this.tags,
28996             features: this.members.map(function(member) {
28997               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
28998             })
28999           };
29000         }
29001       });
29002     },
29003     area: function(resolver) {
29004       return resolver.transient(this, "area", function() {
29005         return area_default(this.asGeoJSON(resolver));
29006       });
29007     },
29008     isMultipolygon: function() {
29009       return this.tags.type === "multipolygon";
29010     },
29011     isComplete: function(resolver) {
29012       for (var i2 = 0; i2 < this.members.length; i2++) {
29013         if (!resolver.hasEntity(this.members[i2].id)) {
29014           return false;
29015         }
29016       }
29017       return true;
29018     },
29019     hasFromViaTo: function() {
29020       return this.members.some(function(m) {
29021         return m.role === "from";
29022       }) && this.members.some(function(m) {
29023         return m.role === "via";
29024       }) && this.members.some(function(m) {
29025         return m.role === "to";
29026       });
29027     },
29028     isRestriction: function() {
29029       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
29030     },
29031     isValidRestriction: function() {
29032       if (!this.isRestriction())
29033         return false;
29034       var froms = this.members.filter(function(m) {
29035         return m.role === "from";
29036       });
29037       var vias = this.members.filter(function(m) {
29038         return m.role === "via";
29039       });
29040       var tos = this.members.filter(function(m) {
29041         return m.role === "to";
29042       });
29043       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
29044         return false;
29045       if (froms.some(function(m) {
29046         return m.type !== "way";
29047       }))
29048         return false;
29049       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
29050         return false;
29051       if (tos.some(function(m) {
29052         return m.type !== "way";
29053       }))
29054         return false;
29055       if (vias.length === 0)
29056         return false;
29057       if (vias.length > 1 && vias.some(function(m) {
29058         return m.type !== "way";
29059       }))
29060         return false;
29061       return true;
29062     },
29063     isConnectivity: function() {
29064       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
29065     },
29066     multipolygon: function(resolver) {
29067       var outers = this.members.filter(function(m) {
29068         return (m.role || "outer") === "outer";
29069       });
29070       var inners = this.members.filter(function(m) {
29071         return m.role === "inner";
29072       });
29073       outers = osmJoinWays(outers, resolver);
29074       inners = osmJoinWays(inners, resolver);
29075       var sequenceToLineString = function(sequence) {
29076         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
29077           sequence.nodes.push(sequence.nodes[0]);
29078         }
29079         return sequence.nodes.map(function(node) {
29080           return node.loc;
29081         });
29082       };
29083       outers = outers.map(sequenceToLineString);
29084       inners = inners.map(sequenceToLineString);
29085       var result = outers.map(function(o2) {
29086         return [area_default({ type: "Polygon", coordinates: [o2] }) > 2 * Math.PI ? o2.reverse() : o2];
29087       });
29088       function findOuter(inner2) {
29089         var o2, outer;
29090         for (o2 = 0; o2 < outers.length; o2++) {
29091           outer = outers[o2];
29092           if (geoPolygonContainsPolygon(outer, inner2)) {
29093             return o2;
29094           }
29095         }
29096         for (o2 = 0; o2 < outers.length; o2++) {
29097           outer = outers[o2];
29098           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
29099             return o2;
29100           }
29101         }
29102       }
29103       for (var i2 = 0; i2 < inners.length; i2++) {
29104         var inner = inners[i2];
29105         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
29106           inner = inner.reverse();
29107         }
29108         var o = findOuter(inners[i2]);
29109         if (o !== void 0) {
29110           result[o].push(inners[i2]);
29111         } else {
29112           result.push([inners[i2]]);
29113         }
29114       }
29115       return result;
29116     }
29117   });
29118
29119   // modules/osm/qa_item.js
29120   var QAItem = class {
29121     constructor(loc, service, itemType, id2, props) {
29122       this.loc = loc;
29123       this.service = service.title;
29124       this.itemType = itemType;
29125       this.id = id2 ? id2 : `${QAItem.id()}`;
29126       this.update(props);
29127       if (service && typeof service.getIcon === "function") {
29128         this.icon = service.getIcon(itemType);
29129       }
29130     }
29131     update(props) {
29132       const { loc, service, itemType, id: id2 } = this;
29133       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
29134       this.loc = loc;
29135       this.service = service;
29136       this.itemType = itemType;
29137       this.id = id2;
29138       return this;
29139     }
29140     static id() {
29141       return this.nextId--;
29142     }
29143   };
29144   QAItem.nextId = -1;
29145
29146   // modules/actions/split.js
29147   function actionSplit(nodeIds, newWayIds) {
29148     if (typeof nodeIds === "string")
29149       nodeIds = [nodeIds];
29150     var _wayIDs;
29151     var _keepHistoryOn = "longest";
29152     var _createdWayIDs = [];
29153     function dist(graph, nA, nB) {
29154       var locA = graph.entity(nA).loc;
29155       var locB = graph.entity(nB).loc;
29156       var epsilon3 = 1e-6;
29157       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
29158     }
29159     function splitArea(nodes, idxA, graph) {
29160       var lengths = new Array(nodes.length);
29161       var length;
29162       var i2;
29163       var best = 0;
29164       var idxB;
29165       function wrap2(index) {
29166         return utilWrap(index, nodes.length);
29167       }
29168       length = 0;
29169       for (i2 = wrap2(idxA + 1); i2 !== idxA; i2 = wrap2(i2 + 1)) {
29170         length += dist(graph, nodes[i2], nodes[wrap2(i2 - 1)]);
29171         lengths[i2] = length;
29172       }
29173       length = 0;
29174       for (i2 = wrap2(idxA - 1); i2 !== idxA; i2 = wrap2(i2 - 1)) {
29175         length += dist(graph, nodes[i2], nodes[wrap2(i2 + 1)]);
29176         if (length < lengths[i2]) {
29177           lengths[i2] = length;
29178         }
29179       }
29180       for (i2 = 0; i2 < nodes.length; i2++) {
29181         var cost = lengths[i2] / dist(graph, nodes[idxA], nodes[i2]);
29182         if (cost > best) {
29183           idxB = i2;
29184           best = cost;
29185         }
29186       }
29187       return idxB;
29188     }
29189     function totalLengthBetweenNodes(graph, nodes) {
29190       var totalLength = 0;
29191       for (var i2 = 0; i2 < nodes.length - 1; i2++) {
29192         totalLength += dist(graph, nodes[i2], nodes[i2 + 1]);
29193       }
29194       return totalLength;
29195     }
29196     function split(graph, nodeId, wayA, newWayId) {
29197       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
29198       var origNodes = wayA.nodes.slice();
29199       var nodesA;
29200       var nodesB;
29201       var isArea = wayA.isArea();
29202       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
29203       if (wayA.isClosed()) {
29204         var nodes = wayA.nodes.slice(0, -1);
29205         var idxA = nodes.indexOf(nodeId);
29206         var idxB = splitArea(nodes, idxA, graph);
29207         if (idxB < idxA) {
29208           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
29209           nodesB = nodes.slice(idxB, idxA + 1);
29210         } else {
29211           nodesA = nodes.slice(idxA, idxB + 1);
29212           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
29213         }
29214       } else {
29215         var idx = wayA.nodes.indexOf(nodeId, 1);
29216         nodesA = wayA.nodes.slice(0, idx + 1);
29217         nodesB = wayA.nodes.slice(idx);
29218       }
29219       var lengthA = totalLengthBetweenNodes(graph, nodesA);
29220       var lengthB = totalLengthBetweenNodes(graph, nodesB);
29221       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
29222         wayA = wayA.update({ nodes: nodesB });
29223         wayB = wayB.update({ nodes: nodesA });
29224         var temp = lengthA;
29225         lengthA = lengthB;
29226         lengthB = temp;
29227       } else {
29228         wayA = wayA.update({ nodes: nodesA });
29229         wayB = wayB.update({ nodes: nodesB });
29230       }
29231       if (wayA.tags.step_count) {
29232         var stepCount = parseFloat(wayA.tags.step_count);
29233         if (stepCount && isFinite(stepCount) && stepCount > 0 && Math.round(stepCount) === stepCount) {
29234           var tagsA = Object.assign({}, wayA.tags);
29235           var tagsB = Object.assign({}, wayB.tags);
29236           var ratioA = lengthA / (lengthA + lengthB);
29237           var countA = Math.round(stepCount * ratioA);
29238           tagsA.step_count = countA.toString();
29239           tagsB.step_count = (stepCount - countA).toString();
29240           wayA = wayA.update({ tags: tagsA });
29241           wayB = wayB.update({ tags: tagsB });
29242         }
29243       }
29244       graph = graph.replace(wayA);
29245       graph = graph.replace(wayB);
29246       graph.parentRelations(wayA).forEach(function(relation) {
29247         var member;
29248         if (relation.hasFromViaTo()) {
29249           var f2 = relation.memberByRole("from");
29250           var v = relation.membersByRole("via");
29251           var t = relation.memberByRole("to");
29252           var i2;
29253           if (f2.id === wayA.id || t.id === wayA.id) {
29254             var keepB = false;
29255             if (v.length === 1 && v[0].type === "node") {
29256               keepB = wayB.contains(v[0].id);
29257             } else {
29258               for (i2 = 0; i2 < v.length; i2++) {
29259                 if (v[i2].type === "way") {
29260                   var wayVia = graph.hasEntity(v[i2].id);
29261                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
29262                     keepB = true;
29263                     break;
29264                   }
29265                 }
29266               }
29267             }
29268             if (keepB) {
29269               relation = relation.replaceMember(wayA, wayB);
29270               graph = graph.replace(relation);
29271             }
29272           } else {
29273             for (i2 = 0; i2 < v.length; i2++) {
29274               if (v[i2].type === "way" && v[i2].id === wayA.id) {
29275                 member = {
29276                   id: wayB.id,
29277                   type: "way",
29278                   role: "via"
29279                 };
29280                 graph = actionAddMember(relation.id, member, v[i2].index + 1)(graph);
29281                 break;
29282               }
29283             }
29284           }
29285         } else {
29286           if (relation === isOuter) {
29287             graph = graph.replace(relation.mergeTags(wayA.tags));
29288             graph = graph.replace(wayA.update({ tags: {} }));
29289             graph = graph.replace(wayB.update({ tags: {} }));
29290           }
29291           member = {
29292             id: wayB.id,
29293             type: "way",
29294             role: relation.memberById(wayA.id).role
29295           };
29296           var insertPair = {
29297             originalID: wayA.id,
29298             insertedID: wayB.id,
29299             nodes: origNodes
29300           };
29301           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
29302         }
29303       });
29304       if (!isOuter && isArea) {
29305         var multipolygon = osmRelation({
29306           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
29307           members: [
29308             { id: wayA.id, role: "outer", type: "way" },
29309             { id: wayB.id, role: "outer", type: "way" }
29310           ]
29311         });
29312         graph = graph.replace(multipolygon);
29313         graph = graph.replace(wayA.update({ tags: {} }));
29314         graph = graph.replace(wayB.update({ tags: {} }));
29315       }
29316       _createdWayIDs.push(wayB.id);
29317       return graph;
29318     }
29319     var action = function(graph) {
29320       _createdWayIDs = [];
29321       var newWayIndex = 0;
29322       for (var i2 = 0; i2 < nodeIds.length; i2++) {
29323         var nodeId = nodeIds[i2];
29324         var candidates = action.waysForNode(nodeId, graph);
29325         for (var j2 = 0; j2 < candidates.length; j2++) {
29326           graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
29327           newWayIndex += 1;
29328         }
29329       }
29330       return graph;
29331     };
29332     action.getCreatedWayIDs = function() {
29333       return _createdWayIDs;
29334     };
29335     action.waysForNode = function(nodeId, graph) {
29336       var node = graph.entity(nodeId);
29337       var splittableParents = graph.parentWays(node).filter(isSplittable);
29338       if (!_wayIDs) {
29339         var hasLine = splittableParents.some(function(parent) {
29340           return parent.geometry(graph) === "line";
29341         });
29342         if (hasLine) {
29343           return splittableParents.filter(function(parent) {
29344             return parent.geometry(graph) === "line";
29345           });
29346         }
29347       }
29348       return splittableParents;
29349       function isSplittable(parent) {
29350         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
29351           return false;
29352         if (parent.isClosed())
29353           return true;
29354         for (var i2 = 1; i2 < parent.nodes.length - 1; i2++) {
29355           if (parent.nodes[i2] === nodeId)
29356             return true;
29357         }
29358         return false;
29359       }
29360     };
29361     action.ways = function(graph) {
29362       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
29363         return action.waysForNode(nodeId, graph);
29364       })));
29365     };
29366     action.disabled = function(graph) {
29367       for (var i2 = 0; i2 < nodeIds.length; i2++) {
29368         var nodeId = nodeIds[i2];
29369         var candidates = action.waysForNode(nodeId, graph);
29370         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
29371           return "not_eligible";
29372         }
29373       }
29374     };
29375     action.limitWays = function(val) {
29376       if (!arguments.length)
29377         return _wayIDs;
29378       _wayIDs = val;
29379       return action;
29380     };
29381     action.keepHistoryOn = function(val) {
29382       if (!arguments.length)
29383         return _keepHistoryOn;
29384       _keepHistoryOn = val;
29385       return action;
29386     };
29387     return action;
29388   }
29389
29390   // modules/core/graph.js
29391   function coreGraph(other, mutable) {
29392     if (!(this instanceof coreGraph))
29393       return new coreGraph(other, mutable);
29394     if (other instanceof coreGraph) {
29395       var base = other.base();
29396       this.entities = Object.assign(Object.create(base.entities), other.entities);
29397       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
29398       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
29399     } else {
29400       this.entities = /* @__PURE__ */ Object.create({});
29401       this._parentWays = /* @__PURE__ */ Object.create({});
29402       this._parentRels = /* @__PURE__ */ Object.create({});
29403       this.rebase(other || [], [this]);
29404     }
29405     this.transients = {};
29406     this._childNodes = {};
29407     this.frozen = !mutable;
29408   }
29409   coreGraph.prototype = {
29410     hasEntity: function(id2) {
29411       return this.entities[id2];
29412     },
29413     entity: function(id2) {
29414       var entity = this.entities[id2];
29415       if (!entity) {
29416         entity = this.entities.__proto__[id2];
29417       }
29418       if (!entity) {
29419         throw new Error("entity " + id2 + " not found");
29420       }
29421       return entity;
29422     },
29423     geometry: function(id2) {
29424       return this.entity(id2).geometry(this);
29425     },
29426     transient: function(entity, key, fn) {
29427       var id2 = entity.id;
29428       var transients = this.transients[id2] || (this.transients[id2] = {});
29429       if (transients[key] !== void 0) {
29430         return transients[key];
29431       }
29432       transients[key] = fn.call(entity);
29433       return transients[key];
29434     },
29435     parentWays: function(entity) {
29436       var parents = this._parentWays[entity.id];
29437       var result = [];
29438       if (parents) {
29439         parents.forEach(function(id2) {
29440           result.push(this.entity(id2));
29441         }, this);
29442       }
29443       return result;
29444     },
29445     isPoi: function(entity) {
29446       var parents = this._parentWays[entity.id];
29447       return !parents || parents.size === 0;
29448     },
29449     isShared: function(entity) {
29450       var parents = this._parentWays[entity.id];
29451       return parents && parents.size > 1;
29452     },
29453     parentRelations: function(entity) {
29454       var parents = this._parentRels[entity.id];
29455       var result = [];
29456       if (parents) {
29457         parents.forEach(function(id2) {
29458           result.push(this.entity(id2));
29459         }, this);
29460       }
29461       return result;
29462     },
29463     parentMultipolygons: function(entity) {
29464       return this.parentRelations(entity).filter(function(relation) {
29465         return relation.isMultipolygon();
29466       });
29467     },
29468     childNodes: function(entity) {
29469       if (this._childNodes[entity.id])
29470         return this._childNodes[entity.id];
29471       if (!entity.nodes)
29472         return [];
29473       var nodes = [];
29474       for (var i2 = 0; i2 < entity.nodes.length; i2++) {
29475         nodes[i2] = this.entity(entity.nodes[i2]);
29476       }
29477       if (debug)
29478         Object.freeze(nodes);
29479       this._childNodes[entity.id] = nodes;
29480       return this._childNodes[entity.id];
29481     },
29482     base: function() {
29483       return {
29484         "entities": Object.getPrototypeOf(this.entities),
29485         "parentWays": Object.getPrototypeOf(this._parentWays),
29486         "parentRels": Object.getPrototypeOf(this._parentRels)
29487       };
29488     },
29489     rebase: function(entities, stack, force) {
29490       var base = this.base();
29491       var i2, j2, k, id2;
29492       for (i2 = 0; i2 < entities.length; i2++) {
29493         var entity = entities[i2];
29494         if (!entity.visible || !force && base.entities[entity.id])
29495           continue;
29496         base.entities[entity.id] = entity;
29497         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
29498         if (entity.type === "way") {
29499           for (j2 = 0; j2 < entity.nodes.length; j2++) {
29500             id2 = entity.nodes[j2];
29501             for (k = 1; k < stack.length; k++) {
29502               var ents = stack[k].entities;
29503               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
29504                 delete ents[id2];
29505               }
29506             }
29507           }
29508         }
29509       }
29510       for (i2 = 0; i2 < stack.length; i2++) {
29511         stack[i2]._updateRebased();
29512       }
29513     },
29514     _updateRebased: function() {
29515       var base = this.base();
29516       Object.keys(this._parentWays).forEach(function(child) {
29517         if (base.parentWays[child]) {
29518           base.parentWays[child].forEach(function(id2) {
29519             if (!this.entities.hasOwnProperty(id2)) {
29520               this._parentWays[child].add(id2);
29521             }
29522           }, this);
29523         }
29524       }, this);
29525       Object.keys(this._parentRels).forEach(function(child) {
29526         if (base.parentRels[child]) {
29527           base.parentRels[child].forEach(function(id2) {
29528             if (!this.entities.hasOwnProperty(id2)) {
29529               this._parentRels[child].add(id2);
29530             }
29531           }, this);
29532         }
29533       }, this);
29534       this.transients = {};
29535     },
29536     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
29537       parentWays = parentWays || this._parentWays;
29538       parentRels = parentRels || this._parentRels;
29539       var type3 = entity && entity.type || oldentity && oldentity.type;
29540       var removed, added, i2;
29541       if (type3 === "way") {
29542         if (oldentity && entity) {
29543           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
29544           added = utilArrayDifference(entity.nodes, oldentity.nodes);
29545         } else if (oldentity) {
29546           removed = oldentity.nodes;
29547           added = [];
29548         } else if (entity) {
29549           removed = [];
29550           added = entity.nodes;
29551         }
29552         for (i2 = 0; i2 < removed.length; i2++) {
29553           parentWays[removed[i2]] = new Set(parentWays[removed[i2]]);
29554           parentWays[removed[i2]].delete(oldentity.id);
29555         }
29556         for (i2 = 0; i2 < added.length; i2++) {
29557           parentWays[added[i2]] = new Set(parentWays[added[i2]]);
29558           parentWays[added[i2]].add(entity.id);
29559         }
29560       } else if (type3 === "relation") {
29561         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m) {
29562           return m.id;
29563         }) : [];
29564         var entityMemberIDs = entity ? entity.members.map(function(m) {
29565           return m.id;
29566         }) : [];
29567         if (oldentity && entity) {
29568           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
29569           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
29570         } else if (oldentity) {
29571           removed = oldentityMemberIDs;
29572           added = [];
29573         } else if (entity) {
29574           removed = [];
29575           added = entityMemberIDs;
29576         }
29577         for (i2 = 0; i2 < removed.length; i2++) {
29578           parentRels[removed[i2]] = new Set(parentRels[removed[i2]]);
29579           parentRels[removed[i2]].delete(oldentity.id);
29580         }
29581         for (i2 = 0; i2 < added.length; i2++) {
29582           parentRels[added[i2]] = new Set(parentRels[added[i2]]);
29583           parentRels[added[i2]].add(entity.id);
29584         }
29585       }
29586     },
29587     replace: function(entity) {
29588       if (this.entities[entity.id] === entity)
29589         return this;
29590       return this.update(function() {
29591         this._updateCalculated(this.entities[entity.id], entity);
29592         this.entities[entity.id] = entity;
29593       });
29594     },
29595     remove: function(entity) {
29596       return this.update(function() {
29597         this._updateCalculated(entity, void 0);
29598         this.entities[entity.id] = void 0;
29599       });
29600     },
29601     revert: function(id2) {
29602       var baseEntity = this.base().entities[id2];
29603       var headEntity = this.entities[id2];
29604       if (headEntity === baseEntity)
29605         return this;
29606       return this.update(function() {
29607         this._updateCalculated(headEntity, baseEntity);
29608         delete this.entities[id2];
29609       });
29610     },
29611     update: function() {
29612       var graph = this.frozen ? coreGraph(this, true) : this;
29613       for (var i2 = 0; i2 < arguments.length; i2++) {
29614         arguments[i2].call(graph, graph);
29615       }
29616       if (this.frozen)
29617         graph.frozen = true;
29618       return graph;
29619     },
29620     load: function(entities) {
29621       var base = this.base();
29622       this.entities = Object.create(base.entities);
29623       for (var i2 in entities) {
29624         this.entities[i2] = entities[i2];
29625         this._updateCalculated(base.entities[i2], this.entities[i2]);
29626       }
29627       return this;
29628     }
29629   };
29630
29631   // modules/osm/intersection.js
29632   function osmTurn(turn) {
29633     if (!(this instanceof osmTurn)) {
29634       return new osmTurn(turn);
29635     }
29636     Object.assign(this, turn);
29637   }
29638   function osmIntersection(graph, startVertexId, maxDistance) {
29639     maxDistance = maxDistance || 30;
29640     var vgraph = coreGraph();
29641     var i2, j2, k;
29642     function memberOfRestriction(entity) {
29643       return graph.parentRelations(entity).some(function(r) {
29644         return r.isRestriction();
29645       });
29646     }
29647     function isRoad(way2) {
29648       if (way2.isArea() || way2.isDegenerate())
29649         return false;
29650       var roads = {
29651         "motorway": true,
29652         "motorway_link": true,
29653         "trunk": true,
29654         "trunk_link": true,
29655         "primary": true,
29656         "primary_link": true,
29657         "secondary": true,
29658         "secondary_link": true,
29659         "tertiary": true,
29660         "tertiary_link": true,
29661         "residential": true,
29662         "unclassified": true,
29663         "living_street": true,
29664         "service": true,
29665         "road": true,
29666         "track": true
29667       };
29668       return roads[way2.tags.highway];
29669     }
29670     var startNode = graph.entity(startVertexId);
29671     var checkVertices = [startNode];
29672     var checkWays;
29673     var vertices = [];
29674     var vertexIds = [];
29675     var vertex;
29676     var ways = [];
29677     var wayIds = [];
29678     var way;
29679     var nodes = [];
29680     var node;
29681     var parents = [];
29682     var parent;
29683     var actions = [];
29684     while (checkVertices.length) {
29685       vertex = checkVertices.pop();
29686       checkWays = graph.parentWays(vertex);
29687       var hasWays = false;
29688       for (i2 = 0; i2 < checkWays.length; i2++) {
29689         way = checkWays[i2];
29690         if (!isRoad(way) && !memberOfRestriction(way))
29691           continue;
29692         ways.push(way);
29693         hasWays = true;
29694         nodes = utilArrayUniq(graph.childNodes(way));
29695         for (j2 = 0; j2 < nodes.length; j2++) {
29696           node = nodes[j2];
29697           if (node === vertex)
29698             continue;
29699           if (vertices.indexOf(node) !== -1)
29700             continue;
29701           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
29702             continue;
29703           var hasParents = false;
29704           parents = graph.parentWays(node);
29705           for (k = 0; k < parents.length; k++) {
29706             parent = parents[k];
29707             if (parent === way)
29708               continue;
29709             if (ways.indexOf(parent) !== -1)
29710               continue;
29711             if (!isRoad(parent))
29712               continue;
29713             hasParents = true;
29714             break;
29715           }
29716           if (hasParents) {
29717             checkVertices.push(node);
29718           }
29719         }
29720       }
29721       if (hasWays) {
29722         vertices.push(vertex);
29723       }
29724     }
29725     vertices = utilArrayUniq(vertices);
29726     ways = utilArrayUniq(ways);
29727     ways.forEach(function(way2) {
29728       graph.childNodes(way2).forEach(function(node2) {
29729         vgraph = vgraph.replace(node2);
29730       });
29731       vgraph = vgraph.replace(way2);
29732       graph.parentRelations(way2).forEach(function(relation) {
29733         if (relation.isRestriction()) {
29734           if (relation.isValidRestriction(graph)) {
29735             vgraph = vgraph.replace(relation);
29736           } else if (relation.isComplete(graph)) {
29737             actions.push(actionDeleteRelation(relation.id));
29738           }
29739         }
29740       });
29741     });
29742     ways.forEach(function(w) {
29743       var way2 = vgraph.entity(w.id);
29744       if (way2.tags.oneway === "-1") {
29745         var action = actionReverse(way2.id, { reverseOneway: true });
29746         actions.push(action);
29747         vgraph = action(vgraph);
29748       }
29749     });
29750     var origCount = osmEntity.id.next.way;
29751     vertices.forEach(function(v) {
29752       var splitAll = actionSplit([v.id]).keepHistoryOn("first");
29753       if (!splitAll.disabled(vgraph)) {
29754         splitAll.ways(vgraph).forEach(function(way2) {
29755           var splitOne = actionSplit([v.id]).limitWays([way2.id]).keepHistoryOn("first");
29756           actions.push(splitOne);
29757           vgraph = splitOne(vgraph);
29758         });
29759       }
29760     });
29761     osmEntity.id.next.way = origCount;
29762     vertexIds = vertices.map(function(v) {
29763       return v.id;
29764     });
29765     vertices = [];
29766     ways = [];
29767     vertexIds.forEach(function(id2) {
29768       var vertex2 = vgraph.entity(id2);
29769       var parents2 = vgraph.parentWays(vertex2);
29770       vertices.push(vertex2);
29771       ways = ways.concat(parents2);
29772     });
29773     vertices = utilArrayUniq(vertices);
29774     ways = utilArrayUniq(ways);
29775     vertexIds = vertices.map(function(v) {
29776       return v.id;
29777     });
29778     wayIds = ways.map(function(w) {
29779       return w.id;
29780     });
29781     function withMetadata(way2, vertexIds2) {
29782       var __oneWay = way2.isOneWay();
29783       var __first = vertexIds2.indexOf(way2.first()) !== -1;
29784       var __last = vertexIds2.indexOf(way2.last()) !== -1;
29785       var __via = __first && __last;
29786       var __from = __first && !__oneWay || __last;
29787       var __to = __first || __last && !__oneWay;
29788       return way2.update({
29789         __first,
29790         __last,
29791         __from,
29792         __via,
29793         __to,
29794         __oneWay
29795       });
29796     }
29797     ways = [];
29798     wayIds.forEach(function(id2) {
29799       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
29800       vgraph = vgraph.replace(way2);
29801       ways.push(way2);
29802     });
29803     var keepGoing;
29804     var removeWayIds = [];
29805     var removeVertexIds = [];
29806     do {
29807       keepGoing = false;
29808       checkVertices = vertexIds.slice();
29809       for (i2 = 0; i2 < checkVertices.length; i2++) {
29810         var vertexId = checkVertices[i2];
29811         vertex = vgraph.hasEntity(vertexId);
29812         if (!vertex) {
29813           if (vertexIds.indexOf(vertexId) !== -1) {
29814             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
29815           }
29816           removeVertexIds.push(vertexId);
29817           continue;
29818         }
29819         parents = vgraph.parentWays(vertex);
29820         if (parents.length < 3) {
29821           if (vertexIds.indexOf(vertexId) !== -1) {
29822             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
29823           }
29824         }
29825         if (parents.length === 2) {
29826           var a = parents[0];
29827           var b = parents[1];
29828           var aIsLeaf = a && !a.__via;
29829           var bIsLeaf = b && !b.__via;
29830           var leaf, survivor;
29831           if (aIsLeaf && !bIsLeaf) {
29832             leaf = a;
29833             survivor = b;
29834           } else if (!aIsLeaf && bIsLeaf) {
29835             leaf = b;
29836             survivor = a;
29837           }
29838           if (leaf && survivor) {
29839             survivor = withMetadata(survivor, vertexIds);
29840             vgraph = vgraph.replace(survivor).remove(leaf);
29841             removeWayIds.push(leaf.id);
29842             keepGoing = true;
29843           }
29844         }
29845         parents = vgraph.parentWays(vertex);
29846         if (parents.length < 2) {
29847           if (vertexIds.indexOf(vertexId) !== -1) {
29848             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
29849           }
29850           removeVertexIds.push(vertexId);
29851           keepGoing = true;
29852         }
29853         if (parents.length < 1) {
29854           vgraph = vgraph.remove(vertex);
29855         }
29856       }
29857     } while (keepGoing);
29858     vertices = vertices.filter(function(vertex2) {
29859       return removeVertexIds.indexOf(vertex2.id) === -1;
29860     }).map(function(vertex2) {
29861       return vgraph.entity(vertex2.id);
29862     });
29863     ways = ways.filter(function(way2) {
29864       return removeWayIds.indexOf(way2.id) === -1;
29865     }).map(function(way2) {
29866       return vgraph.entity(way2.id);
29867     });
29868     var intersection = {
29869       graph: vgraph,
29870       actions,
29871       vertices,
29872       ways
29873     };
29874     intersection.turns = function(fromWayId, maxViaWay) {
29875       if (!fromWayId)
29876         return [];
29877       if (!maxViaWay)
29878         maxViaWay = 0;
29879       var vgraph2 = intersection.graph;
29880       var keyVertexIds = intersection.vertices.map(function(v) {
29881         return v.id;
29882       });
29883       var start2 = vgraph2.entity(fromWayId);
29884       if (!start2 || !(start2.__from || start2.__via))
29885         return [];
29886       var maxPathLength = maxViaWay * 2 + 3;
29887       var turns = [];
29888       step(start2);
29889       return turns;
29890       function step(entity, currPath, currRestrictions, matchedRestriction) {
29891         currPath = (currPath || []).slice();
29892         if (currPath.length >= maxPathLength)
29893           return;
29894         currPath.push(entity.id);
29895         currRestrictions = (currRestrictions || []).slice();
29896         var i3, j3;
29897         if (entity.type === "node") {
29898           var parents2 = vgraph2.parentWays(entity);
29899           var nextWays = [];
29900           for (i3 = 0; i3 < parents2.length; i3++) {
29901             var way2 = parents2[i3];
29902             if (way2.__oneWay && way2.nodes[0] !== entity.id)
29903               continue;
29904             if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
29905               continue;
29906             var restrict = null;
29907             for (j3 = 0; j3 < currRestrictions.length; j3++) {
29908               var restriction = currRestrictions[j3];
29909               var f2 = restriction.memberByRole("from");
29910               var v = restriction.membersByRole("via");
29911               var t = restriction.memberByRole("to");
29912               var isOnly = /^only_/.test(restriction.tags.restriction);
29913               var matchesFrom = f2.id === fromWayId;
29914               var matchesViaTo = false;
29915               var isAlongOnlyPath = false;
29916               if (t.id === way2.id) {
29917                 if (v.length === 1 && v[0].type === "node") {
29918                   matchesViaTo = v[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
29919                 } else {
29920                   var pathVias = [];
29921                   for (k = 2; k < currPath.length; k += 2) {
29922                     pathVias.push(currPath[k]);
29923                   }
29924                   var restrictionVias = [];
29925                   for (k = 0; k < v.length; k++) {
29926                     if (v[k].type === "way") {
29927                       restrictionVias.push(v[k].id);
29928                     }
29929                   }
29930                   var diff = utilArrayDifference(pathVias, restrictionVias);
29931                   matchesViaTo = !diff.length;
29932                 }
29933               } else if (isOnly) {
29934                 for (k = 0; k < v.length; k++) {
29935                   if (v[k].type === "way" && v[k].id === way2.id) {
29936                     isAlongOnlyPath = true;
29937                     break;
29938                   }
29939                 }
29940               }
29941               if (matchesViaTo) {
29942                 if (isOnly) {
29943                   restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
29944                 } else {
29945                   restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
29946                 }
29947               } else {
29948                 if (isAlongOnlyPath) {
29949                   restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
29950                 } else if (isOnly) {
29951                   restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
29952                 }
29953               }
29954               if (restrict && restrict.direct)
29955                 break;
29956             }
29957             nextWays.push({ way: way2, restrict });
29958           }
29959           nextWays.forEach(function(nextWay) {
29960             step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
29961           });
29962         } else {
29963           if (currPath.length >= 3) {
29964             var turnPath = currPath.slice();
29965             if (matchedRestriction && matchedRestriction.direct === false) {
29966               for (i3 = 0; i3 < turnPath.length; i3++) {
29967                 if (turnPath[i3] === matchedRestriction.from) {
29968                   turnPath = turnPath.slice(i3);
29969                   break;
29970                 }
29971               }
29972             }
29973             var turn = pathToTurn(turnPath);
29974             if (turn) {
29975               if (matchedRestriction) {
29976                 turn.restrictionID = matchedRestriction.id;
29977                 turn.no = matchedRestriction.no;
29978                 turn.only = matchedRestriction.only;
29979                 turn.direct = matchedRestriction.direct;
29980               }
29981               turns.push(osmTurn(turn));
29982             }
29983             if (currPath[0] === currPath[2])
29984               return;
29985           }
29986           if (matchedRestriction && matchedRestriction.end)
29987             return;
29988           var n1 = vgraph2.entity(entity.first());
29989           var n2 = vgraph2.entity(entity.last());
29990           var dist = geoSphericalDistance(n1.loc, n2.loc);
29991           var nextNodes = [];
29992           if (currPath.length > 1) {
29993             if (dist > maxDistance)
29994               return;
29995             if (!entity.__via)
29996               return;
29997           }
29998           if (!entity.__oneWay && keyVertexIds.indexOf(n1.id) !== -1 && currPath.indexOf(n1.id) === -1) {
29999             nextNodes.push(n1);
30000           }
30001           if (keyVertexIds.indexOf(n2.id) !== -1 && currPath.indexOf(n2.id) === -1) {
30002             nextNodes.push(n2);
30003           }
30004           nextNodes.forEach(function(nextNode) {
30005             var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r) {
30006               if (!r.isRestriction())
30007                 return false;
30008               var f3 = r.memberByRole("from");
30009               if (!f3 || f3.id !== entity.id)
30010                 return false;
30011               var isOnly2 = /^only_/.test(r.tags.restriction);
30012               if (!isOnly2)
30013                 return true;
30014               var isOnlyVia = false;
30015               var v2 = r.membersByRole("via");
30016               if (v2.length === 1 && v2[0].type === "node") {
30017                 isOnlyVia = v2[0].id === nextNode.id;
30018               } else {
30019                 for (var i4 = 0; i4 < v2.length; i4++) {
30020                   if (v2[i4].type !== "way")
30021                     continue;
30022                   var viaWay = vgraph2.entity(v2[i4].id);
30023                   if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
30024                     isOnlyVia = true;
30025                     break;
30026                   }
30027                 }
30028               }
30029               return isOnlyVia;
30030             });
30031             step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
30032           });
30033         }
30034       }
30035       function pathToTurn(path) {
30036         if (path.length < 3)
30037           return;
30038         var fromWayId2, fromNodeId, fromVertexId;
30039         var toWayId, toNodeId, toVertexId;
30040         var viaWayIds, viaNodeId, isUturn;
30041         fromWayId2 = path[0];
30042         toWayId = path[path.length - 1];
30043         if (path.length === 3 && fromWayId2 === toWayId) {
30044           var way2 = vgraph2.entity(fromWayId2);
30045           if (way2.__oneWay)
30046             return null;
30047           isUturn = true;
30048           viaNodeId = fromVertexId = toVertexId = path[1];
30049           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
30050         } else {
30051           isUturn = false;
30052           fromVertexId = path[1];
30053           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
30054           toVertexId = path[path.length - 2];
30055           toNodeId = adjacentNode(toWayId, toVertexId);
30056           if (path.length === 3) {
30057             viaNodeId = path[1];
30058           } else {
30059             viaWayIds = path.filter(function(entityId) {
30060               return entityId[0] === "w";
30061             });
30062             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
30063           }
30064         }
30065         return {
30066           key: path.join("_"),
30067           path,
30068           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
30069           via: { node: viaNodeId, ways: viaWayIds },
30070           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
30071           u: isUturn
30072         };
30073         function adjacentNode(wayId, affixId) {
30074           var nodes2 = vgraph2.entity(wayId).nodes;
30075           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
30076         }
30077       }
30078     };
30079     return intersection;
30080   }
30081   function osmInferRestriction(graph, turn, projection2) {
30082     var fromWay = graph.entity(turn.from.way);
30083     var fromNode = graph.entity(turn.from.node);
30084     var fromVertex = graph.entity(turn.from.vertex);
30085     var toWay = graph.entity(turn.to.way);
30086     var toNode = graph.entity(turn.to.node);
30087     var toVertex = graph.entity(turn.to.vertex);
30088     var fromOneWay = fromWay.tags.oneway === "yes";
30089     var toOneWay = toWay.tags.oneway === "yes";
30090     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
30091     while (angle2 < 0) {
30092       angle2 += 360;
30093     }
30094     if (fromNode === toNode) {
30095       return "no_u_turn";
30096     }
30097     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
30098       return "no_u_turn";
30099     }
30100     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
30101       return "no_u_turn";
30102     }
30103     if (angle2 < 158) {
30104       return "no_right_turn";
30105     }
30106     if (angle2 > 202) {
30107       return "no_left_turn";
30108     }
30109     return "no_straight_on";
30110   }
30111
30112   // modules/actions/merge_polygon.js
30113   function actionMergePolygon(ids, newRelationId) {
30114     function groupEntities(graph) {
30115       var entities = ids.map(function(id2) {
30116         return graph.entity(id2);
30117       });
30118       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
30119         if (entity.type === "way" && entity.isClosed()) {
30120           return "closedWay";
30121         } else if (entity.type === "relation" && entity.isMultipolygon()) {
30122           return "multipolygon";
30123         } else {
30124           return "other";
30125         }
30126       });
30127       return Object.assign({ closedWay: [], multipolygon: [], other: [] }, geometryGroups);
30128     }
30129     var action = function(graph) {
30130       var entities = groupEntities(graph);
30131       var polygons = entities.multipolygon.reduce(function(polygons2, m) {
30132         return polygons2.concat(osmJoinWays(m.members, graph));
30133       }, []).concat(entities.closedWay.map(function(d) {
30134         var member = [{ id: d.id }];
30135         member.nodes = graph.childNodes(d);
30136         return member;
30137       }));
30138       var contained = polygons.map(function(w, i2) {
30139         return polygons.map(function(d, n2) {
30140           if (i2 === n2)
30141             return null;
30142           return geoPolygonContainsPolygon(d.nodes.map(function(n3) {
30143             return n3.loc;
30144           }), w.nodes.map(function(n3) {
30145             return n3.loc;
30146           }));
30147         });
30148       });
30149       var members = [];
30150       var outer = true;
30151       while (polygons.length) {
30152         extractUncontained(polygons);
30153         polygons = polygons.filter(isContained);
30154         contained = contained.filter(isContained).map(filterContained);
30155       }
30156       function isContained(d, i2) {
30157         return contained[i2].some(function(val) {
30158           return val;
30159         });
30160       }
30161       function filterContained(d) {
30162         return d.filter(isContained);
30163       }
30164       function extractUncontained(polygons2) {
30165         polygons2.forEach(function(d, i2) {
30166           if (!isContained(d, i2)) {
30167             d.forEach(function(member) {
30168               members.push({
30169                 type: "way",
30170                 id: member.id,
30171                 role: outer ? "outer" : "inner"
30172               });
30173             });
30174           }
30175         });
30176         outer = !outer;
30177       }
30178       var relation;
30179       if (entities.multipolygon.length > 0) {
30180         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
30181         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
30182       } else {
30183         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
30184       }
30185       entities.multipolygon.forEach(function(m) {
30186         if (m.id !== relation.id) {
30187           relation = relation.mergeTags(m.tags);
30188           graph = graph.remove(m);
30189         }
30190       });
30191       entities.closedWay.forEach(function(way) {
30192         function isThisOuter(m) {
30193           return m.id === way.id && m.role !== "inner";
30194         }
30195         if (members.some(isThisOuter)) {
30196           relation = relation.mergeTags(way.tags);
30197           graph = graph.replace(way.update({ tags: {} }));
30198         }
30199       });
30200       return graph.replace(relation.update({
30201         members,
30202         tags: utilObjectOmit(relation.tags, ["area"])
30203       }));
30204     };
30205     action.disabled = function(graph) {
30206       var entities = groupEntities(graph);
30207       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
30208         return "not_eligible";
30209       }
30210       if (!entities.multipolygon.every(function(r) {
30211         return r.isComplete(graph);
30212       })) {
30213         return "incomplete_relation";
30214       }
30215       if (!entities.multipolygon.length) {
30216         var sharedMultipolygons = [];
30217         entities.closedWay.forEach(function(way, i2) {
30218           if (i2 === 0) {
30219             sharedMultipolygons = graph.parentMultipolygons(way);
30220           } else {
30221             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
30222           }
30223         });
30224         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
30225           return relation.members.length === entities.closedWay.length;
30226         });
30227         if (sharedMultipolygons.length) {
30228           return "not_eligible";
30229         }
30230       } else if (entities.closedWay.some(function(way) {
30231         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
30232       })) {
30233         return "not_eligible";
30234       }
30235     };
30236     return action;
30237   }
30238
30239   // modules/actions/merge_remote_changes.js
30240   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
30241
30242   // node_modules/node-diff3/index.mjs
30243   function LCS(buffer1, buffer2) {
30244     let equivalenceClasses = {};
30245     for (let j2 = 0; j2 < buffer2.length; j2++) {
30246       const item = buffer2[j2];
30247       if (equivalenceClasses[item]) {
30248         equivalenceClasses[item].push(j2);
30249       } else {
30250         equivalenceClasses[item] = [j2];
30251       }
30252     }
30253     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
30254     let candidates = [NULLRESULT];
30255     for (let i2 = 0; i2 < buffer1.length; i2++) {
30256       const item = buffer1[i2];
30257       const buffer2indices = equivalenceClasses[item] || [];
30258       let r = 0;
30259       let c = candidates[0];
30260       for (let jx = 0; jx < buffer2indices.length; jx++) {
30261         const j2 = buffer2indices[jx];
30262         let s;
30263         for (s = r; s < candidates.length; s++) {
30264           if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
30265             break;
30266           }
30267         }
30268         if (s < candidates.length) {
30269           const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
30270           if (r === candidates.length) {
30271             candidates.push(c);
30272           } else {
30273             candidates[r] = c;
30274           }
30275           r = s + 1;
30276           c = newCandidate;
30277           if (r === candidates.length) {
30278             break;
30279           }
30280         }
30281       }
30282       candidates[r] = c;
30283     }
30284     return candidates[candidates.length - 1];
30285   }
30286   function diffIndices(buffer1, buffer2) {
30287     const lcs = LCS(buffer1, buffer2);
30288     let result = [];
30289     let tail1 = buffer1.length;
30290     let tail2 = buffer2.length;
30291     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
30292       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
30293       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
30294       tail1 = candidate.buffer1index;
30295       tail2 = candidate.buffer2index;
30296       if (mismatchLength1 || mismatchLength2) {
30297         result.push({
30298           buffer1: [tail1 + 1, mismatchLength1],
30299           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
30300           buffer2: [tail2 + 1, mismatchLength2],
30301           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
30302         });
30303       }
30304     }
30305     result.reverse();
30306     return result;
30307   }
30308   function diff3MergeRegions(a, o, b) {
30309     let hunks = [];
30310     function addHunk(h, ab) {
30311       hunks.push({
30312         ab,
30313         oStart: h.buffer1[0],
30314         oLength: h.buffer1[1],
30315         abStart: h.buffer2[0],
30316         abLength: h.buffer2[1]
30317       });
30318     }
30319     diffIndices(o, a).forEach((item) => addHunk(item, "a"));
30320     diffIndices(o, b).forEach((item) => addHunk(item, "b"));
30321     hunks.sort((x, y) => x.oStart - y.oStart);
30322     let results = [];
30323     let currOffset = 0;
30324     function advanceTo(endOffset) {
30325       if (endOffset > currOffset) {
30326         results.push({
30327           stable: true,
30328           buffer: "o",
30329           bufferStart: currOffset,
30330           bufferLength: endOffset - currOffset,
30331           bufferContent: o.slice(currOffset, endOffset)
30332         });
30333         currOffset = endOffset;
30334       }
30335     }
30336     while (hunks.length) {
30337       let hunk = hunks.shift();
30338       let regionStart = hunk.oStart;
30339       let regionEnd = hunk.oStart + hunk.oLength;
30340       let regionHunks = [hunk];
30341       advanceTo(regionStart);
30342       while (hunks.length) {
30343         const nextHunk = hunks[0];
30344         const nextHunkStart = nextHunk.oStart;
30345         if (nextHunkStart > regionEnd)
30346           break;
30347         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
30348         regionHunks.push(hunks.shift());
30349       }
30350       if (regionHunks.length === 1) {
30351         if (hunk.abLength > 0) {
30352           const buffer = hunk.ab === "a" ? a : b;
30353           results.push({
30354             stable: true,
30355             buffer: hunk.ab,
30356             bufferStart: hunk.abStart,
30357             bufferLength: hunk.abLength,
30358             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
30359           });
30360         }
30361       } else {
30362         let bounds = {
30363           a: [a.length, -1, o.length, -1],
30364           b: [b.length, -1, o.length, -1]
30365         };
30366         while (regionHunks.length) {
30367           hunk = regionHunks.shift();
30368           const oStart = hunk.oStart;
30369           const oEnd = oStart + hunk.oLength;
30370           const abStart = hunk.abStart;
30371           const abEnd = abStart + hunk.abLength;
30372           let b2 = bounds[hunk.ab];
30373           b2[0] = Math.min(abStart, b2[0]);
30374           b2[1] = Math.max(abEnd, b2[1]);
30375           b2[2] = Math.min(oStart, b2[2]);
30376           b2[3] = Math.max(oEnd, b2[3]);
30377         }
30378         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
30379         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
30380         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
30381         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
30382         let result = {
30383           stable: false,
30384           aStart,
30385           aLength: aEnd - aStart,
30386           aContent: a.slice(aStart, aEnd),
30387           oStart: regionStart,
30388           oLength: regionEnd - regionStart,
30389           oContent: o.slice(regionStart, regionEnd),
30390           bStart,
30391           bLength: bEnd - bStart,
30392           bContent: b.slice(bStart, bEnd)
30393         };
30394         results.push(result);
30395       }
30396       currOffset = regionEnd;
30397     }
30398     advanceTo(o.length);
30399     return results;
30400   }
30401   function diff3Merge(a, o, b, options2) {
30402     let defaults2 = {
30403       excludeFalseConflicts: true,
30404       stringSeparator: /\s+/
30405     };
30406     options2 = Object.assign(defaults2, options2);
30407     if (typeof a === "string")
30408       a = a.split(options2.stringSeparator);
30409     if (typeof o === "string")
30410       o = o.split(options2.stringSeparator);
30411     if (typeof b === "string")
30412       b = b.split(options2.stringSeparator);
30413     let results = [];
30414     const regions = diff3MergeRegions(a, o, b);
30415     let okBuffer = [];
30416     function flushOk() {
30417       if (okBuffer.length) {
30418         results.push({ ok: okBuffer });
30419       }
30420       okBuffer = [];
30421     }
30422     function isFalseConflict(a2, b2) {
30423       if (a2.length !== b2.length)
30424         return false;
30425       for (let i2 = 0; i2 < a2.length; i2++) {
30426         if (a2[i2] !== b2[i2])
30427           return false;
30428       }
30429       return true;
30430     }
30431     regions.forEach((region) => {
30432       if (region.stable) {
30433         okBuffer.push(...region.bufferContent);
30434       } else {
30435         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
30436           okBuffer.push(...region.aContent);
30437         } else {
30438           flushOk();
30439           results.push({
30440             conflict: {
30441               a: region.aContent,
30442               aIndex: region.aStart,
30443               o: region.oContent,
30444               oIndex: region.oStart,
30445               b: region.bContent,
30446               bIndex: region.bStart
30447             }
30448           });
30449         }
30450       }
30451     });
30452     flushOk();
30453     return results;
30454   }
30455
30456   // modules/actions/merge_remote_changes.js
30457   var import_lodash = __toESM(require_lodash());
30458   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
30459     discardTags = discardTags || {};
30460     var _option = "safe";
30461     var _conflicts = [];
30462     function user(d) {
30463       return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash.escape)(d);
30464     }
30465     function mergeLocation(remote, target) {
30466       function pointEqual(a, b) {
30467         var epsilon3 = 1e-6;
30468         return Math.abs(a[0] - b[0]) < epsilon3 && Math.abs(a[1] - b[1]) < epsilon3;
30469       }
30470       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
30471         return target;
30472       }
30473       if (_option === "force_remote") {
30474         return target.update({ loc: remote.loc });
30475       }
30476       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
30477       return target;
30478     }
30479     function mergeNodes(base, remote, target) {
30480       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
30481         return target;
30482       }
30483       if (_option === "force_remote") {
30484         return target.update({ nodes: remote.nodes });
30485       }
30486       var ccount = _conflicts.length;
30487       var o = base.nodes || [];
30488       var a = target.nodes || [];
30489       var b = remote.nodes || [];
30490       var nodes = [];
30491       var hunks = diff3Merge(a, o, b, { excludeFalseConflicts: true });
30492       for (var i2 = 0; i2 < hunks.length; i2++) {
30493         var hunk = hunks[i2];
30494         if (hunk.ok) {
30495           nodes.push.apply(nodes, hunk.ok);
30496         } else {
30497           var c = hunk.conflict;
30498           if ((0, import_fast_deep_equal.default)(c.o, c.a)) {
30499             nodes.push.apply(nodes, c.b);
30500           } else if ((0, import_fast_deep_equal.default)(c.o, c.b)) {
30501             nodes.push.apply(nodes, c.a);
30502           } else {
30503             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
30504             break;
30505           }
30506         }
30507       }
30508       return _conflicts.length === ccount ? target.update({ nodes }) : target;
30509     }
30510     function mergeChildren(targetWay, children2, updates, graph) {
30511       function isUsed(node2, targetWay2) {
30512         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
30513           return way.id !== targetWay2.id;
30514         });
30515         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
30516       }
30517       var ccount = _conflicts.length;
30518       for (var i2 = 0; i2 < children2.length; i2++) {
30519         var id3 = children2[i2];
30520         var node = graph.hasEntity(id3);
30521         if (targetWay.nodes.indexOf(id3) === -1) {
30522           if (node && !isUsed(node, targetWay)) {
30523             updates.removeIds.push(id3);
30524           }
30525           continue;
30526         }
30527         var local = localGraph.hasEntity(id3);
30528         var remote = remoteGraph.hasEntity(id3);
30529         var target;
30530         if (_option === "force_remote" && remote && remote.visible) {
30531           updates.replacements.push(remote);
30532         } else if (_option === "force_local" && local) {
30533           target = osmEntity(local);
30534           if (remote) {
30535             target = target.update({ version: remote.version });
30536           }
30537           updates.replacements.push(target);
30538         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
30539           target = osmEntity(local, { version: remote.version });
30540           if (remote.visible) {
30541             target = mergeLocation(remote, target);
30542           } else {
30543             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30544           }
30545           if (_conflicts.length !== ccount)
30546             break;
30547           updates.replacements.push(target);
30548         }
30549       }
30550       return targetWay;
30551     }
30552     function updateChildren(updates, graph) {
30553       for (var i2 = 0; i2 < updates.replacements.length; i2++) {
30554         graph = graph.replace(updates.replacements[i2]);
30555       }
30556       if (updates.removeIds.length) {
30557         graph = actionDeleteMultiple(updates.removeIds)(graph);
30558       }
30559       return graph;
30560     }
30561     function mergeMembers(remote, target) {
30562       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
30563         return target;
30564       }
30565       if (_option === "force_remote") {
30566         return target.update({ members: remote.members });
30567       }
30568       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
30569       return target;
30570     }
30571     function mergeTags(base, remote, target) {
30572       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
30573         return target;
30574       }
30575       if (_option === "force_remote") {
30576         return target.update({ tags: remote.tags });
30577       }
30578       var ccount = _conflicts.length;
30579       var o = base.tags || {};
30580       var a = target.tags || {};
30581       var b = remote.tags || {};
30582       var keys = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) {
30583         return !discardTags[k2];
30584       });
30585       var tags = Object.assign({}, a);
30586       var changed = false;
30587       for (var i2 = 0; i2 < keys.length; i2++) {
30588         var k = keys[i2];
30589         if (o[k] !== b[k] && a[k] !== b[k]) {
30590           if (o[k] !== a[k]) {
30591             _conflicts.push(_t.html("merge_remote_changes.conflict.tags", { tag: k, local: a[k], remote: b[k], user: { html: user(remote.user) } }));
30592           } else {
30593             if (b.hasOwnProperty(k)) {
30594               tags[k] = b[k];
30595             } else {
30596               delete tags[k];
30597             }
30598             changed = true;
30599           }
30600         }
30601       }
30602       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
30603     }
30604     var action = function(graph) {
30605       var updates = { replacements: [], removeIds: [] };
30606       var base = graph.base().entities[id2];
30607       var local = localGraph.entity(id2);
30608       var remote = remoteGraph.entity(id2);
30609       var target = osmEntity(local, { version: remote.version });
30610       if (!remote.visible) {
30611         if (_option === "force_remote") {
30612           return actionDeleteMultiple([id2])(graph);
30613         } else if (_option === "force_local") {
30614           if (target.type === "way") {
30615             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
30616             graph = updateChildren(updates, graph);
30617           }
30618           return graph.replace(target);
30619         } else {
30620           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30621           return graph;
30622         }
30623       }
30624       if (target.type === "node") {
30625         target = mergeLocation(remote, target);
30626       } else if (target.type === "way") {
30627         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
30628         target = mergeNodes(base, remote, target);
30629         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
30630       } else if (target.type === "relation") {
30631         target = mergeMembers(remote, target);
30632       }
30633       target = mergeTags(base, remote, target);
30634       if (!_conflicts.length) {
30635         graph = updateChildren(updates, graph).replace(target);
30636       }
30637       return graph;
30638     };
30639     action.withOption = function(opt) {
30640       _option = opt;
30641       return action;
30642     };
30643     action.conflicts = function() {
30644       return _conflicts;
30645     };
30646     return action;
30647   }
30648
30649   // modules/actions/move.js
30650   function actionMove(moveIDs, tryDelta, projection2, cache) {
30651     var _delta = tryDelta;
30652     function setupCache(graph) {
30653       function canMove(nodeID) {
30654         if (moveIDs.indexOf(nodeID) !== -1)
30655           return true;
30656         var parents = graph.parentWays(graph.entity(nodeID));
30657         if (parents.length < 3)
30658           return true;
30659         var parentsMoving = parents.every(function(way) {
30660           return cache.moving[way.id];
30661         });
30662         if (!parentsMoving)
30663           delete cache.moving[nodeID];
30664         return parentsMoving;
30665       }
30666       function cacheEntities(ids) {
30667         for (var i2 = 0; i2 < ids.length; i2++) {
30668           var id2 = ids[i2];
30669           if (cache.moving[id2])
30670             continue;
30671           cache.moving[id2] = true;
30672           var entity = graph.hasEntity(id2);
30673           if (!entity)
30674             continue;
30675           if (entity.type === "node") {
30676             cache.nodes.push(id2);
30677             cache.startLoc[id2] = entity.loc;
30678           } else if (entity.type === "way") {
30679             cache.ways.push(id2);
30680             cacheEntities(entity.nodes);
30681           } else {
30682             cacheEntities(entity.members.map(function(member) {
30683               return member.id;
30684             }));
30685           }
30686         }
30687       }
30688       function cacheIntersections(ids) {
30689         function isEndpoint(way2, id3) {
30690           return !way2.isClosed() && !!way2.affix(id3);
30691         }
30692         for (var i2 = 0; i2 < ids.length; i2++) {
30693           var id2 = ids[i2];
30694           var childNodes = graph.childNodes(graph.entity(id2));
30695           for (var j2 = 0; j2 < childNodes.length; j2++) {
30696             var node = childNodes[j2];
30697             var parents = graph.parentWays(node);
30698             if (parents.length !== 2)
30699               continue;
30700             var moved = graph.entity(id2);
30701             var unmoved = null;
30702             for (var k = 0; k < parents.length; k++) {
30703               var way = parents[k];
30704               if (!cache.moving[way.id]) {
30705                 unmoved = way;
30706                 break;
30707               }
30708             }
30709             if (!unmoved)
30710               continue;
30711             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
30712               continue;
30713             if (moved.isArea() || unmoved.isArea())
30714               continue;
30715             cache.intersections.push({
30716               nodeId: node.id,
30717               movedId: moved.id,
30718               unmovedId: unmoved.id,
30719               movedIsEP: isEndpoint(moved, node.id),
30720               unmovedIsEP: isEndpoint(unmoved, node.id)
30721             });
30722           }
30723         }
30724       }
30725       if (!cache) {
30726         cache = {};
30727       }
30728       if (!cache.ok) {
30729         cache.moving = {};
30730         cache.intersections = [];
30731         cache.replacedVertex = {};
30732         cache.startLoc = {};
30733         cache.nodes = [];
30734         cache.ways = [];
30735         cacheEntities(moveIDs);
30736         cacheIntersections(cache.ways);
30737         cache.nodes = cache.nodes.filter(canMove);
30738         cache.ok = true;
30739       }
30740     }
30741     function replaceMovedVertex(nodeId, wayId, graph, delta) {
30742       var way = graph.entity(wayId);
30743       var moved = graph.entity(nodeId);
30744       var movedIndex = way.nodes.indexOf(nodeId);
30745       var len, prevIndex, nextIndex;
30746       if (way.isClosed()) {
30747         len = way.nodes.length - 1;
30748         prevIndex = (movedIndex + len - 1) % len;
30749         nextIndex = (movedIndex + len + 1) % len;
30750       } else {
30751         len = way.nodes.length;
30752         prevIndex = movedIndex - 1;
30753         nextIndex = movedIndex + 1;
30754       }
30755       var prev = graph.hasEntity(way.nodes[prevIndex]);
30756       var next = graph.hasEntity(way.nodes[nextIndex]);
30757       if (!prev || !next)
30758         return graph;
30759       var key = wayId + "_" + nodeId;
30760       var orig = cache.replacedVertex[key];
30761       if (!orig) {
30762         orig = osmNode();
30763         cache.replacedVertex[key] = orig;
30764         cache.startLoc[orig.id] = cache.startLoc[nodeId];
30765       }
30766       var start2, end;
30767       if (delta) {
30768         start2 = projection2(cache.startLoc[nodeId]);
30769         end = projection2.invert(geoVecAdd(start2, delta));
30770       } else {
30771         end = cache.startLoc[nodeId];
30772       }
30773       orig = orig.move(end);
30774       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
30775       if (angle2 > 175 && angle2 < 185)
30776         return graph;
30777       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
30778       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
30779       var d1 = geoPathLength(p1);
30780       var d2 = geoPathLength(p2);
30781       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
30782       if (way.isClosed() && insertAt === 0)
30783         insertAt = len;
30784       way = way.addNode(orig.id, insertAt);
30785       return graph.replace(orig).replace(way);
30786     }
30787     function removeDuplicateVertices(wayId, graph) {
30788       var way = graph.entity(wayId);
30789       var epsilon3 = 1e-6;
30790       var prev, curr;
30791       function isInteresting(node, graph2) {
30792         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
30793       }
30794       for (var i2 = 0; i2 < way.nodes.length; i2++) {
30795         curr = graph.entity(way.nodes[i2]);
30796         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
30797           if (!isInteresting(prev, graph)) {
30798             way = way.removeNode(prev.id);
30799             graph = graph.replace(way).remove(prev);
30800           } else if (!isInteresting(curr, graph)) {
30801             way = way.removeNode(curr.id);
30802             graph = graph.replace(way).remove(curr);
30803           }
30804         }
30805         prev = curr;
30806       }
30807       return graph;
30808     }
30809     function unZorroIntersection(intersection, graph) {
30810       var vertex = graph.entity(intersection.nodeId);
30811       var way1 = graph.entity(intersection.movedId);
30812       var way2 = graph.entity(intersection.unmovedId);
30813       var isEP1 = intersection.movedIsEP;
30814       var isEP2 = intersection.unmovedIsEP;
30815       if (isEP1 && isEP2)
30816         return graph;
30817       var nodes1 = graph.childNodes(way1).filter(function(n2) {
30818         return n2 !== vertex;
30819       });
30820       var nodes2 = graph.childNodes(way2).filter(function(n2) {
30821         return n2 !== vertex;
30822       });
30823       if (way1.isClosed() && way1.first() === vertex.id)
30824         nodes1.push(nodes1[0]);
30825       if (way2.isClosed() && way2.first() === vertex.id)
30826         nodes2.push(nodes2[0]);
30827       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
30828       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
30829       var loc;
30830       if (!isEP1 && !isEP2) {
30831         var epsilon3 = 1e-6, maxIter = 10;
30832         for (var i2 = 0; i2 < maxIter; i2++) {
30833           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
30834           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
30835           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
30836           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
30837             break;
30838         }
30839       } else if (!isEP1) {
30840         loc = edge1.loc;
30841       } else {
30842         loc = edge2.loc;
30843       }
30844       graph = graph.replace(vertex.move(loc));
30845       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
30846         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
30847         graph = graph.replace(way1);
30848       }
30849       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
30850         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
30851         graph = graph.replace(way2);
30852       }
30853       return graph;
30854     }
30855     function cleanupIntersections(graph) {
30856       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
30857         var obj = cache.intersections[i2];
30858         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
30859         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
30860         graph = unZorroIntersection(obj, graph);
30861         graph = removeDuplicateVertices(obj.movedId, graph);
30862         graph = removeDuplicateVertices(obj.unmovedId, graph);
30863       }
30864       return graph;
30865     }
30866     function limitDelta(graph) {
30867       function moveNode(loc) {
30868         return geoVecAdd(projection2(loc), _delta);
30869       }
30870       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
30871         var obj = cache.intersections[i2];
30872         if (obj.movedIsEP && obj.unmovedIsEP)
30873           continue;
30874         if (!obj.movedIsEP)
30875           continue;
30876         var node = graph.entity(obj.nodeId);
30877         var start2 = projection2(node.loc);
30878         var end = geoVecAdd(start2, _delta);
30879         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
30880         var movedPath = movedNodes.map(function(n2) {
30881           return moveNode(n2.loc);
30882         });
30883         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
30884         var unmovedPath = unmovedNodes.map(function(n2) {
30885           return projection2(n2.loc);
30886         });
30887         var hits = geoPathIntersections(movedPath, unmovedPath);
30888         for (var j2 = 0; i2 < hits.length; i2++) {
30889           if (geoVecEqual(hits[j2], end))
30890             continue;
30891           var edge = geoChooseEdge(unmovedNodes, end, projection2);
30892           _delta = geoVecSubtract(projection2(edge.loc), start2);
30893         }
30894       }
30895     }
30896     var action = function(graph) {
30897       if (_delta[0] === 0 && _delta[1] === 0)
30898         return graph;
30899       setupCache(graph);
30900       if (cache.intersections.length) {
30901         limitDelta(graph);
30902       }
30903       for (var i2 = 0; i2 < cache.nodes.length; i2++) {
30904         var node = graph.entity(cache.nodes[i2]);
30905         var start2 = projection2(node.loc);
30906         var end = geoVecAdd(start2, _delta);
30907         graph = graph.replace(node.move(projection2.invert(end)));
30908       }
30909       if (cache.intersections.length) {
30910         graph = cleanupIntersections(graph);
30911       }
30912       return graph;
30913     };
30914     action.delta = function() {
30915       return _delta;
30916     };
30917     return action;
30918   }
30919
30920   // modules/actions/move_member.js
30921   function actionMoveMember(relationId, fromIndex, toIndex) {
30922     return function(graph) {
30923       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
30924     };
30925   }
30926
30927   // modules/actions/move_node.js
30928   function actionMoveNode(nodeID, toLoc) {
30929     var action = function(graph, t) {
30930       if (t === null || !isFinite(t))
30931         t = 1;
30932       t = Math.min(Math.max(+t, 0), 1);
30933       var node = graph.entity(nodeID);
30934       return graph.replace(node.move(geoVecInterp(node.loc, toLoc, t)));
30935     };
30936     action.transitionable = true;
30937     return action;
30938   }
30939
30940   // modules/actions/noop.js
30941   function actionNoop() {
30942     return function(graph) {
30943       return graph;
30944     };
30945   }
30946
30947   // modules/actions/orthogonalize.js
30948   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
30949     var epsilon3 = ep || 1e-4;
30950     var threshold = degThresh || 13;
30951     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
30952     var upperThreshold = Math.cos(threshold * Math.PI / 180);
30953     var action = function(graph, t) {
30954       if (t === null || !isFinite(t))
30955         t = 1;
30956       t = Math.min(Math.max(+t, 0), 1);
30957       var way = graph.entity(wayID);
30958       way = way.removeNode("");
30959       if (way.tags.nonsquare) {
30960         var tags = Object.assign({}, way.tags);
30961         delete tags.nonsquare;
30962         way = way.update({ tags });
30963       }
30964       graph = graph.replace(way);
30965       var isClosed = way.isClosed();
30966       var nodes = graph.childNodes(way).slice();
30967       if (isClosed)
30968         nodes.pop();
30969       if (vertexID !== void 0) {
30970         nodes = nodeSubset(nodes, vertexID, isClosed);
30971         if (nodes.length !== 3)
30972           return graph;
30973       }
30974       var nodeCount = {};
30975       var points = [];
30976       var corner = { i: 0, dotp: 1 };
30977       var node, point, loc, score, motions, i2, j2;
30978       for (i2 = 0; i2 < nodes.length; i2++) {
30979         node = nodes[i2];
30980         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
30981         points.push({ id: node.id, coord: projection2(node.loc) });
30982       }
30983       if (points.length === 3) {
30984         for (i2 = 0; i2 < 1e3; i2++) {
30985           motions = points.map(calcMotion);
30986           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
30987           score = corner.dotp;
30988           if (score < epsilon3) {
30989             break;
30990           }
30991         }
30992         node = graph.entity(nodes[corner.i].id);
30993         loc = projection2.invert(points[corner.i].coord);
30994         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
30995       } else {
30996         var straights = [];
30997         var simplified = [];
30998         for (i2 = 0; i2 < points.length; i2++) {
30999           point = points[i2];
31000           var dotp = 0;
31001           if (isClosed || i2 > 0 && i2 < points.length - 1) {
31002             var a = points[(i2 - 1 + points.length) % points.length];
31003             var b = points[(i2 + 1) % points.length];
31004             dotp = Math.abs(geoOrthoNormalizedDotProduct(a.coord, b.coord, point.coord));
31005           }
31006           if (dotp > upperThreshold) {
31007             straights.push(point);
31008           } else {
31009             simplified.push(point);
31010           }
31011         }
31012         var bestPoints = clonePoints(simplified);
31013         var originalPoints = clonePoints(simplified);
31014         score = Infinity;
31015         for (i2 = 0; i2 < 1e3; i2++) {
31016           motions = simplified.map(calcMotion);
31017           for (j2 = 0; j2 < motions.length; j2++) {
31018             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
31019           }
31020           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
31021           if (newScore < score) {
31022             bestPoints = clonePoints(simplified);
31023             score = newScore;
31024           }
31025           if (score < epsilon3) {
31026             break;
31027           }
31028         }
31029         var bestCoords = bestPoints.map(function(p) {
31030           return p.coord;
31031         });
31032         if (isClosed)
31033           bestCoords.push(bestCoords[0]);
31034         for (i2 = 0; i2 < bestPoints.length; i2++) {
31035           point = bestPoints[i2];
31036           if (!geoVecEqual(originalPoints[i2].coord, point.coord)) {
31037             node = graph.entity(point.id);
31038             loc = projection2.invert(point.coord);
31039             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31040           }
31041         }
31042         for (i2 = 0; i2 < straights.length; i2++) {
31043           point = straights[i2];
31044           if (nodeCount[point.id] > 1)
31045             continue;
31046           node = graph.entity(point.id);
31047           if (t === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
31048             graph = actionDeleteNode(node.id)(graph);
31049           } else {
31050             var choice = geoVecProject(point.coord, bestCoords);
31051             if (choice) {
31052               loc = projection2.invert(choice.target);
31053               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31054             }
31055           }
31056         }
31057       }
31058       return graph;
31059       function clonePoints(array2) {
31060         return array2.map(function(p) {
31061           return { id: p.id, coord: [p.coord[0], p.coord[1]] };
31062         });
31063       }
31064       function calcMotion(point2, i3, array2) {
31065         if (!isClosed && (i3 === 0 || i3 === array2.length - 1))
31066           return [0, 0];
31067         if (nodeCount[array2[i3].id] > 1)
31068           return [0, 0];
31069         var a2 = array2[(i3 - 1 + array2.length) % array2.length].coord;
31070         var origin = point2.coord;
31071         var b2 = array2[(i3 + 1) % array2.length].coord;
31072         var p = geoVecSubtract(a2, origin);
31073         var q = geoVecSubtract(b2, origin);
31074         var scale = 2 * Math.min(geoVecLength(p), geoVecLength(q));
31075         p = geoVecNormalize(p);
31076         q = geoVecNormalize(q);
31077         var dotp2 = p[0] * q[0] + p[1] * q[1];
31078         var val = Math.abs(dotp2);
31079         if (val < lowerThreshold) {
31080           corner.i = i3;
31081           corner.dotp = val;
31082           var vec = geoVecNormalize(geoVecAdd(p, q));
31083           return geoVecScale(vec, 0.1 * dotp2 * scale);
31084         }
31085         return [0, 0];
31086       }
31087     };
31088     function nodeSubset(nodes, vertexID2, isClosed) {
31089       var first = isClosed ? 0 : 1;
31090       var last = isClosed ? nodes.length : nodes.length - 1;
31091       for (var i2 = first; i2 < last; i2++) {
31092         if (nodes[i2].id === vertexID2) {
31093           return [
31094             nodes[(i2 - 1 + nodes.length) % nodes.length],
31095             nodes[i2],
31096             nodes[(i2 + 1) % nodes.length]
31097           ];
31098         }
31099       }
31100       return [];
31101     }
31102     action.disabled = function(graph) {
31103       var way = graph.entity(wayID);
31104       way = way.removeNode("");
31105       graph = graph.replace(way);
31106       var isClosed = way.isClosed();
31107       var nodes = graph.childNodes(way).slice();
31108       if (isClosed)
31109         nodes.pop();
31110       var allowStraightAngles = false;
31111       if (vertexID !== void 0) {
31112         allowStraightAngles = true;
31113         nodes = nodeSubset(nodes, vertexID, isClosed);
31114         if (nodes.length !== 3)
31115           return "end_vertex";
31116       }
31117       var coords = nodes.map(function(n2) {
31118         return projection2(n2.loc);
31119       });
31120       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
31121       if (score === null) {
31122         return "not_squarish";
31123       } else if (score === 0) {
31124         return "square_enough";
31125       } else {
31126         return false;
31127       }
31128     };
31129     action.transitionable = true;
31130     return action;
31131   }
31132
31133   // modules/actions/restrict_turn.js
31134   function actionRestrictTurn(turn, restrictionType, restrictionID) {
31135     return function(graph) {
31136       var fromWay = graph.entity(turn.from.way);
31137       var toWay = graph.entity(turn.to.way);
31138       var viaNode = turn.via.node && graph.entity(turn.via.node);
31139       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
31140         return graph.entity(id2);
31141       });
31142       var members = [];
31143       members.push({ id: fromWay.id, type: "way", role: "from" });
31144       if (viaNode) {
31145         members.push({ id: viaNode.id, type: "node", role: "via" });
31146       } else if (viaWays) {
31147         viaWays.forEach(function(viaWay) {
31148           members.push({ id: viaWay.id, type: "way", role: "via" });
31149         });
31150       }
31151       members.push({ id: toWay.id, type: "way", role: "to" });
31152       return graph.replace(osmRelation({
31153         id: restrictionID,
31154         tags: {
31155           type: "restriction",
31156           restriction: restrictionType
31157         },
31158         members
31159       }));
31160     };
31161   }
31162
31163   // modules/actions/revert.js
31164   function actionRevert(id2) {
31165     var action = function(graph) {
31166       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
31167       if (entity && !base) {
31168         if (entity.type === "node") {
31169           graph.parentWays(entity).forEach(function(parent) {
31170             parent = parent.removeNode(id2);
31171             graph = graph.replace(parent);
31172             if (parent.isDegenerate()) {
31173               graph = actionDeleteWay(parent.id)(graph);
31174             }
31175           });
31176         }
31177         graph.parentRelations(entity).forEach(function(parent) {
31178           parent = parent.removeMembersWithID(id2);
31179           graph = graph.replace(parent);
31180           if (parent.isDegenerate()) {
31181             graph = actionDeleteRelation(parent.id)(graph);
31182           }
31183         });
31184       }
31185       return graph.revert(id2);
31186     };
31187     return action;
31188   }
31189
31190   // modules/actions/rotate.js
31191   function actionRotate(rotateIds, pivot, angle2, projection2) {
31192     var action = function(graph) {
31193       return graph.update(function(graph2) {
31194         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
31195           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
31196           graph2 = graph2.replace(node.move(projection2.invert(point)));
31197         });
31198       });
31199     };
31200     return action;
31201   }
31202
31203   // modules/actions/scale.js
31204   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
31205     return function(graph) {
31206       return graph.update(function(graph2) {
31207         let point, radial;
31208         utilGetAllNodes(ids, graph2).forEach(function(node) {
31209           point = projection2(node.loc);
31210           radial = [
31211             point[0] - pivotLoc[0],
31212             point[1] - pivotLoc[1]
31213           ];
31214           point = [
31215             pivotLoc[0] + scaleFactor * radial[0],
31216             pivotLoc[1] + scaleFactor * radial[1]
31217           ];
31218           graph2 = graph2.replace(node.move(projection2.invert(point)));
31219         });
31220       });
31221     };
31222   }
31223
31224   // modules/actions/straighten_nodes.js
31225   function actionStraightenNodes(nodeIDs, projection2) {
31226     function positionAlongWay(a, o, b) {
31227       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31228     }
31229     function getEndpoints(points) {
31230       var ssr = geoGetSmallestSurroundingRectangle(points);
31231       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31232       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31233       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31234       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31235       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31236       if (isLong) {
31237         return [p1, q1];
31238       }
31239       return [p2, q2];
31240     }
31241     var action = function(graph, t) {
31242       if (t === null || !isFinite(t))
31243         t = 1;
31244       t = Math.min(Math.max(+t, 0), 1);
31245       var nodes = nodeIDs.map(function(id2) {
31246         return graph.entity(id2);
31247       });
31248       var points = nodes.map(function(n2) {
31249         return projection2(n2.loc);
31250       });
31251       var endpoints = getEndpoints(points);
31252       var startPoint = endpoints[0];
31253       var endPoint = endpoints[1];
31254       for (var i2 = 0; i2 < points.length; i2++) {
31255         var node = nodes[i2];
31256         var point = points[i2];
31257         var u = positionAlongWay(point, startPoint, endPoint);
31258         var point2 = geoVecInterp(startPoint, endPoint, u);
31259         var loc2 = projection2.invert(point2);
31260         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31261       }
31262       return graph;
31263     };
31264     action.disabled = function(graph) {
31265       var nodes = nodeIDs.map(function(id2) {
31266         return graph.entity(id2);
31267       });
31268       var points = nodes.map(function(n2) {
31269         return projection2(n2.loc);
31270       });
31271       var endpoints = getEndpoints(points);
31272       var startPoint = endpoints[0];
31273       var endPoint = endpoints[1];
31274       var maxDistance = 0;
31275       for (var i2 = 0; i2 < points.length; i2++) {
31276         var point = points[i2];
31277         var u = positionAlongWay(point, startPoint, endPoint);
31278         var p = geoVecInterp(startPoint, endPoint, u);
31279         var dist = geoVecLength(p, point);
31280         if (!isNaN(dist) && dist > maxDistance) {
31281           maxDistance = dist;
31282         }
31283       }
31284       if (maxDistance < 1e-4) {
31285         return "straight_enough";
31286       }
31287     };
31288     action.transitionable = true;
31289     return action;
31290   }
31291
31292   // modules/actions/straighten_way.js
31293   function actionStraightenWay(selectedIDs, projection2) {
31294     function positionAlongWay(a, o, b) {
31295       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31296     }
31297     function allNodes(graph) {
31298       var nodes = [];
31299       var startNodes = [];
31300       var endNodes = [];
31301       var remainingWays = [];
31302       var selectedWays = selectedIDs.filter(function(w) {
31303         return graph.entity(w).type === "way";
31304       });
31305       var selectedNodes = selectedIDs.filter(function(n2) {
31306         return graph.entity(n2).type === "node";
31307       });
31308       for (var i2 = 0; i2 < selectedWays.length; i2++) {
31309         var way = graph.entity(selectedWays[i2]);
31310         nodes = way.nodes.slice(0);
31311         remainingWays.push(nodes);
31312         startNodes.push(nodes[0]);
31313         endNodes.push(nodes[nodes.length - 1]);
31314       }
31315       startNodes = startNodes.filter(function(n2) {
31316         return startNodes.indexOf(n2) === startNodes.lastIndexOf(n2);
31317       });
31318       endNodes = endNodes.filter(function(n2) {
31319         return endNodes.indexOf(n2) === endNodes.lastIndexOf(n2);
31320       });
31321       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
31322       var nextWay = [];
31323       nodes = [];
31324       var getNextWay = function(currNode2, remainingWays2) {
31325         return remainingWays2.filter(function(way2) {
31326           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
31327         })[0];
31328       };
31329       while (remainingWays.length) {
31330         nextWay = getNextWay(currNode, remainingWays);
31331         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
31332         if (nextWay[0] !== currNode) {
31333           nextWay.reverse();
31334         }
31335         nodes = nodes.concat(nextWay);
31336         currNode = nodes[nodes.length - 1];
31337       }
31338       if (selectedNodes.length === 2) {
31339         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
31340         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
31341         var sortedStartEnd = [startNodeIdx, endNodeIdx];
31342         sortedStartEnd.sort(function(a, b) {
31343           return a - b;
31344         });
31345         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
31346       }
31347       return nodes.map(function(n2) {
31348         return graph.entity(n2);
31349       });
31350     }
31351     function shouldKeepNode(node, graph) {
31352       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
31353     }
31354     var action = function(graph, t) {
31355       if (t === null || !isFinite(t))
31356         t = 1;
31357       t = Math.min(Math.max(+t, 0), 1);
31358       var nodes = allNodes(graph);
31359       var points = nodes.map(function(n2) {
31360         return projection2(n2.loc);
31361       });
31362       var startPoint = points[0];
31363       var endPoint = points[points.length - 1];
31364       var toDelete = [];
31365       var i2;
31366       for (i2 = 1; i2 < points.length - 1; i2++) {
31367         var node = nodes[i2];
31368         var point = points[i2];
31369         if (t < 1 || shouldKeepNode(node, graph)) {
31370           var u = positionAlongWay(point, startPoint, endPoint);
31371           var p = geoVecInterp(startPoint, endPoint, u);
31372           var loc2 = projection2.invert(p);
31373           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31374         } else {
31375           if (toDelete.indexOf(node) === -1) {
31376             toDelete.push(node);
31377           }
31378         }
31379       }
31380       for (i2 = 0; i2 < toDelete.length; i2++) {
31381         graph = actionDeleteNode(toDelete[i2].id)(graph);
31382       }
31383       return graph;
31384     };
31385     action.disabled = function(graph) {
31386       var nodes = allNodes(graph);
31387       var points = nodes.map(function(n2) {
31388         return projection2(n2.loc);
31389       });
31390       var startPoint = points[0];
31391       var endPoint = points[points.length - 1];
31392       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
31393       var i2;
31394       if (threshold === 0) {
31395         return "too_bendy";
31396       }
31397       var maxDistance = 0;
31398       for (i2 = 1; i2 < points.length - 1; i2++) {
31399         var point = points[i2];
31400         var u = positionAlongWay(point, startPoint, endPoint);
31401         var p = geoVecInterp(startPoint, endPoint, u);
31402         var dist = geoVecLength(p, point);
31403         if (isNaN(dist) || dist > threshold) {
31404           return "too_bendy";
31405         } else if (dist > maxDistance) {
31406           maxDistance = dist;
31407         }
31408       }
31409       var keepingAllNodes = nodes.every(function(node, i3) {
31410         return i3 === 0 || i3 === nodes.length - 1 || shouldKeepNode(node, graph);
31411       });
31412       if (maxDistance < 1e-4 && keepingAllNodes) {
31413         return "straight_enough";
31414       }
31415     };
31416     action.transitionable = true;
31417     return action;
31418   }
31419
31420   // modules/actions/unrestrict_turn.js
31421   function actionUnrestrictTurn(turn) {
31422     return function(graph) {
31423       return actionDeleteRelation(turn.restrictionID)(graph);
31424     };
31425   }
31426
31427   // modules/actions/reflect.js
31428   function actionReflect(reflectIds, projection2) {
31429     var _useLongAxis = true;
31430     var action = function(graph, t) {
31431       if (t === null || !isFinite(t))
31432         t = 1;
31433       t = Math.min(Math.max(+t, 0), 1);
31434       var nodes = utilGetAllNodes(reflectIds, graph);
31435       var points = nodes.map(function(n2) {
31436         return projection2(n2.loc);
31437       });
31438       var ssr = geoGetSmallestSurroundingRectangle(points);
31439       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31440       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31441       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31442       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31443       var p, q;
31444       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31445       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
31446         p = p1;
31447         q = q1;
31448       } else {
31449         p = p2;
31450         q = q2;
31451       }
31452       var dx = q[0] - p[0];
31453       var dy = q[1] - p[1];
31454       var a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
31455       var b = 2 * dx * dy / (dx * dx + dy * dy);
31456       for (var i2 = 0; i2 < nodes.length; i2++) {
31457         var node = nodes[i2];
31458         var c = projection2(node.loc);
31459         var c2 = [
31460           a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0],
31461           b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1]
31462         ];
31463         var loc2 = projection2.invert(c2);
31464         node = node.move(geoVecInterp(node.loc, loc2, t));
31465         graph = graph.replace(node);
31466       }
31467       return graph;
31468     };
31469     action.useLongAxis = function(val) {
31470       if (!arguments.length)
31471         return _useLongAxis;
31472       _useLongAxis = val;
31473       return action;
31474     };
31475     action.transitionable = true;
31476     return action;
31477   }
31478
31479   // modules/actions/upgrade_tags.js
31480   function actionUpgradeTags(entityId, oldTags, replaceTags) {
31481     return function(graph) {
31482       var entity = graph.entity(entityId);
31483       var tags = Object.assign({}, entity.tags);
31484       var transferValue;
31485       var semiIndex;
31486       for (var oldTagKey in oldTags) {
31487         if (!(oldTagKey in tags))
31488           continue;
31489         if (oldTags[oldTagKey] === "*") {
31490           transferValue = tags[oldTagKey];
31491           delete tags[oldTagKey];
31492         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
31493           delete tags[oldTagKey];
31494         } else {
31495           var vals = tags[oldTagKey].split(";").filter(Boolean);
31496           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
31497           if (vals.length === 1 || oldIndex === -1) {
31498             delete tags[oldTagKey];
31499           } else {
31500             if (replaceTags && replaceTags[oldTagKey]) {
31501               semiIndex = oldIndex;
31502             }
31503             vals.splice(oldIndex, 1);
31504             tags[oldTagKey] = vals.join(";");
31505           }
31506         }
31507       }
31508       if (replaceTags) {
31509         for (var replaceKey in replaceTags) {
31510           var replaceValue = replaceTags[replaceKey];
31511           if (replaceValue === "*") {
31512             if (tags[replaceKey] && tags[replaceKey] !== "no") {
31513               continue;
31514             } else {
31515               tags[replaceKey] = "yes";
31516             }
31517           } else if (replaceValue === "$1") {
31518             tags[replaceKey] = transferValue;
31519           } else {
31520             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
31521               var existingVals = tags[replaceKey].split(";").filter(Boolean);
31522               if (existingVals.indexOf(replaceValue) === -1) {
31523                 existingVals.splice(semiIndex, 0, replaceValue);
31524                 tags[replaceKey] = existingVals.join(";");
31525               }
31526             } else {
31527               tags[replaceKey] = replaceValue;
31528             }
31529           }
31530         }
31531       }
31532       return graph.replace(entity.update({ tags }));
31533     };
31534   }
31535
31536   // modules/behavior/edit.js
31537   function behaviorEdit(context) {
31538     function behavior() {
31539       context.map().minzoom(context.minEditableZoom());
31540     }
31541     behavior.off = function() {
31542       context.map().minzoom(0);
31543     };
31544     return behavior;
31545   }
31546
31547   // modules/behavior/hover.js
31548   function behaviorHover(context) {
31549     var dispatch10 = dispatch_default("hover");
31550     var _selection = select_default2(null);
31551     var _newNodeId = null;
31552     var _initialNodeID = null;
31553     var _altDisables;
31554     var _ignoreVertex;
31555     var _targets = [];
31556     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
31557     function keydown(d3_event) {
31558       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31559         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
31560         _selection.classed("hover-disabled", true);
31561         dispatch10.call("hover", this, null);
31562       }
31563     }
31564     function keyup(d3_event) {
31565       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31566         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
31567         _selection.classed("hover-disabled", false);
31568         dispatch10.call("hover", this, _targets);
31569       }
31570     }
31571     function behavior(selection2) {
31572       _selection = selection2;
31573       _targets = [];
31574       if (_initialNodeID) {
31575         _newNodeId = _initialNodeID;
31576         _initialNodeID = null;
31577       } else {
31578         _newNodeId = null;
31579       }
31580       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
31581       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
31582       function eventTarget(d3_event) {
31583         var datum2 = d3_event.target && d3_event.target.__data__;
31584         if (typeof datum2 !== "object")
31585           return null;
31586         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
31587           return datum2.properties.entity;
31588         }
31589         return datum2;
31590       }
31591       function pointerover(d3_event) {
31592         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
31593           return;
31594         var target = eventTarget(d3_event);
31595         if (target && _targets.indexOf(target) === -1) {
31596           _targets.push(target);
31597           updateHover(d3_event, _targets);
31598         }
31599       }
31600       function pointerout(d3_event) {
31601         var target = eventTarget(d3_event);
31602         var index = _targets.indexOf(target);
31603         if (index !== -1) {
31604           _targets.splice(index);
31605           updateHover(d3_event, _targets);
31606         }
31607       }
31608       function allowsVertex(d) {
31609         return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
31610       }
31611       function modeAllowsHover(target) {
31612         var mode = context.mode();
31613         if (mode.id === "add-point") {
31614           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
31615         }
31616         return true;
31617       }
31618       function updateHover(d3_event, targets) {
31619         _selection.selectAll(".hover").classed("hover", false);
31620         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
31621         var mode = context.mode();
31622         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
31623           var node = targets.find(function(target) {
31624             return target instanceof osmEntity && target.type === "node";
31625           });
31626           _newNodeId = node && node.id;
31627         }
31628         targets = targets.filter(function(datum3) {
31629           if (datum3 instanceof osmEntity) {
31630             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
31631           }
31632           return true;
31633         });
31634         var selector = "";
31635         for (var i2 in targets) {
31636           var datum2 = targets[i2];
31637           if (datum2.__featurehash__) {
31638             selector += ", .data" + datum2.__featurehash__;
31639           } else if (datum2 instanceof QAItem) {
31640             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
31641           } else if (datum2 instanceof osmNote) {
31642             selector += ", .note-" + datum2.id;
31643           } else if (datum2 instanceof osmEntity) {
31644             selector += ", ." + datum2.id;
31645             if (datum2.type === "relation") {
31646               for (var j2 in datum2.members) {
31647                 selector += ", ." + datum2.members[j2].id;
31648               }
31649             }
31650           }
31651         }
31652         var suppressed = _altDisables && d3_event && d3_event.altKey;
31653         if (selector.trim().length) {
31654           selector = selector.slice(1);
31655           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
31656         }
31657         dispatch10.call("hover", this, !suppressed && targets);
31658       }
31659     }
31660     behavior.off = function(selection2) {
31661       selection2.selectAll(".hover").classed("hover", false);
31662       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
31663       selection2.classed("hover-disabled", false);
31664       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
31665       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
31666     };
31667     behavior.altDisables = function(val) {
31668       if (!arguments.length)
31669         return _altDisables;
31670       _altDisables = val;
31671       return behavior;
31672     };
31673     behavior.ignoreVertex = function(val) {
31674       if (!arguments.length)
31675         return _ignoreVertex;
31676       _ignoreVertex = val;
31677       return behavior;
31678     };
31679     behavior.initialNodeID = function(nodeId) {
31680       _initialNodeID = nodeId;
31681       return behavior;
31682     };
31683     return utilRebind(behavior, dispatch10, "on");
31684   }
31685
31686   // modules/behavior/draw.js
31687   var _disableSpace = false;
31688   var _lastSpace = null;
31689   function behaviorDraw(context) {
31690     var dispatch10 = dispatch_default("move", "down", "downcancel", "click", "clickWay", "clickNode", "undo", "cancel", "finish");
31691     var keybinding = utilKeybinding("draw");
31692     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
31693     var _edit = behaviorEdit(context);
31694     var _closeTolerance = 4;
31695     var _tolerance = 12;
31696     var _mouseLeave = false;
31697     var _lastMouse = null;
31698     var _lastPointerUpEvent;
31699     var _downPointer;
31700     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
31701     function datum2(d3_event) {
31702       var mode = context.mode();
31703       var isNote = mode && mode.id.indexOf("note") !== -1;
31704       if (d3_event.altKey || isNote)
31705         return {};
31706       var element;
31707       if (d3_event.type === "keydown") {
31708         element = _lastMouse && _lastMouse.target;
31709       } else {
31710         element = d3_event.target;
31711       }
31712       var d = element.__data__;
31713       return d && d.properties && d.properties.target ? d : {};
31714     }
31715     function pointerdown(d3_event) {
31716       if (_downPointer)
31717         return;
31718       var pointerLocGetter = utilFastMouse(this);
31719       _downPointer = {
31720         id: d3_event.pointerId || "mouse",
31721         pointerLocGetter,
31722         downTime: +new Date(),
31723         downLoc: pointerLocGetter(d3_event)
31724       };
31725       dispatch10.call("down", this, d3_event, datum2(d3_event));
31726     }
31727     function pointerup(d3_event) {
31728       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
31729         return;
31730       var downPointer = _downPointer;
31731       _downPointer = null;
31732       _lastPointerUpEvent = d3_event;
31733       if (downPointer.isCancelled)
31734         return;
31735       var t2 = +new Date();
31736       var p2 = downPointer.pointerLocGetter(d3_event);
31737       var dist = geoVecLength(downPointer.downLoc, p2);
31738       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
31739         select_default2(window).on("click.draw-block", function() {
31740           d3_event.stopPropagation();
31741         }, true);
31742         context.map().dblclickZoomEnable(false);
31743         window.setTimeout(function() {
31744           context.map().dblclickZoomEnable(true);
31745           select_default2(window).on("click.draw-block", null);
31746         }, 500);
31747         click(d3_event, p2);
31748       }
31749     }
31750     function pointermove(d3_event) {
31751       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
31752         var p2 = _downPointer.pointerLocGetter(d3_event);
31753         var dist = geoVecLength(_downPointer.downLoc, p2);
31754         if (dist >= _closeTolerance) {
31755           _downPointer.isCancelled = true;
31756           dispatch10.call("downcancel", this);
31757         }
31758       }
31759       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
31760         return;
31761       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
31762         return;
31763       _lastMouse = d3_event;
31764       dispatch10.call("move", this, d3_event, datum2(d3_event));
31765     }
31766     function pointercancel(d3_event) {
31767       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
31768         if (!_downPointer.isCancelled) {
31769           dispatch10.call("downcancel", this);
31770         }
31771         _downPointer = null;
31772       }
31773     }
31774     function mouseenter() {
31775       _mouseLeave = false;
31776     }
31777     function mouseleave() {
31778       _mouseLeave = true;
31779     }
31780     function allowsVertex(d) {
31781       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
31782     }
31783     function click(d3_event, loc) {
31784       var d = datum2(d3_event);
31785       var target = d && d.properties && d.properties.entity;
31786       var mode = context.mode();
31787       if (target && target.type === "node" && allowsVertex(target)) {
31788         dispatch10.call("clickNode", this, target, d);
31789         return;
31790       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
31791         var choice = geoChooseEdge(context.graph().childNodes(target), loc, context.projection, context.activeID());
31792         if (choice) {
31793           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
31794           dispatch10.call("clickWay", this, choice.loc, edge, d);
31795           return;
31796         }
31797       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
31798         var locLatLng = context.projection.invert(loc);
31799         dispatch10.call("click", this, locLatLng, d);
31800       }
31801     }
31802     function space(d3_event) {
31803       d3_event.preventDefault();
31804       d3_event.stopPropagation();
31805       var currSpace = context.map().mouse();
31806       if (_disableSpace && _lastSpace) {
31807         var dist = geoVecLength(_lastSpace, currSpace);
31808         if (dist > _tolerance) {
31809           _disableSpace = false;
31810         }
31811       }
31812       if (_disableSpace || _mouseLeave || !_lastMouse)
31813         return;
31814       _lastSpace = currSpace;
31815       _disableSpace = true;
31816       select_default2(window).on("keyup.space-block", function() {
31817         d3_event.preventDefault();
31818         d3_event.stopPropagation();
31819         _disableSpace = false;
31820         select_default2(window).on("keyup.space-block", null);
31821       });
31822       var loc = context.map().mouse() || context.projection(context.map().center());
31823       click(d3_event, loc);
31824     }
31825     function backspace(d3_event) {
31826       d3_event.preventDefault();
31827       dispatch10.call("undo");
31828     }
31829     function del(d3_event) {
31830       d3_event.preventDefault();
31831       dispatch10.call("cancel");
31832     }
31833     function ret(d3_event) {
31834       d3_event.preventDefault();
31835       dispatch10.call("finish");
31836     }
31837     function behavior(selection2) {
31838       context.install(_hover);
31839       context.install(_edit);
31840       _downPointer = null;
31841       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
31842       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
31843       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
31844       select_default2(document).call(keybinding);
31845       return behavior;
31846     }
31847     behavior.off = function(selection2) {
31848       context.ui().sidebar.hover.cancel();
31849       context.uninstall(_hover);
31850       context.uninstall(_edit);
31851       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
31852       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
31853       select_default2(document).call(keybinding.unbind);
31854     };
31855     behavior.hover = function() {
31856       return _hover;
31857     };
31858     return utilRebind(behavior, dispatch10, "on");
31859   }
31860
31861   // modules/behavior/breathe.js
31862   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
31863
31864   // node_modules/d3-scale/src/init.js
31865   function initRange(domain2, range3) {
31866     switch (arguments.length) {
31867       case 0:
31868         break;
31869       case 1:
31870         this.range(domain2);
31871         break;
31872       default:
31873         this.range(range3).domain(domain2);
31874         break;
31875     }
31876     return this;
31877   }
31878
31879   // node_modules/d3-scale/src/constant.js
31880   function constants(x) {
31881     return function() {
31882       return x;
31883     };
31884   }
31885
31886   // node_modules/d3-scale/src/number.js
31887   function number2(x) {
31888     return +x;
31889   }
31890
31891   // node_modules/d3-scale/src/continuous.js
31892   var unit = [0, 1];
31893   function identity3(x) {
31894     return x;
31895   }
31896   function normalize(a, b) {
31897     return (b -= a = +a) ? function(x) {
31898       return (x - a) / b;
31899     } : constants(isNaN(b) ? NaN : 0.5);
31900   }
31901   function clamper(a, b) {
31902     var t;
31903     if (a > b)
31904       t = a, a = b, b = t;
31905     return function(x) {
31906       return Math.max(a, Math.min(b, x));
31907     };
31908   }
31909   function bimap(domain2, range3, interpolate) {
31910     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
31911     if (d1 < d0)
31912       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
31913     else
31914       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
31915     return function(x) {
31916       return r0(d0(x));
31917     };
31918   }
31919   function polymap(domain2, range3, interpolate) {
31920     var j2 = Math.min(domain2.length, range3.length) - 1, d = new Array(j2), r = new Array(j2), i2 = -1;
31921     if (domain2[j2] < domain2[0]) {
31922       domain2 = domain2.slice().reverse();
31923       range3 = range3.slice().reverse();
31924     }
31925     while (++i2 < j2) {
31926       d[i2] = normalize(domain2[i2], domain2[i2 + 1]);
31927       r[i2] = interpolate(range3[i2], range3[i2 + 1]);
31928     }
31929     return function(x) {
31930       var i3 = bisect_default(domain2, x, 1, j2) - 1;
31931       return r[i3](d[i3](x));
31932     };
31933   }
31934   function copy(source, target) {
31935     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
31936   }
31937   function transformer2() {
31938     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
31939     function rescale() {
31940       var n2 = Math.min(domain2.length, range3.length);
31941       if (clamp3 !== identity3)
31942         clamp3 = clamper(domain2[0], domain2[n2 - 1]);
31943       piecewise = n2 > 2 ? polymap : bimap;
31944       output = input = null;
31945       return scale;
31946     }
31947     function scale(x) {
31948       return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x)));
31949     }
31950     scale.invert = function(y) {
31951       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y)));
31952     };
31953     scale.domain = function(_) {
31954       return arguments.length ? (domain2 = Array.from(_, number2), rescale()) : domain2.slice();
31955     };
31956     scale.range = function(_) {
31957       return arguments.length ? (range3 = Array.from(_), rescale()) : range3.slice();
31958     };
31959     scale.rangeRound = function(_) {
31960       return range3 = Array.from(_), interpolate = round_default, rescale();
31961     };
31962     scale.clamp = function(_) {
31963       return arguments.length ? (clamp3 = _ ? true : identity3, rescale()) : clamp3 !== identity3;
31964     };
31965     scale.interpolate = function(_) {
31966       return arguments.length ? (interpolate = _, rescale()) : interpolate;
31967     };
31968     scale.unknown = function(_) {
31969       return arguments.length ? (unknown = _, scale) : unknown;
31970     };
31971     return function(t, u) {
31972       transform2 = t, untransform = u;
31973       return rescale();
31974     };
31975   }
31976   function continuous() {
31977     return transformer2()(identity3, identity3);
31978   }
31979
31980   // node_modules/d3-format/src/formatDecimal.js
31981   function formatDecimal_default(x) {
31982     return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
31983   }
31984   function formatDecimalParts(x, p) {
31985     if ((i2 = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
31986       return null;
31987     var i2, coefficient = x.slice(0, i2);
31988     return [
31989       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
31990       +x.slice(i2 + 1)
31991     ];
31992   }
31993
31994   // node_modules/d3-format/src/exponent.js
31995   function exponent_default(x) {
31996     return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
31997   }
31998
31999   // node_modules/d3-format/src/formatGroup.js
32000   function formatGroup_default(grouping, thousands) {
32001     return function(value, width) {
32002       var i2 = value.length, t = [], j2 = 0, g = grouping[0], length = 0;
32003       while (i2 > 0 && g > 0) {
32004         if (length + g + 1 > width)
32005           g = Math.max(1, width - length);
32006         t.push(value.substring(i2 -= g, i2 + g));
32007         if ((length += g + 1) > width)
32008           break;
32009         g = grouping[j2 = (j2 + 1) % grouping.length];
32010       }
32011       return t.reverse().join(thousands);
32012     };
32013   }
32014
32015   // node_modules/d3-format/src/formatNumerals.js
32016   function formatNumerals_default(numerals) {
32017     return function(value) {
32018       return value.replace(/[0-9]/g, function(i2) {
32019         return numerals[+i2];
32020       });
32021     };
32022   }
32023
32024   // node_modules/d3-format/src/formatSpecifier.js
32025   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
32026   function formatSpecifier(specifier) {
32027     if (!(match = re.exec(specifier)))
32028       throw new Error("invalid format: " + specifier);
32029     var match;
32030     return new FormatSpecifier({
32031       fill: match[1],
32032       align: match[2],
32033       sign: match[3],
32034       symbol: match[4],
32035       zero: match[5],
32036       width: match[6],
32037       comma: match[7],
32038       precision: match[8] && match[8].slice(1),
32039       trim: match[9],
32040       type: match[10]
32041     });
32042   }
32043   formatSpecifier.prototype = FormatSpecifier.prototype;
32044   function FormatSpecifier(specifier) {
32045     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
32046     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
32047     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
32048     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
32049     this.zero = !!specifier.zero;
32050     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
32051     this.comma = !!specifier.comma;
32052     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
32053     this.trim = !!specifier.trim;
32054     this.type = specifier.type === void 0 ? "" : specifier.type + "";
32055   }
32056   FormatSpecifier.prototype.toString = function() {
32057     return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
32058   };
32059
32060   // node_modules/d3-format/src/formatTrim.js
32061   function formatTrim_default(s) {
32062     out:
32063       for (var n2 = s.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
32064         switch (s[i2]) {
32065           case ".":
32066             i0 = i1 = i2;
32067             break;
32068           case "0":
32069             if (i0 === 0)
32070               i0 = i2;
32071             i1 = i2;
32072             break;
32073           default:
32074             if (!+s[i2])
32075               break out;
32076             if (i0 > 0)
32077               i0 = 0;
32078             break;
32079         }
32080       }
32081     return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
32082   }
32083
32084   // node_modules/d3-format/src/formatPrefixAuto.js
32085   var prefixExponent;
32086   function formatPrefixAuto_default(x, p) {
32087     var d = formatDecimalParts(x, p);
32088     if (!d)
32089       return x + "";
32090     var coefficient = d[0], exponent = d[1], i2 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length;
32091     return i2 === n2 ? coefficient : i2 > n2 ? coefficient + new Array(i2 - n2 + 1).join("0") : i2 > 0 ? coefficient.slice(0, i2) + "." + coefficient.slice(i2) : "0." + new Array(1 - i2).join("0") + formatDecimalParts(x, Math.max(0, p + i2 - 1))[0];
32092   }
32093
32094   // node_modules/d3-format/src/formatRounded.js
32095   function formatRounded_default(x, p) {
32096     var d = formatDecimalParts(x, p);
32097     if (!d)
32098       return x + "";
32099     var coefficient = d[0], exponent = d[1];
32100     return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
32101   }
32102
32103   // node_modules/d3-format/src/formatTypes.js
32104   var formatTypes_default = {
32105     "%": (x, p) => (x * 100).toFixed(p),
32106     "b": (x) => Math.round(x).toString(2),
32107     "c": (x) => x + "",
32108     "d": formatDecimal_default,
32109     "e": (x, p) => x.toExponential(p),
32110     "f": (x, p) => x.toFixed(p),
32111     "g": (x, p) => x.toPrecision(p),
32112     "o": (x) => Math.round(x).toString(8),
32113     "p": (x, p) => formatRounded_default(x * 100, p),
32114     "r": formatRounded_default,
32115     "s": formatPrefixAuto_default,
32116     "X": (x) => Math.round(x).toString(16).toUpperCase(),
32117     "x": (x) => Math.round(x).toString(16)
32118   };
32119
32120   // node_modules/d3-format/src/identity.js
32121   function identity_default3(x) {
32122     return x;
32123   }
32124
32125   // node_modules/d3-format/src/locale.js
32126   var map = Array.prototype.map;
32127   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
32128   function locale_default(locale2) {
32129     var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default3 : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default3 : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
32130     function newFormat(specifier) {
32131       specifier = formatSpecifier(specifier);
32132       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision2 = specifier.precision, trim = specifier.trim, type3 = specifier.type;
32133       if (type3 === "n")
32134         comma = true, type3 = "g";
32135       else if (!formatTypes_default[type3])
32136         precision2 === void 0 && (precision2 = 12), trim = true, type3 = "g";
32137       if (zero3 || fill === "0" && align === "=")
32138         zero3 = true, fill = "0", align = "=";
32139       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : "";
32140       var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3);
32141       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
32142       function format2(value) {
32143         var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c;
32144         if (type3 === "c") {
32145           valueSuffix = formatType(value) + valueSuffix;
32146           value = "";
32147         } else {
32148           value = +value;
32149           var valueNegative = value < 0 || 1 / value < 0;
32150           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
32151           if (trim)
32152             value = formatTrim_default(value);
32153           if (valueNegative && +value === 0 && sign2 !== "+")
32154             valueNegative = false;
32155           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
32156           valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
32157           if (maybeSuffix) {
32158             i2 = -1, n2 = value.length;
32159             while (++i2 < n2) {
32160               if (c = value.charCodeAt(i2), 48 > c || c > 57) {
32161                 valueSuffix = (c === 46 ? decimal + value.slice(i2 + 1) : value.slice(i2)) + valueSuffix;
32162                 value = value.slice(0, i2);
32163                 break;
32164               }
32165             }
32166           }
32167         }
32168         if (comma && !zero3)
32169           value = group(value, Infinity);
32170         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
32171         if (comma && zero3)
32172           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
32173         switch (align) {
32174           case "<":
32175             value = valuePrefix + value + valueSuffix + padding;
32176             break;
32177           case "=":
32178             value = valuePrefix + padding + value + valueSuffix;
32179             break;
32180           case "^":
32181             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
32182             break;
32183           default:
32184             value = padding + valuePrefix + value + valueSuffix;
32185             break;
32186         }
32187         return numerals(value);
32188       }
32189       format2.toString = function() {
32190         return specifier + "";
32191       };
32192       return format2;
32193     }
32194     function formatPrefix2(specifier, value) {
32195       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
32196       return function(value2) {
32197         return f2(k * value2) + prefix;
32198       };
32199     }
32200     return {
32201       format: newFormat,
32202       formatPrefix: formatPrefix2
32203     };
32204   }
32205
32206   // node_modules/d3-format/src/defaultLocale.js
32207   var locale;
32208   var format;
32209   var formatPrefix;
32210   defaultLocale({
32211     thousands: ",",
32212     grouping: [3],
32213     currency: ["$", ""]
32214   });
32215   function defaultLocale(definition) {
32216     locale = locale_default(definition);
32217     format = locale.format;
32218     formatPrefix = locale.formatPrefix;
32219     return locale;
32220   }
32221
32222   // node_modules/d3-format/src/precisionFixed.js
32223   function precisionFixed_default(step) {
32224     return Math.max(0, -exponent_default(Math.abs(step)));
32225   }
32226
32227   // node_modules/d3-format/src/precisionPrefix.js
32228   function precisionPrefix_default(step, value) {
32229     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
32230   }
32231
32232   // node_modules/d3-format/src/precisionRound.js
32233   function precisionRound_default(step, max3) {
32234     step = Math.abs(step), max3 = Math.abs(max3) - step;
32235     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
32236   }
32237
32238   // node_modules/d3-scale/src/tickFormat.js
32239   function tickFormat(start2, stop, count, specifier) {
32240     var step = tickStep(start2, stop, count), precision2;
32241     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
32242     switch (specifier.type) {
32243       case "s": {
32244         var value = Math.max(Math.abs(start2), Math.abs(stop));
32245         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
32246           specifier.precision = precision2;
32247         return formatPrefix(specifier, value);
32248       }
32249       case "":
32250       case "e":
32251       case "g":
32252       case "p":
32253       case "r": {
32254         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
32255           specifier.precision = precision2 - (specifier.type === "e");
32256         break;
32257       }
32258       case "f":
32259       case "%": {
32260         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
32261           specifier.precision = precision2 - (specifier.type === "%") * 2;
32262         break;
32263       }
32264     }
32265     return format(specifier);
32266   }
32267
32268   // node_modules/d3-scale/src/linear.js
32269   function linearish(scale) {
32270     var domain2 = scale.domain;
32271     scale.ticks = function(count) {
32272       var d = domain2();
32273       return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
32274     };
32275     scale.tickFormat = function(count, specifier) {
32276       var d = domain2();
32277       return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
32278     };
32279     scale.nice = function(count) {
32280       if (count == null)
32281         count = 10;
32282       var d = domain2();
32283       var i0 = 0;
32284       var i1 = d.length - 1;
32285       var start2 = d[i0];
32286       var stop = d[i1];
32287       var prestep;
32288       var step;
32289       var maxIter = 10;
32290       if (stop < start2) {
32291         step = start2, start2 = stop, stop = step;
32292         step = i0, i0 = i1, i1 = step;
32293       }
32294       while (maxIter-- > 0) {
32295         step = tickIncrement(start2, stop, count);
32296         if (step === prestep) {
32297           d[i0] = start2;
32298           d[i1] = stop;
32299           return domain2(d);
32300         } else if (step > 0) {
32301           start2 = Math.floor(start2 / step) * step;
32302           stop = Math.ceil(stop / step) * step;
32303         } else if (step < 0) {
32304           start2 = Math.ceil(start2 * step) / step;
32305           stop = Math.floor(stop * step) / step;
32306         } else {
32307           break;
32308         }
32309         prestep = step;
32310       }
32311       return scale;
32312     };
32313     return scale;
32314   }
32315   function linear3() {
32316     var scale = continuous();
32317     scale.copy = function() {
32318       return copy(scale, linear3());
32319     };
32320     initRange.apply(scale, arguments);
32321     return linearish(scale);
32322   }
32323
32324   // node_modules/d3-scale/src/quantize.js
32325   function quantize() {
32326     var x05 = 0, x12 = 1, n2 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
32327     function scale(x) {
32328       return x != null && x <= x ? range3[bisect_default(domain2, x, 0, n2)] : unknown;
32329     }
32330     function rescale() {
32331       var i2 = -1;
32332       domain2 = new Array(n2);
32333       while (++i2 < n2)
32334         domain2[i2] = ((i2 + 1) * x12 - (i2 - n2) * x05) / (n2 + 1);
32335       return scale;
32336     }
32337     scale.domain = function(_) {
32338       return arguments.length ? ([x05, x12] = _, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
32339     };
32340     scale.range = function(_) {
32341       return arguments.length ? (n2 = (range3 = Array.from(_)).length - 1, rescale()) : range3.slice();
32342     };
32343     scale.invertExtent = function(y) {
32344       var i2 = range3.indexOf(y);
32345       return i2 < 0 ? [NaN, NaN] : i2 < 1 ? [x05, domain2[0]] : i2 >= n2 ? [domain2[n2 - 1], x12] : [domain2[i2 - 1], domain2[i2]];
32346     };
32347     scale.unknown = function(_) {
32348       return arguments.length ? (unknown = _, scale) : scale;
32349     };
32350     scale.thresholds = function() {
32351       return domain2.slice();
32352     };
32353     scale.copy = function() {
32354       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
32355     };
32356     return initRange.apply(linearish(scale), arguments);
32357   }
32358
32359   // modules/behavior/breathe.js
32360   function behaviorBreathe() {
32361     var duration = 800;
32362     var steps = 4;
32363     var selector = ".selected.shadow, .selected .shadow";
32364     var _selected = select_default2(null);
32365     var _classed = "";
32366     var _params = {};
32367     var _done = false;
32368     var _timer;
32369     function ratchetyInterpolator(a, b, steps2, units) {
32370       a = parseFloat(a);
32371       b = parseFloat(b);
32372       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a, b), steps2));
32373       return function(t) {
32374         return String(sample(t)) + (units || "");
32375       };
32376     }
32377     function reset(selection2) {
32378       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
32379     }
32380     function setAnimationParams(transition2, fromTo) {
32381       var toFrom = fromTo === "from" ? "to" : "from";
32382       transition2.styleTween("stroke-opacity", function(d) {
32383         return ratchetyInterpolator(_params[d.id][toFrom].opacity, _params[d.id][fromTo].opacity, steps);
32384       }).styleTween("stroke-width", function(d) {
32385         return ratchetyInterpolator(_params[d.id][toFrom].width, _params[d.id][fromTo].width, steps, "px");
32386       }).styleTween("fill-opacity", function(d) {
32387         return ratchetyInterpolator(_params[d.id][toFrom].opacity, _params[d.id][fromTo].opacity, steps);
32388       }).styleTween("r", function(d) {
32389         return ratchetyInterpolator(_params[d.id][toFrom].width, _params[d.id][fromTo].width, steps, "px");
32390       });
32391     }
32392     function calcAnimationParams(selection2) {
32393       selection2.call(reset).each(function(d) {
32394         var s = select_default2(this);
32395         var tag = s.node().tagName;
32396         var p = { "from": {}, "to": {} };
32397         var opacity;
32398         var width;
32399         if (tag === "circle") {
32400           opacity = parseFloat(s.style("fill-opacity") || 0.5);
32401           width = parseFloat(s.style("r") || 15.5);
32402         } else {
32403           opacity = parseFloat(s.style("stroke-opacity") || 0.7);
32404           width = parseFloat(s.style("stroke-width") || 10);
32405         }
32406         p.tag = tag;
32407         p.from.opacity = opacity * 0.6;
32408         p.to.opacity = opacity * 1.25;
32409         p.from.width = width * 0.7;
32410         p.to.width = width * (tag === "circle" ? 1.5 : 1);
32411         _params[d.id] = p;
32412       });
32413     }
32414     function run(surface, fromTo) {
32415       var toFrom = fromTo === "from" ? "to" : "from";
32416       var currSelected = surface.selectAll(selector);
32417       var currClassed = surface.attr("class");
32418       if (_done || currSelected.empty()) {
32419         _selected.call(reset);
32420         _selected = select_default2(null);
32421         return;
32422       }
32423       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
32424         _selected.call(reset);
32425         _classed = currClassed;
32426         _selected = currSelected.call(calcAnimationParams);
32427       }
32428       var didCallNextRun = false;
32429       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
32430         if (!didCallNextRun) {
32431           surface.call(run, toFrom);
32432           didCallNextRun = true;
32433         }
32434         if (!select_default2(this).classed("selected")) {
32435           reset(select_default2(this));
32436         }
32437       });
32438     }
32439     function behavior(surface) {
32440       _done = false;
32441       _timer = timer(function() {
32442         if (surface.selectAll(selector).empty()) {
32443           return false;
32444         }
32445         surface.call(run, "from");
32446         _timer.stop();
32447         return true;
32448       }, 20);
32449     }
32450     behavior.restartIfNeeded = function(surface) {
32451       if (_selected.empty()) {
32452         surface.call(run, "from");
32453         if (_timer) {
32454           _timer.stop();
32455         }
32456       }
32457     };
32458     behavior.off = function() {
32459       _done = true;
32460       if (_timer) {
32461         _timer.stop();
32462       }
32463       _selected.interrupt().call(reset);
32464     };
32465     return behavior;
32466   }
32467
32468   // modules/behavior/operation.js
32469   function behaviorOperation(context) {
32470     var _operation;
32471     function keypress(d3_event) {
32472       if (!context.map().withinEditableZoom())
32473         return;
32474       if (_operation.availableForKeypress && !_operation.availableForKeypress())
32475         return;
32476       d3_event.preventDefault();
32477       var disabled = _operation.disabled();
32478       if (disabled) {
32479         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip)();
32480       } else {
32481         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
32482         if (_operation.point)
32483           _operation.point(null);
32484         _operation();
32485       }
32486     }
32487     function behavior() {
32488       if (_operation && _operation.available()) {
32489         context.keybinding().on(_operation.keys, keypress);
32490       }
32491       return behavior;
32492     }
32493     behavior.off = function() {
32494       context.keybinding().off(_operation.keys);
32495     };
32496     behavior.which = function(_) {
32497       if (!arguments.length)
32498         return _operation;
32499       _operation = _;
32500       return behavior;
32501     };
32502     return behavior;
32503   }
32504
32505   // modules/operations/circularize.js
32506   function operationCircularize(context, selectedIDs) {
32507     var _extent;
32508     var _actions = selectedIDs.map(getAction).filter(Boolean);
32509     var _amount = _actions.length === 1 ? "single" : "multiple";
32510     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
32511       return n2.loc;
32512     });
32513     function getAction(entityID) {
32514       var entity = context.entity(entityID);
32515       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
32516         return null;
32517       if (!_extent) {
32518         _extent = entity.extent(context.graph());
32519       } else {
32520         _extent = _extent.extend(entity.extent(context.graph()));
32521       }
32522       return actionCircularize(entityID, context.projection);
32523     }
32524     var operation = function() {
32525       if (!_actions.length)
32526         return;
32527       var combinedAction = function(graph, t) {
32528         _actions.forEach(function(action) {
32529           if (!action.disabled(graph)) {
32530             graph = action(graph, t);
32531           }
32532         });
32533         return graph;
32534       };
32535       combinedAction.transitionable = true;
32536       context.perform(combinedAction, operation.annotation());
32537       window.setTimeout(function() {
32538         context.validator().validate();
32539       }, 300);
32540     };
32541     operation.available = function() {
32542       return _actions.length && selectedIDs.length === _actions.length;
32543     };
32544     operation.disabled = function() {
32545       if (!_actions.length)
32546         return "";
32547       var actionDisableds = _actions.map(function(action) {
32548         return action.disabled(context.graph());
32549       }).filter(Boolean);
32550       if (actionDisableds.length === _actions.length) {
32551         if (new Set(actionDisableds).size > 1) {
32552           return "multiple_blockers";
32553         }
32554         return actionDisableds[0];
32555       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
32556         return "too_large";
32557       } else if (someMissing()) {
32558         return "not_downloaded";
32559       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32560         return "connected_to_hidden";
32561       }
32562       return false;
32563       function someMissing() {
32564         if (context.inIntro())
32565           return false;
32566         var osm = context.connection();
32567         if (osm) {
32568           var missing = _coords.filter(function(loc) {
32569             return !osm.isDataLoaded(loc);
32570           });
32571           if (missing.length) {
32572             missing.forEach(function(loc) {
32573               context.loadTileAtLoc(loc);
32574             });
32575             return true;
32576           }
32577         }
32578         return false;
32579       }
32580     };
32581     operation.tooltip = function() {
32582       var disable = operation.disabled();
32583       return disable ? _t("operations.circularize." + disable + "." + _amount) : _t("operations.circularize.description." + _amount);
32584     };
32585     operation.annotation = function() {
32586       return _t("operations.circularize.annotation.feature", { n: _actions.length });
32587     };
32588     operation.id = "circularize";
32589     operation.keys = [_t("operations.circularize.key")];
32590     operation.title = _t("operations.circularize.title");
32591     operation.behavior = behaviorOperation(context).which(operation);
32592     return operation;
32593   }
32594
32595   // modules/ui/cmd.js
32596   var uiCmd = function(code) {
32597     var detected = utilDetect();
32598     if (detected.os === "mac") {
32599       return code;
32600     }
32601     if (detected.os === "win") {
32602       if (code === "\u2318\u21E7Z")
32603         return "Ctrl+Y";
32604     }
32605     var result = "", replacements = {
32606       "\u2318": "Ctrl",
32607       "\u21E7": "Shift",
32608       "\u2325": "Alt",
32609       "\u232B": "Backspace",
32610       "\u2326": "Delete"
32611     };
32612     for (var i2 = 0; i2 < code.length; i2++) {
32613       if (code[i2] in replacements) {
32614         result += replacements[code[i2]] + (i2 < code.length - 1 ? "+" : "");
32615       } else {
32616         result += code[i2];
32617       }
32618     }
32619     return result;
32620   };
32621   uiCmd.display = function(code) {
32622     if (code.length !== 1)
32623       return code;
32624     var detected = utilDetect();
32625     var mac = detected.os === "mac";
32626     var replacements = {
32627       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
32628       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
32629       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
32630       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
32631       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
32632       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
32633       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
32634       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
32635       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
32636       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
32637       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
32638       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
32639       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
32640     };
32641     return replacements[code] || code;
32642   };
32643
32644   // modules/operations/delete.js
32645   function operationDelete(context, selectedIDs) {
32646     var multi = selectedIDs.length === 1 ? "single" : "multiple";
32647     var action = actionDeleteMultiple(selectedIDs);
32648     var nodes = utilGetAllNodes(selectedIDs, context.graph());
32649     var coords = nodes.map(function(n2) {
32650       return n2.loc;
32651     });
32652     var extent = utilTotalExtent(selectedIDs, context.graph());
32653     var operation = function() {
32654       var nextSelectedID;
32655       var nextSelectedLoc;
32656       if (selectedIDs.length === 1) {
32657         var id2 = selectedIDs[0];
32658         var entity = context.entity(id2);
32659         var geometry = entity.geometry(context.graph());
32660         var parents = context.graph().parentWays(entity);
32661         var parent = parents[0];
32662         if (geometry === "vertex") {
32663           var nodes2 = parent.nodes;
32664           var i2 = nodes2.indexOf(id2);
32665           if (i2 === 0) {
32666             i2++;
32667           } else if (i2 === nodes2.length - 1) {
32668             i2--;
32669           } else {
32670             var a = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 - 1]).loc);
32671             var b = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 + 1]).loc);
32672             i2 = a < b ? i2 - 1 : i2 + 1;
32673           }
32674           nextSelectedID = nodes2[i2];
32675           nextSelectedLoc = context.entity(nextSelectedID).loc;
32676         }
32677       }
32678       context.perform(action, operation.annotation());
32679       context.validator().validate();
32680       if (nextSelectedID && nextSelectedLoc) {
32681         if (context.hasEntity(nextSelectedID)) {
32682           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
32683         } else {
32684           context.map().centerEase(nextSelectedLoc);
32685           context.enter(modeBrowse(context));
32686         }
32687       } else {
32688         context.enter(modeBrowse(context));
32689       }
32690     };
32691     operation.available = function() {
32692       return true;
32693     };
32694     operation.disabled = function() {
32695       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
32696         return "too_large";
32697       } else if (someMissing()) {
32698         return "not_downloaded";
32699       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32700         return "connected_to_hidden";
32701       } else if (selectedIDs.some(protectedMember)) {
32702         return "part_of_relation";
32703       } else if (selectedIDs.some(incompleteRelation)) {
32704         return "incomplete_relation";
32705       } else if (selectedIDs.some(hasWikidataTag)) {
32706         return "has_wikidata_tag";
32707       }
32708       return false;
32709       function someMissing() {
32710         if (context.inIntro())
32711           return false;
32712         var osm = context.connection();
32713         if (osm) {
32714           var missing = coords.filter(function(loc) {
32715             return !osm.isDataLoaded(loc);
32716           });
32717           if (missing.length) {
32718             missing.forEach(function(loc) {
32719               context.loadTileAtLoc(loc);
32720             });
32721             return true;
32722           }
32723         }
32724         return false;
32725       }
32726       function hasWikidataTag(id2) {
32727         var entity = context.entity(id2);
32728         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
32729       }
32730       function incompleteRelation(id2) {
32731         var entity = context.entity(id2);
32732         return entity.type === "relation" && !entity.isComplete(context.graph());
32733       }
32734       function protectedMember(id2) {
32735         var entity = context.entity(id2);
32736         if (entity.type !== "way")
32737           return false;
32738         var parents = context.graph().parentRelations(entity);
32739         for (var i2 = 0; i2 < parents.length; i2++) {
32740           var parent = parents[i2];
32741           var type3 = parent.tags.type;
32742           var role = parent.memberById(id2).role || "outer";
32743           if (type3 === "route" || type3 === "boundary" || type3 === "multipolygon" && role === "outer") {
32744             return true;
32745           }
32746         }
32747         return false;
32748       }
32749     };
32750     operation.tooltip = function() {
32751       var disable = operation.disabled();
32752       return disable ? _t("operations.delete." + disable + "." + multi) : _t("operations.delete.description." + multi);
32753     };
32754     operation.annotation = function() {
32755       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
32756     };
32757     operation.id = "delete";
32758     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
32759     operation.title = _t("operations.delete.title");
32760     operation.behavior = behaviorOperation(context).which(operation);
32761     return operation;
32762   }
32763
32764   // modules/operations/orthogonalize.js
32765   function operationOrthogonalize(context, selectedIDs) {
32766     var _extent;
32767     var _type;
32768     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
32769     var _amount = _actions.length === 1 ? "single" : "multiple";
32770     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
32771       return n2.loc;
32772     });
32773     function chooseAction(entityID) {
32774       var entity = context.entity(entityID);
32775       var geometry = entity.geometry(context.graph());
32776       if (!_extent) {
32777         _extent = entity.extent(context.graph());
32778       } else {
32779         _extent = _extent.extend(entity.extent(context.graph()));
32780       }
32781       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
32782         if (_type && _type !== "feature")
32783           return null;
32784         _type = "feature";
32785         return actionOrthogonalize(entityID, context.projection);
32786       } else if (geometry === "vertex") {
32787         if (_type && _type !== "corner")
32788           return null;
32789         _type = "corner";
32790         var graph = context.graph();
32791         var parents = graph.parentWays(entity);
32792         if (parents.length === 1) {
32793           var way = parents[0];
32794           if (way.nodes.indexOf(entityID) !== -1) {
32795             return actionOrthogonalize(way.id, context.projection, entityID);
32796           }
32797         }
32798       }
32799       return null;
32800     }
32801     var operation = function() {
32802       if (!_actions.length)
32803         return;
32804       var combinedAction = function(graph, t) {
32805         _actions.forEach(function(action) {
32806           if (!action.disabled(graph)) {
32807             graph = action(graph, t);
32808           }
32809         });
32810         return graph;
32811       };
32812       combinedAction.transitionable = true;
32813       context.perform(combinedAction, operation.annotation());
32814       window.setTimeout(function() {
32815         context.validator().validate();
32816       }, 300);
32817     };
32818     operation.available = function() {
32819       return _actions.length && selectedIDs.length === _actions.length;
32820     };
32821     operation.disabled = function() {
32822       if (!_actions.length)
32823         return "";
32824       var actionDisableds = _actions.map(function(action) {
32825         return action.disabled(context.graph());
32826       }).filter(Boolean);
32827       if (actionDisableds.length === _actions.length) {
32828         if (new Set(actionDisableds).size > 1) {
32829           return "multiple_blockers";
32830         }
32831         return actionDisableds[0];
32832       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
32833         return "too_large";
32834       } else if (someMissing()) {
32835         return "not_downloaded";
32836       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32837         return "connected_to_hidden";
32838       }
32839       return false;
32840       function someMissing() {
32841         if (context.inIntro())
32842           return false;
32843         var osm = context.connection();
32844         if (osm) {
32845           var missing = _coords.filter(function(loc) {
32846             return !osm.isDataLoaded(loc);
32847           });
32848           if (missing.length) {
32849             missing.forEach(function(loc) {
32850               context.loadTileAtLoc(loc);
32851             });
32852             return true;
32853           }
32854         }
32855         return false;
32856       }
32857     };
32858     operation.tooltip = function() {
32859       var disable = operation.disabled();
32860       return disable ? _t("operations.orthogonalize." + disable + "." + _amount) : _t("operations.orthogonalize.description." + _type + "." + _amount);
32861     };
32862     operation.annotation = function() {
32863       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
32864     };
32865     operation.id = "orthogonalize";
32866     operation.keys = [_t("operations.orthogonalize.key")];
32867     operation.title = _t("operations.orthogonalize.title");
32868     operation.behavior = behaviorOperation(context).which(operation);
32869     return operation;
32870   }
32871
32872   // modules/operations/reflect.js
32873   function operationReflectShort(context, selectedIDs) {
32874     return operationReflect(context, selectedIDs, "short");
32875   }
32876   function operationReflectLong(context, selectedIDs) {
32877     return operationReflect(context, selectedIDs, "long");
32878   }
32879   function operationReflect(context, selectedIDs, axis) {
32880     axis = axis || "long";
32881     var multi = selectedIDs.length === 1 ? "single" : "multiple";
32882     var nodes = utilGetAllNodes(selectedIDs, context.graph());
32883     var coords = nodes.map(function(n2) {
32884       return n2.loc;
32885     });
32886     var extent = utilTotalExtent(selectedIDs, context.graph());
32887     var operation = function() {
32888       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
32889       context.perform(action, operation.annotation());
32890       window.setTimeout(function() {
32891         context.validator().validate();
32892       }, 300);
32893     };
32894     operation.available = function() {
32895       return nodes.length >= 3;
32896     };
32897     operation.disabled = function() {
32898       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
32899         return "too_large";
32900       } else if (someMissing()) {
32901         return "not_downloaded";
32902       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32903         return "connected_to_hidden";
32904       } else if (selectedIDs.some(incompleteRelation)) {
32905         return "incomplete_relation";
32906       }
32907       return false;
32908       function someMissing() {
32909         if (context.inIntro())
32910           return false;
32911         var osm = context.connection();
32912         if (osm) {
32913           var missing = coords.filter(function(loc) {
32914             return !osm.isDataLoaded(loc);
32915           });
32916           if (missing.length) {
32917             missing.forEach(function(loc) {
32918               context.loadTileAtLoc(loc);
32919             });
32920             return true;
32921           }
32922         }
32923         return false;
32924       }
32925       function incompleteRelation(id2) {
32926         var entity = context.entity(id2);
32927         return entity.type === "relation" && !entity.isComplete(context.graph());
32928       }
32929     };
32930     operation.tooltip = function() {
32931       var disable = operation.disabled();
32932       return disable ? _t("operations.reflect." + disable + "." + multi) : _t("operations.reflect.description." + axis + "." + multi);
32933     };
32934     operation.annotation = function() {
32935       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
32936     };
32937     operation.id = "reflect-" + axis;
32938     operation.keys = [_t("operations.reflect.key." + axis)];
32939     operation.title = _t("operations.reflect.title." + axis);
32940     operation.behavior = behaviorOperation(context).which(operation);
32941     return operation;
32942   }
32943
32944   // modules/operations/move.js
32945   function operationMove(context, selectedIDs) {
32946     var multi = selectedIDs.length === 1 ? "single" : "multiple";
32947     var nodes = utilGetAllNodes(selectedIDs, context.graph());
32948     var coords = nodes.map(function(n2) {
32949       return n2.loc;
32950     });
32951     var extent = utilTotalExtent(selectedIDs, context.graph());
32952     var operation = function() {
32953       context.enter(modeMove(context, selectedIDs));
32954     };
32955     operation.available = function() {
32956       return selectedIDs.length > 0;
32957     };
32958     operation.disabled = function() {
32959       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
32960         return "too_large";
32961       } else if (someMissing()) {
32962         return "not_downloaded";
32963       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32964         return "connected_to_hidden";
32965       } else if (selectedIDs.some(incompleteRelation)) {
32966         return "incomplete_relation";
32967       }
32968       return false;
32969       function someMissing() {
32970         if (context.inIntro())
32971           return false;
32972         var osm = context.connection();
32973         if (osm) {
32974           var missing = coords.filter(function(loc) {
32975             return !osm.isDataLoaded(loc);
32976           });
32977           if (missing.length) {
32978             missing.forEach(function(loc) {
32979               context.loadTileAtLoc(loc);
32980             });
32981             return true;
32982           }
32983         }
32984         return false;
32985       }
32986       function incompleteRelation(id2) {
32987         var entity = context.entity(id2);
32988         return entity.type === "relation" && !entity.isComplete(context.graph());
32989       }
32990     };
32991     operation.tooltip = function() {
32992       var disable = operation.disabled();
32993       return disable ? _t("operations.move." + disable + "." + multi) : _t("operations.move.description." + multi);
32994     };
32995     operation.annotation = function() {
32996       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
32997     };
32998     operation.id = "move";
32999     operation.keys = [_t("operations.move.key")];
33000     operation.title = _t("operations.move.title");
33001     operation.behavior = behaviorOperation(context).which(operation);
33002     operation.mouseOnly = true;
33003     return operation;
33004   }
33005
33006   // modules/modes/rotate.js
33007   function modeRotate(context, entityIDs) {
33008     var _tolerancePx = 4;
33009     var mode = {
33010       id: "rotate",
33011       button: "browse"
33012     };
33013     var keybinding = utilKeybinding("rotate");
33014     var behaviors = [
33015       behaviorEdit(context),
33016       operationCircularize(context, entityIDs).behavior,
33017       operationDelete(context, entityIDs).behavior,
33018       operationMove(context, entityIDs).behavior,
33019       operationOrthogonalize(context, entityIDs).behavior,
33020       operationReflectLong(context, entityIDs).behavior,
33021       operationReflectShort(context, entityIDs).behavior
33022     ];
33023     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
33024     var _prevGraph;
33025     var _prevAngle;
33026     var _prevTransform;
33027     var _pivot;
33028     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33029     function doRotate(d3_event) {
33030       var fn;
33031       if (context.graph() !== _prevGraph) {
33032         fn = context.perform;
33033       } else {
33034         fn = context.replace;
33035       }
33036       var projection2 = context.projection;
33037       var currTransform = projection2.transform();
33038       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
33039         var nodes = utilGetAllNodes(entityIDs, context.graph());
33040         var points = nodes.map(function(n2) {
33041           return projection2(n2.loc);
33042         });
33043         _pivot = getPivot(points);
33044         _prevAngle = void 0;
33045       }
33046       var currMouse = context.map().mouse(d3_event);
33047       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
33048       if (typeof _prevAngle === "undefined")
33049         _prevAngle = currAngle;
33050       var delta = currAngle - _prevAngle;
33051       fn(actionRotate(entityIDs, _pivot, delta, projection2));
33052       _prevTransform = currTransform;
33053       _prevAngle = currAngle;
33054       _prevGraph = context.graph();
33055     }
33056     function getPivot(points) {
33057       var _pivot2;
33058       if (points.length === 1) {
33059         _pivot2 = points[0];
33060       } else if (points.length === 2) {
33061         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33062       } else {
33063         var polygonHull = hull_default(points);
33064         if (polygonHull.length === 2) {
33065           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33066         } else {
33067           _pivot2 = centroid_default2(hull_default(points));
33068         }
33069       }
33070       return _pivot2;
33071     }
33072     function finish(d3_event) {
33073       d3_event.stopPropagation();
33074       context.replace(actionNoop(), annotation);
33075       context.enter(modeSelect(context, entityIDs));
33076     }
33077     function cancel() {
33078       if (_prevGraph)
33079         context.pop();
33080       context.enter(modeSelect(context, entityIDs));
33081     }
33082     function undone() {
33083       context.enter(modeBrowse(context));
33084     }
33085     mode.enter = function() {
33086       _prevGraph = null;
33087       context.features().forceVisible(entityIDs);
33088       behaviors.forEach(context.install);
33089       var downEvent;
33090       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
33091         downEvent = d3_event;
33092       });
33093       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
33094         if (!downEvent)
33095           return;
33096         var mapNode = context.container().select(".main-map").node();
33097         var pointGetter = utilFastMouse(mapNode);
33098         var p1 = pointGetter(downEvent);
33099         var p2 = pointGetter(d3_event);
33100         var dist = geoVecLength(p1, p2);
33101         if (dist <= _tolerancePx)
33102           finish(d3_event);
33103         downEvent = null;
33104       }, true);
33105       context.history().on("undone.modeRotate", undone);
33106       keybinding.on("\u238B", cancel).on("\u21A9", finish);
33107       select_default2(document).call(keybinding);
33108     };
33109     mode.exit = function() {
33110       behaviors.forEach(context.uninstall);
33111       context.surface().on(_pointerPrefix + "down.modeRotate", null);
33112       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
33113       context.history().on("undone.modeRotate", null);
33114       select_default2(document).call(keybinding.unbind);
33115       context.features().forceVisible([]);
33116     };
33117     mode.selectedIDs = function() {
33118       if (!arguments.length)
33119         return entityIDs;
33120       return mode;
33121     };
33122     return mode;
33123   }
33124
33125   // modules/operations/rotate.js
33126   function operationRotate(context, selectedIDs) {
33127     var multi = selectedIDs.length === 1 ? "single" : "multiple";
33128     var nodes = utilGetAllNodes(selectedIDs, context.graph());
33129     var coords = nodes.map(function(n2) {
33130       return n2.loc;
33131     });
33132     var extent = utilTotalExtent(selectedIDs, context.graph());
33133     var operation = function() {
33134       context.enter(modeRotate(context, selectedIDs));
33135     };
33136     operation.available = function() {
33137       return nodes.length >= 2;
33138     };
33139     operation.disabled = function() {
33140       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33141         return "too_large";
33142       } else if (someMissing()) {
33143         return "not_downloaded";
33144       } else if (selectedIDs.some(context.hasHiddenConnections)) {
33145         return "connected_to_hidden";
33146       } else if (selectedIDs.some(incompleteRelation)) {
33147         return "incomplete_relation";
33148       }
33149       return false;
33150       function someMissing() {
33151         if (context.inIntro())
33152           return false;
33153         var osm = context.connection();
33154         if (osm) {
33155           var missing = coords.filter(function(loc) {
33156             return !osm.isDataLoaded(loc);
33157           });
33158           if (missing.length) {
33159             missing.forEach(function(loc) {
33160               context.loadTileAtLoc(loc);
33161             });
33162             return true;
33163           }
33164         }
33165         return false;
33166       }
33167       function incompleteRelation(id2) {
33168         var entity = context.entity(id2);
33169         return entity.type === "relation" && !entity.isComplete(context.graph());
33170       }
33171     };
33172     operation.tooltip = function() {
33173       var disable = operation.disabled();
33174       return disable ? _t("operations.rotate." + disable + "." + multi) : _t("operations.rotate.description." + multi);
33175     };
33176     operation.annotation = function() {
33177       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
33178     };
33179     operation.id = "rotate";
33180     operation.keys = [_t("operations.rotate.key")];
33181     operation.title = _t("operations.rotate.title");
33182     operation.behavior = behaviorOperation(context).which(operation);
33183     operation.mouseOnly = true;
33184     return operation;
33185   }
33186
33187   // modules/modes/move.js
33188   function modeMove(context, entityIDs, baseGraph) {
33189     var _tolerancePx = 4;
33190     var mode = {
33191       id: "move",
33192       button: "browse"
33193     };
33194     var keybinding = utilKeybinding("move");
33195     var behaviors = [
33196       behaviorEdit(context),
33197       operationCircularize(context, entityIDs).behavior,
33198       operationDelete(context, entityIDs).behavior,
33199       operationOrthogonalize(context, entityIDs).behavior,
33200       operationReflectLong(context, entityIDs).behavior,
33201       operationReflectShort(context, entityIDs).behavior,
33202       operationRotate(context, entityIDs).behavior
33203     ];
33204     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
33205     var _prevGraph;
33206     var _cache4;
33207     var _origin;
33208     var _nudgeInterval;
33209     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33210     function doMove(nudge) {
33211       nudge = nudge || [0, 0];
33212       var fn;
33213       if (_prevGraph !== context.graph()) {
33214         _cache4 = {};
33215         _origin = context.map().mouseCoordinates();
33216         fn = context.perform;
33217       } else {
33218         fn = context.overwrite;
33219       }
33220       var currMouse = context.map().mouse();
33221       var origMouse = context.projection(_origin);
33222       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
33223       fn(actionMove(entityIDs, delta, context.projection, _cache4));
33224       _prevGraph = context.graph();
33225     }
33226     function startNudge(nudge) {
33227       if (_nudgeInterval)
33228         window.clearInterval(_nudgeInterval);
33229       _nudgeInterval = window.setInterval(function() {
33230         context.map().pan(nudge);
33231         doMove(nudge);
33232       }, 50);
33233     }
33234     function stopNudge() {
33235       if (_nudgeInterval) {
33236         window.clearInterval(_nudgeInterval);
33237         _nudgeInterval = null;
33238       }
33239     }
33240     function move() {
33241       doMove();
33242       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
33243       if (nudge) {
33244         startNudge(nudge);
33245       } else {
33246         stopNudge();
33247       }
33248     }
33249     function finish(d3_event) {
33250       d3_event.stopPropagation();
33251       context.replace(actionNoop(), annotation);
33252       context.enter(modeSelect(context, entityIDs));
33253       stopNudge();
33254     }
33255     function cancel() {
33256       if (baseGraph) {
33257         while (context.graph() !== baseGraph)
33258           context.pop();
33259         context.enter(modeBrowse(context));
33260       } else {
33261         if (_prevGraph)
33262           context.pop();
33263         context.enter(modeSelect(context, entityIDs));
33264       }
33265       stopNudge();
33266     }
33267     function undone() {
33268       context.enter(modeBrowse(context));
33269     }
33270     mode.enter = function() {
33271       _origin = context.map().mouseCoordinates();
33272       _prevGraph = null;
33273       _cache4 = {};
33274       context.features().forceVisible(entityIDs);
33275       behaviors.forEach(context.install);
33276       var downEvent;
33277       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
33278         downEvent = d3_event;
33279       });
33280       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
33281         if (!downEvent)
33282           return;
33283         var mapNode = context.container().select(".main-map").node();
33284         var pointGetter = utilFastMouse(mapNode);
33285         var p1 = pointGetter(downEvent);
33286         var p2 = pointGetter(d3_event);
33287         var dist = geoVecLength(p1, p2);
33288         if (dist <= _tolerancePx)
33289           finish(d3_event);
33290         downEvent = null;
33291       }, true);
33292       context.history().on("undone.modeMove", undone);
33293       keybinding.on("\u238B", cancel).on("\u21A9", finish);
33294       select_default2(document).call(keybinding);
33295     };
33296     mode.exit = function() {
33297       stopNudge();
33298       behaviors.forEach(function(behavior) {
33299         context.uninstall(behavior);
33300       });
33301       context.surface().on(_pointerPrefix + "down.modeMove", null);
33302       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
33303       context.history().on("undone.modeMove", null);
33304       select_default2(document).call(keybinding.unbind);
33305       context.features().forceVisible([]);
33306     };
33307     mode.selectedIDs = function() {
33308       if (!arguments.length)
33309         return entityIDs;
33310       return mode;
33311     };
33312     return mode;
33313   }
33314
33315   // modules/behavior/paste.js
33316   function behaviorPaste(context) {
33317     function doPaste(d3_event) {
33318       if (!context.map().withinEditableZoom())
33319         return;
33320       d3_event.preventDefault();
33321       var baseGraph = context.graph();
33322       var mouse = context.map().mouse();
33323       var projection2 = context.projection;
33324       var viewport = geoExtent(projection2.clipExtent()).polygon();
33325       if (!geoPointInPolygon(mouse, viewport))
33326         return;
33327       var oldIDs = context.copyIDs();
33328       if (!oldIDs.length)
33329         return;
33330       var extent = geoExtent();
33331       var oldGraph = context.copyGraph();
33332       var newIDs = [];
33333       var action = actionCopyEntities(oldIDs, oldGraph);
33334       context.perform(action);
33335       var copies = action.copies();
33336       var originals = /* @__PURE__ */ new Set();
33337       Object.values(copies).forEach(function(entity) {
33338         originals.add(entity.id);
33339       });
33340       for (var id2 in copies) {
33341         var oldEntity = oldGraph.entity(id2);
33342         var newEntity = copies[id2];
33343         extent._extend(oldEntity.extent(oldGraph));
33344         var parents = context.graph().parentWays(newEntity);
33345         var parentCopied = parents.some(function(parent) {
33346           return originals.has(parent.id);
33347         });
33348         if (!parentCopied) {
33349           newIDs.push(newEntity.id);
33350         }
33351       }
33352       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
33353       var delta = geoVecSubtract(mouse, copyPoint);
33354       context.perform(actionMove(newIDs, delta, projection2));
33355       context.enter(modeMove(context, newIDs, baseGraph));
33356     }
33357     function behavior() {
33358       context.keybinding().on(uiCmd("\u2318V"), doPaste);
33359       return behavior;
33360     }
33361     behavior.off = function() {
33362       context.keybinding().off(uiCmd("\u2318V"));
33363     };
33364     return behavior;
33365   }
33366
33367   // modules/behavior/drag.js
33368   function behaviorDrag() {
33369     var dispatch10 = dispatch_default("start", "move", "end");
33370     var _tolerancePx = 1;
33371     var _penTolerancePx = 4;
33372     var _origin = null;
33373     var _selector = "";
33374     var _targetNode;
33375     var _targetEntity;
33376     var _surface;
33377     var _pointerId;
33378     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33379     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
33380     var d3_event_userSelectSuppress = function() {
33381       var selection2 = selection_default();
33382       var select = selection2.style(d3_event_userSelectProperty);
33383       selection2.style(d3_event_userSelectProperty, "none");
33384       return function() {
33385         selection2.style(d3_event_userSelectProperty, select);
33386       };
33387     };
33388     function pointerdown(d3_event) {
33389       if (_pointerId)
33390         return;
33391       _pointerId = d3_event.pointerId || "mouse";
33392       _targetNode = this;
33393       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
33394       var offset;
33395       var startOrigin = pointerLocGetter(d3_event);
33396       var started = false;
33397       var selectEnable = d3_event_userSelectSuppress();
33398       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
33399       if (_origin) {
33400         offset = _origin.call(_targetNode, _targetEntity);
33401         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
33402       } else {
33403         offset = [0, 0];
33404       }
33405       d3_event.stopPropagation();
33406       function pointermove(d3_event2) {
33407         if (_pointerId !== (d3_event2.pointerId || "mouse"))
33408           return;
33409         var p = pointerLocGetter(d3_event2);
33410         if (!started) {
33411           var dist = geoVecLength(startOrigin, p);
33412           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
33413           if (dist < tolerance)
33414             return;
33415           started = true;
33416           dispatch10.call("start", this, d3_event2, _targetEntity);
33417         } else {
33418           startOrigin = p;
33419           d3_event2.stopPropagation();
33420           d3_event2.preventDefault();
33421           var dx = p[0] - startOrigin[0];
33422           var dy = p[1] - startOrigin[1];
33423           dispatch10.call("move", this, d3_event2, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
33424         }
33425       }
33426       function pointerup(d3_event2) {
33427         if (_pointerId !== (d3_event2.pointerId || "mouse"))
33428           return;
33429         _pointerId = null;
33430         if (started) {
33431           dispatch10.call("end", this, d3_event2, _targetEntity);
33432           d3_event2.preventDefault();
33433         }
33434         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33435         selectEnable();
33436       }
33437     }
33438     function behavior(selection2) {
33439       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
33440       var delegate = pointerdown;
33441       if (_selector) {
33442         delegate = function(d3_event) {
33443           var root3 = this;
33444           var target = d3_event.target;
33445           for (; target && target !== root3; target = target.parentNode) {
33446             var datum2 = target.__data__;
33447             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
33448             if (_targetEntity && target[matchesSelector](_selector)) {
33449               return pointerdown.call(target, d3_event);
33450             }
33451           }
33452         };
33453       }
33454       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
33455     }
33456     behavior.off = function(selection2) {
33457       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
33458     };
33459     behavior.selector = function(_) {
33460       if (!arguments.length)
33461         return _selector;
33462       _selector = _;
33463       return behavior;
33464     };
33465     behavior.origin = function(_) {
33466       if (!arguments.length)
33467         return _origin;
33468       _origin = _;
33469       return behavior;
33470     };
33471     behavior.cancel = function() {
33472       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33473       return behavior;
33474     };
33475     behavior.targetNode = function(_) {
33476       if (!arguments.length)
33477         return _targetNode;
33478       _targetNode = _;
33479       return behavior;
33480     };
33481     behavior.targetEntity = function(_) {
33482       if (!arguments.length)
33483         return _targetEntity;
33484       _targetEntity = _;
33485       return behavior;
33486     };
33487     behavior.surface = function(_) {
33488       if (!arguments.length)
33489         return _surface;
33490       _surface = _;
33491       return behavior;
33492     };
33493     return utilRebind(behavior, dispatch10, "on");
33494   }
33495
33496   // modules/modes/drag_node.js
33497   function modeDragNode(context) {
33498     var mode = {
33499       id: "drag-node",
33500       button: "browse"
33501     };
33502     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
33503     var edit2 = behaviorEdit(context);
33504     var _nudgeInterval;
33505     var _restoreSelectedIDs = [];
33506     var _wasMidpoint = false;
33507     var _isCancelled = false;
33508     var _activeEntity;
33509     var _startLoc;
33510     var _lastLoc;
33511     function startNudge(d3_event, entity, nudge) {
33512       if (_nudgeInterval)
33513         window.clearInterval(_nudgeInterval);
33514       _nudgeInterval = window.setInterval(function() {
33515         context.map().pan(nudge);
33516         doMove(d3_event, entity, nudge);
33517       }, 50);
33518     }
33519     function stopNudge() {
33520       if (_nudgeInterval) {
33521         window.clearInterval(_nudgeInterval);
33522         _nudgeInterval = null;
33523       }
33524     }
33525     function moveAnnotation(entity) {
33526       return _t("operations.move.annotation." + entity.geometry(context.graph()));
33527     }
33528     function connectAnnotation(nodeEntity, targetEntity) {
33529       var nodeGeometry = nodeEntity.geometry(context.graph());
33530       var targetGeometry = targetEntity.geometry(context.graph());
33531       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
33532         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
33533         var targetParentWayIDs = context.graph().parentWays(targetEntity);
33534         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
33535         if (sharedParentWays.length !== 0) {
33536           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
33537             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
33538           }
33539           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
33540         }
33541       }
33542       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
33543     }
33544     function shouldSnapToNode(target) {
33545       if (!_activeEntity)
33546         return false;
33547       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
33548     }
33549     function origin(entity) {
33550       return context.projection(entity.loc);
33551     }
33552     function keydown(d3_event) {
33553       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33554         if (context.surface().classed("nope")) {
33555           context.surface().classed("nope-suppressed", true);
33556         }
33557         context.surface().classed("nope", false).classed("nope-disabled", true);
33558       }
33559     }
33560     function keyup(d3_event) {
33561       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33562         if (context.surface().classed("nope-suppressed")) {
33563           context.surface().classed("nope", true);
33564         }
33565         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
33566       }
33567     }
33568     function start2(d3_event, entity) {
33569       _wasMidpoint = entity.type === "midpoint";
33570       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
33571       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
33572       if (_isCancelled) {
33573         if (hasHidden) {
33574           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t("modes.drag_node.connected_to_hidden"))();
33575         }
33576         return drag.cancel();
33577       }
33578       if (_wasMidpoint) {
33579         var midpoint = entity;
33580         entity = osmNode();
33581         context.perform(actionAddMidpoint(midpoint, entity));
33582         entity = context.entity(entity.id);
33583         var vertex = context.surface().selectAll("." + entity.id);
33584         drag.targetNode(vertex.node()).targetEntity(entity);
33585       } else {
33586         context.perform(actionNoop());
33587       }
33588       _activeEntity = entity;
33589       _startLoc = entity.loc;
33590       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
33591       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
33592       context.enter(mode);
33593     }
33594     function datum2(d3_event) {
33595       if (!d3_event || d3_event.altKey) {
33596         return {};
33597       } else {
33598         var d = d3_event.target.__data__;
33599         return d && d.properties && d.properties.target ? d : {};
33600       }
33601     }
33602     function doMove(d3_event, entity, nudge) {
33603       nudge = nudge || [0, 0];
33604       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
33605       var currMouse = geoVecSubtract(currPoint, nudge);
33606       var loc = context.projection.invert(currMouse);
33607       var target, edge;
33608       if (!_nudgeInterval) {
33609         var d = datum2(d3_event);
33610         target = d && d.properties && d.properties.entity;
33611         var targetLoc = target && target.loc;
33612         var targetNodes = d && d.properties && d.properties.nodes;
33613         if (targetLoc) {
33614           if (shouldSnapToNode(target)) {
33615             loc = targetLoc;
33616           }
33617         } else if (targetNodes) {
33618           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
33619           if (edge) {
33620             loc = edge.loc;
33621           }
33622         }
33623       }
33624       context.replace(actionMoveNode(entity.id, loc));
33625       var isInvalid = false;
33626       if (target) {
33627         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
33628       }
33629       if (!isInvalid) {
33630         isInvalid = hasInvalidGeometry(entity, context.graph());
33631       }
33632       var nope = context.surface().classed("nope");
33633       if (isInvalid === "relation" || isInvalid === "restriction") {
33634         if (!nope) {
33635           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.connect." + isInvalid, { relation: _mainPresetIndex.item("type/restriction").name() }))();
33636         }
33637       } else if (isInvalid) {
33638         var errorID = isInvalid === "line" ? "lines" : "areas";
33639         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.html("self_intersection.error." + errorID))();
33640       } else {
33641         if (nope) {
33642           context.ui().flash.duration(1).label("")();
33643         }
33644       }
33645       var nopeDisabled = context.surface().classed("nope-disabled");
33646       if (nopeDisabled) {
33647         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
33648       } else {
33649         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
33650       }
33651       _lastLoc = loc;
33652     }
33653     function hasRelationConflict(entity, target, edge, graph) {
33654       var testGraph = graph.update();
33655       if (edge) {
33656         var midpoint = osmNode();
33657         var action = actionAddMidpoint({
33658           loc: edge.loc,
33659           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
33660         }, midpoint);
33661         testGraph = action(testGraph);
33662         target = midpoint;
33663       }
33664       var ids = [entity.id, target.id];
33665       return actionConnect(ids).disabled(testGraph);
33666     }
33667     function hasInvalidGeometry(entity, graph) {
33668       var parents = graph.parentWays(entity);
33669       var i2, j2, k;
33670       for (i2 = 0; i2 < parents.length; i2++) {
33671         var parent = parents[i2];
33672         var nodes = [];
33673         var activeIndex = null;
33674         var relations = graph.parentRelations(parent);
33675         for (j2 = 0; j2 < relations.length; j2++) {
33676           if (!relations[j2].isMultipolygon())
33677             continue;
33678           var rings = osmJoinWays(relations[j2].members, graph);
33679           for (k = 0; k < rings.length; k++) {
33680             nodes = rings[k].nodes;
33681             if (nodes.find(function(n2) {
33682               return n2.id === entity.id;
33683             })) {
33684               activeIndex = k;
33685               if (geoHasSelfIntersections(nodes, entity.id)) {
33686                 return "multipolygonMember";
33687               }
33688             }
33689             rings[k].coords = nodes.map(function(n2) {
33690               return n2.loc;
33691             });
33692           }
33693           for (k = 0; k < rings.length; k++) {
33694             if (k === activeIndex)
33695               continue;
33696             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) {
33697               return "multipolygonRing";
33698             }
33699           }
33700         }
33701         if (activeIndex === null) {
33702           nodes = parent.nodes.map(function(nodeID) {
33703             return graph.entity(nodeID);
33704           });
33705           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
33706             return parent.geometry(graph);
33707           }
33708         }
33709       }
33710       return false;
33711     }
33712     function move(d3_event, entity, point) {
33713       if (_isCancelled)
33714         return;
33715       d3_event.stopPropagation();
33716       context.surface().classed("nope-disabled", d3_event.altKey);
33717       _lastLoc = context.projection.invert(point);
33718       doMove(d3_event, entity);
33719       var nudge = geoViewportEdge(point, context.map().dimensions());
33720       if (nudge) {
33721         startNudge(d3_event, entity, nudge);
33722       } else {
33723         stopNudge();
33724       }
33725     }
33726     function end(d3_event, entity) {
33727       if (_isCancelled)
33728         return;
33729       var wasPoint = entity.geometry(context.graph()) === "point";
33730       var d = datum2(d3_event);
33731       var nope = d && d.properties && d.properties.nope || context.surface().classed("nope");
33732       var target = d && d.properties && d.properties.entity;
33733       if (nope) {
33734         context.perform(_actionBounceBack(entity.id, _startLoc));
33735       } else if (target && target.type === "way") {
33736         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
33737         context.replace(actionAddMidpoint({
33738           loc: choice.loc,
33739           edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
33740         }, entity), connectAnnotation(entity, target));
33741       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
33742         context.replace(actionConnect([target.id, entity.id]), connectAnnotation(entity, target));
33743       } else if (_wasMidpoint) {
33744         context.replace(actionNoop(), _t("operations.add.annotation.vertex"));
33745       } else {
33746         context.replace(actionNoop(), moveAnnotation(entity));
33747       }
33748       if (wasPoint) {
33749         context.enter(modeSelect(context, [entity.id]));
33750       } else {
33751         var reselection = _restoreSelectedIDs.filter(function(id2) {
33752           return context.graph().hasEntity(id2);
33753         });
33754         if (reselection.length) {
33755           context.enter(modeSelect(context, reselection));
33756         } else {
33757           context.enter(modeBrowse(context));
33758         }
33759       }
33760     }
33761     function _actionBounceBack(nodeID, toLoc) {
33762       var moveNode = actionMoveNode(nodeID, toLoc);
33763       var action = function(graph, t) {
33764         if (t === 1)
33765           context.pop();
33766         return moveNode(graph, t);
33767       };
33768       action.transitionable = true;
33769       return action;
33770     }
33771     function cancel() {
33772       drag.cancel();
33773       context.enter(modeBrowse(context));
33774     }
33775     var drag = behaviorDrag().selector(".layer-touch.points .target").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
33776     mode.enter = function() {
33777       context.install(hover);
33778       context.install(edit2);
33779       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
33780       context.history().on("undone.drag-node", cancel);
33781     };
33782     mode.exit = function() {
33783       context.ui().sidebar.hover.cancel();
33784       context.uninstall(hover);
33785       context.uninstall(edit2);
33786       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
33787       context.history().on("undone.drag-node", null);
33788       _activeEntity = null;
33789       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
33790       stopNudge();
33791     };
33792     mode.selectedIDs = function() {
33793       if (!arguments.length)
33794         return _activeEntity ? [_activeEntity.id] : [];
33795       return mode;
33796     };
33797     mode.activeID = function() {
33798       if (!arguments.length)
33799         return _activeEntity && _activeEntity.id;
33800       return mode;
33801     };
33802     mode.restoreSelectedIDs = function(_) {
33803       if (!arguments.length)
33804         return _restoreSelectedIDs;
33805       _restoreSelectedIDs = _;
33806       return mode;
33807     };
33808     mode.behavior = drag;
33809     return mode;
33810   }
33811
33812   // modules/services/keepRight.js
33813   var import_rbush = __toESM(require_rbush_min());
33814
33815   // node_modules/d3-fetch/src/text.js
33816   function responseText(response) {
33817     if (!response.ok)
33818       throw new Error(response.status + " " + response.statusText);
33819     return response.text();
33820   }
33821   function text_default3(input, init2) {
33822     return fetch(input, init2).then(responseText);
33823   }
33824
33825   // node_modules/d3-fetch/src/json.js
33826   function responseJson(response) {
33827     if (!response.ok)
33828       throw new Error(response.status + " " + response.statusText);
33829     if (response.status === 204 || response.status === 205)
33830       return;
33831     return response.json();
33832   }
33833   function json_default(input, init2) {
33834     return fetch(input, init2).then(responseJson);
33835   }
33836
33837   // node_modules/d3-fetch/src/xml.js
33838   function parser(type3) {
33839     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type3));
33840   }
33841   var xml_default = parser("application/xml");
33842   var html = parser("text/html");
33843   var svg = parser("image/svg+xml");
33844
33845   // modules/services/keepRight.js
33846   var tiler = utilTiler();
33847   var dispatch2 = dispatch_default("loaded");
33848   var _tileZoom = 14;
33849   var _krUrlRoot = "https://www.keepright.at";
33850   var _krData = { errorTypes: {}, localizeStrings: {} };
33851   var _cache;
33852   var _krRuleset = [
33853     30,
33854     40,
33855     50,
33856     60,
33857     70,
33858     90,
33859     100,
33860     110,
33861     120,
33862     130,
33863     150,
33864     160,
33865     170,
33866     180,
33867     190,
33868     191,
33869     192,
33870     193,
33871     194,
33872     195,
33873     196,
33874     197,
33875     198,
33876     200,
33877     201,
33878     202,
33879     203,
33880     204,
33881     205,
33882     206,
33883     207,
33884     208,
33885     210,
33886     220,
33887     230,
33888     231,
33889     232,
33890     270,
33891     280,
33892     281,
33893     282,
33894     283,
33895     284,
33896     285,
33897     290,
33898     291,
33899     292,
33900     293,
33901     294,
33902     295,
33903     296,
33904     297,
33905     298,
33906     300,
33907     310,
33908     311,
33909     312,
33910     313,
33911     320,
33912     350,
33913     360,
33914     370,
33915     380,
33916     390,
33917     400,
33918     401,
33919     402,
33920     410,
33921     411,
33922     412,
33923     413
33924   ];
33925   function abortRequest(controller) {
33926     if (controller) {
33927       controller.abort();
33928     }
33929   }
33930   function abortUnwantedRequests(cache, tiles) {
33931     Object.keys(cache.inflightTile).forEach((k) => {
33932       const wanted = tiles.find((tile) => k === tile.id);
33933       if (!wanted) {
33934         abortRequest(cache.inflightTile[k]);
33935         delete cache.inflightTile[k];
33936       }
33937     });
33938   }
33939   function encodeIssueRtree(d) {
33940     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
33941   }
33942   function updateRtree(item, replace) {
33943     _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id);
33944     if (replace) {
33945       _cache.rtree.insert(item);
33946     }
33947   }
33948   function tokenReplacements(d) {
33949     if (!(d instanceof QAItem))
33950       return;
33951     const replacements = {};
33952     const issueTemplate = _krData.errorTypes[d.whichType];
33953     if (!issueTemplate) {
33954       console.log("No Template: ", d.whichType);
33955       console.log("  ", d.description);
33956       return;
33957     }
33958     if (!issueTemplate.regex)
33959       return;
33960     const errorRegex = new RegExp(issueTemplate.regex, "i");
33961     const errorMatch = errorRegex.exec(d.description);
33962     if (!errorMatch) {
33963       console.log("Unmatched: ", d.whichType);
33964       console.log("  ", d.description);
33965       console.log("  ", errorRegex);
33966       return;
33967     }
33968     for (let i2 = 1; i2 < errorMatch.length; i2++) {
33969       let capture = errorMatch[i2];
33970       let idType;
33971       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i2 - 1] : "";
33972       if (idType && capture) {
33973         capture = parseError(capture, idType);
33974       } else {
33975         const compare = capture.toLowerCase();
33976         if (_krData.localizeStrings[compare]) {
33977           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
33978         } else {
33979           capture = unescape_default(capture);
33980         }
33981       }
33982       replacements["var" + i2] = capture;
33983     }
33984     return replacements;
33985   }
33986   function parseError(capture, idType) {
33987     const compare = capture.toLowerCase();
33988     if (_krData.localizeStrings[compare]) {
33989       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
33990     }
33991     switch (idType) {
33992       case "this":
33993         capture = linkErrorObject2(capture);
33994         break;
33995       case "url":
33996         capture = linkURL(capture);
33997         break;
33998       case "n":
33999       case "w":
34000       case "r":
34001         capture = linkEntity2(idType + capture);
34002         break;
34003       case "20":
34004         capture = parse20(capture);
34005         break;
34006       case "211":
34007         capture = parse211(capture);
34008         break;
34009       case "231":
34010         capture = parse231(capture);
34011         break;
34012       case "294":
34013         capture = parse294(capture);
34014         break;
34015       case "370":
34016         capture = parse370(capture);
34017         break;
34018     }
34019     return capture;
34020     function linkErrorObject2(d) {
34021       return { html: `<a class="error_object_link">${d}</a>` };
34022     }
34023     function linkEntity2(d) {
34024       return { html: `<a class="error_entity_link">${d}</a>` };
34025     }
34026     function linkURL(d) {
34027       return { html: `<a class="kr_external_link" target="_blank" href="${d}">${d}</a>` };
34028     }
34029     function parse211(capture2) {
34030       let newList = [];
34031       const items = capture2.split(", ");
34032       items.forEach((item) => {
34033         let id2 = linkEntity2("n" + item.slice(1));
34034         newList.push(id2);
34035       });
34036       return newList.join(", ");
34037     }
34038     function parse231(capture2) {
34039       let newList = [];
34040       const items = capture2.split("),");
34041       items.forEach((item) => {
34042         const match = item.match(/\#(\d+)\((.+)\)?/);
34043         if (match !== null && match.length > 2) {
34044           newList.push(linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] }));
34045         }
34046       });
34047       return newList.join(", ");
34048     }
34049     function parse294(capture2) {
34050       let newList = [];
34051       const items = capture2.split(",");
34052       items.forEach((item) => {
34053         item = item.split(" ");
34054         const role = `"${item[0]}"`;
34055         const idType2 = item[1].slice(0, 1);
34056         let id2 = item[2].slice(1);
34057         id2 = linkEntity2(idType2 + id2);
34058         newList.push(`${role} ${item[1]} ${id2}`);
34059       });
34060       return newList.join(", ");
34061     }
34062     function parse370(capture2) {
34063       if (!capture2)
34064         return "";
34065       const match = capture2.match(/\(including the name (\'.+\')\)/);
34066       if (match && match.length) {
34067         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
34068       }
34069       return "";
34070     }
34071     function parse20(capture2) {
34072       let newList = [];
34073       const items = capture2.split(",");
34074       items.forEach((item) => {
34075         const id2 = linkEntity2("n" + item.slice(1));
34076         newList.push(id2);
34077       });
34078       return newList.join(", ");
34079     }
34080   }
34081   var keepRight_default = {
34082     title: "keepRight",
34083     init() {
34084       _mainFileFetcher.get("keepRight").then((d) => _krData = d);
34085       if (!_cache) {
34086         this.reset();
34087       }
34088       this.event = utilRebind(this, dispatch2, "on");
34089     },
34090     reset() {
34091       if (_cache) {
34092         Object.values(_cache.inflightTile).forEach(abortRequest);
34093       }
34094       _cache = {
34095         data: {},
34096         loadedTile: {},
34097         inflightTile: {},
34098         inflightPost: {},
34099         closed: {},
34100         rtree: new import_rbush.default()
34101       };
34102     },
34103     loadIssues(projection2) {
34104       const options2 = {
34105         format: "geojson",
34106         ch: _krRuleset
34107       };
34108       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
34109       abortUnwantedRequests(_cache, tiles);
34110       tiles.forEach((tile) => {
34111         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
34112           return;
34113         const [left, top, right, bottom] = tile.extent.rectangle();
34114         const params = Object.assign({}, options2, { left, bottom, right, top });
34115         const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
34116         const controller = new AbortController();
34117         _cache.inflightTile[tile.id] = controller;
34118         json_default(url, { signal: controller.signal }).then((data) => {
34119           delete _cache.inflightTile[tile.id];
34120           _cache.loadedTile[tile.id] = true;
34121           if (!data || !data.features || !data.features.length) {
34122             throw new Error("No Data");
34123           }
34124           data.features.forEach((feature3) => {
34125             const {
34126               properties: {
34127                 error_type: itemType,
34128                 error_id: id2,
34129                 comment = null,
34130                 object_id: objectId,
34131                 object_type: objectType,
34132                 schema,
34133                 title
34134               }
34135             } = feature3;
34136             let {
34137               geometry: { coordinates: loc },
34138               properties: { description: description2 = "" }
34139             } = feature3;
34140             const issueTemplate = _krData.errorTypes[itemType];
34141             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
34142             const whichType = issueTemplate ? itemType : parentIssueType;
34143             const whichTemplate = _krData.errorTypes[whichType];
34144             switch (whichType) {
34145               case "170":
34146                 description2 = `This feature has a FIXME tag: ${description2}`;
34147                 break;
34148               case "292":
34149               case "293":
34150                 description2 = description2.replace("A turn-", "This turn-");
34151                 break;
34152               case "294":
34153               case "295":
34154               case "296":
34155               case "297":
34156               case "298":
34157                 description2 = `This turn-restriction~${description2}`;
34158                 break;
34159               case "300":
34160                 description2 = "This highway is missing a maxspeed tag";
34161                 break;
34162               case "411":
34163               case "412":
34164               case "413":
34165                 description2 = `This feature~${description2}`;
34166                 break;
34167             }
34168             let coincident = false;
34169             do {
34170               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
34171               loc = geoVecAdd(loc, delta);
34172               let bbox = geoExtent(loc).bbox();
34173               coincident = _cache.rtree.search(bbox).length;
34174             } while (coincident);
34175             let d = new QAItem(loc, this, itemType, id2, {
34176               comment,
34177               description: description2,
34178               whichType,
34179               parentIssueType,
34180               severity: whichTemplate.severity || "error",
34181               objectId,
34182               objectType,
34183               schema,
34184               title
34185             });
34186             d.replacements = tokenReplacements(d);
34187             _cache.data[id2] = d;
34188             _cache.rtree.insert(encodeIssueRtree(d));
34189           });
34190           dispatch2.call("loaded");
34191         }).catch(() => {
34192           delete _cache.inflightTile[tile.id];
34193           _cache.loadedTile[tile.id] = true;
34194         });
34195       });
34196     },
34197     postUpdate(d, callback) {
34198       if (_cache.inflightPost[d.id]) {
34199         return callback({ message: "Error update already inflight", status: -2 }, d);
34200       }
34201       const params = { schema: d.schema, id: d.id };
34202       if (d.newStatus) {
34203         params.st = d.newStatus;
34204       }
34205       if (d.newComment !== void 0) {
34206         params.co = d.newComment;
34207       }
34208       const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
34209       const controller = new AbortController();
34210       _cache.inflightPost[d.id] = controller;
34211       json_default(url, { signal: controller.signal }).finally(() => {
34212         delete _cache.inflightPost[d.id];
34213         if (d.newStatus === "ignore") {
34214           this.removeItem(d);
34215         } else if (d.newStatus === "ignore_t") {
34216           this.removeItem(d);
34217           _cache.closed[`${d.schema}:${d.id}`] = true;
34218         } else {
34219           d = this.replaceItem(d.update({
34220             comment: d.newComment,
34221             newComment: void 0,
34222             newState: void 0
34223           }));
34224         }
34225         if (callback)
34226           callback(null, d);
34227       });
34228     },
34229     getItems(projection2) {
34230       const viewport = projection2.clipExtent();
34231       const min3 = [viewport[0][0], viewport[1][1]];
34232       const max3 = [viewport[1][0], viewport[0][1]];
34233       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34234       return _cache.rtree.search(bbox).map((d) => d.data);
34235     },
34236     getError(id2) {
34237       return _cache.data[id2];
34238     },
34239     replaceItem(item) {
34240       if (!(item instanceof QAItem) || !item.id)
34241         return;
34242       _cache.data[item.id] = item;
34243       updateRtree(encodeIssueRtree(item), true);
34244       return item;
34245     },
34246     removeItem(item) {
34247       if (!(item instanceof QAItem) || !item.id)
34248         return;
34249       delete _cache.data[item.id];
34250       updateRtree(encodeIssueRtree(item), false);
34251     },
34252     issueURL(item) {
34253       return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
34254     },
34255     getClosedIDs() {
34256       return Object.keys(_cache.closed).sort();
34257     }
34258   };
34259
34260   // modules/services/improveOSM.js
34261   var import_rbush2 = __toESM(require_rbush_min());
34262   var tiler2 = utilTiler();
34263   var dispatch3 = dispatch_default("loaded");
34264   var _tileZoom2 = 14;
34265   var _impOsmUrls = {
34266     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
34267     mr: "https://grab.community.improve-osm.org/missingGeoService",
34268     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
34269   };
34270   var _impOsmData = { icons: {} };
34271   var _cache2;
34272   function abortRequest2(i2) {
34273     Object.values(i2).forEach((controller) => {
34274       if (controller) {
34275         controller.abort();
34276       }
34277     });
34278   }
34279   function abortUnwantedRequests2(cache, tiles) {
34280     Object.keys(cache.inflightTile).forEach((k) => {
34281       const wanted = tiles.find((tile) => k === tile.id);
34282       if (!wanted) {
34283         abortRequest2(cache.inflightTile[k]);
34284         delete cache.inflightTile[k];
34285       }
34286     });
34287   }
34288   function encodeIssueRtree2(d) {
34289     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
34290   }
34291   function updateRtree2(item, replace) {
34292     _cache2.rtree.remove(item, (a, b) => a.data.id === b.data.id);
34293     if (replace) {
34294       _cache2.rtree.insert(item);
34295     }
34296   }
34297   function linkErrorObject(d) {
34298     return { html: `<a class="error_object_link">${d}</a>` };
34299   }
34300   function linkEntity(d) {
34301     return { html: `<a class="error_entity_link">${d}</a>` };
34302   }
34303   function pointAverage(points) {
34304     if (points.length) {
34305       const sum = points.reduce((acc, point) => geoVecAdd(acc, [point.lon, point.lat]), [0, 0]);
34306       return geoVecScale(sum, 1 / points.length);
34307     } else {
34308       return [0, 0];
34309     }
34310   }
34311   function relativeBearing(p1, p2) {
34312     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
34313     if (angle2 < 0) {
34314       angle2 += 2 * Math.PI;
34315     }
34316     return angle2 * 180 / Math.PI;
34317   }
34318   function cardinalDirection(bearing) {
34319     const dir = 45 * Math.round(bearing / 45);
34320     const compass = {
34321       0: "north",
34322       45: "northeast",
34323       90: "east",
34324       135: "southeast",
34325       180: "south",
34326       225: "southwest",
34327       270: "west",
34328       315: "northwest",
34329       360: "north"
34330     };
34331     return _t(`QA.improveOSM.directions.${compass[dir]}`);
34332   }
34333   function preventCoincident(loc, bumpUp) {
34334     let coincident = false;
34335     do {
34336       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
34337       loc = geoVecAdd(loc, delta);
34338       let bbox = geoExtent(loc).bbox();
34339       coincident = _cache2.rtree.search(bbox).length;
34340     } while (coincident);
34341     return loc;
34342   }
34343   var improveOSM_default = {
34344     title: "improveOSM",
34345     init() {
34346       _mainFileFetcher.get("qa_data").then((d) => _impOsmData = d.improveOSM);
34347       if (!_cache2) {
34348         this.reset();
34349       }
34350       this.event = utilRebind(this, dispatch3, "on");
34351     },
34352     reset() {
34353       if (_cache2) {
34354         Object.values(_cache2.inflightTile).forEach(abortRequest2);
34355       }
34356       _cache2 = {
34357         data: {},
34358         loadedTile: {},
34359         inflightTile: {},
34360         inflightPost: {},
34361         closed: {},
34362         rtree: new import_rbush2.default()
34363       };
34364     },
34365     loadIssues(projection2) {
34366       const options2 = {
34367         client: "iD",
34368         status: "OPEN",
34369         zoom: "19"
34370       };
34371       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
34372       abortUnwantedRequests2(_cache2, tiles);
34373       tiles.forEach((tile) => {
34374         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
34375           return;
34376         const [east, north, west, south] = tile.extent.rectangle();
34377         const params = Object.assign({}, options2, { east, south, west, north });
34378         const requests = {};
34379         Object.keys(_impOsmUrls).forEach((k) => {
34380           const kParams = Object.assign({}, params, k === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" });
34381           const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams);
34382           const controller = new AbortController();
34383           requests[k] = controller;
34384           json_default(url, { signal: controller.signal }).then((data) => {
34385             delete _cache2.inflightTile[tile.id][k];
34386             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34387               delete _cache2.inflightTile[tile.id];
34388               _cache2.loadedTile[tile.id] = true;
34389             }
34390             if (data.roadSegments) {
34391               data.roadSegments.forEach((feature3) => {
34392                 const { points, wayId, fromNodeId, toNodeId } = feature3;
34393                 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
34394                 let mid = points.length / 2;
34395                 let loc;
34396                 if (mid % 1 === 0) {
34397                   loc = pointAverage([points[mid - 1], points[mid]]);
34398                 } else {
34399                   mid = points[Math.floor(mid)];
34400                   loc = [mid.lon, mid.lat];
34401                 }
34402                 loc = preventCoincident(loc, false);
34403                 let d = new QAItem(loc, this, k, itemId, {
34404                   issueKey: k,
34405                   identifier: {
34406                     wayId,
34407                     fromNodeId,
34408                     toNodeId
34409                   },
34410                   objectId: wayId,
34411                   objectType: "way"
34412                 });
34413                 d.replacements = {
34414                   percentage: feature3.percentOfTrips,
34415                   num_trips: feature3.numberOfTrips,
34416                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
34417                   from_node: linkEntity("n" + feature3.fromNodeId),
34418                   to_node: linkEntity("n" + feature3.toNodeId)
34419                 };
34420                 _cache2.data[d.id] = d;
34421                 _cache2.rtree.insert(encodeIssueRtree2(d));
34422               });
34423             }
34424             if (data.tiles) {
34425               data.tiles.forEach((feature3) => {
34426                 const { type: type3, x, y, numberOfTrips } = feature3;
34427                 const geoType = type3.toLowerCase();
34428                 const itemId = `${geoType}${x}${y}${numberOfTrips}`;
34429                 let loc = pointAverage(feature3.points);
34430                 loc = preventCoincident(loc, false);
34431                 let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, {
34432                   issueKey: k,
34433                   identifier: { x, y }
34434                 });
34435                 d.replacements = {
34436                   num_trips: numberOfTrips,
34437                   geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
34438                 };
34439                 if (numberOfTrips === -1) {
34440                   d.desc = _t("QA.improveOSM.error_types.mr.description_alt", d.replacements);
34441                 }
34442                 _cache2.data[d.id] = d;
34443                 _cache2.rtree.insert(encodeIssueRtree2(d));
34444               });
34445             }
34446             if (data.entities) {
34447               data.entities.forEach((feature3) => {
34448                 const { point, id: id2, segments, numberOfPasses, turnType } = feature3;
34449                 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
34450                 const loc = preventCoincident([point.lon, point.lat], true);
34451                 const ids = id2.split(",");
34452                 const from_way = ids[0];
34453                 const via_node = ids[3];
34454                 const to_way = ids[2].split(":")[1];
34455                 let d = new QAItem(loc, this, k, itemId, {
34456                   issueKey: k,
34457                   identifier: id2,
34458                   objectId: via_node,
34459                   objectType: "node"
34460                 });
34461                 const [p1, p2] = segments[0].points;
34462                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
34463                 d.replacements = {
34464                   num_passed: numberOfPasses,
34465                   num_trips: segments[0].numberOfTrips,
34466                   turn_restriction: turnType.toLowerCase(),
34467                   from_way: linkEntity("w" + from_way),
34468                   to_way: linkEntity("w" + to_way),
34469                   travel_direction: dir_of_travel,
34470                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
34471                 };
34472                 _cache2.data[d.id] = d;
34473                 _cache2.rtree.insert(encodeIssueRtree2(d));
34474                 dispatch3.call("loaded");
34475               });
34476             }
34477           }).catch(() => {
34478             delete _cache2.inflightTile[tile.id][k];
34479             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34480               delete _cache2.inflightTile[tile.id];
34481               _cache2.loadedTile[tile.id] = true;
34482             }
34483           });
34484         });
34485         _cache2.inflightTile[tile.id] = requests;
34486       });
34487     },
34488     getComments(item) {
34489       if (item.comments) {
34490         return Promise.resolve(item);
34491       }
34492       const key = item.issueKey;
34493       let qParams = {};
34494       if (key === "ow") {
34495         qParams = item.identifier;
34496       } else if (key === "mr") {
34497         qParams.tileX = item.identifier.x;
34498         qParams.tileY = item.identifier.y;
34499       } else if (key === "tr") {
34500         qParams.targetId = item.identifier;
34501       }
34502       const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
34503       const cacheComments = (data) => {
34504         item.comments = data.comments ? data.comments.reverse() : [];
34505         this.replaceItem(item);
34506       };
34507       return json_default(url).then(cacheComments).then(() => item);
34508     },
34509     postUpdate(d, callback) {
34510       if (!osm_default.authenticated()) {
34511         return callback({ message: "Not Authenticated", status: -3 }, d);
34512       }
34513       if (_cache2.inflightPost[d.id]) {
34514         return callback({ message: "Error update already inflight", status: -2 }, d);
34515       }
34516       osm_default.userDetails(sendPayload.bind(this));
34517       function sendPayload(err, user) {
34518         if (err) {
34519           return callback(err, d);
34520         }
34521         const key = d.issueKey;
34522         const url = `${_impOsmUrls[key]}/comment`;
34523         const payload = {
34524           username: user.display_name,
34525           targetIds: [d.identifier]
34526         };
34527         if (d.newStatus) {
34528           payload.status = d.newStatus;
34529           payload.text = "status changed";
34530         }
34531         if (d.newComment) {
34532           payload.text = d.newComment;
34533         }
34534         const controller = new AbortController();
34535         _cache2.inflightPost[d.id] = controller;
34536         const options2 = {
34537           method: "POST",
34538           signal: controller.signal,
34539           body: JSON.stringify(payload)
34540         };
34541         json_default(url, options2).then(() => {
34542           delete _cache2.inflightPost[d.id];
34543           if (!d.newStatus) {
34544             const now3 = new Date();
34545             let comments = d.comments ? d.comments : [];
34546             comments.push({
34547               username: payload.username,
34548               text: payload.text,
34549               timestamp: now3.getTime() / 1e3
34550             });
34551             this.replaceItem(d.update({
34552               comments,
34553               newComment: void 0
34554             }));
34555           } else {
34556             this.removeItem(d);
34557             if (d.newStatus === "SOLVED") {
34558               if (!(d.issueKey in _cache2.closed)) {
34559                 _cache2.closed[d.issueKey] = 0;
34560               }
34561               _cache2.closed[d.issueKey] += 1;
34562             }
34563           }
34564           if (callback)
34565             callback(null, d);
34566         }).catch((err2) => {
34567           delete _cache2.inflightPost[d.id];
34568           if (callback)
34569             callback(err2.message);
34570         });
34571       }
34572     },
34573     getItems(projection2) {
34574       const viewport = projection2.clipExtent();
34575       const min3 = [viewport[0][0], viewport[1][1]];
34576       const max3 = [viewport[1][0], viewport[0][1]];
34577       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34578       return _cache2.rtree.search(bbox).map((d) => d.data);
34579     },
34580     getError(id2) {
34581       return _cache2.data[id2];
34582     },
34583     getIcon(itemType) {
34584       return _impOsmData.icons[itemType];
34585     },
34586     replaceItem(issue) {
34587       if (!(issue instanceof QAItem) || !issue.id)
34588         return;
34589       _cache2.data[issue.id] = issue;
34590       updateRtree2(encodeIssueRtree2(issue), true);
34591       return issue;
34592     },
34593     removeItem(issue) {
34594       if (!(issue instanceof QAItem) || !issue.id)
34595         return;
34596       delete _cache2.data[issue.id];
34597       updateRtree2(encodeIssueRtree2(issue), false);
34598     },
34599     getClosedCounts() {
34600       return _cache2.closed;
34601     }
34602   };
34603
34604   // modules/services/osmose.js
34605   var import_rbush3 = __toESM(require_rbush_min());
34606
34607   // node_modules/marked/lib/marked.esm.js
34608   function getDefaults() {
34609     return {
34610       baseUrl: null,
34611       breaks: false,
34612       extensions: null,
34613       gfm: true,
34614       headerIds: true,
34615       headerPrefix: "",
34616       highlight: null,
34617       langPrefix: "language-",
34618       mangle: true,
34619       pedantic: false,
34620       renderer: null,
34621       sanitize: false,
34622       sanitizer: null,
34623       silent: false,
34624       smartLists: false,
34625       smartypants: false,
34626       tokenizer: null,
34627       walkTokens: null,
34628       xhtml: false
34629     };
34630   }
34631   var defaults = getDefaults();
34632   function changeDefaults(newDefaults) {
34633     defaults = newDefaults;
34634   }
34635   var escapeTest = /[&<>"']/;
34636   var escapeReplace = /[&<>"']/g;
34637   var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
34638   var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
34639   var escapeReplacements = {
34640     "&": "&amp;",
34641     "<": "&lt;",
34642     ">": "&gt;",
34643     '"': "&quot;",
34644     "'": "&#39;"
34645   };
34646   var getEscapeReplacement = (ch) => escapeReplacements[ch];
34647   function escape4(html2, encode) {
34648     if (encode) {
34649       if (escapeTest.test(html2)) {
34650         return html2.replace(escapeReplace, getEscapeReplacement);
34651       }
34652     } else {
34653       if (escapeTestNoEncode.test(html2)) {
34654         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
34655       }
34656     }
34657     return html2;
34658   }
34659   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
34660   function unescape3(html2) {
34661     return html2.replace(unescapeTest, (_, n2) => {
34662       n2 = n2.toLowerCase();
34663       if (n2 === "colon")
34664         return ":";
34665       if (n2.charAt(0) === "#") {
34666         return n2.charAt(1) === "x" ? String.fromCharCode(parseInt(n2.substring(2), 16)) : String.fromCharCode(+n2.substring(1));
34667       }
34668       return "";
34669     });
34670   }
34671   var caret = /(^|[^\[])\^/g;
34672   function edit(regex, opt) {
34673     regex = typeof regex === "string" ? regex : regex.source;
34674     opt = opt || "";
34675     const obj = {
34676       replace: (name2, val) => {
34677         val = val.source || val;
34678         val = val.replace(caret, "$1");
34679         regex = regex.replace(name2, val);
34680         return obj;
34681       },
34682       getRegex: () => {
34683         return new RegExp(regex, opt);
34684       }
34685     };
34686     return obj;
34687   }
34688   var nonWordAndColonTest = /[^\w:]/g;
34689   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
34690   function cleanUrl(sanitize, base, href) {
34691     if (sanitize) {
34692       let prot;
34693       try {
34694         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
34695       } catch (e) {
34696         return null;
34697       }
34698       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
34699         return null;
34700       }
34701     }
34702     if (base && !originIndependentUrl.test(href)) {
34703       href = resolveUrl(base, href);
34704     }
34705     try {
34706       href = encodeURI(href).replace(/%25/g, "%");
34707     } catch (e) {
34708       return null;
34709     }
34710     return href;
34711   }
34712   var baseUrls = {};
34713   var justDomain = /^[^:]+:\/*[^/]*$/;
34714   var protocol = /^([^:]+:)[\s\S]*$/;
34715   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
34716   function resolveUrl(base, href) {
34717     if (!baseUrls[" " + base]) {
34718       if (justDomain.test(base)) {
34719         baseUrls[" " + base] = base + "/";
34720       } else {
34721         baseUrls[" " + base] = rtrim(base, "/", true);
34722       }
34723     }
34724     base = baseUrls[" " + base];
34725     const relativeBase = base.indexOf(":") === -1;
34726     if (href.substring(0, 2) === "//") {
34727       if (relativeBase) {
34728         return href;
34729       }
34730       return base.replace(protocol, "$1") + href;
34731     } else if (href.charAt(0) === "/") {
34732       if (relativeBase) {
34733         return href;
34734       }
34735       return base.replace(domain, "$1") + href;
34736     } else {
34737       return base + href;
34738     }
34739   }
34740   var noopTest = { exec: function noopTest2() {
34741   } };
34742   function merge2(obj) {
34743     let i2 = 1, target, key;
34744     for (; i2 < arguments.length; i2++) {
34745       target = arguments[i2];
34746       for (key in target) {
34747         if (Object.prototype.hasOwnProperty.call(target, key)) {
34748           obj[key] = target[key];
34749         }
34750       }
34751     }
34752     return obj;
34753   }
34754   function splitCells(tableRow, count) {
34755     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
34756       let escaped = false, curr = offset;
34757       while (--curr >= 0 && str2[curr] === "\\")
34758         escaped = !escaped;
34759       if (escaped) {
34760         return "|";
34761       } else {
34762         return " |";
34763       }
34764     }), cells = row.split(/ \|/);
34765     let i2 = 0;
34766     if (!cells[0].trim()) {
34767       cells.shift();
34768     }
34769     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
34770       cells.pop();
34771     }
34772     if (cells.length > count) {
34773       cells.splice(count);
34774     } else {
34775       while (cells.length < count)
34776         cells.push("");
34777     }
34778     for (; i2 < cells.length; i2++) {
34779       cells[i2] = cells[i2].trim().replace(/\\\|/g, "|");
34780     }
34781     return cells;
34782   }
34783   function rtrim(str2, c, invert) {
34784     const l = str2.length;
34785     if (l === 0) {
34786       return "";
34787     }
34788     let suffLen = 0;
34789     while (suffLen < l) {
34790       const currChar = str2.charAt(l - suffLen - 1);
34791       if (currChar === c && !invert) {
34792         suffLen++;
34793       } else if (currChar !== c && invert) {
34794         suffLen++;
34795       } else {
34796         break;
34797       }
34798     }
34799     return str2.slice(0, l - suffLen);
34800   }
34801   function findClosingBracket(str2, b) {
34802     if (str2.indexOf(b[1]) === -1) {
34803       return -1;
34804     }
34805     const l = str2.length;
34806     let level = 0, i2 = 0;
34807     for (; i2 < l; i2++) {
34808       if (str2[i2] === "\\") {
34809         i2++;
34810       } else if (str2[i2] === b[0]) {
34811         level++;
34812       } else if (str2[i2] === b[1]) {
34813         level--;
34814         if (level < 0) {
34815           return i2;
34816         }
34817       }
34818     }
34819     return -1;
34820   }
34821   function checkSanitizeDeprecation(opt) {
34822     if (opt && opt.sanitize && !opt.silent) {
34823       console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
34824     }
34825   }
34826   function repeatString(pattern, count) {
34827     if (count < 1) {
34828       return "";
34829     }
34830     let result = "";
34831     while (count > 1) {
34832       if (count & 1) {
34833         result += pattern;
34834       }
34835       count >>= 1;
34836       pattern += pattern;
34837     }
34838     return result + pattern;
34839   }
34840   function outputLink(cap, link2, raw, lexer2) {
34841     const href = link2.href;
34842     const title = link2.title ? escape4(link2.title) : null;
34843     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
34844     if (cap[0].charAt(0) !== "!") {
34845       lexer2.state.inLink = true;
34846       const token = {
34847         type: "link",
34848         raw,
34849         href,
34850         title,
34851         text: text2,
34852         tokens: lexer2.inlineTokens(text2, [])
34853       };
34854       lexer2.state.inLink = false;
34855       return token;
34856     }
34857     return {
34858       type: "image",
34859       raw,
34860       href,
34861       title,
34862       text: escape4(text2)
34863     };
34864   }
34865   function indentCodeCompensation(raw, text2) {
34866     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
34867     if (matchIndentToCode === null) {
34868       return text2;
34869     }
34870     const indentToCode = matchIndentToCode[1];
34871     return text2.split("\n").map((node) => {
34872       const matchIndentInNode = node.match(/^\s+/);
34873       if (matchIndentInNode === null) {
34874         return node;
34875       }
34876       const [indentInNode] = matchIndentInNode;
34877       if (indentInNode.length >= indentToCode.length) {
34878         return node.slice(indentToCode.length);
34879       }
34880       return node;
34881     }).join("\n");
34882   }
34883   var Tokenizer = class {
34884     constructor(options2) {
34885       this.options = options2 || defaults;
34886     }
34887     space(src) {
34888       const cap = this.rules.block.newline.exec(src);
34889       if (cap && cap[0].length > 0) {
34890         return {
34891           type: "space",
34892           raw: cap[0]
34893         };
34894       }
34895     }
34896     code(src) {
34897       const cap = this.rules.block.code.exec(src);
34898       if (cap) {
34899         const text2 = cap[0].replace(/^ {1,4}/gm, "");
34900         return {
34901           type: "code",
34902           raw: cap[0],
34903           codeBlockStyle: "indented",
34904           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
34905         };
34906       }
34907     }
34908     fences(src) {
34909       const cap = this.rules.block.fences.exec(src);
34910       if (cap) {
34911         const raw = cap[0];
34912         const text2 = indentCodeCompensation(raw, cap[3] || "");
34913         return {
34914           type: "code",
34915           raw,
34916           lang: cap[2] ? cap[2].trim() : cap[2],
34917           text: text2
34918         };
34919       }
34920     }
34921     heading(src) {
34922       const cap = this.rules.block.heading.exec(src);
34923       if (cap) {
34924         let text2 = cap[2].trim();
34925         if (/#$/.test(text2)) {
34926           const trimmed = rtrim(text2, "#");
34927           if (this.options.pedantic) {
34928             text2 = trimmed.trim();
34929           } else if (!trimmed || / $/.test(trimmed)) {
34930             text2 = trimmed.trim();
34931           }
34932         }
34933         const token = {
34934           type: "heading",
34935           raw: cap[0],
34936           depth: cap[1].length,
34937           text: text2,
34938           tokens: []
34939         };
34940         this.lexer.inline(token.text, token.tokens);
34941         return token;
34942       }
34943     }
34944     hr(src) {
34945       const cap = this.rules.block.hr.exec(src);
34946       if (cap) {
34947         return {
34948           type: "hr",
34949           raw: cap[0]
34950         };
34951       }
34952     }
34953     blockquote(src) {
34954       const cap = this.rules.block.blockquote.exec(src);
34955       if (cap) {
34956         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
34957         return {
34958           type: "blockquote",
34959           raw: cap[0],
34960           tokens: this.lexer.blockTokens(text2, []),
34961           text: text2
34962         };
34963       }
34964     }
34965     list(src) {
34966       let cap = this.rules.block.list.exec(src);
34967       if (cap) {
34968         let raw, istask, ischecked, indent2, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
34969         let bull = cap[1].trim();
34970         const isordered = bull.length > 1;
34971         const list = {
34972           type: "list",
34973           raw: "",
34974           ordered: isordered,
34975           start: isordered ? +bull.slice(0, -1) : "",
34976           loose: false,
34977           items: []
34978         };
34979         bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
34980         if (this.options.pedantic) {
34981           bull = isordered ? bull : "[*+-]";
34982         }
34983         const itemRegex = new RegExp(`^( {0,3}${bull})((?:[      ][^\\n]*)?(?:\\n|$))`);
34984         while (src) {
34985           endEarly = false;
34986           if (!(cap = itemRegex.exec(src))) {
34987             break;
34988           }
34989           if (this.rules.block.hr.test(src)) {
34990             break;
34991           }
34992           raw = cap[0];
34993           src = src.substring(raw.length);
34994           line = cap[2].split("\n", 1)[0];
34995           nextLine = src.split("\n", 1)[0];
34996           if (this.options.pedantic) {
34997             indent2 = 2;
34998             itemContents = line.trimLeft();
34999           } else {
35000             indent2 = cap[2].search(/[^ ]/);
35001             indent2 = indent2 > 4 ? 1 : indent2;
35002             itemContents = line.slice(indent2);
35003             indent2 += cap[1].length;
35004           }
35005           blankLine = false;
35006           if (!line && /^ *$/.test(nextLine)) {
35007             raw += nextLine + "\n";
35008             src = src.substring(nextLine.length + 1);
35009             endEarly = true;
35010           }
35011           if (!endEarly) {
35012             const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
35013             const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
35014             const fencesBeginRegex = new RegExp(`^( {0,${Math.min(3, indent2 - 1)}})(\`\`\`|~~~)`);
35015             while (src) {
35016               rawLine = src.split("\n", 1)[0];
35017               line = rawLine;
35018               if (this.options.pedantic) {
35019                 line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
35020               }
35021               if (fencesBeginRegex.test(line)) {
35022                 break;
35023               }
35024               if (this.rules.block.heading.test(line)) {
35025                 break;
35026               }
35027               if (nextBulletRegex.test(line)) {
35028                 break;
35029               }
35030               if (hrRegex.test(src)) {
35031                 break;
35032               }
35033               if (line.search(/[^ ]/) >= indent2 || !line.trim()) {
35034                 itemContents += "\n" + line.slice(indent2);
35035               } else if (!blankLine) {
35036                 itemContents += "\n" + line;
35037               } else {
35038                 break;
35039               }
35040               if (!blankLine && !line.trim()) {
35041                 blankLine = true;
35042               }
35043               raw += rawLine + "\n";
35044               src = src.substring(rawLine.length + 1);
35045             }
35046           }
35047           if (!list.loose) {
35048             if (endsWithBlankLine) {
35049               list.loose = true;
35050             } else if (/\n *\n *$/.test(raw)) {
35051               endsWithBlankLine = true;
35052             }
35053           }
35054           if (this.options.gfm) {
35055             istask = /^\[[ xX]\] /.exec(itemContents);
35056             if (istask) {
35057               ischecked = istask[0] !== "[ ] ";
35058               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
35059             }
35060           }
35061           list.items.push({
35062             type: "list_item",
35063             raw,
35064             task: !!istask,
35065             checked: ischecked,
35066             loose: false,
35067             text: itemContents
35068           });
35069           list.raw += raw;
35070         }
35071         list.items[list.items.length - 1].raw = raw.trimRight();
35072         list.items[list.items.length - 1].text = itemContents.trimRight();
35073         list.raw = list.raw.trimRight();
35074         const l = list.items.length;
35075         for (i2 = 0; i2 < l; i2++) {
35076           this.lexer.state.top = false;
35077           list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
35078           const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
35079           const hasMultipleLineBreaks = spacers.every((t) => {
35080             const chars = t.raw.split("");
35081             let lineBreaks = 0;
35082             for (const char of chars) {
35083               if (char === "\n") {
35084                 lineBreaks += 1;
35085               }
35086               if (lineBreaks > 1) {
35087                 return true;
35088               }
35089             }
35090             return false;
35091           });
35092           if (!list.loose && spacers.length && hasMultipleLineBreaks) {
35093             list.loose = true;
35094             list.items[i2].loose = true;
35095           }
35096         }
35097         return list;
35098       }
35099     }
35100     html(src) {
35101       const cap = this.rules.block.html.exec(src);
35102       if (cap) {
35103         const token = {
35104           type: "html",
35105           raw: cap[0],
35106           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
35107           text: cap[0]
35108         };
35109         if (this.options.sanitize) {
35110           token.type = "paragraph";
35111           token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
35112           token.tokens = [];
35113           this.lexer.inline(token.text, token.tokens);
35114         }
35115         return token;
35116       }
35117     }
35118     def(src) {
35119       const cap = this.rules.block.def.exec(src);
35120       if (cap) {
35121         if (cap[3])
35122           cap[3] = cap[3].substring(1, cap[3].length - 1);
35123         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
35124         return {
35125           type: "def",
35126           tag,
35127           raw: cap[0],
35128           href: cap[2],
35129           title: cap[3]
35130         };
35131       }
35132     }
35133     table(src) {
35134       const cap = this.rules.block.table.exec(src);
35135       if (cap) {
35136         const item = {
35137           type: "table",
35138           header: splitCells(cap[1]).map((c) => {
35139             return { text: c };
35140           }),
35141           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
35142           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
35143         };
35144         if (item.header.length === item.align.length) {
35145           item.raw = cap[0];
35146           let l = item.align.length;
35147           let i2, j2, k, row;
35148           for (i2 = 0; i2 < l; i2++) {
35149             if (/^ *-+: *$/.test(item.align[i2])) {
35150               item.align[i2] = "right";
35151             } else if (/^ *:-+: *$/.test(item.align[i2])) {
35152               item.align[i2] = "center";
35153             } else if (/^ *:-+ *$/.test(item.align[i2])) {
35154               item.align[i2] = "left";
35155             } else {
35156               item.align[i2] = null;
35157             }
35158           }
35159           l = item.rows.length;
35160           for (i2 = 0; i2 < l; i2++) {
35161             item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
35162               return { text: c };
35163             });
35164           }
35165           l = item.header.length;
35166           for (j2 = 0; j2 < l; j2++) {
35167             item.header[j2].tokens = [];
35168             this.lexer.inline(item.header[j2].text, item.header[j2].tokens);
35169           }
35170           l = item.rows.length;
35171           for (j2 = 0; j2 < l; j2++) {
35172             row = item.rows[j2];
35173             for (k = 0; k < row.length; k++) {
35174               row[k].tokens = [];
35175               this.lexer.inline(row[k].text, row[k].tokens);
35176             }
35177           }
35178           return item;
35179         }
35180       }
35181     }
35182     lheading(src) {
35183       const cap = this.rules.block.lheading.exec(src);
35184       if (cap) {
35185         const token = {
35186           type: "heading",
35187           raw: cap[0],
35188           depth: cap[2].charAt(0) === "=" ? 1 : 2,
35189           text: cap[1],
35190           tokens: []
35191         };
35192         this.lexer.inline(token.text, token.tokens);
35193         return token;
35194       }
35195     }
35196     paragraph(src) {
35197       const cap = this.rules.block.paragraph.exec(src);
35198       if (cap) {
35199         const token = {
35200           type: "paragraph",
35201           raw: cap[0],
35202           text: cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1],
35203           tokens: []
35204         };
35205         this.lexer.inline(token.text, token.tokens);
35206         return token;
35207       }
35208     }
35209     text(src) {
35210       const cap = this.rules.block.text.exec(src);
35211       if (cap) {
35212         const token = {
35213           type: "text",
35214           raw: cap[0],
35215           text: cap[0],
35216           tokens: []
35217         };
35218         this.lexer.inline(token.text, token.tokens);
35219         return token;
35220       }
35221     }
35222     escape(src) {
35223       const cap = this.rules.inline.escape.exec(src);
35224       if (cap) {
35225         return {
35226           type: "escape",
35227           raw: cap[0],
35228           text: escape4(cap[1])
35229         };
35230       }
35231     }
35232     tag(src) {
35233       const cap = this.rules.inline.tag.exec(src);
35234       if (cap) {
35235         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
35236           this.lexer.state.inLink = true;
35237         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
35238           this.lexer.state.inLink = false;
35239         }
35240         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35241           this.lexer.state.inRawBlock = true;
35242         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35243           this.lexer.state.inRawBlock = false;
35244         }
35245         return {
35246           type: this.options.sanitize ? "text" : "html",
35247           raw: cap[0],
35248           inLink: this.lexer.state.inLink,
35249           inRawBlock: this.lexer.state.inRawBlock,
35250           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
35251         };
35252       }
35253     }
35254     link(src) {
35255       const cap = this.rules.inline.link.exec(src);
35256       if (cap) {
35257         const trimmedUrl = cap[2].trim();
35258         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
35259           if (!/>$/.test(trimmedUrl)) {
35260             return;
35261           }
35262           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
35263           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
35264             return;
35265           }
35266         } else {
35267           const lastParenIndex = findClosingBracket(cap[2], "()");
35268           if (lastParenIndex > -1) {
35269             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
35270             const linkLen = start2 + cap[1].length + lastParenIndex;
35271             cap[2] = cap[2].substring(0, lastParenIndex);
35272             cap[0] = cap[0].substring(0, linkLen).trim();
35273             cap[3] = "";
35274           }
35275         }
35276         let href = cap[2];
35277         let title = "";
35278         if (this.options.pedantic) {
35279           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
35280           if (link2) {
35281             href = link2[1];
35282             title = link2[3];
35283           }
35284         } else {
35285           title = cap[3] ? cap[3].slice(1, -1) : "";
35286         }
35287         href = href.trim();
35288         if (/^</.test(href)) {
35289           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
35290             href = href.slice(1);
35291           } else {
35292             href = href.slice(1, -1);
35293           }
35294         }
35295         return outputLink(cap, {
35296           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
35297           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
35298         }, cap[0], this.lexer);
35299       }
35300     }
35301     reflink(src, links) {
35302       let cap;
35303       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
35304         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
35305         link2 = links[link2.toLowerCase()];
35306         if (!link2 || !link2.href) {
35307           const text2 = cap[0].charAt(0);
35308           return {
35309             type: "text",
35310             raw: text2,
35311             text: text2
35312           };
35313         }
35314         return outputLink(cap, link2, cap[0], this.lexer);
35315       }
35316     }
35317     emStrong(src, maskedSrc, prevChar = "") {
35318       let match = this.rules.inline.emStrong.lDelim.exec(src);
35319       if (!match)
35320         return;
35321       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
35322         return;
35323       const nextChar = match[1] || match[2] || "";
35324       if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
35325         const lLength = match[0].length - 1;
35326         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
35327         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
35328         endReg.lastIndex = 0;
35329         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
35330         while ((match = endReg.exec(maskedSrc)) != null) {
35331           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
35332           if (!rDelim)
35333             continue;
35334           rLength = rDelim.length;
35335           if (match[3] || match[4]) {
35336             delimTotal += rLength;
35337             continue;
35338           } else if (match[5] || match[6]) {
35339             if (lLength % 3 && !((lLength + rLength) % 3)) {
35340               midDelimTotal += rLength;
35341               continue;
35342             }
35343           }
35344           delimTotal -= rLength;
35345           if (delimTotal > 0)
35346             continue;
35347           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
35348           if (Math.min(lLength, rLength) % 2) {
35349             const text3 = src.slice(1, lLength + match.index + rLength);
35350             return {
35351               type: "em",
35352               raw: src.slice(0, lLength + match.index + rLength + 1),
35353               text: text3,
35354               tokens: this.lexer.inlineTokens(text3, [])
35355             };
35356           }
35357           const text2 = src.slice(2, lLength + match.index + rLength - 1);
35358           return {
35359             type: "strong",
35360             raw: src.slice(0, lLength + match.index + rLength + 1),
35361             text: text2,
35362             tokens: this.lexer.inlineTokens(text2, [])
35363           };
35364         }
35365       }
35366     }
35367     codespan(src) {
35368       const cap = this.rules.inline.code.exec(src);
35369       if (cap) {
35370         let text2 = cap[2].replace(/\n/g, " ");
35371         const hasNonSpaceChars = /[^ ]/.test(text2);
35372         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
35373         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
35374           text2 = text2.substring(1, text2.length - 1);
35375         }
35376         text2 = escape4(text2, true);
35377         return {
35378           type: "codespan",
35379           raw: cap[0],
35380           text: text2
35381         };
35382       }
35383     }
35384     br(src) {
35385       const cap = this.rules.inline.br.exec(src);
35386       if (cap) {
35387         return {
35388           type: "br",
35389           raw: cap[0]
35390         };
35391       }
35392     }
35393     del(src) {
35394       const cap = this.rules.inline.del.exec(src);
35395       if (cap) {
35396         return {
35397           type: "del",
35398           raw: cap[0],
35399           text: cap[2],
35400           tokens: this.lexer.inlineTokens(cap[2], [])
35401         };
35402       }
35403     }
35404     autolink(src, mangle2) {
35405       const cap = this.rules.inline.autolink.exec(src);
35406       if (cap) {
35407         let text2, href;
35408         if (cap[2] === "@") {
35409           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
35410           href = "mailto:" + text2;
35411         } else {
35412           text2 = escape4(cap[1]);
35413           href = text2;
35414         }
35415         return {
35416           type: "link",
35417           raw: cap[0],
35418           text: text2,
35419           href,
35420           tokens: [
35421             {
35422               type: "text",
35423               raw: text2,
35424               text: text2
35425             }
35426           ]
35427         };
35428       }
35429     }
35430     url(src, mangle2) {
35431       let cap;
35432       if (cap = this.rules.inline.url.exec(src)) {
35433         let text2, href;
35434         if (cap[2] === "@") {
35435           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
35436           href = "mailto:" + text2;
35437         } else {
35438           let prevCapZero;
35439           do {
35440             prevCapZero = cap[0];
35441             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
35442           } while (prevCapZero !== cap[0]);
35443           text2 = escape4(cap[0]);
35444           if (cap[1] === "www.") {
35445             href = "http://" + text2;
35446           } else {
35447             href = text2;
35448           }
35449         }
35450         return {
35451           type: "link",
35452           raw: cap[0],
35453           text: text2,
35454           href,
35455           tokens: [
35456             {
35457               type: "text",
35458               raw: text2,
35459               text: text2
35460             }
35461           ]
35462         };
35463       }
35464     }
35465     inlineText(src, smartypants2) {
35466       const cap = this.rules.inline.text.exec(src);
35467       if (cap) {
35468         let text2;
35469         if (this.lexer.state.inRawBlock) {
35470           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
35471         } else {
35472           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
35473         }
35474         return {
35475           type: "text",
35476           raw: cap[0],
35477           text: text2
35478         };
35479       }
35480     }
35481   };
35482   var block = {
35483     newline: /^(?: *(?:\n|$))+/,
35484     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
35485     fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
35486     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
35487     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
35488     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
35489     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
35490     html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
35491     def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
35492     table: noopTest,
35493     lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
35494     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
35495     text: /^[^\n]+/
35496   };
35497   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
35498   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
35499   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
35500   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
35501   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
35502   block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex();
35503   block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
35504   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
35505   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
35506   block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
35507   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
35508   block.normal = merge2({}, block);
35509   block.gfm = merge2({}, block.normal, {
35510     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
35511   });
35512   block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
35513   block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
35514   block.pedantic = merge2({}, block.normal, {
35515     html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
35516     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
35517     heading: /^(#{1,6})(.*)(?:\n+|$)/,
35518     fences: noopTest,
35519     paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
35520   });
35521   var inline = {
35522     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
35523     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
35524     url: noopTest,
35525     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
35526     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
35527     reflink: /^!?\[(label)\]\[(ref)\]/,
35528     nolink: /^!?\[(ref)\](?:\[\])?/,
35529     reflinkSearch: "reflink|nolink(?!\\()",
35530     emStrong: {
35531       lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
35532       rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
35533       rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
35534     },
35535     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
35536     br: /^( {2,}|\\)\n(?!\s*$)/,
35537     del: noopTest,
35538     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
35539     punctuation: /^([\spunctuation])/
35540   };
35541   inline._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
35542   inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
35543   inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
35544   inline.escapedEmSt = /\\\*|\\_/g;
35545   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
35546   inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
35547   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
35548   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
35549   inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
35550   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
35551   inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
35552   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
35553   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
35554   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
35555   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
35556   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
35557   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
35558   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
35559   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
35560   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
35561   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
35562   inline.normal = merge2({}, inline);
35563   inline.pedantic = merge2({}, inline.normal, {
35564     strong: {
35565       start: /^__|\*\*/,
35566       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
35567       endAst: /\*\*(?!\*)/g,
35568       endUnd: /__(?!_)/g
35569     },
35570     em: {
35571       start: /^_|\*/,
35572       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
35573       endAst: /\*(?!\*)/g,
35574       endUnd: /_(?!_)/g
35575     },
35576     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
35577     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
35578   });
35579   inline.gfm = merge2({}, inline.normal, {
35580     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
35581     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
35582     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
35583     _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
35584     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
35585     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
35586   });
35587   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
35588   inline.breaks = merge2({}, inline.gfm, {
35589     br: edit(inline.br).replace("{2,}", "*").getRegex(),
35590     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
35591   });
35592   function smartypants(text2) {
35593     return text2.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026");
35594   }
35595   function mangle(text2) {
35596     let out = "", i2, ch;
35597     const l = text2.length;
35598     for (i2 = 0; i2 < l; i2++) {
35599       ch = text2.charCodeAt(i2);
35600       if (Math.random() > 0.5) {
35601         ch = "x" + ch.toString(16);
35602       }
35603       out += "&#" + ch + ";";
35604     }
35605     return out;
35606   }
35607   var Lexer = class {
35608     constructor(options2) {
35609       this.tokens = [];
35610       this.tokens.links = /* @__PURE__ */ Object.create(null);
35611       this.options = options2 || defaults;
35612       this.options.tokenizer = this.options.tokenizer || new Tokenizer();
35613       this.tokenizer = this.options.tokenizer;
35614       this.tokenizer.options = this.options;
35615       this.tokenizer.lexer = this;
35616       this.inlineQueue = [];
35617       this.state = {
35618         inLink: false,
35619         inRawBlock: false,
35620         top: true
35621       };
35622       const rules = {
35623         block: block.normal,
35624         inline: inline.normal
35625       };
35626       if (this.options.pedantic) {
35627         rules.block = block.pedantic;
35628         rules.inline = inline.pedantic;
35629       } else if (this.options.gfm) {
35630         rules.block = block.gfm;
35631         if (this.options.breaks) {
35632           rules.inline = inline.breaks;
35633         } else {
35634           rules.inline = inline.gfm;
35635         }
35636       }
35637       this.tokenizer.rules = rules;
35638     }
35639     static get rules() {
35640       return {
35641         block,
35642         inline
35643       };
35644     }
35645     static lex(src, options2) {
35646       const lexer2 = new Lexer(options2);
35647       return lexer2.lex(src);
35648     }
35649     static lexInline(src, options2) {
35650       const lexer2 = new Lexer(options2);
35651       return lexer2.inlineTokens(src);
35652     }
35653     lex(src) {
35654       src = src.replace(/\r\n|\r/g, "\n");
35655       this.blockTokens(src, this.tokens);
35656       let next;
35657       while (next = this.inlineQueue.shift()) {
35658         this.inlineTokens(next.src, next.tokens);
35659       }
35660       return this.tokens;
35661     }
35662     blockTokens(src, tokens = []) {
35663       if (this.options.pedantic) {
35664         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
35665       } else {
35666         src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
35667           return leading + "    ".repeat(tabs.length);
35668         });
35669       }
35670       let token, lastToken, cutSrc, lastParagraphClipped;
35671       while (src) {
35672         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
35673           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
35674             src = src.substring(token.raw.length);
35675             tokens.push(token);
35676             return true;
35677           }
35678           return false;
35679         })) {
35680           continue;
35681         }
35682         if (token = this.tokenizer.space(src)) {
35683           src = src.substring(token.raw.length);
35684           if (token.raw.length === 1 && tokens.length > 0) {
35685             tokens[tokens.length - 1].raw += "\n";
35686           } else {
35687             tokens.push(token);
35688           }
35689           continue;
35690         }
35691         if (token = this.tokenizer.code(src)) {
35692           src = src.substring(token.raw.length);
35693           lastToken = tokens[tokens.length - 1];
35694           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35695             lastToken.raw += "\n" + token.raw;
35696             lastToken.text += "\n" + token.text;
35697             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35698           } else {
35699             tokens.push(token);
35700           }
35701           continue;
35702         }
35703         if (token = this.tokenizer.fences(src)) {
35704           src = src.substring(token.raw.length);
35705           tokens.push(token);
35706           continue;
35707         }
35708         if (token = this.tokenizer.heading(src)) {
35709           src = src.substring(token.raw.length);
35710           tokens.push(token);
35711           continue;
35712         }
35713         if (token = this.tokenizer.hr(src)) {
35714           src = src.substring(token.raw.length);
35715           tokens.push(token);
35716           continue;
35717         }
35718         if (token = this.tokenizer.blockquote(src)) {
35719           src = src.substring(token.raw.length);
35720           tokens.push(token);
35721           continue;
35722         }
35723         if (token = this.tokenizer.list(src)) {
35724           src = src.substring(token.raw.length);
35725           tokens.push(token);
35726           continue;
35727         }
35728         if (token = this.tokenizer.html(src)) {
35729           src = src.substring(token.raw.length);
35730           tokens.push(token);
35731           continue;
35732         }
35733         if (token = this.tokenizer.def(src)) {
35734           src = src.substring(token.raw.length);
35735           lastToken = tokens[tokens.length - 1];
35736           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35737             lastToken.raw += "\n" + token.raw;
35738             lastToken.text += "\n" + token.raw;
35739             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35740           } else if (!this.tokens.links[token.tag]) {
35741             this.tokens.links[token.tag] = {
35742               href: token.href,
35743               title: token.title
35744             };
35745           }
35746           continue;
35747         }
35748         if (token = this.tokenizer.table(src)) {
35749           src = src.substring(token.raw.length);
35750           tokens.push(token);
35751           continue;
35752         }
35753         if (token = this.tokenizer.lheading(src)) {
35754           src = src.substring(token.raw.length);
35755           tokens.push(token);
35756           continue;
35757         }
35758         cutSrc = src;
35759         if (this.options.extensions && this.options.extensions.startBlock) {
35760           let startIndex = Infinity;
35761           const tempSrc = src.slice(1);
35762           let tempStart;
35763           this.options.extensions.startBlock.forEach(function(getStartIndex) {
35764             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
35765             if (typeof tempStart === "number" && tempStart >= 0) {
35766               startIndex = Math.min(startIndex, tempStart);
35767             }
35768           });
35769           if (startIndex < Infinity && startIndex >= 0) {
35770             cutSrc = src.substring(0, startIndex + 1);
35771           }
35772         }
35773         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
35774           lastToken = tokens[tokens.length - 1];
35775           if (lastParagraphClipped && lastToken.type === "paragraph") {
35776             lastToken.raw += "\n" + token.raw;
35777             lastToken.text += "\n" + token.text;
35778             this.inlineQueue.pop();
35779             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35780           } else {
35781             tokens.push(token);
35782           }
35783           lastParagraphClipped = cutSrc.length !== src.length;
35784           src = src.substring(token.raw.length);
35785           continue;
35786         }
35787         if (token = this.tokenizer.text(src)) {
35788           src = src.substring(token.raw.length);
35789           lastToken = tokens[tokens.length - 1];
35790           if (lastToken && lastToken.type === "text") {
35791             lastToken.raw += "\n" + token.raw;
35792             lastToken.text += "\n" + token.text;
35793             this.inlineQueue.pop();
35794             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35795           } else {
35796             tokens.push(token);
35797           }
35798           continue;
35799         }
35800         if (src) {
35801           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
35802           if (this.options.silent) {
35803             console.error(errMsg);
35804             break;
35805           } else {
35806             throw new Error(errMsg);
35807           }
35808         }
35809       }
35810       this.state.top = true;
35811       return tokens;
35812     }
35813     inline(src, tokens) {
35814       this.inlineQueue.push({ src, tokens });
35815     }
35816     inlineTokens(src, tokens = []) {
35817       let token, lastToken, cutSrc;
35818       let maskedSrc = src;
35819       let match;
35820       let keepPrevChar, prevChar;
35821       if (this.tokens.links) {
35822         const links = Object.keys(this.tokens.links);
35823         if (links.length > 0) {
35824           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
35825             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
35826               maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
35827             }
35828           }
35829         }
35830       }
35831       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
35832         maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
35833       }
35834       while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
35835         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
35836       }
35837       while (src) {
35838         if (!keepPrevChar) {
35839           prevChar = "";
35840         }
35841         keepPrevChar = false;
35842         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
35843           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
35844             src = src.substring(token.raw.length);
35845             tokens.push(token);
35846             return true;
35847           }
35848           return false;
35849         })) {
35850           continue;
35851         }
35852         if (token = this.tokenizer.escape(src)) {
35853           src = src.substring(token.raw.length);
35854           tokens.push(token);
35855           continue;
35856         }
35857         if (token = this.tokenizer.tag(src)) {
35858           src = src.substring(token.raw.length);
35859           lastToken = tokens[tokens.length - 1];
35860           if (lastToken && token.type === "text" && lastToken.type === "text") {
35861             lastToken.raw += token.raw;
35862             lastToken.text += token.text;
35863           } else {
35864             tokens.push(token);
35865           }
35866           continue;
35867         }
35868         if (token = this.tokenizer.link(src)) {
35869           src = src.substring(token.raw.length);
35870           tokens.push(token);
35871           continue;
35872         }
35873         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
35874           src = src.substring(token.raw.length);
35875           lastToken = tokens[tokens.length - 1];
35876           if (lastToken && token.type === "text" && lastToken.type === "text") {
35877             lastToken.raw += token.raw;
35878             lastToken.text += token.text;
35879           } else {
35880             tokens.push(token);
35881           }
35882           continue;
35883         }
35884         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
35885           src = src.substring(token.raw.length);
35886           tokens.push(token);
35887           continue;
35888         }
35889         if (token = this.tokenizer.codespan(src)) {
35890           src = src.substring(token.raw.length);
35891           tokens.push(token);
35892           continue;
35893         }
35894         if (token = this.tokenizer.br(src)) {
35895           src = src.substring(token.raw.length);
35896           tokens.push(token);
35897           continue;
35898         }
35899         if (token = this.tokenizer.del(src)) {
35900           src = src.substring(token.raw.length);
35901           tokens.push(token);
35902           continue;
35903         }
35904         if (token = this.tokenizer.autolink(src, mangle)) {
35905           src = src.substring(token.raw.length);
35906           tokens.push(token);
35907           continue;
35908         }
35909         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
35910           src = src.substring(token.raw.length);
35911           tokens.push(token);
35912           continue;
35913         }
35914         cutSrc = src;
35915         if (this.options.extensions && this.options.extensions.startInline) {
35916           let startIndex = Infinity;
35917           const tempSrc = src.slice(1);
35918           let tempStart;
35919           this.options.extensions.startInline.forEach(function(getStartIndex) {
35920             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
35921             if (typeof tempStart === "number" && tempStart >= 0) {
35922               startIndex = Math.min(startIndex, tempStart);
35923             }
35924           });
35925           if (startIndex < Infinity && startIndex >= 0) {
35926             cutSrc = src.substring(0, startIndex + 1);
35927           }
35928         }
35929         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
35930           src = src.substring(token.raw.length);
35931           if (token.raw.slice(-1) !== "_") {
35932             prevChar = token.raw.slice(-1);
35933           }
35934           keepPrevChar = true;
35935           lastToken = tokens[tokens.length - 1];
35936           if (lastToken && lastToken.type === "text") {
35937             lastToken.raw += token.raw;
35938             lastToken.text += token.text;
35939           } else {
35940             tokens.push(token);
35941           }
35942           continue;
35943         }
35944         if (src) {
35945           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
35946           if (this.options.silent) {
35947             console.error(errMsg);
35948             break;
35949           } else {
35950             throw new Error(errMsg);
35951           }
35952         }
35953       }
35954       return tokens;
35955     }
35956   };
35957   var Renderer = class {
35958     constructor(options2) {
35959       this.options = options2 || defaults;
35960     }
35961     code(code, infostring, escaped) {
35962       const lang = (infostring || "").match(/\S*/)[0];
35963       if (this.options.highlight) {
35964         const out = this.options.highlight(code, lang);
35965         if (out != null && out !== code) {
35966           escaped = true;
35967           code = out;
35968         }
35969       }
35970       code = code.replace(/\n$/, "") + "\n";
35971       if (!lang) {
35972         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
35973       }
35974       return '<pre><code class="' + this.options.langPrefix + escape4(lang, true) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
35975     }
35976     blockquote(quote2) {
35977       return `<blockquote>
35978 ${quote2}</blockquote>
35979 `;
35980     }
35981     html(html2) {
35982       return html2;
35983     }
35984     heading(text2, level, raw, slugger) {
35985       if (this.options.headerIds) {
35986         const id2 = this.options.headerPrefix + slugger.slug(raw);
35987         return `<h${level} id="${id2}">${text2}</h${level}>
35988 `;
35989       }
35990       return `<h${level}>${text2}</h${level}>
35991 `;
35992     }
35993     hr() {
35994       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
35995     }
35996     list(body, ordered, start2) {
35997       const type3 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
35998       return "<" + type3 + startatt + ">\n" + body + "</" + type3 + ">\n";
35999     }
36000     listitem(text2) {
36001       return `<li>${text2}</li>
36002 `;
36003     }
36004     checkbox(checked) {
36005       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
36006     }
36007     paragraph(text2) {
36008       return `<p>${text2}</p>
36009 `;
36010     }
36011     table(header, body) {
36012       if (body)
36013         body = `<tbody>${body}</tbody>`;
36014       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
36015     }
36016     tablerow(content) {
36017       return `<tr>
36018 ${content}</tr>
36019 `;
36020     }
36021     tablecell(content, flags) {
36022       const type3 = flags.header ? "th" : "td";
36023       const tag = flags.align ? `<${type3} align="${flags.align}">` : `<${type3}>`;
36024       return tag + content + `</${type3}>
36025 `;
36026     }
36027     strong(text2) {
36028       return `<strong>${text2}</strong>`;
36029     }
36030     em(text2) {
36031       return `<em>${text2}</em>`;
36032     }
36033     codespan(text2) {
36034       return `<code>${text2}</code>`;
36035     }
36036     br() {
36037       return this.options.xhtml ? "<br/>" : "<br>";
36038     }
36039     del(text2) {
36040       return `<del>${text2}</del>`;
36041     }
36042     link(href, title, text2) {
36043       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36044       if (href === null) {
36045         return text2;
36046       }
36047       let out = '<a href="' + escape4(href) + '"';
36048       if (title) {
36049         out += ' title="' + title + '"';
36050       }
36051       out += ">" + text2 + "</a>";
36052       return out;
36053     }
36054     image(href, title, text2) {
36055       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36056       if (href === null) {
36057         return text2;
36058       }
36059       let out = `<img src="${href}" alt="${text2}"`;
36060       if (title) {
36061         out += ` title="${title}"`;
36062       }
36063       out += this.options.xhtml ? "/>" : ">";
36064       return out;
36065     }
36066     text(text2) {
36067       return text2;
36068     }
36069   };
36070   var TextRenderer = class {
36071     strong(text2) {
36072       return text2;
36073     }
36074     em(text2) {
36075       return text2;
36076     }
36077     codespan(text2) {
36078       return text2;
36079     }
36080     del(text2) {
36081       return text2;
36082     }
36083     html(text2) {
36084       return text2;
36085     }
36086     text(text2) {
36087       return text2;
36088     }
36089     link(href, title, text2) {
36090       return "" + text2;
36091     }
36092     image(href, title, text2) {
36093       return "" + text2;
36094     }
36095     br() {
36096       return "";
36097     }
36098   };
36099   var Slugger = class {
36100     constructor() {
36101       this.seen = {};
36102     }
36103     serialize(value) {
36104       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
36105     }
36106     getNextSafeSlug(originalSlug, isDryRun) {
36107       let slug = originalSlug;
36108       let occurenceAccumulator = 0;
36109       if (this.seen.hasOwnProperty(slug)) {
36110         occurenceAccumulator = this.seen[originalSlug];
36111         do {
36112           occurenceAccumulator++;
36113           slug = originalSlug + "-" + occurenceAccumulator;
36114         } while (this.seen.hasOwnProperty(slug));
36115       }
36116       if (!isDryRun) {
36117         this.seen[originalSlug] = occurenceAccumulator;
36118         this.seen[slug] = 0;
36119       }
36120       return slug;
36121     }
36122     slug(value, options2 = {}) {
36123       const slug = this.serialize(value);
36124       return this.getNextSafeSlug(slug, options2.dryrun);
36125     }
36126   };
36127   var Parser = class {
36128     constructor(options2) {
36129       this.options = options2 || defaults;
36130       this.options.renderer = this.options.renderer || new Renderer();
36131       this.renderer = this.options.renderer;
36132       this.renderer.options = this.options;
36133       this.textRenderer = new TextRenderer();
36134       this.slugger = new Slugger();
36135     }
36136     static parse(tokens, options2) {
36137       const parser3 = new Parser(options2);
36138       return parser3.parse(tokens);
36139     }
36140     static parseInline(tokens, options2) {
36141       const parser3 = new Parser(options2);
36142       return parser3.parseInline(tokens);
36143     }
36144     parse(tokens, top = true) {
36145       let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
36146       const l = tokens.length;
36147       for (i2 = 0; i2 < l; i2++) {
36148         token = tokens[i2];
36149         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36150           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36151           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
36152             out += ret || "";
36153             continue;
36154           }
36155         }
36156         switch (token.type) {
36157           case "space": {
36158             continue;
36159           }
36160           case "hr": {
36161             out += this.renderer.hr();
36162             continue;
36163           }
36164           case "heading": {
36165             out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
36166             continue;
36167           }
36168           case "code": {
36169             out += this.renderer.code(token.text, token.lang, token.escaped);
36170             continue;
36171           }
36172           case "table": {
36173             header = "";
36174             cell = "";
36175             l2 = token.header.length;
36176             for (j2 = 0; j2 < l2; j2++) {
36177               cell += this.renderer.tablecell(this.parseInline(token.header[j2].tokens), { header: true, align: token.align[j2] });
36178             }
36179             header += this.renderer.tablerow(cell);
36180             body = "";
36181             l2 = token.rows.length;
36182             for (j2 = 0; j2 < l2; j2++) {
36183               row = token.rows[j2];
36184               cell = "";
36185               l3 = row.length;
36186               for (k = 0; k < l3; k++) {
36187                 cell += this.renderer.tablecell(this.parseInline(row[k].tokens), { header: false, align: token.align[k] });
36188               }
36189               body += this.renderer.tablerow(cell);
36190             }
36191             out += this.renderer.table(header, body);
36192             continue;
36193           }
36194           case "blockquote": {
36195             body = this.parse(token.tokens);
36196             out += this.renderer.blockquote(body);
36197             continue;
36198           }
36199           case "list": {
36200             ordered = token.ordered;
36201             start2 = token.start;
36202             loose = token.loose;
36203             l2 = token.items.length;
36204             body = "";
36205             for (j2 = 0; j2 < l2; j2++) {
36206               item = token.items[j2];
36207               checked = item.checked;
36208               task = item.task;
36209               itemBody = "";
36210               if (item.task) {
36211                 checkbox = this.renderer.checkbox(checked);
36212                 if (loose) {
36213                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
36214                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
36215                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
36216                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
36217                     }
36218                   } else {
36219                     item.tokens.unshift({
36220                       type: "text",
36221                       text: checkbox
36222                     });
36223                   }
36224                 } else {
36225                   itemBody += checkbox;
36226                 }
36227               }
36228               itemBody += this.parse(item.tokens, loose);
36229               body += this.renderer.listitem(itemBody, task, checked);
36230             }
36231             out += this.renderer.list(body, ordered, start2);
36232             continue;
36233           }
36234           case "html": {
36235             out += this.renderer.html(token.text);
36236             continue;
36237           }
36238           case "paragraph": {
36239             out += this.renderer.paragraph(this.parseInline(token.tokens));
36240             continue;
36241           }
36242           case "text": {
36243             body = token.tokens ? this.parseInline(token.tokens) : token.text;
36244             while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
36245               token = tokens[++i2];
36246               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
36247             }
36248             out += top ? this.renderer.paragraph(body) : body;
36249             continue;
36250           }
36251           default: {
36252             const errMsg = 'Token with "' + token.type + '" type was not found.';
36253             if (this.options.silent) {
36254               console.error(errMsg);
36255               return;
36256             } else {
36257               throw new Error(errMsg);
36258             }
36259           }
36260         }
36261       }
36262       return out;
36263     }
36264     parseInline(tokens, renderer) {
36265       renderer = renderer || this.renderer;
36266       let out = "", i2, token, ret;
36267       const l = tokens.length;
36268       for (i2 = 0; i2 < l; i2++) {
36269         token = tokens[i2];
36270         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36271           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36272           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
36273             out += ret || "";
36274             continue;
36275           }
36276         }
36277         switch (token.type) {
36278           case "escape": {
36279             out += renderer.text(token.text);
36280             break;
36281           }
36282           case "html": {
36283             out += renderer.html(token.text);
36284             break;
36285           }
36286           case "link": {
36287             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
36288             break;
36289           }
36290           case "image": {
36291             out += renderer.image(token.href, token.title, token.text);
36292             break;
36293           }
36294           case "strong": {
36295             out += renderer.strong(this.parseInline(token.tokens, renderer));
36296             break;
36297           }
36298           case "em": {
36299             out += renderer.em(this.parseInline(token.tokens, renderer));
36300             break;
36301           }
36302           case "codespan": {
36303             out += renderer.codespan(token.text);
36304             break;
36305           }
36306           case "br": {
36307             out += renderer.br();
36308             break;
36309           }
36310           case "del": {
36311             out += renderer.del(this.parseInline(token.tokens, renderer));
36312             break;
36313           }
36314           case "text": {
36315             out += renderer.text(token.text);
36316             break;
36317           }
36318           default: {
36319             const errMsg = 'Token with "' + token.type + '" type was not found.';
36320             if (this.options.silent) {
36321               console.error(errMsg);
36322               return;
36323             } else {
36324               throw new Error(errMsg);
36325             }
36326           }
36327         }
36328       }
36329       return out;
36330     }
36331   };
36332   function marked(src, opt, callback) {
36333     if (typeof src === "undefined" || src === null) {
36334       throw new Error("marked(): input parameter is undefined or null");
36335     }
36336     if (typeof src !== "string") {
36337       throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36338     }
36339     if (typeof opt === "function") {
36340       callback = opt;
36341       opt = null;
36342     }
36343     opt = merge2({}, marked.defaults, opt || {});
36344     checkSanitizeDeprecation(opt);
36345     if (callback) {
36346       const highlight = opt.highlight;
36347       let tokens;
36348       try {
36349         tokens = Lexer.lex(src, opt);
36350       } catch (e) {
36351         return callback(e);
36352       }
36353       const done = function(err) {
36354         let out;
36355         if (!err) {
36356           try {
36357             if (opt.walkTokens) {
36358               marked.walkTokens(tokens, opt.walkTokens);
36359             }
36360             out = Parser.parse(tokens, opt);
36361           } catch (e) {
36362             err = e;
36363           }
36364         }
36365         opt.highlight = highlight;
36366         return err ? callback(err) : callback(null, out);
36367       };
36368       if (!highlight || highlight.length < 3) {
36369         return done();
36370       }
36371       delete opt.highlight;
36372       if (!tokens.length)
36373         return done();
36374       let pending = 0;
36375       marked.walkTokens(tokens, function(token) {
36376         if (token.type === "code") {
36377           pending++;
36378           setTimeout(() => {
36379             highlight(token.text, token.lang, function(err, code) {
36380               if (err) {
36381                 return done(err);
36382               }
36383               if (code != null && code !== token.text) {
36384                 token.text = code;
36385                 token.escaped = true;
36386               }
36387               pending--;
36388               if (pending === 0) {
36389                 done();
36390               }
36391             });
36392           }, 0);
36393         }
36394       });
36395       if (pending === 0) {
36396         done();
36397       }
36398       return;
36399     }
36400     try {
36401       const tokens = Lexer.lex(src, opt);
36402       if (opt.walkTokens) {
36403         marked.walkTokens(tokens, opt.walkTokens);
36404       }
36405       return Parser.parse(tokens, opt);
36406     } catch (e) {
36407       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36408       if (opt.silent) {
36409         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36410       }
36411       throw e;
36412     }
36413   }
36414   marked.options = marked.setOptions = function(opt) {
36415     merge2(marked.defaults, opt);
36416     changeDefaults(marked.defaults);
36417     return marked;
36418   };
36419   marked.getDefaults = getDefaults;
36420   marked.defaults = defaults;
36421   marked.use = function(...args) {
36422     const opts = merge2({}, ...args);
36423     const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
36424     let hasExtensions;
36425     args.forEach((pack) => {
36426       if (pack.extensions) {
36427         hasExtensions = true;
36428         pack.extensions.forEach((ext) => {
36429           if (!ext.name) {
36430             throw new Error("extension name required");
36431           }
36432           if (ext.renderer) {
36433             const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
36434             if (prevRenderer) {
36435               extensions.renderers[ext.name] = function(...args2) {
36436                 let ret = ext.renderer.apply(this, args2);
36437                 if (ret === false) {
36438                   ret = prevRenderer.apply(this, args2);
36439                 }
36440                 return ret;
36441               };
36442             } else {
36443               extensions.renderers[ext.name] = ext.renderer;
36444             }
36445           }
36446           if (ext.tokenizer) {
36447             if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
36448               throw new Error("extension level must be 'block' or 'inline'");
36449             }
36450             if (extensions[ext.level]) {
36451               extensions[ext.level].unshift(ext.tokenizer);
36452             } else {
36453               extensions[ext.level] = [ext.tokenizer];
36454             }
36455             if (ext.start) {
36456               if (ext.level === "block") {
36457                 if (extensions.startBlock) {
36458                   extensions.startBlock.push(ext.start);
36459                 } else {
36460                   extensions.startBlock = [ext.start];
36461                 }
36462               } else if (ext.level === "inline") {
36463                 if (extensions.startInline) {
36464                   extensions.startInline.push(ext.start);
36465                 } else {
36466                   extensions.startInline = [ext.start];
36467                 }
36468               }
36469             }
36470           }
36471           if (ext.childTokens) {
36472             extensions.childTokens[ext.name] = ext.childTokens;
36473           }
36474         });
36475       }
36476       if (pack.renderer) {
36477         const renderer = marked.defaults.renderer || new Renderer();
36478         for (const prop in pack.renderer) {
36479           const prevRenderer = renderer[prop];
36480           renderer[prop] = (...args2) => {
36481             let ret = pack.renderer[prop].apply(renderer, args2);
36482             if (ret === false) {
36483               ret = prevRenderer.apply(renderer, args2);
36484             }
36485             return ret;
36486           };
36487         }
36488         opts.renderer = renderer;
36489       }
36490       if (pack.tokenizer) {
36491         const tokenizer = marked.defaults.tokenizer || new Tokenizer();
36492         for (const prop in pack.tokenizer) {
36493           const prevTokenizer = tokenizer[prop];
36494           tokenizer[prop] = (...args2) => {
36495             let ret = pack.tokenizer[prop].apply(tokenizer, args2);
36496             if (ret === false) {
36497               ret = prevTokenizer.apply(tokenizer, args2);
36498             }
36499             return ret;
36500           };
36501         }
36502         opts.tokenizer = tokenizer;
36503       }
36504       if (pack.walkTokens) {
36505         const walkTokens2 = marked.defaults.walkTokens;
36506         opts.walkTokens = function(token) {
36507           pack.walkTokens.call(this, token);
36508           if (walkTokens2) {
36509             walkTokens2.call(this, token);
36510           }
36511         };
36512       }
36513       if (hasExtensions) {
36514         opts.extensions = extensions;
36515       }
36516       marked.setOptions(opts);
36517     });
36518   };
36519   marked.walkTokens = function(tokens, callback) {
36520     for (const token of tokens) {
36521       callback.call(marked, token);
36522       switch (token.type) {
36523         case "table": {
36524           for (const cell of token.header) {
36525             marked.walkTokens(cell.tokens, callback);
36526           }
36527           for (const row of token.rows) {
36528             for (const cell of row) {
36529               marked.walkTokens(cell.tokens, callback);
36530             }
36531           }
36532           break;
36533         }
36534         case "list": {
36535           marked.walkTokens(token.items, callback);
36536           break;
36537         }
36538         default: {
36539           if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
36540             marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
36541               marked.walkTokens(token[childTokens], callback);
36542             });
36543           } else if (token.tokens) {
36544             marked.walkTokens(token.tokens, callback);
36545           }
36546         }
36547       }
36548     }
36549   };
36550   marked.parseInline = function(src, opt) {
36551     if (typeof src === "undefined" || src === null) {
36552       throw new Error("marked.parseInline(): input parameter is undefined or null");
36553     }
36554     if (typeof src !== "string") {
36555       throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36556     }
36557     opt = merge2({}, marked.defaults, opt || {});
36558     checkSanitizeDeprecation(opt);
36559     try {
36560       const tokens = Lexer.lexInline(src, opt);
36561       if (opt.walkTokens) {
36562         marked.walkTokens(tokens, opt.walkTokens);
36563       }
36564       return Parser.parseInline(tokens, opt);
36565     } catch (e) {
36566       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36567       if (opt.silent) {
36568         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36569       }
36570       throw e;
36571     }
36572   };
36573   marked.Parser = Parser;
36574   marked.parser = Parser.parse;
36575   marked.Renderer = Renderer;
36576   marked.TextRenderer = TextRenderer;
36577   marked.Lexer = Lexer;
36578   marked.lexer = Lexer.lex;
36579   marked.Tokenizer = Tokenizer;
36580   marked.Slugger = Slugger;
36581   marked.parse = marked;
36582   var options = marked.options;
36583   var setOptions = marked.setOptions;
36584   var use = marked.use;
36585   var walkTokens = marked.walkTokens;
36586   var parseInline = marked.parseInline;
36587   var parser2 = Parser.parse;
36588   var lexer = Lexer.lex;
36589
36590   // modules/services/osmose.js
36591   var tiler3 = utilTiler();
36592   var dispatch4 = dispatch_default("loaded");
36593   var _tileZoom3 = 14;
36594   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
36595   var _osmoseData = { icons: {}, items: [] };
36596   var _cache3;
36597   function abortRequest3(controller) {
36598     if (controller) {
36599       controller.abort();
36600     }
36601   }
36602   function abortUnwantedRequests3(cache, tiles) {
36603     Object.keys(cache.inflightTile).forEach((k) => {
36604       let wanted = tiles.find((tile) => k === tile.id);
36605       if (!wanted) {
36606         abortRequest3(cache.inflightTile[k]);
36607         delete cache.inflightTile[k];
36608       }
36609     });
36610   }
36611   function encodeIssueRtree3(d) {
36612     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
36613   }
36614   function updateRtree3(item, replace) {
36615     _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
36616     if (replace) {
36617       _cache3.rtree.insert(item);
36618     }
36619   }
36620   function preventCoincident2(loc) {
36621     let coincident = false;
36622     do {
36623       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36624       loc = geoVecAdd(loc, delta);
36625       let bbox = geoExtent(loc).bbox();
36626       coincident = _cache3.rtree.search(bbox).length;
36627     } while (coincident);
36628     return loc;
36629   }
36630   var osmose_default = {
36631     title: "osmose",
36632     init() {
36633       _mainFileFetcher.get("qa_data").then((d) => {
36634         _osmoseData = d.osmose;
36635         _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
36636       });
36637       if (!_cache3) {
36638         this.reset();
36639       }
36640       this.event = utilRebind(this, dispatch4, "on");
36641     },
36642     reset() {
36643       let _strings = {};
36644       let _colors = {};
36645       if (_cache3) {
36646         Object.values(_cache3.inflightTile).forEach(abortRequest3);
36647         _strings = _cache3.strings;
36648         _colors = _cache3.colors;
36649       }
36650       _cache3 = {
36651         data: {},
36652         loadedTile: {},
36653         inflightTile: {},
36654         inflightPost: {},
36655         closed: {},
36656         rtree: new import_rbush3.default(),
36657         strings: _strings,
36658         colors: _colors
36659       };
36660     },
36661     loadIssues(projection2) {
36662       let params = {
36663         item: _osmoseData.items
36664       };
36665       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
36666       abortUnwantedRequests3(_cache3, tiles);
36667       tiles.forEach((tile) => {
36668         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
36669           return;
36670         let [x, y, z] = tile.xyz;
36671         let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.json?` + utilQsString(params);
36672         let controller = new AbortController();
36673         _cache3.inflightTile[tile.id] = controller;
36674         json_default(url, { signal: controller.signal }).then((data) => {
36675           delete _cache3.inflightTile[tile.id];
36676           _cache3.loadedTile[tile.id] = true;
36677           if (data.features) {
36678             data.features.forEach((issue) => {
36679               const { item, class: cl, uuid: id2 } = issue.properties;
36680               const itemType = `${item}-${cl}`;
36681               if (itemType in _osmoseData.icons) {
36682                 let loc = issue.geometry.coordinates;
36683                 loc = preventCoincident2(loc);
36684                 let d = new QAItem(loc, this, itemType, id2, { item });
36685                 if (item === 8300 || item === 8360) {
36686                   d.elems = [];
36687                 }
36688                 _cache3.data[d.id] = d;
36689                 _cache3.rtree.insert(encodeIssueRtree3(d));
36690               }
36691             });
36692           }
36693           dispatch4.call("loaded");
36694         }).catch(() => {
36695           delete _cache3.inflightTile[tile.id];
36696           _cache3.loadedTile[tile.id] = true;
36697         });
36698       });
36699     },
36700     loadIssueDetail(issue) {
36701       if (issue.elems !== void 0) {
36702         return Promise.resolve(issue);
36703       }
36704       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
36705       const cacheDetails = (data) => {
36706         issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
36707         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
36708         this.replaceItem(issue);
36709       };
36710       return json_default(url).then(cacheDetails).then(() => issue);
36711     },
36712     loadStrings(locale2 = _mainLocalizer.localeCode()) {
36713       const items = Object.keys(_osmoseData.icons);
36714       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
36715         return Promise.resolve(_cache3.strings[locale2]);
36716       }
36717       if (!(locale2 in _cache3.strings)) {
36718         _cache3.strings[locale2] = {};
36719       }
36720       const allRequests = items.map((itemType) => {
36721         if (itemType in _cache3.strings[locale2])
36722           return null;
36723         const cacheData = (data) => {
36724           const [cat = { items: [] }] = data.categories;
36725           const [item2 = { class: [] }] = cat.items;
36726           const [cl2 = null] = item2.class;
36727           if (!cl2) {
36728             console.log(`Osmose strings request (${itemType}) had unexpected data`);
36729             return;
36730           }
36731           const { item: itemInt, color: color2 } = item2;
36732           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
36733             _cache3.colors[itemInt] = color2;
36734           }
36735           const { title, detail, fix, trap } = cl2;
36736           let issueStrings = {};
36737           if (title)
36738             issueStrings.title = title.auto;
36739           if (detail)
36740             issueStrings.detail = marked(detail.auto);
36741           if (trap)
36742             issueStrings.trap = marked(trap.auto);
36743           if (fix)
36744             issueStrings.fix = marked(fix.auto);
36745           _cache3.strings[locale2][itemType] = issueStrings;
36746         };
36747         const [item, cl] = itemType.split("-");
36748         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
36749         return json_default(url).then(cacheData);
36750       }).filter(Boolean);
36751       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
36752     },
36753     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
36754       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
36755     },
36756     getColor(itemType) {
36757       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
36758     },
36759     postUpdate(issue, callback) {
36760       if (_cache3.inflightPost[issue.id]) {
36761         return callback({ message: "Issue update already inflight", status: -2 }, issue);
36762       }
36763       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
36764       const controller = new AbortController();
36765       const after = () => {
36766         delete _cache3.inflightPost[issue.id];
36767         this.removeItem(issue);
36768         if (issue.newStatus === "done") {
36769           if (!(issue.item in _cache3.closed)) {
36770             _cache3.closed[issue.item] = 0;
36771           }
36772           _cache3.closed[issue.item] += 1;
36773         }
36774         if (callback)
36775           callback(null, issue);
36776       };
36777       _cache3.inflightPost[issue.id] = controller;
36778       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
36779         delete _cache3.inflightPost[issue.id];
36780         if (callback)
36781           callback(err.message);
36782       });
36783     },
36784     getItems(projection2) {
36785       const viewport = projection2.clipExtent();
36786       const min3 = [viewport[0][0], viewport[1][1]];
36787       const max3 = [viewport[1][0], viewport[0][1]];
36788       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36789       return _cache3.rtree.search(bbox).map((d) => d.data);
36790     },
36791     getError(id2) {
36792       return _cache3.data[id2];
36793     },
36794     getIcon(itemType) {
36795       return _osmoseData.icons[itemType];
36796     },
36797     replaceItem(item) {
36798       if (!(item instanceof QAItem) || !item.id)
36799         return;
36800       _cache3.data[item.id] = item;
36801       updateRtree3(encodeIssueRtree3(item), true);
36802       return item;
36803     },
36804     removeItem(item) {
36805       if (!(item instanceof QAItem) || !item.id)
36806         return;
36807       delete _cache3.data[item.id];
36808       updateRtree3(encodeIssueRtree3(item), false);
36809     },
36810     getClosedCounts() {
36811       return _cache3.closed;
36812     },
36813     itemURL(item) {
36814       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
36815     }
36816   };
36817
36818   // modules/services/mapillary.js
36819   var import_pbf = __toESM(require_pbf());
36820   var import_rbush4 = __toESM(require_rbush_min());
36821   var import_vector_tile = __toESM(require_vector_tile());
36822   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
36823   var apiUrl = "https://graph.mapillary.com/";
36824   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
36825   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
36826   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
36827   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
36828   var viewercss = "mapillary-js/mapillary.css";
36829   var viewerjs = "mapillary-js/mapillary.js";
36830   var minZoom = 14;
36831   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
36832   var _loadViewerPromise;
36833   var _mlyActiveImage;
36834   var _mlyCache;
36835   var _mlyFallback = false;
36836   var _mlyHighlightedDetection;
36837   var _mlyShowFeatureDetections = false;
36838   var _mlyShowSignDetections = false;
36839   var _mlyViewer;
36840   var _mlyViewerFilter = ["all"];
36841   function loadTiles(which, url, maxZoom2, projection2) {
36842     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
36843     const tiles = tiler8.getTiles(projection2);
36844     tiles.forEach(function(tile) {
36845       loadTile(which, url, tile);
36846     });
36847   }
36848   function loadTile(which, url, tile) {
36849     const cache = _mlyCache.requests;
36850     const tileId = `${tile.id}-${which}`;
36851     if (cache.loaded[tileId] || cache.inflight[tileId])
36852       return;
36853     const controller = new AbortController();
36854     cache.inflight[tileId] = controller;
36855     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
36856     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
36857       if (!response.ok) {
36858         throw new Error(response.status + " " + response.statusText);
36859       }
36860       cache.loaded[tileId] = true;
36861       delete cache.inflight[tileId];
36862       return response.arrayBuffer();
36863     }).then(function(data) {
36864       if (!data) {
36865         throw new Error("No Data");
36866       }
36867       loadTileDataToCache(data, tile, which);
36868       if (which === "images") {
36869         dispatch5.call("loadedImages");
36870       } else if (which === "signs") {
36871         dispatch5.call("loadedSigns");
36872       } else if (which === "points") {
36873         dispatch5.call("loadedMapFeatures");
36874       }
36875     }).catch(function() {
36876       cache.loaded[tileId] = true;
36877       delete cache.inflight[tileId];
36878     });
36879   }
36880   function loadTileDataToCache(data, tile, which) {
36881     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
36882     let features2, cache, layer, i2, feature3, loc, d;
36883     if (vectorTile.layers.hasOwnProperty("image")) {
36884       features2 = [];
36885       cache = _mlyCache.images;
36886       layer = vectorTile.layers.image;
36887       for (i2 = 0; i2 < layer.length; i2++) {
36888         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36889         loc = feature3.geometry.coordinates;
36890         d = {
36891           loc,
36892           captured_at: feature3.properties.captured_at,
36893           ca: feature3.properties.compass_angle,
36894           id: feature3.properties.id,
36895           is_pano: feature3.properties.is_pano,
36896           sequence_id: feature3.properties.sequence_id
36897         };
36898         cache.forImageId[d.id] = d;
36899         features2.push({
36900           minX: loc[0],
36901           minY: loc[1],
36902           maxX: loc[0],
36903           maxY: loc[1],
36904           data: d
36905         });
36906       }
36907       if (cache.rtree) {
36908         cache.rtree.load(features2);
36909       }
36910     }
36911     if (vectorTile.layers.hasOwnProperty("sequence")) {
36912       features2 = [];
36913       cache = _mlyCache.sequences;
36914       layer = vectorTile.layers.sequence;
36915       for (i2 = 0; i2 < layer.length; i2++) {
36916         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36917         if (cache.lineString[feature3.properties.id]) {
36918           cache.lineString[feature3.properties.id].push(feature3);
36919         } else {
36920           cache.lineString[feature3.properties.id] = [feature3];
36921         }
36922       }
36923     }
36924     if (vectorTile.layers.hasOwnProperty("point")) {
36925       features2 = [];
36926       cache = _mlyCache[which];
36927       layer = vectorTile.layers.point;
36928       for (i2 = 0; i2 < layer.length; i2++) {
36929         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36930         loc = feature3.geometry.coordinates;
36931         d = {
36932           loc,
36933           id: feature3.properties.id,
36934           first_seen_at: feature3.properties.first_seen_at,
36935           last_seen_at: feature3.properties.last_seen_at,
36936           value: feature3.properties.value
36937         };
36938         features2.push({
36939           minX: loc[0],
36940           minY: loc[1],
36941           maxX: loc[0],
36942           maxY: loc[1],
36943           data: d
36944         });
36945       }
36946       if (cache.rtree) {
36947         cache.rtree.load(features2);
36948       }
36949     }
36950     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
36951       features2 = [];
36952       cache = _mlyCache[which];
36953       layer = vectorTile.layers.traffic_sign;
36954       for (i2 = 0; i2 < layer.length; i2++) {
36955         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36956         loc = feature3.geometry.coordinates;
36957         d = {
36958           loc,
36959           id: feature3.properties.id,
36960           first_seen_at: feature3.properties.first_seen_at,
36961           last_seen_at: feature3.properties.last_seen_at,
36962           value: feature3.properties.value
36963         };
36964         features2.push({
36965           minX: loc[0],
36966           minY: loc[1],
36967           maxX: loc[0],
36968           maxY: loc[1],
36969           data: d
36970         });
36971       }
36972       if (cache.rtree) {
36973         cache.rtree.load(features2);
36974       }
36975     }
36976   }
36977   function loadData(url) {
36978     return fetch(url).then(function(response) {
36979       if (!response.ok) {
36980         throw new Error(response.status + " " + response.statusText);
36981       }
36982       return response.json();
36983     }).then(function(result) {
36984       if (!result) {
36985         return [];
36986       }
36987       return result.data || [];
36988     });
36989   }
36990   function partitionViewport(projection2) {
36991     const z = geoScaleToZoom(projection2.scale());
36992     const z2 = Math.ceil(z * 2) / 2 + 2.5;
36993     const tiler8 = utilTiler().zoomExtent([z2, z2]);
36994     return tiler8.getTiles(projection2).map(function(tile) {
36995       return tile.extent;
36996     });
36997   }
36998   function searchLimited(limit, projection2, rtree) {
36999     limit = limit || 5;
37000     return partitionViewport(projection2).reduce(function(result, extent) {
37001       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
37002         return d.data;
37003       });
37004       return found.length ? result.concat(found) : result;
37005     }, []);
37006   }
37007   var mapillary_default = {
37008     init: function() {
37009       if (!_mlyCache) {
37010         this.reset();
37011       }
37012       this.event = utilRebind(this, dispatch5, "on");
37013     },
37014     reset: function() {
37015       if (_mlyCache) {
37016         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
37017           request3.abort();
37018         });
37019       }
37020       _mlyCache = {
37021         images: { rtree: new import_rbush4.default(), forImageId: {} },
37022         image_detections: { forImageId: {} },
37023         signs: { rtree: new import_rbush4.default() },
37024         points: { rtree: new import_rbush4.default() },
37025         sequences: { rtree: new import_rbush4.default(), lineString: {} },
37026         requests: { loaded: {}, inflight: {} }
37027       };
37028       _mlyActiveImage = null;
37029     },
37030     images: function(projection2) {
37031       const limit = 5;
37032       return searchLimited(limit, projection2, _mlyCache.images.rtree);
37033     },
37034     signs: function(projection2) {
37035       const limit = 5;
37036       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
37037     },
37038     mapFeatures: function(projection2) {
37039       const limit = 5;
37040       return searchLimited(limit, projection2, _mlyCache.points.rtree);
37041     },
37042     cachedImage: function(imageId) {
37043       return _mlyCache.images.forImageId[imageId];
37044     },
37045     sequences: function(projection2) {
37046       const viewport = projection2.clipExtent();
37047       const min3 = [viewport[0][0], viewport[1][1]];
37048       const max3 = [viewport[1][0], viewport[0][1]];
37049       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37050       const sequenceIds = {};
37051       let lineStrings = [];
37052       _mlyCache.images.rtree.search(bbox).forEach(function(d) {
37053         if (d.data.sequence_id) {
37054           sequenceIds[d.data.sequence_id] = true;
37055         }
37056       });
37057       Object.keys(sequenceIds).forEach(function(sequenceId) {
37058         if (_mlyCache.sequences.lineString[sequenceId]) {
37059           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
37060         }
37061       });
37062       return lineStrings;
37063     },
37064     loadImages: function(projection2) {
37065       loadTiles("images", tileUrl, 14, projection2);
37066     },
37067     loadSigns: function(projection2) {
37068       loadTiles("signs", trafficSignTileUrl, 14, projection2);
37069     },
37070     loadMapFeatures: function(projection2) {
37071       loadTiles("points", mapFeatureTileUrl, 14, projection2);
37072     },
37073     ensureViewerLoaded: function(context) {
37074       if (_loadViewerPromise)
37075         return _loadViewerPromise;
37076       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
37077       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
37078       const that = this;
37079       _loadViewerPromise = new Promise((resolve, reject) => {
37080         let loadedCount = 0;
37081         function loaded() {
37082           loadedCount += 1;
37083           if (loadedCount === 2)
37084             resolve();
37085         }
37086         const head = select_default2("head");
37087         head.selectAll("#ideditor-mapillary-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapillary-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(viewercss)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
37088           reject();
37089         });
37090         head.selectAll("#ideditor-mapillary-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapillary-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(viewerjs)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
37091           reject();
37092         });
37093       }).catch(function() {
37094         _loadViewerPromise = null;
37095       }).then(function() {
37096         that.initViewer(context);
37097       });
37098       return _loadViewerPromise;
37099     },
37100     loadSignResources: function(context) {
37101       context.ui().svgDefs.addSprites(["mapillary-sprite"], false);
37102       return this;
37103     },
37104     loadObjectResources: function(context) {
37105       context.ui().svgDefs.addSprites(["mapillary-object-sprite"], false);
37106       return this;
37107     },
37108     resetTags: function() {
37109       if (_mlyViewer && !_mlyFallback) {
37110         _mlyViewer.getComponent("tag").removeAll();
37111       }
37112     },
37113     showFeatureDetections: function(value) {
37114       _mlyShowFeatureDetections = value;
37115       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37116         this.resetTags();
37117       }
37118     },
37119     showSignDetections: function(value) {
37120       _mlyShowSignDetections = value;
37121       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37122         this.resetTags();
37123       }
37124     },
37125     filterViewer: function(context) {
37126       const showsPano = context.photos().showsPanoramic();
37127       const showsFlat = context.photos().showsFlat();
37128       const fromDate = context.photos().fromDate();
37129       const toDate = context.photos().toDate();
37130       const filter2 = ["all"];
37131       if (!showsPano)
37132         filter2.push(["!=", "cameraType", "spherical"]);
37133       if (!showsFlat && showsPano)
37134         filter2.push(["==", "pano", true]);
37135       if (fromDate) {
37136         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
37137       }
37138       if (toDate) {
37139         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
37140       }
37141       if (_mlyViewer) {
37142         _mlyViewer.setFilter(filter2);
37143       }
37144       _mlyViewerFilter = filter2;
37145       return filter2;
37146     },
37147     showViewer: function(context) {
37148       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
37149       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
37150       if (isHidden && _mlyViewer) {
37151         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
37152         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
37153         _mlyViewer.resize();
37154       }
37155       return this;
37156     },
37157     hideViewer: function(context) {
37158       _mlyActiveImage = null;
37159       if (!_mlyFallback && _mlyViewer) {
37160         _mlyViewer.getComponent("sequence").stop();
37161       }
37162       const viewer = context.container().select(".photoviewer");
37163       if (!viewer.empty())
37164         viewer.datum(null);
37165       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37166       this.updateUrlImage(null);
37167       dispatch5.call("imageChanged");
37168       dispatch5.call("loadedMapFeatures");
37169       dispatch5.call("loadedSigns");
37170       return this.setStyles(context, null);
37171     },
37172     updateUrlImage: function(imageId) {
37173       if (!window.mocha) {
37174         const hash = utilStringQs(window.location.hash);
37175         if (imageId) {
37176           hash.photo = "mapillary/" + imageId;
37177         } else {
37178           delete hash.photo;
37179         }
37180         window.location.replace("#" + utilQsString(hash, true));
37181       }
37182     },
37183     highlightDetection: function(detection) {
37184       if (detection) {
37185         _mlyHighlightedDetection = detection.id;
37186       }
37187       return this;
37188     },
37189     initViewer: function(context) {
37190       const that = this;
37191       if (!window.mapillary)
37192         return;
37193       const opts = {
37194         accessToken,
37195         component: {
37196           cover: false,
37197           keyboard: false,
37198           tag: true
37199         },
37200         container: "ideditor-mly"
37201       };
37202       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
37203         _mlyFallback = true;
37204         opts.component = {
37205           cover: false,
37206           direction: false,
37207           imagePlane: false,
37208           keyboard: false,
37209           mouse: false,
37210           sequence: false,
37211           tag: false,
37212           image: true,
37213           navigation: true
37214         };
37215       }
37216       _mlyViewer = new mapillary.Viewer(opts);
37217       _mlyViewer.on("image", imageChanged);
37218       _mlyViewer.on("bearing", bearingChanged);
37219       if (_mlyViewerFilter) {
37220         _mlyViewer.setFilter(_mlyViewerFilter);
37221       }
37222       context.ui().photoviewer.on("resize.mapillary", function() {
37223         if (_mlyViewer)
37224           _mlyViewer.resize();
37225       });
37226       function imageChanged(node) {
37227         that.resetTags();
37228         const image = node.image;
37229         that.setActiveImage(image);
37230         that.setStyles(context, null);
37231         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
37232         context.map().centerEase(loc);
37233         that.updateUrlImage(image.id);
37234         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
37235           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
37236         }
37237         dispatch5.call("imageChanged");
37238       }
37239       function bearingChanged(e) {
37240         dispatch5.call("bearingChanged", void 0, e);
37241       }
37242     },
37243     selectImage: function(context, imageId) {
37244       if (_mlyViewer && imageId) {
37245         _mlyViewer.moveTo(imageId).catch(function(e) {
37246           console.error("mly3", e);
37247         });
37248       }
37249       return this;
37250     },
37251     getActiveImage: function() {
37252       return _mlyActiveImage;
37253     },
37254     getDetections: function(id2) {
37255       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
37256     },
37257     setActiveImage: function(image) {
37258       if (image) {
37259         _mlyActiveImage = {
37260           ca: image.originalCompassAngle,
37261           id: image.id,
37262           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
37263           is_pano: image.cameraType === "spherical",
37264           sequence_id: image.sequenceId
37265         };
37266       } else {
37267         _mlyActiveImage = null;
37268       }
37269     },
37270     setStyles: function(context, hovered) {
37271       const hoveredImageId = hovered && hovered.id;
37272       const hoveredSequenceId = hovered && hovered.sequence_id;
37273       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
37274       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
37275         return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
37276       }).classed("hovered", function(d) {
37277         return d.id === hoveredImageId;
37278       });
37279       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
37280         return d.properties.id === hoveredSequenceId;
37281       }).classed("currentView", function(d) {
37282         return d.properties.id === selectedSequenceId;
37283       });
37284       return this;
37285     },
37286     updateDetections: function(imageId, url) {
37287       if (!_mlyViewer || _mlyFallback)
37288         return;
37289       if (!imageId)
37290         return;
37291       const cache = _mlyCache.image_detections;
37292       if (cache.forImageId[imageId]) {
37293         showDetections(_mlyCache.image_detections.forImageId[imageId]);
37294       } else {
37295         loadData(url).then((detections) => {
37296           detections.forEach(function(detection) {
37297             if (!cache.forImageId[imageId]) {
37298               cache.forImageId[imageId] = [];
37299             }
37300             cache.forImageId[imageId].push({
37301               geometry: detection.geometry,
37302               id: detection.id,
37303               image_id: imageId,
37304               value: detection.value
37305             });
37306           });
37307           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
37308         });
37309       }
37310       function showDetections(detections) {
37311         const tagComponent = _mlyViewer.getComponent("tag");
37312         detections.forEach(function(data) {
37313           const tag = makeTag(data);
37314           if (tag) {
37315             tagComponent.add([tag]);
37316           }
37317         });
37318       }
37319       function makeTag(data) {
37320         const valueParts = data.value.split("--");
37321         if (!valueParts.length)
37322           return;
37323         let tag;
37324         let text2;
37325         let color2 = 16777215;
37326         if (_mlyHighlightedDetection === data.id) {
37327           color2 = 16776960;
37328           text2 = valueParts[1];
37329           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
37330             text2 = valueParts[2];
37331           }
37332           text2 = text2.replace(/-/g, " ");
37333           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
37334           _mlyHighlightedDetection = null;
37335         }
37336         var decodedGeometry = window.atob(data.geometry);
37337         var uintArray = new Uint8Array(decodedGeometry.length);
37338         for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
37339           uintArray[i2] = decodedGeometry.charCodeAt(i2);
37340         }
37341         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
37342         const layer = tile.layers["mpy-or"];
37343         const geometries = layer.feature(0).loadGeometry();
37344         const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
37345         tag = new mapillary.OutlineTag(data.id, new mapillary.PolygonGeometry(polygon2[0]), {
37346           text: text2,
37347           textColor: color2,
37348           lineColor: color2,
37349           lineWidth: 2,
37350           fillColor: color2,
37351           fillOpacity: 0.3
37352         });
37353         return tag;
37354       }
37355     },
37356     cache: function() {
37357       return _mlyCache;
37358     }
37359   };
37360
37361   // modules/core/validation/models.js
37362   function validationIssue(attrs) {
37363     this.type = attrs.type;
37364     this.subtype = attrs.subtype;
37365     this.severity = attrs.severity;
37366     this.message = attrs.message;
37367     this.reference = attrs.reference;
37368     this.entityIds = attrs.entityIds;
37369     this.loc = attrs.loc;
37370     this.data = attrs.data;
37371     this.dynamicFixes = attrs.dynamicFixes;
37372     this.hash = attrs.hash;
37373     this.id = generateID.apply(this);
37374     this.key = generateKey.apply(this);
37375     this.autoFix = null;
37376     function generateID() {
37377       var parts = [this.type];
37378       if (this.hash) {
37379         parts.push(this.hash);
37380       }
37381       if (this.subtype) {
37382         parts.push(this.subtype);
37383       }
37384       if (this.entityIds) {
37385         var entityKeys = this.entityIds.slice().sort();
37386         parts.push.apply(parts, entityKeys);
37387       }
37388       return parts.join(":");
37389     }
37390     function generateKey() {
37391       return this.id + ":" + Date.now().toString();
37392     }
37393     this.extent = function(resolver) {
37394       if (this.loc) {
37395         return geoExtent(this.loc);
37396       }
37397       if (this.entityIds && this.entityIds.length) {
37398         return this.entityIds.reduce(function(extent, entityId) {
37399           return extent.extend(resolver.entity(entityId).extent(resolver));
37400         }, geoExtent());
37401       }
37402       return null;
37403     };
37404     this.fixes = function(context) {
37405       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
37406       var issue = this;
37407       if (issue.severity === "warning") {
37408         fixes.push(new validationIssueFix({
37409           title: _t.html("issues.fix.ignore_issue.title"),
37410           icon: "iD-icon-close",
37411           onClick: function() {
37412             context.validator().ignoreIssue(this.issue.id);
37413           }
37414         }));
37415       }
37416       fixes.forEach(function(fix) {
37417         fix.id = fix.title;
37418         fix.issue = issue;
37419         if (fix.autoArgs) {
37420           issue.autoFix = fix;
37421         }
37422       });
37423       return fixes;
37424     };
37425   }
37426   function validationIssueFix(attrs) {
37427     this.title = attrs.title;
37428     this.onClick = attrs.onClick;
37429     this.disabledReason = attrs.disabledReason;
37430     this.icon = attrs.icon;
37431     this.entityIds = attrs.entityIds || [];
37432     this.autoArgs = attrs.autoArgs;
37433     this.issue = null;
37434   }
37435
37436   // modules/services/maprules.js
37437   var buildRuleChecks = function() {
37438     return {
37439       equals: function(equals) {
37440         return function(tags) {
37441           return Object.keys(equals).every(function(k) {
37442             return equals[k] === tags[k];
37443           });
37444         };
37445       },
37446       notEquals: function(notEquals) {
37447         return function(tags) {
37448           return Object.keys(notEquals).some(function(k) {
37449             return notEquals[k] !== tags[k];
37450           });
37451         };
37452       },
37453       absence: function(absence) {
37454         return function(tags) {
37455           return Object.keys(tags).indexOf(absence) === -1;
37456         };
37457       },
37458       presence: function(presence) {
37459         return function(tags) {
37460           return Object.keys(tags).indexOf(presence) > -1;
37461         };
37462       },
37463       greaterThan: function(greaterThan) {
37464         var key = Object.keys(greaterThan)[0];
37465         var value = greaterThan[key];
37466         return function(tags) {
37467           return tags[key] > value;
37468         };
37469       },
37470       greaterThanEqual: function(greaterThanEqual) {
37471         var key = Object.keys(greaterThanEqual)[0];
37472         var value = greaterThanEqual[key];
37473         return function(tags) {
37474           return tags[key] >= value;
37475         };
37476       },
37477       lessThan: function(lessThan) {
37478         var key = Object.keys(lessThan)[0];
37479         var value = lessThan[key];
37480         return function(tags) {
37481           return tags[key] < value;
37482         };
37483       },
37484       lessThanEqual: function(lessThanEqual) {
37485         var key = Object.keys(lessThanEqual)[0];
37486         var value = lessThanEqual[key];
37487         return function(tags) {
37488           return tags[key] <= value;
37489         };
37490       },
37491       positiveRegex: function(positiveRegex) {
37492         var tagKey = Object.keys(positiveRegex)[0];
37493         var expression = positiveRegex[tagKey].join("|");
37494         var regex = new RegExp(expression);
37495         return function(tags) {
37496           return regex.test(tags[tagKey]);
37497         };
37498       },
37499       negativeRegex: function(negativeRegex) {
37500         var tagKey = Object.keys(negativeRegex)[0];
37501         var expression = negativeRegex[tagKey].join("|");
37502         var regex = new RegExp(expression);
37503         return function(tags) {
37504           return !regex.test(tags[tagKey]);
37505         };
37506       }
37507     };
37508   };
37509   var buildLineKeys = function() {
37510     return {
37511       highway: {
37512         rest_area: true,
37513         services: true
37514       },
37515       railway: {
37516         roundhouse: true,
37517         station: true,
37518         traverser: true,
37519         turntable: true,
37520         wash: true
37521       }
37522     };
37523   };
37524   var maprules_default = {
37525     init: function() {
37526       this._ruleChecks = buildRuleChecks();
37527       this._validationRules = [];
37528       this._areaKeys = osmAreaKeys;
37529       this._lineKeys = buildLineKeys();
37530     },
37531     filterRuleChecks: function(selector) {
37532       var _ruleChecks = this._ruleChecks;
37533       return Object.keys(selector).reduce(function(rules, key) {
37534         if (["geometry", "error", "warning"].indexOf(key) === -1) {
37535           rules.push(_ruleChecks[key](selector[key]));
37536         }
37537         return rules;
37538       }, []);
37539     },
37540     buildTagMap: function(selector) {
37541       var getRegexValues = function(regexes) {
37542         return regexes.map(function(regex) {
37543           return regex.replace(/\$|\^/g, "");
37544         });
37545       };
37546       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
37547         var values;
37548         var isRegex = /regex/gi.test(key);
37549         var isEqual = /equals/gi.test(key);
37550         if (isRegex || isEqual) {
37551           Object.keys(selector[key]).forEach(function(selectorKey) {
37552             values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
37553             if (expectedTags.hasOwnProperty(selectorKey)) {
37554               values = values.concat(expectedTags[selectorKey]);
37555             }
37556             expectedTags[selectorKey] = values;
37557           });
37558         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
37559           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
37560           values = [selector[key][tagKey]];
37561           if (expectedTags.hasOwnProperty(tagKey)) {
37562             values = values.concat(expectedTags[tagKey]);
37563           }
37564           expectedTags[tagKey] = values;
37565         }
37566         return expectedTags;
37567       }, {});
37568       return tagMap;
37569     },
37570     inferGeometry: function(tagMap) {
37571       var _lineKeys = this._lineKeys;
37572       var _areaKeys = this._areaKeys;
37573       var keyValueDoesNotImplyArea = function(key2) {
37574         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
37575       };
37576       var keyValueImpliesLine = function(key2) {
37577         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
37578       };
37579       if (tagMap.hasOwnProperty("area")) {
37580         if (tagMap.area.indexOf("yes") > -1) {
37581           return "area";
37582         }
37583         if (tagMap.area.indexOf("no") > -1) {
37584           return "line";
37585         }
37586       }
37587       for (var key in tagMap) {
37588         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
37589           return "area";
37590         }
37591         if (key in _lineKeys && keyValueImpliesLine(key)) {
37592           return "area";
37593         }
37594       }
37595       return "line";
37596     },
37597     addRule: function(selector) {
37598       var rule = {
37599         checks: this.filterRuleChecks(selector),
37600         matches: function(entity) {
37601           return this.checks.every(function(check) {
37602             return check(entity.tags);
37603           });
37604         },
37605         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
37606         geometryMatches: function(entity, graph) {
37607           if (entity.type === "node" || entity.type === "relation") {
37608             return selector.geometry === entity.type;
37609           } else if (entity.type === "way") {
37610             return this.inferredGeometry === entity.geometry(graph);
37611           }
37612         },
37613         findIssues: function(entity, graph, issues) {
37614           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
37615             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
37616             var message = selector[severity];
37617             issues.push(new validationIssue({
37618               type: "maprules",
37619               severity,
37620               message: function() {
37621                 return message;
37622               },
37623               entityIds: [entity.id]
37624             }));
37625           }
37626         }
37627       };
37628       this._validationRules.push(rule);
37629     },
37630     clearRules: function() {
37631       this._validationRules = [];
37632     },
37633     validationRules: function() {
37634       return this._validationRules;
37635     },
37636     ruleChecks: function() {
37637       return this._ruleChecks;
37638     }
37639   };
37640
37641   // modules/services/nominatim.js
37642   var import_rbush5 = __toESM(require_rbush_min());
37643   var apibase = "https://nominatim.openstreetmap.org/";
37644   var _inflight = {};
37645   var _nominatimCache;
37646   var nominatim_default = {
37647     init: function() {
37648       _inflight = {};
37649       _nominatimCache = new import_rbush5.default();
37650     },
37651     reset: function() {
37652       Object.values(_inflight).forEach(function(controller) {
37653         controller.abort();
37654       });
37655       _inflight = {};
37656       _nominatimCache = new import_rbush5.default();
37657     },
37658     countryCode: function(location, callback) {
37659       this.reverse(location, function(err, result) {
37660         if (err) {
37661           return callback(err);
37662         } else if (result.address) {
37663           return callback(null, result.address.country_code);
37664         } else {
37665           return callback("Unable to geocode", null);
37666         }
37667       });
37668     },
37669     reverse: function(loc, callback) {
37670       var cached = _nominatimCache.search({ minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] });
37671       if (cached.length > 0) {
37672         if (callback)
37673           callback(null, cached[0].data);
37674         return;
37675       }
37676       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
37677       var url = apibase + "reverse?" + utilQsString(params);
37678       if (_inflight[url])
37679         return;
37680       var controller = new AbortController();
37681       _inflight[url] = controller;
37682       json_default(url, { signal: controller.signal }).then(function(result) {
37683         delete _inflight[url];
37684         if (result && result.error) {
37685           throw new Error(result.error);
37686         }
37687         var extent = geoExtent(loc).padByMeters(200);
37688         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
37689         if (callback)
37690           callback(null, result);
37691       }).catch(function(err) {
37692         delete _inflight[url];
37693         if (err.name === "AbortError")
37694           return;
37695         if (callback)
37696           callback(err.message);
37697       });
37698     },
37699     search: function(val, callback) {
37700       var searchVal = encodeURIComponent(val);
37701       var url = apibase + "search/" + searchVal + "?limit=10&format=json";
37702       if (_inflight[url])
37703         return;
37704       var controller = new AbortController();
37705       _inflight[url] = controller;
37706       json_default(url, { signal: controller.signal }).then(function(result) {
37707         delete _inflight[url];
37708         if (result && result.error) {
37709           throw new Error(result.error);
37710         }
37711         if (callback)
37712           callback(null, result);
37713       }).catch(function(err) {
37714         delete _inflight[url];
37715         if (err.name === "AbortError")
37716           return;
37717         if (callback)
37718           callback(err.message);
37719       });
37720     }
37721   };
37722
37723   // node_modules/name-suggestion-index/lib/matcher.js
37724   var import_which_polygon3 = __toESM(require_which_polygon(), 1);
37725
37726   // node_modules/name-suggestion-index/lib/simplify.js
37727   var import_diacritics2 = __toESM(require_diacritics(), 1);
37728   function simplify(str2) {
37729     if (typeof str2 !== "string")
37730       return "";
37731     return import_diacritics2.default.remove(str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase());
37732   }
37733
37734   // node_modules/name-suggestion-index/config/matchGroups.json
37735   var matchGroups = {
37736     adult_gaming_centre: [
37737       "amenity/casino",
37738       "amenity/gambling",
37739       "leisure/adult_gaming_centre"
37740     ],
37741     beauty: [
37742       "shop/beauty",
37743       "shop/hairdresser_supply"
37744     ],
37745     bed: [
37746       "shop/bed",
37747       "shop/furniture"
37748     ],
37749     beverages: [
37750       "shop/alcohol",
37751       "shop/beer",
37752       "shop/beverages",
37753       "shop/kiosk",
37754       "shop/wine"
37755     ],
37756     camping: [
37757       "tourism/camp_site",
37758       "tourism/caravan_site"
37759     ],
37760     car_parts: [
37761       "shop/car_parts",
37762       "shop/car_repair",
37763       "shop/tires",
37764       "shop/tyres"
37765     ],
37766     clinic: [
37767       "amenity/clinic",
37768       "amenity/doctors",
37769       "healthcare/clinic",
37770       "healthcare/laboratory",
37771       "healthcare/physiotherapist",
37772       "healthcare/sample_collection",
37773       "healthcare/dialysis"
37774     ],
37775     convenience: [
37776       "shop/beauty",
37777       "shop/chemist",
37778       "shop/convenience",
37779       "shop/cosmetics",
37780       "shop/grocery",
37781       "shop/kiosk",
37782       "shop/newsagent",
37783       "shop/perfumery"
37784     ],
37785     coworking: [
37786       "amenity/coworking_space",
37787       "office/coworking",
37788       "office/coworking_space"
37789     ],
37790     dentist: [
37791       "amenity/dentist",
37792       "amenity/doctors",
37793       "healthcare/dentist"
37794     ],
37795     electronics: [
37796       "office/telecommunication",
37797       "shop/computer",
37798       "shop/electronics",
37799       "shop/hifi",
37800       "shop/kiosk",
37801       "shop/mobile",
37802       "shop/mobile_phone",
37803       "shop/telecommunication"
37804     ],
37805     fabric: [
37806       "shop/fabric",
37807       "shop/haberdashery",
37808       "shop/sewing"
37809     ],
37810     fashion: [
37811       "shop/accessories",
37812       "shop/bag",
37813       "shop/boutique",
37814       "shop/clothes",
37815       "shop/department_store",
37816       "shop/fashion",
37817       "shop/fashion_accessories",
37818       "shop/sports",
37819       "shop/shoes"
37820     ],
37821     financial: [
37822       "amenity/bank",
37823       "office/accountant",
37824       "office/financial",
37825       "office/financial_advisor",
37826       "office/tax_advisor",
37827       "shop/tax"
37828     ],
37829     fitness: [
37830       "leisure/fitness_centre",
37831       "leisure/fitness_center",
37832       "leisure/sports_centre",
37833       "leisure/sports_center"
37834     ],
37835     food: [
37836       "amenity/bar",
37837       "amenity/cafe",
37838       "amenity/fast_food",
37839       "amenity/ice_cream",
37840       "amenity/pub",
37841       "amenity/restaurant",
37842       "shop/bakery",
37843       "shop/candy",
37844       "shop/chocolate",
37845       "shop/coffee",
37846       "shop/confectionary",
37847       "shop/confectionery",
37848       "shop/food",
37849       "shop/kiosk",
37850       "shop/ice_cream",
37851       "shop/pastry",
37852       "shop/tea"
37853     ],
37854     fuel: [
37855       "amenity/fuel",
37856       "shop/gas",
37857       "shop/convenience;gas",
37858       "shop/gas;convenience"
37859     ],
37860     gift: [
37861       "shop/gift",
37862       "shop/card",
37863       "shop/cards",
37864       "shop/kiosk",
37865       "shop/stationery"
37866     ],
37867     hardware: [
37868       "shop/bathroom_furnishing",
37869       "shop/carpet",
37870       "shop/diy",
37871       "shop/doityourself",
37872       "shop/doors",
37873       "shop/electrical",
37874       "shop/flooring",
37875       "shop/hardware",
37876       "shop/hardware_store",
37877       "shop/power_tools",
37878       "shop/tool_hire",
37879       "shop/tools",
37880       "shop/trade"
37881     ],
37882     health_food: [
37883       "shop/health",
37884       "shop/health_food",
37885       "shop/herbalist",
37886       "shop/nutrition_supplements"
37887     ],
37888     hobby: [
37889       "shop/electronics",
37890       "shop/hobby",
37891       "shop/books",
37892       "shop/games",
37893       "shop/collector",
37894       "shop/toys",
37895       "shop/model",
37896       "shop/video_games",
37897       "shop/anime"
37898     ],
37899     hospital: [
37900       "amenity/doctors",
37901       "amenity/hospital",
37902       "healthcare/hospital"
37903     ],
37904     houseware: [
37905       "shop/houseware",
37906       "shop/interior_decoration"
37907     ],
37908     lifeboat_station: [
37909       "amenity/lifeboat_station",
37910       "emergency/lifeboat_station",
37911       "emergency/marine_rescue"
37912     ],
37913     lodging: [
37914       "tourism/hotel",
37915       "tourism/motel"
37916     ],
37917     money_transfer: [
37918       "amenity/money_transfer",
37919       "shop/money_transfer"
37920     ],
37921     office_supplies: [
37922       "shop/office_supplies",
37923       "shop/stationary",
37924       "shop/stationery"
37925     ],
37926     outdoor: [
37927       "shop/clothes",
37928       "shop/outdoor",
37929       "shop/sports"
37930     ],
37931     parcel_locker: [
37932       "amenity/parcel_locker",
37933       "amenity/vending_machine"
37934     ],
37935     pharmacy: [
37936       "amenity/doctors",
37937       "amenity/pharmacy",
37938       "healthcare/pharmacy"
37939     ],
37940     playground: [
37941       "amenity/theme_park",
37942       "leisure/amusement_arcade",
37943       "leisure/playground"
37944     ],
37945     rental: [
37946       "amenity/bicycle_rental",
37947       "amenity/boat_rental",
37948       "amenity/car_rental",
37949       "amenity/truck_rental",
37950       "amenity/vehicle_rental",
37951       "shop/kiosk",
37952       "shop/rental"
37953     ],
37954     school: [
37955       "amenity/childcare",
37956       "amenity/college",
37957       "amenity/kindergarten",
37958       "amenity/language_school",
37959       "amenity/prep_school",
37960       "amenity/school",
37961       "amenity/university"
37962     ],
37963     storage: [
37964       "shop/storage_units",
37965       "shop/storage_rental"
37966     ],
37967     substation: [
37968       "power/station",
37969       "power/substation",
37970       "power/sub_station"
37971     ],
37972     supermarket: [
37973       "shop/food",
37974       "shop/frozen_food",
37975       "shop/greengrocer",
37976       "shop/grocery",
37977       "shop/supermarket",
37978       "shop/wholesale"
37979     ],
37980     variety_store: [
37981       "shop/variety_store",
37982       "shop/discount",
37983       "shop/convenience"
37984     ],
37985     vending: [
37986       "amenity/vending_machine",
37987       "shop/kiosk",
37988       "shop/vending_machine"
37989     ],
37990     weight_loss: [
37991       "amenity/clinic",
37992       "amenity/doctors",
37993       "amenity/weight_clinic",
37994       "healthcare/counselling",
37995       "leisure/fitness_centre",
37996       "office/therapist",
37997       "shop/beauty",
37998       "shop/diet",
37999       "shop/food",
38000       "shop/health_food",
38001       "shop/herbalist",
38002       "shop/nutrition",
38003       "shop/nutrition_supplements",
38004       "shop/weight_loss"
38005     ],
38006     wholesale: [
38007       "shop/wholesale",
38008       "shop/supermarket",
38009       "shop/department_store"
38010     ]
38011   };
38012   var matchGroups_default = {
38013     matchGroups
38014   };
38015
38016   // node_modules/name-suggestion-index/config/genericWords.json
38017   var genericWords = [
38018     "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
38019     "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
38020     "^(club|green|out|ware)\\s?house$",
38021     "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
38022     "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
38023     "^(hofladen|librairie|magazine?|maison)$",
38024     "^(mobile home|skate)?\\s?park$",
38025     "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
38026     "^\\?+$",
38027     "^private$",
38028     "^tattoo( studio)?$",
38029     "^windmill$",
38030     "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
38031   ];
38032   var genericWords_default = {
38033     genericWords
38034   };
38035
38036   // node_modules/name-suggestion-index/config/trees.json
38037   var trees = {
38038     brands: {
38039       emoji: "\u{1F354}",
38040       mainTag: "brand:wikidata",
38041       sourceTags: ["brand", "name"],
38042       nameTags: {
38043         primary: "^(name|name:\\w+)$",
38044         alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
38045       }
38046     },
38047     flags: {
38048       emoji: "\u{1F6A9}",
38049       mainTag: "flag:wikidata",
38050       nameTags: {
38051         primary: "^(flag:name|flag:name:\\w+)$",
38052         alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
38053       }
38054     },
38055     operators: {
38056       emoji: "\u{1F4BC}",
38057       mainTag: "operator:wikidata",
38058       sourceTags: ["operator"],
38059       nameTags: {
38060         primary: "^(name|name:\\w+|operator|operator:\\w+)$",
38061         alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
38062       }
38063     },
38064     transit: {
38065       emoji: "\u{1F687}",
38066       mainTag: "network:wikidata",
38067       sourceTags: ["network"],
38068       nameTags: {
38069         primary: "^network$",
38070         alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
38071       }
38072     }
38073   };
38074   var trees_default = {
38075     trees
38076   };
38077
38078   // node_modules/name-suggestion-index/lib/matcher.js
38079   var matchGroups2 = matchGroups_default.matchGroups;
38080   var trees2 = trees_default.trees;
38081   var Matcher = class {
38082     constructor() {
38083       this.matchIndex = void 0;
38084       this.genericWords = /* @__PURE__ */ new Map();
38085       (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
38086       this.itemLocation = void 0;
38087       this.locationSets = void 0;
38088       this.locationIndex = void 0;
38089       this.warnings = [];
38090     }
38091     buildMatchIndex(data) {
38092       const that = this;
38093       if (that.matchIndex)
38094         return;
38095       that.matchIndex = /* @__PURE__ */ new Map();
38096       const seenTree = /* @__PURE__ */ new Map();
38097       Object.keys(data).forEach((tkv) => {
38098         const category = data[tkv];
38099         const parts = tkv.split("/", 3);
38100         const t = parts[0];
38101         const k = parts[1];
38102         const v = parts[2];
38103         const thiskv = `${k}/${v}`;
38104         const tree = trees2[t];
38105         let branch = that.matchIndex.get(thiskv);
38106         if (!branch) {
38107           branch = {
38108             primary: /* @__PURE__ */ new Map(),
38109             alternate: /* @__PURE__ */ new Map(),
38110             excludeGeneric: /* @__PURE__ */ new Map(),
38111             excludeNamed: /* @__PURE__ */ new Map()
38112           };
38113           that.matchIndex.set(thiskv, branch);
38114         }
38115         const properties = category.properties || {};
38116         const exclude = properties.exclude || {};
38117         (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
38118         (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
38119         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
38120         let items = category.items;
38121         if (!Array.isArray(items) || !items.length)
38122           return;
38123         const primaryName = new RegExp(tree.nameTags.primary, "i");
38124         const alternateName = new RegExp(tree.nameTags.alternate, "i");
38125         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
38126         const skipGenericKV = skipGenericKVMatches(t, k, v);
38127         const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
38128         const matchGroupKV = /* @__PURE__ */ new Set();
38129         Object.values(matchGroups2).forEach((matchGroup) => {
38130           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
38131           if (!inGroup)
38132             return;
38133           matchGroup.forEach((otherkv) => {
38134             if (otherkv === thiskv)
38135               return;
38136             matchGroupKV.add(otherkv);
38137             const otherk = otherkv.split("/", 2)[0];
38138             genericKV.add(`${otherk}/yes`);
38139           });
38140         });
38141         items.forEach((item) => {
38142           if (!item.id)
38143             return;
38144           if (Array.isArray(item.matchTags) && item.matchTags.length) {
38145             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
38146             if (!item.matchTags.length)
38147               delete item.matchTags;
38148           }
38149           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
38150           if (!skipGenericKV) {
38151             kvTags = kvTags.concat(Array.from(genericKV));
38152           }
38153           Object.keys(item.tags).forEach((osmkey) => {
38154             if (notName.test(osmkey))
38155               return;
38156             const osmvalue = item.tags[osmkey];
38157             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
38158               return;
38159             if (primaryName.test(osmkey)) {
38160               kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id));
38161             } else if (alternateName.test(osmkey)) {
38162               kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id));
38163             }
38164           });
38165           let keepMatchNames = /* @__PURE__ */ new Set();
38166           (item.matchNames || []).forEach((matchName) => {
38167             const nsimple = simplify(matchName);
38168             kvTags.forEach((kv) => {
38169               const branch2 = that.matchIndex.get(kv);
38170               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
38171               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
38172               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
38173               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
38174               if (!inPrimary && !inAlternate) {
38175                 insertName("alternate", t, kv, nsimple, item.id);
38176                 keepMatchNames.add(matchName);
38177               }
38178             });
38179           });
38180           if (keepMatchNames.size) {
38181             item.matchNames = Array.from(keepMatchNames);
38182           } else {
38183             delete item.matchNames;
38184           }
38185         });
38186       });
38187       function insertName(which, t, kv, nsimple, itemID) {
38188         if (!nsimple) {
38189           that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
38190           return;
38191         }
38192         let branch = that.matchIndex.get(kv);
38193         if (!branch) {
38194           branch = {
38195             primary: /* @__PURE__ */ new Map(),
38196             alternate: /* @__PURE__ */ new Map(),
38197             excludeGeneric: /* @__PURE__ */ new Map(),
38198             excludeNamed: /* @__PURE__ */ new Map()
38199           };
38200           that.matchIndex.set(kv, branch);
38201         }
38202         let leaf = branch[which].get(nsimple);
38203         if (!leaf) {
38204           leaf = /* @__PURE__ */ new Set();
38205           branch[which].set(nsimple, leaf);
38206         }
38207         leaf.add(itemID);
38208         if (!/yes$/.test(kv)) {
38209           const kvnsimple = `${kv}/${nsimple}`;
38210           const existing = seenTree.get(kvnsimple);
38211           if (existing && existing !== t) {
38212             const items = Array.from(leaf);
38213             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
38214             return;
38215           }
38216           seenTree.set(kvnsimple, t);
38217         }
38218       }
38219       function skipGenericKVMatches(t, k, v) {
38220         return t === "flags" || t === "transit" || k === "landuse" || v === "atm" || v === "bicycle_parking" || v === "car_sharing" || v === "caravan_site" || v === "charging_station" || v === "dog_park" || v === "parking" || v === "phone" || v === "playground" || v === "post_box" || v === "public_bookcase" || v === "recycling" || v === "vending_machine";
38221       }
38222     }
38223     buildLocationIndex(data, loco) {
38224       const that = this;
38225       if (that.locationIndex)
38226         return;
38227       that.itemLocation = /* @__PURE__ */ new Map();
38228       that.locationSets = /* @__PURE__ */ new Map();
38229       Object.keys(data).forEach((tkv) => {
38230         const items = data[tkv].items;
38231         if (!Array.isArray(items) || !items.length)
38232           return;
38233         items.forEach((item) => {
38234           if (that.itemLocation.has(item.id))
38235             return;
38236           let resolved;
38237           try {
38238             resolved = loco.resolveLocationSet(item.locationSet);
38239           } catch (err) {
38240             console.warn(`buildLocationIndex: ${err.message}`);
38241           }
38242           if (!resolved || !resolved.id)
38243             return;
38244           that.itemLocation.set(item.id, resolved.id);
38245           if (that.locationSets.has(resolved.id))
38246             return;
38247           let feature3 = _cloneDeep2(resolved.feature);
38248           feature3.id = resolved.id;
38249           feature3.properties.id = resolved.id;
38250           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
38251             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
38252             console.warn(JSON.stringify(feature3));
38253             return;
38254           }
38255           that.locationSets.set(resolved.id, feature3);
38256         });
38257       });
38258       that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
38259       function _cloneDeep2(obj) {
38260         return JSON.parse(JSON.stringify(obj));
38261       }
38262     }
38263     match(k, v, n2, loc) {
38264       const that = this;
38265       if (!that.matchIndex) {
38266         throw new Error("match:  matchIndex not built.");
38267       }
38268       let matchLocations;
38269       if (Array.isArray(loc) && that.locationIndex) {
38270         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
38271       }
38272       const nsimple = simplify(n2);
38273       let seen = /* @__PURE__ */ new Set();
38274       let results = [];
38275       gatherResults("primary");
38276       gatherResults("alternate");
38277       if (results.length)
38278         return results;
38279       gatherResults("exclude");
38280       return results.length ? results : null;
38281       function gatherResults(which) {
38282         const kv = `${k}/${v}`;
38283         let didMatch = tryMatch(which, kv);
38284         if (didMatch)
38285           return;
38286         for (let mg in matchGroups2) {
38287           const matchGroup = matchGroups2[mg];
38288           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
38289           if (!inGroup)
38290             continue;
38291           for (let i2 = 0; i2 < matchGroup.length; i2++) {
38292             const otherkv = matchGroup[i2];
38293             if (otherkv === kv)
38294               continue;
38295             didMatch = tryMatch(which, otherkv);
38296             if (didMatch)
38297               return;
38298           }
38299         }
38300         if (which === "exclude") {
38301           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
38302           if (regex) {
38303             results.push({ match: "excludeGeneric", pattern: String(regex) });
38304             return;
38305           }
38306         }
38307       }
38308       function tryMatch(which, kv) {
38309         const branch = that.matchIndex.get(kv);
38310         if (!branch)
38311           return;
38312         if (which === "exclude") {
38313           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
38314           if (regex) {
38315             results.push({ match: "excludeNamed", pattern: String(regex), kv });
38316             return;
38317           }
38318           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
38319           if (regex) {
38320             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
38321             return;
38322           }
38323           return;
38324         }
38325         const leaf = branch[which].get(nsimple);
38326         if (!leaf || !leaf.size)
38327           return;
38328         let hits = Array.from(leaf).map((itemID) => {
38329           let area = Infinity;
38330           if (that.itemLocation && that.locationSets) {
38331             const location = that.locationSets.get(that.itemLocation.get(itemID));
38332             area = location && location.properties.area || Infinity;
38333           }
38334           return { match: which, itemID, area, kv, nsimple };
38335         });
38336         let sortFn = byAreaDescending;
38337         if (matchLocations) {
38338           hits = hits.filter(isValidLocation);
38339           sortFn = byAreaAscending;
38340         }
38341         if (!hits.length)
38342           return;
38343         hits.sort(sortFn).forEach((hit) => {
38344           if (seen.has(hit.itemID))
38345             return;
38346           seen.add(hit.itemID);
38347           results.push(hit);
38348         });
38349         return true;
38350         function isValidLocation(hit) {
38351           if (!that.itemLocation)
38352             return true;
38353           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
38354         }
38355         function byAreaAscending(hitA, hitB) {
38356           return hitA.area - hitB.area;
38357         }
38358         function byAreaDescending(hitA, hitB) {
38359           return hitB.area - hitA.area;
38360         }
38361       }
38362     }
38363     getWarnings() {
38364       return this.warnings;
38365     }
38366   };
38367
38368   // modules/services/nsi.js
38369   var import_vparse2 = __toESM(require_vparse());
38370
38371   // modules/core/difference.js
38372   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
38373   function coreDifference(base, head) {
38374     var _changes = {};
38375     var _didChange = {};
38376     var _diff = {};
38377     function checkEntityID(id2) {
38378       var h = head.entities[id2];
38379       var b = base.entities[id2];
38380       if (h === b)
38381         return;
38382       if (_changes[id2])
38383         return;
38384       if (!h && b) {
38385         _changes[id2] = { base: b, head: h };
38386         _didChange.deletion = true;
38387         return;
38388       }
38389       if (h && !b) {
38390         _changes[id2] = { base: b, head: h };
38391         _didChange.addition = true;
38392         return;
38393       }
38394       if (h && b) {
38395         if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
38396           _changes[id2] = { base: b, head: h };
38397           _didChange.geometry = true;
38398           _didChange.properties = true;
38399           return;
38400         }
38401         if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
38402           _changes[id2] = { base: b, head: h };
38403           _didChange.geometry = true;
38404         }
38405         if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
38406           _changes[id2] = { base: b, head: h };
38407           _didChange.geometry = true;
38408         }
38409         if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
38410           _changes[id2] = { base: b, head: h };
38411           _didChange.properties = true;
38412         }
38413       }
38414     }
38415     function load() {
38416       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
38417       for (var i2 = 0; i2 < ids.length; i2++) {
38418         checkEntityID(ids[i2]);
38419       }
38420     }
38421     load();
38422     _diff.length = function length() {
38423       return Object.keys(_changes).length;
38424     };
38425     _diff.changes = function changes() {
38426       return _changes;
38427     };
38428     _diff.didChange = _didChange;
38429     _diff.extantIDs = function extantIDs(includeRelMembers) {
38430       var result = /* @__PURE__ */ new Set();
38431       Object.keys(_changes).forEach(function(id2) {
38432         if (_changes[id2].head) {
38433           result.add(id2);
38434         }
38435         var h = _changes[id2].head;
38436         var b = _changes[id2].base;
38437         var entity = h || b;
38438         if (includeRelMembers && entity.type === "relation") {
38439           var mh = h ? h.members.map(function(m) {
38440             return m.id;
38441           }) : [];
38442           var mb = b ? b.members.map(function(m) {
38443             return m.id;
38444           }) : [];
38445           utilArrayUnion(mh, mb).forEach(function(memberID) {
38446             if (head.hasEntity(memberID)) {
38447               result.add(memberID);
38448             }
38449           });
38450         }
38451       });
38452       return Array.from(result);
38453     };
38454     _diff.modified = function modified() {
38455       var result = [];
38456       Object.values(_changes).forEach(function(change) {
38457         if (change.base && change.head) {
38458           result.push(change.head);
38459         }
38460       });
38461       return result;
38462     };
38463     _diff.created = function created() {
38464       var result = [];
38465       Object.values(_changes).forEach(function(change) {
38466         if (!change.base && change.head) {
38467           result.push(change.head);
38468         }
38469       });
38470       return result;
38471     };
38472     _diff.deleted = function deleted() {
38473       var result = [];
38474       Object.values(_changes).forEach(function(change) {
38475         if (change.base && !change.head) {
38476           result.push(change.base);
38477         }
38478       });
38479       return result;
38480     };
38481     _diff.summary = function summary() {
38482       var relevant = {};
38483       var keys = Object.keys(_changes);
38484       for (var i2 = 0; i2 < keys.length; i2++) {
38485         var change = _changes[keys[i2]];
38486         if (change.head && change.head.geometry(head) !== "vertex") {
38487           addEntity(change.head, head, change.base ? "modified" : "created");
38488         } else if (change.base && change.base.geometry(base) !== "vertex") {
38489           addEntity(change.base, base, "deleted");
38490         } else if (change.base && change.head) {
38491           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
38492           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
38493           if (moved) {
38494             addParents(change.head);
38495           }
38496           if (retagged || moved && change.head.hasInterestingTags()) {
38497             addEntity(change.head, head, "modified");
38498           }
38499         } else if (change.head && change.head.hasInterestingTags()) {
38500           addEntity(change.head, head, "created");
38501         } else if (change.base && change.base.hasInterestingTags()) {
38502           addEntity(change.base, base, "deleted");
38503         }
38504       }
38505       return Object.values(relevant);
38506       function addEntity(entity, graph, changeType) {
38507         relevant[entity.id] = {
38508           entity,
38509           graph,
38510           changeType
38511         };
38512       }
38513       function addParents(entity) {
38514         var parents = head.parentWays(entity);
38515         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
38516           var parent = parents[j2];
38517           if (!(parent.id in relevant)) {
38518             addEntity(parent, head, "modified");
38519           }
38520         }
38521       }
38522     };
38523     _diff.complete = function complete(extent) {
38524       var result = {};
38525       var id2, change;
38526       for (id2 in _changes) {
38527         change = _changes[id2];
38528         var h = change.head;
38529         var b = change.base;
38530         var entity = h || b;
38531         var i2;
38532         if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
38533           continue;
38534         }
38535         result[id2] = h;
38536         if (entity.type === "way") {
38537           var nh = h ? h.nodes : [];
38538           var nb = b ? b.nodes : [];
38539           var diff;
38540           diff = utilArrayDifference(nh, nb);
38541           for (i2 = 0; i2 < diff.length; i2++) {
38542             result[diff[i2]] = head.hasEntity(diff[i2]);
38543           }
38544           diff = utilArrayDifference(nb, nh);
38545           for (i2 = 0; i2 < diff.length; i2++) {
38546             result[diff[i2]] = head.hasEntity(diff[i2]);
38547           }
38548         }
38549         if (entity.type === "relation" && entity.isMultipolygon()) {
38550           var mh = h ? h.members.map(function(m) {
38551             return m.id;
38552           }) : [];
38553           var mb = b ? b.members.map(function(m) {
38554             return m.id;
38555           }) : [];
38556           var ids = utilArrayUnion(mh, mb);
38557           for (i2 = 0; i2 < ids.length; i2++) {
38558             var member = head.hasEntity(ids[i2]);
38559             if (!member)
38560               continue;
38561             if (extent && !member.intersects(extent, head))
38562               continue;
38563             result[ids[i2]] = member;
38564           }
38565         }
38566         addParents(head.parentWays(entity), result);
38567         addParents(head.parentRelations(entity), result);
38568       }
38569       return result;
38570       function addParents(parents, result2) {
38571         for (var i3 = 0; i3 < parents.length; i3++) {
38572           var parent = parents[i3];
38573           if (parent.id in result2)
38574             continue;
38575           result2[parent.id] = parent;
38576           addParents(head.parentRelations(parent), result2);
38577         }
38578       }
38579     };
38580     return _diff;
38581   }
38582
38583   // modules/core/tree.js
38584   var import_rbush6 = __toESM(require_rbush_min());
38585   function coreTree(head) {
38586     var _rtree = new import_rbush6.default();
38587     var _bboxes = {};
38588     var _segmentsRTree = new import_rbush6.default();
38589     var _segmentsBBoxes = {};
38590     var _segmentsByWayId = {};
38591     var tree = {};
38592     function entityBBox(entity) {
38593       var bbox = entity.extent(head).bbox();
38594       bbox.id = entity.id;
38595       _bboxes[entity.id] = bbox;
38596       return bbox;
38597     }
38598     function segmentBBox(segment) {
38599       var extent = segment.extent(head);
38600       if (!extent)
38601         return null;
38602       var bbox = extent.bbox();
38603       bbox.segment = segment;
38604       _segmentsBBoxes[segment.id] = bbox;
38605       return bbox;
38606     }
38607     function removeEntity(entity) {
38608       _rtree.remove(_bboxes[entity.id]);
38609       delete _bboxes[entity.id];
38610       if (_segmentsByWayId[entity.id]) {
38611         _segmentsByWayId[entity.id].forEach(function(segment) {
38612           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
38613           delete _segmentsBBoxes[segment.id];
38614         });
38615         delete _segmentsByWayId[entity.id];
38616       }
38617     }
38618     function loadEntities(entities) {
38619       _rtree.load(entities.map(entityBBox));
38620       var segments = [];
38621       entities.forEach(function(entity) {
38622         if (entity.segments) {
38623           var entitySegments = entity.segments(head);
38624           _segmentsByWayId[entity.id] = entitySegments;
38625           segments = segments.concat(entitySegments);
38626         }
38627       });
38628       if (segments.length)
38629         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
38630     }
38631     function updateParents(entity, insertions, memo) {
38632       head.parentWays(entity).forEach(function(way) {
38633         if (_bboxes[way.id]) {
38634           removeEntity(way);
38635           insertions[way.id] = way;
38636         }
38637         updateParents(way, insertions, memo);
38638       });
38639       head.parentRelations(entity).forEach(function(relation) {
38640         if (memo[entity.id])
38641           return;
38642         memo[entity.id] = true;
38643         if (_bboxes[relation.id]) {
38644           removeEntity(relation);
38645           insertions[relation.id] = relation;
38646         }
38647         updateParents(relation, insertions, memo);
38648       });
38649     }
38650     tree.rebase = function(entities, force) {
38651       var insertions = {};
38652       for (var i2 = 0; i2 < entities.length; i2++) {
38653         var entity = entities[i2];
38654         if (!entity.visible)
38655           continue;
38656         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
38657           if (!force) {
38658             continue;
38659           } else if (_bboxes[entity.id]) {
38660             removeEntity(entity);
38661           }
38662         }
38663         insertions[entity.id] = entity;
38664         updateParents(entity, insertions, {});
38665       }
38666       loadEntities(Object.values(insertions));
38667       return tree;
38668     };
38669     function updateToGraph(graph) {
38670       if (graph === head)
38671         return;
38672       var diff = coreDifference(head, graph);
38673       head = graph;
38674       var changed = diff.didChange;
38675       if (!changed.addition && !changed.deletion && !changed.geometry)
38676         return;
38677       var insertions = {};
38678       if (changed.deletion) {
38679         diff.deleted().forEach(function(entity) {
38680           removeEntity(entity);
38681         });
38682       }
38683       if (changed.geometry) {
38684         diff.modified().forEach(function(entity) {
38685           removeEntity(entity);
38686           insertions[entity.id] = entity;
38687           updateParents(entity, insertions, {});
38688         });
38689       }
38690       if (changed.addition) {
38691         diff.created().forEach(function(entity) {
38692           insertions[entity.id] = entity;
38693         });
38694       }
38695       loadEntities(Object.values(insertions));
38696     }
38697     tree.intersects = function(extent, graph) {
38698       updateToGraph(graph);
38699       return _rtree.search(extent.bbox()).map(function(bbox) {
38700         return graph.entity(bbox.id);
38701       });
38702     };
38703     tree.waySegments = function(extent, graph) {
38704       updateToGraph(graph);
38705       return _segmentsRTree.search(extent.bbox()).map(function(bbox) {
38706         return bbox.segment;
38707       });
38708     };
38709     return tree;
38710   }
38711
38712   // modules/svg/icon.js
38713   function svgIcon(name2, svgklass, useklass) {
38714     return function drawIcon(selection2) {
38715       selection2.selectAll("svg.icon" + (svgklass ? "." + svgklass.split(" ")[0] : "")).data([0]).enter().append("svg").attr("class", "icon " + (svgklass || "")).append("use").attr("xlink:href", name2).attr("class", useklass);
38716     };
38717   }
38718
38719   // modules/ui/modal.js
38720   function uiModal(selection2, blocking) {
38721     let keybinding = utilKeybinding("modal");
38722     let previous = selection2.select("div.modal");
38723     let animate = previous.empty();
38724     previous.transition().duration(200).style("opacity", 0).remove();
38725     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
38726     shaded.close = () => {
38727       shaded.transition().duration(200).style("opacity", 0).remove();
38728       modal.transition().duration(200).style("top", "0px");
38729       select_default2(document).call(keybinding.unbind);
38730     };
38731     let modal = shaded.append("div").attr("class", "modal fillL");
38732     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
38733     if (!blocking) {
38734       shaded.on("click.remove-modal", (d3_event) => {
38735         if (d3_event.target === this) {
38736           shaded.close();
38737         }
38738       });
38739       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
38740       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
38741       select_default2(document).call(keybinding);
38742     }
38743     modal.append("div").attr("class", "content");
38744     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
38745     if (animate) {
38746       shaded.transition().style("opacity", 1);
38747     } else {
38748       shaded.style("opacity", 1);
38749     }
38750     return shaded;
38751     function moveFocusToFirst() {
38752       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
38753       if (node) {
38754         node.focus();
38755       } else {
38756         select_default2(this).node().blur();
38757       }
38758     }
38759     function moveFocusToLast() {
38760       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
38761       if (nodes.length) {
38762         nodes[nodes.length - 1].focus();
38763       } else {
38764         select_default2(this).node().blur();
38765       }
38766     }
38767   }
38768
38769   // modules/ui/loading.js
38770   function uiLoading(context) {
38771     let _modalSelection = select_default2(null);
38772     let _message = "";
38773     let _blocking = false;
38774     let loading = (selection2) => {
38775       _modalSelection = uiModal(selection2, _blocking);
38776       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
38777       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
38778       loadertext.append("h3").html(_message);
38779       _modalSelection.select("button.close").attr("class", "hide");
38780       return loading;
38781     };
38782     loading.message = function(val) {
38783       if (!arguments.length)
38784         return _message;
38785       _message = val;
38786       return loading;
38787     };
38788     loading.blocking = function(val) {
38789       if (!arguments.length)
38790         return _blocking;
38791       _blocking = val;
38792       return loading;
38793     };
38794     loading.close = () => {
38795       _modalSelection.remove();
38796     };
38797     loading.isShown = () => {
38798       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
38799     };
38800     return loading;
38801   }
38802
38803   // modules/core/history.js
38804   function coreHistory(context) {
38805     var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
38806     var lock = utilSessionMutex("lock");
38807     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
38808     var duration = 150;
38809     var _imageryUsed = [];
38810     var _photoOverlaysUsed = [];
38811     var _checkpoints = {};
38812     var _pausedGraph;
38813     var _stack;
38814     var _index;
38815     var _tree;
38816     function _act(actions, t) {
38817       actions = Array.prototype.slice.call(actions);
38818       var annotation;
38819       if (typeof actions[actions.length - 1] !== "function") {
38820         annotation = actions.pop();
38821       }
38822       var graph = _stack[_index].graph;
38823       for (var i2 = 0; i2 < actions.length; i2++) {
38824         graph = actions[i2](graph, t);
38825       }
38826       return {
38827         graph,
38828         annotation,
38829         imageryUsed: _imageryUsed,
38830         photoOverlaysUsed: _photoOverlaysUsed,
38831         transform: context.projection.transform(),
38832         selectedIDs: context.selectedIDs()
38833       };
38834     }
38835     function _perform(args, t) {
38836       var previous = _stack[_index].graph;
38837       _stack = _stack.slice(0, _index + 1);
38838       var actionResult = _act(args, t);
38839       _stack.push(actionResult);
38840       _index++;
38841       return change(previous);
38842     }
38843     function _replace(args, t) {
38844       var previous = _stack[_index].graph;
38845       var actionResult = _act(args, t);
38846       _stack[_index] = actionResult;
38847       return change(previous);
38848     }
38849     function _overwrite(args, t) {
38850       var previous = _stack[_index].graph;
38851       if (_index > 0) {
38852         _index--;
38853         _stack.pop();
38854       }
38855       _stack = _stack.slice(0, _index + 1);
38856       var actionResult = _act(args, t);
38857       _stack.push(actionResult);
38858       _index++;
38859       return change(previous);
38860     }
38861     function change(previous) {
38862       var difference = coreDifference(previous, history.graph());
38863       if (!_pausedGraph) {
38864         dispatch10.call("change", this, difference);
38865       }
38866       return difference;
38867     }
38868     function getKey(n2) {
38869       return "iD_" + window.location.origin + "_" + n2;
38870     }
38871     var history = {
38872       graph: function() {
38873         return _stack[_index].graph;
38874       },
38875       tree: function() {
38876         return _tree;
38877       },
38878       base: function() {
38879         return _stack[0].graph;
38880       },
38881       merge: function(entities) {
38882         var stack = _stack.map(function(state) {
38883           return state.graph;
38884         });
38885         _stack[0].graph.rebase(entities, stack, false);
38886         _tree.rebase(entities, false);
38887         dispatch10.call("merge", this, entities);
38888       },
38889       perform: function() {
38890         select_default2(document).interrupt("history.perform");
38891         var transitionable = false;
38892         var action0 = arguments[0];
38893         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
38894           transitionable = !!action0.transitionable;
38895         }
38896         if (transitionable) {
38897           var origArguments = arguments;
38898           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
38899             return function(t) {
38900               if (t < 1)
38901                 _overwrite([action0], t);
38902             };
38903           }).on("start", function() {
38904             _perform([action0], 0);
38905           }).on("end interrupt", function() {
38906             _overwrite(origArguments, 1);
38907           });
38908         } else {
38909           return _perform(arguments);
38910         }
38911       },
38912       replace: function() {
38913         select_default2(document).interrupt("history.perform");
38914         return _replace(arguments, 1);
38915       },
38916       overwrite: function() {
38917         select_default2(document).interrupt("history.perform");
38918         return _overwrite(arguments, 1);
38919       },
38920       pop: function(n2) {
38921         select_default2(document).interrupt("history.perform");
38922         var previous = _stack[_index].graph;
38923         if (isNaN(+n2) || +n2 < 0) {
38924           n2 = 1;
38925         }
38926         while (n2-- > 0 && _index > 0) {
38927           _index--;
38928           _stack.pop();
38929         }
38930         return change(previous);
38931       },
38932       undo: function() {
38933         select_default2(document).interrupt("history.perform");
38934         var previousStack = _stack[_index];
38935         var previous = previousStack.graph;
38936         while (_index > 0) {
38937           _index--;
38938           if (_stack[_index].annotation)
38939             break;
38940         }
38941         dispatch10.call("undone", this, _stack[_index], previousStack);
38942         return change(previous);
38943       },
38944       redo: function() {
38945         select_default2(document).interrupt("history.perform");
38946         var previousStack = _stack[_index];
38947         var previous = previousStack.graph;
38948         var tryIndex = _index;
38949         while (tryIndex < _stack.length - 1) {
38950           tryIndex++;
38951           if (_stack[tryIndex].annotation) {
38952             _index = tryIndex;
38953             dispatch10.call("redone", this, _stack[_index], previousStack);
38954             break;
38955           }
38956         }
38957         return change(previous);
38958       },
38959       pauseChangeDispatch: function() {
38960         if (!_pausedGraph) {
38961           _pausedGraph = _stack[_index].graph;
38962         }
38963       },
38964       resumeChangeDispatch: function() {
38965         if (_pausedGraph) {
38966           var previous = _pausedGraph;
38967           _pausedGraph = null;
38968           return change(previous);
38969         }
38970       },
38971       undoAnnotation: function() {
38972         var i2 = _index;
38973         while (i2 >= 0) {
38974           if (_stack[i2].annotation)
38975             return _stack[i2].annotation;
38976           i2--;
38977         }
38978       },
38979       redoAnnotation: function() {
38980         var i2 = _index + 1;
38981         while (i2 <= _stack.length - 1) {
38982           if (_stack[i2].annotation)
38983             return _stack[i2].annotation;
38984           i2++;
38985         }
38986       },
38987       intersects: function(extent) {
38988         return _tree.intersects(extent, _stack[_index].graph);
38989       },
38990       difference: function() {
38991         var base = _stack[0].graph;
38992         var head = _stack[_index].graph;
38993         return coreDifference(base, head);
38994       },
38995       changes: function(action) {
38996         var base = _stack[0].graph;
38997         var head = _stack[_index].graph;
38998         if (action) {
38999           head = action(head);
39000         }
39001         var difference = coreDifference(base, head);
39002         return {
39003           modified: difference.modified(),
39004           created: difference.created(),
39005           deleted: difference.deleted()
39006         };
39007       },
39008       hasChanges: function() {
39009         return this.difference().length() > 0;
39010       },
39011       imageryUsed: function(sources) {
39012         if (sources) {
39013           _imageryUsed = sources;
39014           return history;
39015         } else {
39016           var s = /* @__PURE__ */ new Set();
39017           _stack.slice(1, _index + 1).forEach(function(state) {
39018             state.imageryUsed.forEach(function(source) {
39019               if (source !== "Custom") {
39020                 s.add(source);
39021               }
39022             });
39023           });
39024           return Array.from(s);
39025         }
39026       },
39027       photoOverlaysUsed: function(sources) {
39028         if (sources) {
39029           _photoOverlaysUsed = sources;
39030           return history;
39031         } else {
39032           var s = /* @__PURE__ */ new Set();
39033           _stack.slice(1, _index + 1).forEach(function(state) {
39034             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
39035               state.photoOverlaysUsed.forEach(function(photoOverlay) {
39036                 s.add(photoOverlay);
39037               });
39038             }
39039           });
39040           return Array.from(s);
39041         }
39042       },
39043       checkpoint: function(key) {
39044         _checkpoints[key] = {
39045           stack: _stack,
39046           index: _index
39047         };
39048         return history;
39049       },
39050       reset: function(key) {
39051         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
39052           _stack = _checkpoints[key].stack;
39053           _index = _checkpoints[key].index;
39054         } else {
39055           _stack = [{ graph: coreGraph() }];
39056           _index = 0;
39057           _tree = coreTree(_stack[0].graph);
39058           _checkpoints = {};
39059         }
39060         dispatch10.call("reset");
39061         dispatch10.call("change");
39062         return history;
39063       },
39064       toIntroGraph: function() {
39065         var nextID = { n: 0, r: 0, w: 0 };
39066         var permIDs = {};
39067         var graph = this.graph();
39068         var baseEntities = {};
39069         Object.values(graph.base().entities).forEach(function(entity) {
39070           var copy2 = copyIntroEntity(entity);
39071           baseEntities[copy2.id] = copy2;
39072         });
39073         Object.keys(graph.entities).forEach(function(id2) {
39074           var entity = graph.entities[id2];
39075           if (entity) {
39076             var copy2 = copyIntroEntity(entity);
39077             baseEntities[copy2.id] = copy2;
39078           } else {
39079             delete baseEntities[id2];
39080           }
39081         });
39082         Object.values(baseEntities).forEach(function(entity) {
39083           if (Array.isArray(entity.nodes)) {
39084             entity.nodes = entity.nodes.map(function(node) {
39085               return permIDs[node] || node;
39086             });
39087           }
39088           if (Array.isArray(entity.members)) {
39089             entity.members = entity.members.map(function(member) {
39090               member.id = permIDs[member.id] || member.id;
39091               return member;
39092             });
39093           }
39094         });
39095         return JSON.stringify({ dataIntroGraph: baseEntities });
39096         function copyIntroEntity(source) {
39097           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
39098           if (copy2.tags && !Object.keys(copy2.tags)) {
39099             delete copy2.tags;
39100           }
39101           if (Array.isArray(copy2.loc)) {
39102             copy2.loc[0] = +copy2.loc[0].toFixed(6);
39103             copy2.loc[1] = +copy2.loc[1].toFixed(6);
39104           }
39105           var match = source.id.match(/([nrw])-\d*/);
39106           if (match !== null) {
39107             var nrw = match[1];
39108             var permID;
39109             do {
39110               permID = nrw + ++nextID[nrw];
39111             } while (baseEntities.hasOwnProperty(permID));
39112             copy2.id = permIDs[source.id] = permID;
39113           }
39114           return copy2;
39115         }
39116       },
39117       toJSON: function() {
39118         if (!this.hasChanges())
39119           return;
39120         var allEntities = {};
39121         var baseEntities = {};
39122         var base = _stack[0];
39123         var s = _stack.map(function(i2) {
39124           var modified = [];
39125           var deleted = [];
39126           Object.keys(i2.graph.entities).forEach(function(id2) {
39127             var entity = i2.graph.entities[id2];
39128             if (entity) {
39129               var key = osmEntity.key(entity);
39130               allEntities[key] = entity;
39131               modified.push(key);
39132             } else {
39133               deleted.push(id2);
39134             }
39135             if (id2 in base.graph.entities) {
39136               baseEntities[id2] = base.graph.entities[id2];
39137             }
39138             if (entity && entity.nodes) {
39139               entity.nodes.forEach(function(nodeID) {
39140                 if (nodeID in base.graph.entities) {
39141                   baseEntities[nodeID] = base.graph.entities[nodeID];
39142                 }
39143               });
39144             }
39145             var baseParents = base.graph._parentWays[id2];
39146             if (baseParents) {
39147               baseParents.forEach(function(parentID) {
39148                 if (parentID in base.graph.entities) {
39149                   baseEntities[parentID] = base.graph.entities[parentID];
39150                 }
39151               });
39152             }
39153           });
39154           var x = {};
39155           if (modified.length)
39156             x.modified = modified;
39157           if (deleted.length)
39158             x.deleted = deleted;
39159           if (i2.imageryUsed)
39160             x.imageryUsed = i2.imageryUsed;
39161           if (i2.photoOverlaysUsed)
39162             x.photoOverlaysUsed = i2.photoOverlaysUsed;
39163           if (i2.annotation)
39164             x.annotation = i2.annotation;
39165           if (i2.transform)
39166             x.transform = i2.transform;
39167           if (i2.selectedIDs)
39168             x.selectedIDs = i2.selectedIDs;
39169           return x;
39170         });
39171         return JSON.stringify({
39172           version: 3,
39173           entities: Object.values(allEntities),
39174           baseEntities: Object.values(baseEntities),
39175           stack: s,
39176           nextIDs: osmEntity.id.next,
39177           index: _index,
39178           timestamp: new Date().getTime()
39179         });
39180       },
39181       fromJSON: function(json, loadChildNodes) {
39182         var h = JSON.parse(json);
39183         var loadComplete = true;
39184         osmEntity.id.next = h.nextIDs;
39185         _index = h.index;
39186         if (h.version === 2 || h.version === 3) {
39187           var allEntities = {};
39188           h.entities.forEach(function(entity) {
39189             allEntities[osmEntity.key(entity)] = osmEntity(entity);
39190           });
39191           if (h.version === 3) {
39192             var baseEntities = h.baseEntities.map(function(d) {
39193               return osmEntity(d);
39194             });
39195             var stack = _stack.map(function(state) {
39196               return state.graph;
39197             });
39198             _stack[0].graph.rebase(baseEntities, stack, true);
39199             _tree.rebase(baseEntities, true);
39200             if (loadChildNodes) {
39201               var osm = context.connection();
39202               var baseWays = baseEntities.filter(function(e) {
39203                 return e.type === "way";
39204               });
39205               var nodeIDs = baseWays.reduce(function(acc, way) {
39206                 return utilArrayUnion(acc, way.nodes);
39207               }, []);
39208               var missing = nodeIDs.filter(function(n2) {
39209                 return !_stack[0].graph.hasEntity(n2);
39210               });
39211               if (missing.length && osm) {
39212                 loadComplete = false;
39213                 context.map().redrawEnable(false);
39214                 var loading = uiLoading(context).blocking(true);
39215                 context.container().call(loading);
39216                 var childNodesLoaded = function(err, result) {
39217                   if (!err) {
39218                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
39219                     var visibles = visibleGroups.true || [];
39220                     var invisibles = visibleGroups.false || [];
39221                     if (visibles.length) {
39222                       var visibleIDs = visibles.map(function(entity) {
39223                         return entity.id;
39224                       });
39225                       var stack2 = _stack.map(function(state) {
39226                         return state.graph;
39227                       });
39228                       missing = utilArrayDifference(missing, visibleIDs);
39229                       _stack[0].graph.rebase(visibles, stack2, true);
39230                       _tree.rebase(visibles, true);
39231                     }
39232                     invisibles.forEach(function(entity) {
39233                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
39234                     });
39235                   }
39236                   if (err || !missing.length) {
39237                     loading.close();
39238                     context.map().redrawEnable(true);
39239                     dispatch10.call("change");
39240                     dispatch10.call("restore", this);
39241                   }
39242                 };
39243                 osm.loadMultiple(missing, childNodesLoaded);
39244               }
39245             }
39246           }
39247           _stack = h.stack.map(function(d) {
39248             var entities = {}, entity;
39249             if (d.modified) {
39250               d.modified.forEach(function(key) {
39251                 entity = allEntities[key];
39252                 entities[entity.id] = entity;
39253               });
39254             }
39255             if (d.deleted) {
39256               d.deleted.forEach(function(id2) {
39257                 entities[id2] = void 0;
39258               });
39259             }
39260             return {
39261               graph: coreGraph(_stack[0].graph).load(entities),
39262               annotation: d.annotation,
39263               imageryUsed: d.imageryUsed,
39264               photoOverlaysUsed: d.photoOverlaysUsed,
39265               transform: d.transform,
39266               selectedIDs: d.selectedIDs
39267             };
39268           });
39269         } else {
39270           _stack = h.stack.map(function(d) {
39271             var entities = {};
39272             for (var i2 in d.entities) {
39273               var entity = d.entities[i2];
39274               entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
39275             }
39276             d.graph = coreGraph(_stack[0].graph).load(entities);
39277             return d;
39278           });
39279         }
39280         var transform2 = _stack[_index].transform;
39281         if (transform2) {
39282           context.map().transformEase(transform2, 0);
39283         }
39284         if (loadComplete) {
39285           dispatch10.call("change");
39286           dispatch10.call("restore", this);
39287         }
39288         return history;
39289       },
39290       lock: function() {
39291         return lock.lock();
39292       },
39293       unlock: function() {
39294         lock.unlock();
39295       },
39296       save: function() {
39297         if (lock.locked() && !_hasUnresolvedRestorableChanges) {
39298           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
39299           if (!success)
39300             dispatch10.call("storage_error");
39301         }
39302         return history;
39303       },
39304       clearSaved: function() {
39305         context.debouncedSave.cancel();
39306         if (lock.locked()) {
39307           _hasUnresolvedRestorableChanges = false;
39308           corePreferences(getKey("saved_history"), null);
39309           corePreferences("comment", null);
39310           corePreferences("hashtags", null);
39311           corePreferences("source", null);
39312         }
39313         return history;
39314       },
39315       savedHistoryJSON: function() {
39316         return corePreferences(getKey("saved_history"));
39317       },
39318       hasRestorableChanges: function() {
39319         return _hasUnresolvedRestorableChanges;
39320       },
39321       restore: function() {
39322         if (lock.locked()) {
39323           _hasUnresolvedRestorableChanges = false;
39324           var json = this.savedHistoryJSON();
39325           if (json)
39326             history.fromJSON(json, true);
39327         }
39328       },
39329       _getKey: getKey
39330     };
39331     history.reset();
39332     return utilRebind(history, dispatch10, "on");
39333   }
39334
39335   // modules/validations/index.js
39336   var validations_exports = {};
39337   __export(validations_exports, {
39338     validationAlmostJunction: () => validationAlmostJunction,
39339     validationCloseNodes: () => validationCloseNodes,
39340     validationCrossingWays: () => validationCrossingWays,
39341     validationDisconnectedWay: () => validationDisconnectedWay,
39342     validationFormatting: () => validationFormatting,
39343     validationHelpRequest: () => validationHelpRequest,
39344     validationImpossibleOneway: () => validationImpossibleOneway,
39345     validationIncompatibleSource: () => validationIncompatibleSource,
39346     validationMaprules: () => validationMaprules,
39347     validationMismatchedGeometry: () => validationMismatchedGeometry,
39348     validationMissingRole: () => validationMissingRole,
39349     validationMissingTag: () => validationMissingTag,
39350     validationOutdatedTags: () => validationOutdatedTags,
39351     validationPrivateData: () => validationPrivateData,
39352     validationSuspiciousName: () => validationSuspiciousName,
39353     validationUnsquareWay: () => validationUnsquareWay
39354   });
39355
39356   // modules/validations/almost_junction.js
39357   function validationAlmostJunction(context) {
39358     const type3 = "almost_junction";
39359     const EXTEND_TH_METERS = 5;
39360     const WELD_TH_METERS = 0.75;
39361     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
39362     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
39363     function isHighway(entity) {
39364       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
39365     }
39366     function isTaggedAsNotContinuing(node) {
39367       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
39368     }
39369     const validation = function checkAlmostJunction(entity, graph) {
39370       if (!isHighway(entity))
39371         return [];
39372       if (entity.isDegenerate())
39373         return [];
39374       const tree = context.history().tree();
39375       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
39376       let issues = [];
39377       extendableNodeInfos.forEach((extendableNodeInfo) => {
39378         issues.push(new validationIssue({
39379           type: type3,
39380           subtype: "highway-highway",
39381           severity: "warning",
39382           message: function(context2) {
39383             const entity1 = context2.hasEntity(this.entityIds[0]);
39384             if (this.entityIds[0] === this.entityIds[2]) {
39385               return entity1 ? _t.html("issues.almost_junction.self.message", {
39386                 feature: utilDisplayLabel(entity1, context2.graph())
39387               }) : "";
39388             } else {
39389               const entity2 = context2.hasEntity(this.entityIds[2]);
39390               return entity1 && entity2 ? _t.html("issues.almost_junction.message", {
39391                 feature: utilDisplayLabel(entity1, context2.graph()),
39392                 feature2: utilDisplayLabel(entity2, context2.graph())
39393               }) : "";
39394             }
39395           },
39396           reference: showReference,
39397           entityIds: [
39398             entity.id,
39399             extendableNodeInfo.node.id,
39400             extendableNodeInfo.wid
39401           ],
39402           loc: extendableNodeInfo.node.loc,
39403           hash: JSON.stringify(extendableNodeInfo.node.loc),
39404           data: {
39405             midId: extendableNodeInfo.mid.id,
39406             edge: extendableNodeInfo.edge,
39407             cross_loc: extendableNodeInfo.cross_loc
39408           },
39409           dynamicFixes: makeFixes
39410         }));
39411       });
39412       return issues;
39413       function makeFixes(context2) {
39414         let fixes = [new validationIssueFix({
39415           icon: "iD-icon-abutment",
39416           title: _t.html("issues.fix.connect_features.title"),
39417           onClick: function(context3) {
39418             const annotation = _t("issues.fix.connect_almost_junction.annotation");
39419             const [, endNodeId, crossWayId] = this.issue.entityIds;
39420             const midNode = context3.entity(this.issue.data.midId);
39421             const endNode = context3.entity(endNodeId);
39422             const crossWay = context3.entity(crossWayId);
39423             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
39424             if (nearEndNodes.length > 0) {
39425               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
39426               if (collinear) {
39427                 context3.perform(actionMergeNodes([collinear.id, endNode.id], collinear.loc), annotation);
39428                 return;
39429               }
39430             }
39431             const targetEdge = this.issue.data.edge;
39432             const crossLoc = this.issue.data.cross_loc;
39433             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
39434             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
39435             if (closestNodeInfo.distance < WELD_TH_METERS) {
39436               context3.perform(actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc), annotation);
39437             } else {
39438               context3.perform(actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode), annotation);
39439             }
39440           }
39441         })];
39442         const node = context2.hasEntity(this.entityIds[1]);
39443         if (node && !node.hasInterestingTags()) {
39444           fixes.push(new validationIssueFix({
39445             icon: "maki-barrier",
39446             title: _t.html("issues.fix.tag_as_disconnected.title"),
39447             onClick: function(context3) {
39448               const nodeID = this.issue.entityIds[1];
39449               const tags = Object.assign({}, context3.entity(nodeID).tags);
39450               tags.noexit = "yes";
39451               context3.perform(actionChangeTags(nodeID, tags), _t("issues.fix.tag_as_disconnected.annotation"));
39452             }
39453           }));
39454         }
39455         return fixes;
39456       }
39457       function showReference(selection2) {
39458         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
39459       }
39460       function isExtendableCandidate(node, way) {
39461         const osm = services.osm;
39462         if (osm && !osm.isDataLoaded(node.loc)) {
39463           return false;
39464         }
39465         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
39466           return false;
39467         }
39468         let occurrences = 0;
39469         for (const index in way.nodes) {
39470           if (way.nodes[index] === node.id) {
39471             occurrences += 1;
39472             if (occurrences > 1) {
39473               return false;
39474             }
39475           }
39476         }
39477         return true;
39478       }
39479       function findConnectableEndNodesByExtension(way) {
39480         let results = [];
39481         if (way.isClosed())
39482           return results;
39483         let testNodes;
39484         const indices = [0, way.nodes.length - 1];
39485         indices.forEach((nodeIndex) => {
39486           const nodeID = way.nodes[nodeIndex];
39487           const node = graph.entity(nodeID);
39488           if (!isExtendableCandidate(node, way))
39489             return;
39490           const connectionInfo = canConnectByExtend(way, nodeIndex);
39491           if (!connectionInfo)
39492             return;
39493           testNodes = graph.childNodes(way).slice();
39494           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
39495           if (geoHasSelfIntersections(testNodes, nodeID))
39496             return;
39497           results.push(connectionInfo);
39498         });
39499         return results;
39500       }
39501       function findNearbyEndNodes(node, way) {
39502         return [
39503           way.nodes[0],
39504           way.nodes[way.nodes.length - 1]
39505         ].map((d) => graph.entity(d)).filter((d) => {
39506           return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
39507         });
39508       }
39509       function findSmallJoinAngle(midNode, tipNode, endNodes) {
39510         let joinTo;
39511         let minAngle = Infinity;
39512         endNodes.forEach((endNode) => {
39513           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
39514           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
39515           const diff = Math.max(a1, a2) - Math.min(a1, a2);
39516           if (diff < minAngle) {
39517             joinTo = endNode;
39518             minAngle = diff;
39519           }
39520         });
39521         if (minAngle <= SIG_ANGLE_TH)
39522           return joinTo;
39523         return null;
39524       }
39525       function hasTag(tags, key) {
39526         return tags[key] !== void 0 && tags[key] !== "no";
39527       }
39528       function canConnectWays(way, way2) {
39529         if (way.id === way2.id)
39530           return true;
39531         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
39532           return false;
39533         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
39534           return false;
39535         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
39536         if (layer1 !== layer2)
39537           return false;
39538         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
39539         if (level1 !== level2)
39540           return false;
39541         return true;
39542       }
39543       function canConnectByExtend(way, endNodeIdx) {
39544         const tipNid = way.nodes[endNodeIdx];
39545         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
39546         const tipNode = graph.entity(tipNid);
39547         const midNode = graph.entity(midNid);
39548         const lon = tipNode.loc[0];
39549         const lat = tipNode.loc[1];
39550         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
39551         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
39552         const queryExtent = geoExtent([
39553           [lon - lon_range, lat - lat_range],
39554           [lon + lon_range, lat + lat_range]
39555         ]);
39556         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
39557         const t = EXTEND_TH_METERS / edgeLen + 1;
39558         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
39559         const segmentInfos = tree.waySegments(queryExtent, graph);
39560         for (let i2 = 0; i2 < segmentInfos.length; i2++) {
39561           let segmentInfo = segmentInfos[i2];
39562           let way2 = graph.entity(segmentInfo.wayId);
39563           if (!isHighway(way2))
39564             continue;
39565           if (!canConnectWays(way, way2))
39566             continue;
39567           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
39568           if (nAid === tipNid || nBid === tipNid)
39569             continue;
39570           let nA = graph.entity(nAid), nB = graph.entity(nBid);
39571           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
39572           if (crossLoc) {
39573             return {
39574               mid: midNode,
39575               node: tipNode,
39576               wid: way2.id,
39577               edge: [nA.id, nB.id],
39578               cross_loc: crossLoc
39579             };
39580           }
39581         }
39582         return null;
39583       }
39584     };
39585     validation.type = type3;
39586     return validation;
39587   }
39588
39589   // modules/validations/close_nodes.js
39590   function validationCloseNodes(context) {
39591     var type3 = "close_nodes";
39592     var pointThresholdMeters = 0.2;
39593     var validation = function(entity, graph) {
39594       if (entity.type === "node") {
39595         return getIssuesForNode(entity);
39596       } else if (entity.type === "way") {
39597         return getIssuesForWay(entity);
39598       }
39599       return [];
39600       function getIssuesForNode(node) {
39601         var parentWays = graph.parentWays(node);
39602         if (parentWays.length) {
39603           return getIssuesForVertex(node, parentWays);
39604         } else {
39605           return getIssuesForDetachedPoint(node);
39606         }
39607       }
39608       function wayTypeFor(way) {
39609         if (way.tags.boundary && way.tags.boundary !== "no")
39610           return "boundary";
39611         if (way.tags.indoor && way.tags.indoor !== "no")
39612           return "indoor";
39613         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
39614           return "building";
39615         if (osmPathHighwayTagValues[way.tags.highway])
39616           return "path";
39617         var parentRelations = graph.parentRelations(way);
39618         for (var i2 in parentRelations) {
39619           var relation = parentRelations[i2];
39620           if (relation.tags.type === "boundary")
39621             return "boundary";
39622           if (relation.isMultipolygon()) {
39623             if (relation.tags.indoor && relation.tags.indoor !== "no")
39624               return "indoor";
39625             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
39626               return "building";
39627           }
39628         }
39629         return "other";
39630       }
39631       function shouldCheckWay(way) {
39632         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
39633           return false;
39634         var bbox = way.extent(graph).bbox();
39635         var hypotenuseMeters = geoSphericalDistance([bbox.minX, bbox.minY], [bbox.maxX, bbox.maxY]);
39636         if (hypotenuseMeters < 1.5)
39637           return false;
39638         return true;
39639       }
39640       function getIssuesForWay(way) {
39641         if (!shouldCheckWay(way))
39642           return [];
39643         var issues = [], nodes = graph.childNodes(way);
39644         for (var i2 = 0; i2 < nodes.length - 1; i2++) {
39645           var node1 = nodes[i2];
39646           var node2 = nodes[i2 + 1];
39647           var issue = getWayIssueIfAny(node1, node2, way);
39648           if (issue)
39649             issues.push(issue);
39650         }
39651         return issues;
39652       }
39653       function getIssuesForVertex(node, parentWays) {
39654         var issues = [];
39655         function checkForCloseness(node1, node2, way) {
39656           var issue = getWayIssueIfAny(node1, node2, way);
39657           if (issue)
39658             issues.push(issue);
39659         }
39660         for (var i2 = 0; i2 < parentWays.length; i2++) {
39661           var parentWay = parentWays[i2];
39662           if (!shouldCheckWay(parentWay))
39663             continue;
39664           var lastIndex = parentWay.nodes.length - 1;
39665           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
39666             if (j2 !== 0) {
39667               if (parentWay.nodes[j2 - 1] === node.id) {
39668                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
39669               }
39670             }
39671             if (j2 !== lastIndex) {
39672               if (parentWay.nodes[j2 + 1] === node.id) {
39673                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
39674               }
39675             }
39676           }
39677         }
39678         return issues;
39679       }
39680       function thresholdMetersForWay(way) {
39681         if (!shouldCheckWay(way))
39682           return 0;
39683         var wayType = wayTypeFor(way);
39684         if (wayType === "boundary")
39685           return 0;
39686         if (wayType === "indoor")
39687           return 0.01;
39688         if (wayType === "building")
39689           return 0.05;
39690         if (wayType === "path")
39691           return 0.1;
39692         return 0.2;
39693       }
39694       function getIssuesForDetachedPoint(node) {
39695         var issues = [];
39696         var lon = node.loc[0];
39697         var lat = node.loc[1];
39698         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
39699         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
39700         var queryExtent = geoExtent([
39701           [lon - lon_range, lat - lat_range],
39702           [lon + lon_range, lat + lat_range]
39703         ]);
39704         var intersected = context.history().tree().intersects(queryExtent, graph);
39705         for (var j2 = 0; j2 < intersected.length; j2++) {
39706           var nearby = intersected[j2];
39707           if (nearby.id === node.id)
39708             continue;
39709           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
39710             continue;
39711           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
39712             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
39713             var zAxisDifferentiates = false;
39714             for (var key in zAxisKeys) {
39715               var nodeValue = node.tags[key] || "0";
39716               var nearbyValue = nearby.tags[key] || "0";
39717               if (nodeValue !== nearbyValue) {
39718                 zAxisDifferentiates = true;
39719                 break;
39720               }
39721             }
39722             if (zAxisDifferentiates)
39723               continue;
39724             issues.push(new validationIssue({
39725               type: type3,
39726               subtype: "detached",
39727               severity: "warning",
39728               message: function(context2) {
39729                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
39730                 return entity2 && entity22 ? _t.html("issues.close_nodes.detached.message", {
39731                   feature: utilDisplayLabel(entity2, context2.graph()),
39732                   feature2: utilDisplayLabel(entity22, context2.graph())
39733                 }) : "";
39734               },
39735               reference: showReference,
39736               entityIds: [node.id, nearby.id],
39737               dynamicFixes: function() {
39738                 return [
39739                   new validationIssueFix({
39740                     icon: "iD-operation-disconnect",
39741                     title: _t.html("issues.fix.move_points_apart.title")
39742                   }),
39743                   new validationIssueFix({
39744                     icon: "iD-icon-layers",
39745                     title: _t.html("issues.fix.use_different_layers_or_levels.title")
39746                   })
39747                 ];
39748               }
39749             }));
39750           }
39751         }
39752         return issues;
39753         function showReference(selection2) {
39754           var referenceText = _t("issues.close_nodes.detached.reference");
39755           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
39756         }
39757       }
39758       function getWayIssueIfAny(node1, node2, way) {
39759         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
39760           return null;
39761         }
39762         if (node1.loc !== node2.loc) {
39763           var parentWays1 = graph.parentWays(node1);
39764           var parentWays2 = new Set(graph.parentWays(node2));
39765           var sharedWays = parentWays1.filter(function(parentWay) {
39766             return parentWays2.has(parentWay);
39767           });
39768           var thresholds = sharedWays.map(function(parentWay) {
39769             return thresholdMetersForWay(parentWay);
39770           });
39771           var threshold = Math.min(...thresholds);
39772           var distance = geoSphericalDistance(node1.loc, node2.loc);
39773           if (distance > threshold)
39774             return null;
39775         }
39776         return new validationIssue({
39777           type: type3,
39778           subtype: "vertices",
39779           severity: "warning",
39780           message: function(context2) {
39781             var entity2 = context2.hasEntity(this.entityIds[0]);
39782             return entity2 ? _t.html("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
39783           },
39784           reference: showReference,
39785           entityIds: [way.id, node1.id, node2.id],
39786           loc: node1.loc,
39787           dynamicFixes: function() {
39788             return [
39789               new validationIssueFix({
39790                 icon: "iD-icon-plus",
39791                 title: _t.html("issues.fix.merge_points.title"),
39792                 onClick: function(context2) {
39793                   var entityIds = this.issue.entityIds;
39794                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
39795                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
39796                 }
39797               }),
39798               new validationIssueFix({
39799                 icon: "iD-operation-disconnect",
39800                 title: _t.html("issues.fix.move_points_apart.title")
39801               })
39802             ];
39803           }
39804         });
39805         function showReference(selection2) {
39806           var referenceText = _t("issues.close_nodes.reference");
39807           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
39808         }
39809       }
39810     };
39811     validation.type = type3;
39812     return validation;
39813   }
39814
39815   // modules/validations/crossing_ways.js
39816   function validationCrossingWays(context) {
39817     var type3 = "crossing_ways";
39818     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
39819       if (getFeatureType(way, graph) === null) {
39820         var parentRels = graph.parentRelations(way);
39821         for (var i2 = 0; i2 < parentRels.length; i2++) {
39822           var rel = parentRels[i2];
39823           if (getFeatureType(rel, graph) !== null) {
39824             return rel;
39825           }
39826         }
39827       }
39828       return way;
39829     }
39830     function hasTag(tags, key) {
39831       return tags[key] !== void 0 && tags[key] !== "no";
39832     }
39833     function taggedAsIndoor(tags) {
39834       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
39835     }
39836     function allowsBridge(featureType) {
39837       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
39838     }
39839     function allowsTunnel(featureType) {
39840       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
39841     }
39842     var ignoredBuildings = {
39843       demolished: true,
39844       dismantled: true,
39845       proposed: true,
39846       razed: true
39847     };
39848     function getFeatureType(entity, graph) {
39849       var geometry = entity.geometry(graph);
39850       if (geometry !== "line" && geometry !== "area")
39851         return null;
39852       var tags = entity.tags;
39853       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
39854         return "building";
39855       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
39856         return "highway";
39857       if (geometry !== "line")
39858         return null;
39859       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
39860         return "railway";
39861       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
39862         return "waterway";
39863       return null;
39864     }
39865     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
39866       var level1 = tags1.level || "0";
39867       var level2 = tags2.level || "0";
39868       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
39869         return true;
39870       }
39871       var layer1 = tags1.layer || "0";
39872       var layer2 = tags2.layer || "0";
39873       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
39874         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
39875           return true;
39876         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
39877           return true;
39878         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
39879           return true;
39880       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
39881         return true;
39882       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
39883         return true;
39884       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
39885         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
39886           return true;
39887         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
39888           return true;
39889         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
39890           return true;
39891       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
39892         return true;
39893       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
39894         return true;
39895       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
39896         return true;
39897       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
39898         return true;
39899       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
39900         if (layer1 !== layer2)
39901           return true;
39902       }
39903       return false;
39904     }
39905     var highwaysDisallowingFords = {
39906       motorway: true,
39907       motorway_link: true,
39908       trunk: true,
39909       trunk_link: true,
39910       primary: true,
39911       primary_link: true,
39912       secondary: true,
39913       secondary_link: true
39914     };
39915     var nonCrossingHighways = { track: true };
39916     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) {
39917       var featureType1 = getFeatureType(entity1, graph);
39918       var featureType2 = getFeatureType(entity2, graph);
39919       var geometry1 = entity1.geometry(graph);
39920       var geometry2 = entity2.geometry(graph);
39921       var bothLines = geometry1 === "line" && geometry2 === "line";
39922       if (featureType1 === featureType2) {
39923         if (featureType1 === "highway") {
39924           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
39925           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
39926           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
39927             var roadFeature = entity1IsPath ? entity2 : entity1;
39928             if (nonCrossingHighways[roadFeature.tags.highway]) {
39929               return {};
39930             }
39931             var pathFeature = entity1IsPath ? entity1 : entity2;
39932             if (["marked", "unmarked"].indexOf(pathFeature.tags.crossing) !== -1) {
39933               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
39934             }
39935             return bothLines ? { highway: "crossing" } : {};
39936           }
39937           return {};
39938         }
39939         if (featureType1 === "waterway")
39940           return {};
39941         if (featureType1 === "railway")
39942           return {};
39943       } else {
39944         var featureTypes = [featureType1, featureType2];
39945         if (featureTypes.indexOf("highway") !== -1) {
39946           if (featureTypes.indexOf("railway") !== -1) {
39947             if (!bothLines)
39948               return {};
39949             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
39950             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
39951               if (isTram)
39952                 return { railway: "tram_crossing" };
39953               return { railway: "crossing" };
39954             } else {
39955               if (isTram)
39956                 return { railway: "tram_level_crossing" };
39957               return { railway: "level_crossing" };
39958             }
39959           }
39960           if (featureTypes.indexOf("waterway") !== -1) {
39961             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
39962               return null;
39963             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
39964               return null;
39965             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
39966               return null;
39967             }
39968             return bothLines ? { ford: "yes" } : {};
39969           }
39970         }
39971       }
39972       return null;
39973     }
39974     function findCrossingsByWay(way1, graph, tree) {
39975       var edgeCrossInfos = [];
39976       if (way1.type !== "way")
39977         return edgeCrossInfos;
39978       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
39979       var way1FeatureType = getFeatureType(taggedFeature1, graph);
39980       if (way1FeatureType === null)
39981         return edgeCrossInfos;
39982       var checkedSingleCrossingWays = {};
39983       var i2, j2;
39984       var extent;
39985       var n1, n2, nA, nB, nAId, nBId;
39986       var segment1, segment2;
39987       var oneOnly;
39988       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
39989       var way1Nodes = graph.childNodes(way1);
39990       var comparedWays = {};
39991       for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
39992         n1 = way1Nodes[i2];
39993         n2 = way1Nodes[i2 + 1];
39994         extent = geoExtent([
39995           [
39996             Math.min(n1.loc[0], n2.loc[0]),
39997             Math.min(n1.loc[1], n2.loc[1])
39998           ],
39999           [
40000             Math.max(n1.loc[0], n2.loc[0]),
40001             Math.max(n1.loc[1], n2.loc[1])
40002           ]
40003         ]);
40004         segmentInfos = tree.waySegments(extent, graph);
40005         for (j2 = 0; j2 < segmentInfos.length; j2++) {
40006           segment2Info = segmentInfos[j2];
40007           if (segment2Info.wayId === way1.id)
40008             continue;
40009           if (checkedSingleCrossingWays[segment2Info.wayId])
40010             continue;
40011           comparedWays[segment2Info.wayId] = true;
40012           way2 = graph.hasEntity(segment2Info.wayId);
40013           if (!way2)
40014             continue;
40015           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
40016           way2FeatureType = getFeatureType(taggedFeature2, graph);
40017           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
40018             continue;
40019           }
40020           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
40021           nAId = segment2Info.nodes[0];
40022           nBId = segment2Info.nodes[1];
40023           if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
40024             continue;
40025           }
40026           nA = graph.hasEntity(nAId);
40027           if (!nA)
40028             continue;
40029           nB = graph.hasEntity(nBId);
40030           if (!nB)
40031             continue;
40032           segment1 = [n1.loc, n2.loc];
40033           segment2 = [nA.loc, nB.loc];
40034           var point = geoLineIntersection(segment1, segment2);
40035           if (point) {
40036             edgeCrossInfos.push({
40037               wayInfos: [
40038                 {
40039                   way: way1,
40040                   featureType: way1FeatureType,
40041                   edge: [n1.id, n2.id]
40042                 },
40043                 {
40044                   way: way2,
40045                   featureType: way2FeatureType,
40046                   edge: [nA.id, nB.id]
40047                 }
40048               ],
40049               crossPoint: point
40050             });
40051             if (oneOnly) {
40052               checkedSingleCrossingWays[way2.id] = true;
40053               break;
40054             }
40055           }
40056         }
40057       }
40058       return edgeCrossInfos;
40059     }
40060     function waysToCheck(entity, graph) {
40061       var featureType = getFeatureType(entity, graph);
40062       if (!featureType)
40063         return [];
40064       if (entity.type === "way") {
40065         return [entity];
40066       } else if (entity.type === "relation") {
40067         return entity.members.reduce(function(array2, member) {
40068           if (member.type === "way" && (!member.role || member.role === "outer" || member.role === "inner")) {
40069             var entity2 = graph.hasEntity(member.id);
40070             if (entity2 && array2.indexOf(entity2) === -1) {
40071               array2.push(entity2);
40072             }
40073           }
40074           return array2;
40075         }, []);
40076       }
40077       return [];
40078     }
40079     var validation = function checkCrossingWays(entity, graph) {
40080       var tree = context.history().tree();
40081       var ways = waysToCheck(entity, graph);
40082       var issues = [];
40083       var wayIndex, crossingIndex, crossings;
40084       for (wayIndex in ways) {
40085         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
40086         for (crossingIndex in crossings) {
40087           issues.push(createIssue(crossings[crossingIndex], graph));
40088         }
40089       }
40090       return issues;
40091     };
40092     function createIssue(crossing, graph) {
40093       crossing.wayInfos.sort(function(way1Info, way2Info) {
40094         var type1 = way1Info.featureType;
40095         var type22 = way2Info.featureType;
40096         if (type1 === type22) {
40097           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
40098         } else if (type1 === "waterway") {
40099           return true;
40100         } else if (type22 === "waterway") {
40101           return false;
40102         }
40103         return type1 < type22;
40104       });
40105       var entities = crossing.wayInfos.map(function(wayInfo) {
40106         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
40107       });
40108       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
40109       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
40110       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
40111       var featureType1 = crossing.wayInfos[0].featureType;
40112       var featureType2 = crossing.wayInfos[1].featureType;
40113       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
40114       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
40115       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
40116       var subtype = [featureType1, featureType2].sort().join("-");
40117       var crossingTypeID = subtype;
40118       if (isCrossingIndoors) {
40119         crossingTypeID = "indoor-indoor";
40120       } else if (isCrossingTunnels) {
40121         crossingTypeID = "tunnel-tunnel";
40122       } else if (isCrossingBridges) {
40123         crossingTypeID = "bridge-bridge";
40124       }
40125       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
40126         crossingTypeID += "_connectable";
40127       }
40128       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
40129       return new validationIssue({
40130         type: type3,
40131         subtype,
40132         severity: "warning",
40133         message: function(context2) {
40134           var graph2 = context2.graph();
40135           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
40136           return entity1 && entity2 ? _t.html("issues.crossing_ways.message", {
40137             feature: utilDisplayLabel(entity1, graph2),
40138             feature2: utilDisplayLabel(entity2, graph2)
40139           }) : "";
40140         },
40141         reference: showReference,
40142         entityIds: entities.map(function(entity) {
40143           return entity.id;
40144         }),
40145         data: {
40146           edges,
40147           featureTypes,
40148           connectionTags
40149         },
40150         hash: uniqueID,
40151         loc: crossing.crossPoint,
40152         dynamicFixes: function(context2) {
40153           var mode = context2.mode();
40154           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
40155             return [];
40156           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
40157           var selectedFeatureType = this.data.featureTypes[selectedIndex];
40158           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
40159           var fixes = [];
40160           if (connectionTags) {
40161             fixes.push(makeConnectWaysFix(this.data.connectionTags));
40162           }
40163           if (isCrossingIndoors) {
40164             fixes.push(new validationIssueFix({
40165               icon: "iD-icon-layers",
40166               title: _t.html("issues.fix.use_different_levels.title")
40167             }));
40168           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
40169             fixes.push(makeChangeLayerFix("higher"));
40170             fixes.push(makeChangeLayerFix("lower"));
40171           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
40172             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
40173               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
40174             }
40175             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
40176             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
40177               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
40178             }
40179           }
40180           fixes.push(new validationIssueFix({
40181             icon: "iD-operation-move",
40182             title: _t.html("issues.fix.reposition_features.title")
40183           }));
40184           return fixes;
40185         }
40186       });
40187       function showReference(selection2) {
40188         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
40189       }
40190     }
40191     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
40192       return new validationIssueFix({
40193         icon: iconName,
40194         title: _t.html("issues.fix." + fixTitleID + ".title"),
40195         onClick: function(context2) {
40196           var mode = context2.mode();
40197           if (!mode || mode.id !== "select")
40198             return;
40199           var selectedIDs = mode.selectedIDs();
40200           if (selectedIDs.length !== 1)
40201             return;
40202           var selectedWayID = selectedIDs[0];
40203           if (!context2.hasEntity(selectedWayID))
40204             return;
40205           var resultWayIDs = [selectedWayID];
40206           var edge, crossedEdge, crossedWayID;
40207           if (this.issue.entityIds[0] === selectedWayID) {
40208             edge = this.issue.data.edges[0];
40209             crossedEdge = this.issue.data.edges[1];
40210             crossedWayID = this.issue.entityIds[1];
40211           } else {
40212             edge = this.issue.data.edges[1];
40213             crossedEdge = this.issue.data.edges[0];
40214             crossedWayID = this.issue.entityIds[0];
40215           }
40216           var crossingLoc = this.issue.loc;
40217           var projection2 = context2.projection;
40218           var action = function actionAddStructure(graph) {
40219             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40220             var crossedWay = graph.hasEntity(crossedWayID);
40221             var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
40222             if (!structLengthMeters) {
40223               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
40224             }
40225             if (structLengthMeters) {
40226               if (getFeatureType(crossedWay, graph) === "railway") {
40227                 structLengthMeters *= 2;
40228               }
40229             } else {
40230               structLengthMeters = 8;
40231             }
40232             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
40233             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
40234             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
40235             if (crossingAngle > Math.PI)
40236               crossingAngle -= Math.PI;
40237             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
40238             structLengthMeters += 4;
40239             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
40240             function geomToProj(geoPoint) {
40241               return [
40242                 geoLonToMeters(geoPoint[0], geoPoint[1]),
40243                 geoLatToMeters(geoPoint[1])
40244               ];
40245             }
40246             function projToGeom(projPoint) {
40247               var lat = geoMetersToLat(projPoint[1]);
40248               return [
40249                 geoMetersToLon(projPoint[0], lat),
40250                 lat
40251               ];
40252             }
40253             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
40254             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
40255             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
40256             var projectedCrossingLoc = geomToProj(crossingLoc);
40257             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
40258             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
40259               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
40260               return projToGeom([
40261                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
40262                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
40263               ]);
40264             }
40265             var endpointLocGetter1 = function(lengthMeters) {
40266               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
40267             };
40268             var endpointLocGetter2 = function(lengthMeters) {
40269               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
40270             };
40271             var minEdgeLengthMeters = 0.55;
40272             function determineEndpoint(edge2, endNode, locGetter) {
40273               var newNode;
40274               var idealLengthMeters = structLengthMeters / 2;
40275               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
40276               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
40277                 var idealNodeLoc = locGetter(idealLengthMeters);
40278                 newNode = osmNode();
40279                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
40280               } else {
40281                 var edgeCount = 0;
40282                 endNode.parentIntersectionWays(graph).forEach(function(way) {
40283                   way.nodes.forEach(function(nodeID) {
40284                     if (nodeID === endNode.id) {
40285                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
40286                         edgeCount += 1;
40287                       } else {
40288                         edgeCount += 2;
40289                       }
40290                     }
40291                   });
40292                 });
40293                 if (edgeCount >= 3) {
40294                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
40295                   if (insetLength > minEdgeLengthMeters) {
40296                     var insetNodeLoc = locGetter(insetLength);
40297                     newNode = osmNode();
40298                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
40299                   }
40300                 }
40301               }
40302               if (!newNode)
40303                 newNode = endNode;
40304               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
40305               graph = splitAction(graph);
40306               if (splitAction.getCreatedWayIDs().length) {
40307                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
40308               }
40309               return newNode;
40310             }
40311             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
40312             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
40313             var structureWay = resultWayIDs.map(function(id2) {
40314               return graph.entity(id2);
40315             }).find(function(way) {
40316               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
40317             });
40318             var tags = Object.assign({}, structureWay.tags);
40319             if (bridgeOrTunnel === "bridge") {
40320               tags.bridge = "yes";
40321               tags.layer = "1";
40322             } else {
40323               var tunnelValue = "yes";
40324               if (getFeatureType(structureWay, graph) === "waterway") {
40325                 tunnelValue = "culvert";
40326               }
40327               tags.tunnel = tunnelValue;
40328               tags.layer = "-1";
40329             }
40330             graph = actionChangeTags(structureWay.id, tags)(graph);
40331             return graph;
40332           };
40333           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
40334           context2.enter(modeSelect(context2, resultWayIDs));
40335         }
40336       });
40337     }
40338     function makeConnectWaysFix(connectionTags) {
40339       var fixTitleID = "connect_features";
40340       if (connectionTags.ford) {
40341         fixTitleID = "connect_using_ford";
40342       }
40343       return new validationIssueFix({
40344         icon: "iD-icon-crossing",
40345         title: _t.html("issues.fix." + fixTitleID + ".title"),
40346         onClick: function(context2) {
40347           var loc = this.issue.loc;
40348           var connectionTags2 = this.issue.data.connectionTags;
40349           var edges = this.issue.data.edges;
40350           context2.perform(function actionConnectCrossingWays(graph) {
40351             var node = osmNode({ loc, tags: connectionTags2 });
40352             graph = graph.replace(node);
40353             var nodesToMerge = [node.id];
40354             var mergeThresholdInMeters = 0.75;
40355             edges.forEach(function(edge) {
40356               var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40357               var nearby = geoSphericalClosestNode(edgeNodes, loc);
40358               if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
40359                 nodesToMerge.push(nearby.node.id);
40360               } else {
40361                 graph = actionAddMidpoint({ loc, edge }, node)(graph);
40362               }
40363             });
40364             if (nodesToMerge.length > 1) {
40365               graph = actionMergeNodes(nodesToMerge, loc)(graph);
40366             }
40367             return graph;
40368           }, _t("issues.fix.connect_crossing_features.annotation"));
40369         }
40370       });
40371     }
40372     function makeChangeLayerFix(higherOrLower) {
40373       return new validationIssueFix({
40374         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
40375         title: _t.html("issues.fix.tag_this_as_" + higherOrLower + ".title"),
40376         onClick: function(context2) {
40377           var mode = context2.mode();
40378           if (!mode || mode.id !== "select")
40379             return;
40380           var selectedIDs = mode.selectedIDs();
40381           if (selectedIDs.length !== 1)
40382             return;
40383           var selectedID = selectedIDs[0];
40384           if (!this.issue.entityIds.some(function(entityId) {
40385             return entityId === selectedID;
40386           }))
40387             return;
40388           var entity = context2.hasEntity(selectedID);
40389           if (!entity)
40390             return;
40391           var tags = Object.assign({}, entity.tags);
40392           var layer = tags.layer && Number(tags.layer);
40393           if (layer && !isNaN(layer)) {
40394             if (higherOrLower === "higher") {
40395               layer += 1;
40396             } else {
40397               layer -= 1;
40398             }
40399           } else {
40400             if (higherOrLower === "higher") {
40401               layer = 1;
40402             } else {
40403               layer = -1;
40404             }
40405           }
40406           tags.layer = layer.toString();
40407           context2.perform(actionChangeTags(entity.id, tags), _t("operations.change_tags.annotation"));
40408         }
40409       });
40410     }
40411     validation.type = type3;
40412     return validation;
40413   }
40414
40415   // modules/behavior/draw_way.js
40416   function behaviorDrawWay(context, wayID, mode, startGraph) {
40417     const keybinding = utilKeybinding("drawWay");
40418     var dispatch10 = dispatch_default("rejectedSelfIntersection");
40419     var behavior = behaviorDraw(context);
40420     var _nodeIndex;
40421     var _origWay;
40422     var _wayGeometry;
40423     var _headNodeID;
40424     var _annotation;
40425     var _pointerHasMoved = false;
40426     var _drawNode;
40427     var _didResolveTempEdit = false;
40428     function createDrawNode(loc) {
40429       _drawNode = osmNode({ loc });
40430       context.pauseChangeDispatch();
40431       context.replace(function actionAddDrawNode(graph) {
40432         var way = graph.entity(wayID);
40433         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
40434       }, _annotation);
40435       context.resumeChangeDispatch();
40436       setActiveElements();
40437     }
40438     function removeDrawNode() {
40439       context.pauseChangeDispatch();
40440       context.replace(function actionDeleteDrawNode(graph) {
40441         var way = graph.entity(wayID);
40442         return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
40443       }, _annotation);
40444       _drawNode = void 0;
40445       context.resumeChangeDispatch();
40446     }
40447     function keydown(d3_event) {
40448       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40449         if (context.surface().classed("nope")) {
40450           context.surface().classed("nope-suppressed", true);
40451         }
40452         context.surface().classed("nope", false).classed("nope-disabled", true);
40453       }
40454     }
40455     function keyup(d3_event) {
40456       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40457         if (context.surface().classed("nope-suppressed")) {
40458           context.surface().classed("nope", true);
40459         }
40460         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
40461       }
40462     }
40463     function allowsVertex(d) {
40464       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
40465     }
40466     function move(d3_event, datum2) {
40467       var loc = context.map().mouseCoordinates();
40468       if (!_drawNode)
40469         createDrawNode(loc);
40470       context.surface().classed("nope-disabled", d3_event.altKey);
40471       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
40472       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
40473       if (targetLoc) {
40474         loc = targetLoc;
40475       } else if (targetNodes) {
40476         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
40477         if (choice) {
40478           loc = choice.loc;
40479         }
40480       }
40481       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40482       _drawNode = context.entity(_drawNode.id);
40483       checkGeometry(true);
40484     }
40485     function checkGeometry(includeDrawNode) {
40486       var nopeDisabled = context.surface().classed("nope-disabled");
40487       var isInvalid = isInvalidGeometry(includeDrawNode);
40488       if (nopeDisabled) {
40489         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
40490       } else {
40491         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
40492       }
40493     }
40494     function isInvalidGeometry(includeDrawNode) {
40495       var testNode = _drawNode;
40496       var parentWay = context.graph().entity(wayID);
40497       var nodes = context.graph().childNodes(parentWay).slice();
40498       if (includeDrawNode) {
40499         if (parentWay.isClosed()) {
40500           nodes.pop();
40501         }
40502       } else {
40503         if (parentWay.isClosed()) {
40504           if (nodes.length < 3)
40505             return false;
40506           if (_drawNode)
40507             nodes.splice(-2, 1);
40508           testNode = nodes[nodes.length - 2];
40509         } else {
40510           return false;
40511         }
40512       }
40513       return testNode && geoHasSelfIntersections(nodes, testNode.id);
40514     }
40515     function undone() {
40516       _didResolveTempEdit = true;
40517       context.pauseChangeDispatch();
40518       var nextMode;
40519       if (context.graph() === startGraph) {
40520         nextMode = modeSelect(context, [wayID]);
40521       } else {
40522         context.pop(1);
40523         nextMode = mode;
40524       }
40525       context.perform(actionNoop());
40526       context.pop(1);
40527       context.resumeChangeDispatch();
40528       context.enter(nextMode);
40529     }
40530     function setActiveElements() {
40531       if (!_drawNode)
40532         return;
40533       context.surface().selectAll("." + _drawNode.id).classed("active", true);
40534     }
40535     function resetToStartGraph() {
40536       while (context.graph() !== startGraph) {
40537         context.pop();
40538       }
40539     }
40540     var drawWay = function(surface) {
40541       _drawNode = void 0;
40542       _didResolveTempEdit = false;
40543       _origWay = context.entity(wayID);
40544       if (typeof _nodeIndex === "number") {
40545         _headNodeID = _origWay.nodes[_nodeIndex];
40546       } else if (_origWay.isClosed()) {
40547         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
40548       } else {
40549         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
40550       }
40551       _wayGeometry = _origWay.geometry(context.graph());
40552       _annotation = _t((_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry);
40553       _pointerHasMoved = false;
40554       context.pauseChangeDispatch();
40555       context.perform(actionNoop(), _annotation);
40556       context.resumeChangeDispatch();
40557       behavior.hover().initialNodeID(_headNodeID);
40558       behavior.on("move", function() {
40559         _pointerHasMoved = true;
40560         move.apply(this, arguments);
40561       }).on("down", function() {
40562         move.apply(this, arguments);
40563       }).on("downcancel", function() {
40564         if (_drawNode)
40565           removeDrawNode();
40566       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
40567       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
40568       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
40569       setActiveElements();
40570       surface.call(behavior);
40571       context.history().on("undone.draw", undone);
40572     };
40573     drawWay.off = function(surface) {
40574       if (!_didResolveTempEdit) {
40575         context.pauseChangeDispatch();
40576         resetToStartGraph();
40577         context.resumeChangeDispatch();
40578       }
40579       _drawNode = void 0;
40580       _nodeIndex = void 0;
40581       context.map().on("drawn.draw", null);
40582       surface.call(behavior.off).selectAll(".active").classed("active", false);
40583       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
40584       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
40585       context.history().on("undone.draw", null);
40586     };
40587     function attemptAdd(d, loc, doAdd) {
40588       if (_drawNode) {
40589         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40590         _drawNode = context.entity(_drawNode.id);
40591       } else {
40592         createDrawNode(loc);
40593       }
40594       checkGeometry(true);
40595       if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
40596         if (!_pointerHasMoved) {
40597           removeDrawNode();
40598         }
40599         dispatch10.call("rejectedSelfIntersection", this);
40600         return;
40601       }
40602       context.pauseChangeDispatch();
40603       doAdd();
40604       _didResolveTempEdit = true;
40605       context.resumeChangeDispatch();
40606       context.enter(mode);
40607     }
40608     drawWay.add = function(loc, d) {
40609       attemptAdd(d, loc, function() {
40610       });
40611     };
40612     drawWay.addWay = function(loc, edge, d) {
40613       attemptAdd(d, loc, function() {
40614         context.replace(actionAddMidpoint({ loc, edge }, _drawNode), _annotation);
40615       });
40616     };
40617     drawWay.addNode = function(node, d) {
40618       if (node.id === _headNodeID || _origWay.isClosed() && node.id === _origWay.first()) {
40619         drawWay.finish();
40620         return;
40621       }
40622       attemptAdd(d, node.loc, function() {
40623         context.replace(function actionReplaceDrawNode(graph) {
40624           graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
40625           return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
40626         }, _annotation);
40627       });
40628     };
40629     function getFeatureType(ways) {
40630       if (ways.every((way) => way.isClosed()))
40631         return "area";
40632       if (ways.every((way) => !way.isClosed()))
40633         return "line";
40634       return "generic";
40635     }
40636     function followMode() {
40637       if (_didResolveTempEdit)
40638         return;
40639       try {
40640         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
40641         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
40642         const historyGraph = context.history().graph();
40643         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
40644           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.needs_more_initial_nodes"))();
40645           return;
40646         }
40647         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
40648         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
40649         const featureType = getFeatureType(lastNodesParents);
40650         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
40651           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
40652           return;
40653         }
40654         if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
40655           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
40656           return;
40657         }
40658         const way = lastNodesParents[0];
40659         const indexOfLast = way.nodes.indexOf(lastNodeId);
40660         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
40661         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
40662         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
40663         if (nextNodeIndex === -1)
40664           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
40665         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
40666         drawWay.addNode(nextNode, {
40667           geometry: { type: "Point", coordinates: nextNode.loc },
40668           id: nextNode.id,
40669           properties: { target: true, entity: nextNode }
40670         });
40671       } catch (ex) {
40672         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.unknown"))();
40673       }
40674     }
40675     keybinding.on(_t("operations.follow.key"), followMode);
40676     select_default2(document).call(keybinding);
40677     drawWay.finish = function() {
40678       checkGeometry(false);
40679       if (context.surface().classed("nope")) {
40680         dispatch10.call("rejectedSelfIntersection", this);
40681         return;
40682       }
40683       context.pauseChangeDispatch();
40684       context.pop(1);
40685       _didResolveTempEdit = true;
40686       context.resumeChangeDispatch();
40687       var way = context.hasEntity(wayID);
40688       if (!way || way.isDegenerate()) {
40689         drawWay.cancel();
40690         return;
40691       }
40692       window.setTimeout(function() {
40693         context.map().dblclickZoomEnable(true);
40694       }, 1e3);
40695       var isNewFeature = !mode.isContinuing;
40696       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
40697     };
40698     drawWay.cancel = function() {
40699       context.pauseChangeDispatch();
40700       resetToStartGraph();
40701       context.resumeChangeDispatch();
40702       window.setTimeout(function() {
40703         context.map().dblclickZoomEnable(true);
40704       }, 1e3);
40705       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
40706       context.enter(modeBrowse(context));
40707     };
40708     drawWay.nodeIndex = function(val) {
40709       if (!arguments.length)
40710         return _nodeIndex;
40711       _nodeIndex = val;
40712       return drawWay;
40713     };
40714     drawWay.activeID = function() {
40715       if (!arguments.length)
40716         return _drawNode && _drawNode.id;
40717       return drawWay;
40718     };
40719     return utilRebind(drawWay, dispatch10, "on");
40720   }
40721
40722   // modules/modes/draw_line.js
40723   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
40724     var mode = {
40725       button,
40726       id: "draw-line"
40727     };
40728     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
40729       context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.lines"))();
40730     });
40731     mode.wayID = wayID;
40732     mode.isContinuing = continuing;
40733     mode.enter = function() {
40734       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
40735       context.install(behavior);
40736     };
40737     mode.exit = function() {
40738       context.uninstall(behavior);
40739     };
40740     mode.selectedIDs = function() {
40741       return [wayID];
40742     };
40743     mode.activeID = function() {
40744       return behavior && behavior.activeID() || [];
40745     };
40746     return mode;
40747   }
40748
40749   // modules/validations/disconnected_way.js
40750   function validationDisconnectedWay() {
40751     var type3 = "disconnected_way";
40752     function isTaggedAsHighway(entity) {
40753       return osmRoutableHighwayTagValues[entity.tags.highway];
40754     }
40755     var validation = function checkDisconnectedWay(entity, graph) {
40756       var routingIslandWays = routingIslandForEntity(entity);
40757       if (!routingIslandWays)
40758         return [];
40759       return [new validationIssue({
40760         type: type3,
40761         subtype: "highway",
40762         severity: "warning",
40763         message: function(context) {
40764           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
40765           var label = entity2 && utilDisplayLabel(entity2, context.graph());
40766           return _t.html("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
40767         },
40768         reference: showReference,
40769         entityIds: Array.from(routingIslandWays).map(function(way) {
40770           return way.id;
40771         }),
40772         dynamicFixes: makeFixes
40773       })];
40774       function makeFixes(context) {
40775         var fixes = [];
40776         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
40777         if (singleEntity) {
40778           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
40779             var textDirection = _mainLocalizer.textDirection();
40780             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
40781             if (startFix)
40782               fixes.push(startFix);
40783             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
40784             if (endFix)
40785               fixes.push(endFix);
40786           }
40787           if (!fixes.length) {
40788             fixes.push(new validationIssueFix({
40789               title: _t.html("issues.fix.connect_feature.title")
40790             }));
40791           }
40792           fixes.push(new validationIssueFix({
40793             icon: "iD-operation-delete",
40794             title: _t.html("issues.fix.delete_feature.title"),
40795             entityIds: [singleEntity.id],
40796             onClick: function(context2) {
40797               var id2 = this.issue.entityIds[0];
40798               var operation = operationDelete(context2, [id2]);
40799               if (!operation.disabled()) {
40800                 operation();
40801               }
40802             }
40803           }));
40804         } else {
40805           fixes.push(new validationIssueFix({
40806             title: _t.html("issues.fix.connect_features.title")
40807           }));
40808         }
40809         return fixes;
40810       }
40811       function showReference(selection2) {
40812         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
40813       }
40814       function routingIslandForEntity(entity2) {
40815         var routingIsland = /* @__PURE__ */ new Set();
40816         var waysToCheck = [];
40817         function queueParentWays(node) {
40818           graph.parentWays(node).forEach(function(parentWay) {
40819             if (!routingIsland.has(parentWay) && isRoutableWay(parentWay, false)) {
40820               routingIsland.add(parentWay);
40821               waysToCheck.push(parentWay);
40822             }
40823           });
40824         }
40825         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
40826           routingIsland.add(entity2);
40827           waysToCheck.push(entity2);
40828         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
40829           routingIsland.add(entity2);
40830           queueParentWays(entity2);
40831         } else {
40832           return null;
40833         }
40834         while (waysToCheck.length) {
40835           var wayToCheck = waysToCheck.pop();
40836           var childNodes = graph.childNodes(wayToCheck);
40837           for (var i2 in childNodes) {
40838             var vertex = childNodes[i2];
40839             if (isConnectedVertex(vertex)) {
40840               return null;
40841             }
40842             if (isRoutableNode(vertex)) {
40843               routingIsland.add(vertex);
40844             }
40845             queueParentWays(vertex);
40846           }
40847         }
40848         return routingIsland;
40849       }
40850       function isConnectedVertex(vertex) {
40851         var osm = services.osm;
40852         if (osm && !osm.isDataLoaded(vertex.loc))
40853           return true;
40854         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
40855           return true;
40856         if (vertex.tags.amenity === "parking_entrance")
40857           return true;
40858         return false;
40859       }
40860       function isRoutableNode(node) {
40861         if (node.tags.highway === "elevator")
40862           return true;
40863         return false;
40864       }
40865       function isRoutableWay(way, ignoreInnerWays) {
40866         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
40867           return true;
40868         return graph.parentRelations(way).some(function(parentRelation) {
40869           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
40870             return true;
40871           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
40872             return true;
40873           return false;
40874         });
40875       }
40876       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
40877         var vertex = graph.hasEntity(vertexID);
40878         if (!vertex || vertex.tags.noexit === "yes")
40879           return null;
40880         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
40881         return new validationIssueFix({
40882           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
40883           title: _t.html("issues.fix.continue_from_" + whichEnd + ".title"),
40884           entityIds: [vertexID],
40885           onClick: function(context) {
40886             var wayId = this.issue.entityIds[0];
40887             var way = context.hasEntity(wayId);
40888             var vertexId = this.entityIds[0];
40889             var vertex2 = context.hasEntity(vertexId);
40890             if (!way || !vertex2)
40891               return;
40892             var map2 = context.map();
40893             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
40894               map2.zoomToEase(vertex2);
40895             }
40896             context.enter(modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true));
40897           }
40898         });
40899       }
40900     };
40901     validation.type = type3;
40902     return validation;
40903   }
40904
40905   // modules/validations/invalid_format.js
40906   function validationFormatting() {
40907     var type3 = "invalid_format";
40908     var validation = function(entity) {
40909       var issues = [];
40910       function isValidEmail(email) {
40911         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
40912         return !email || valid_email.test(email);
40913       }
40914       function showReferenceEmail(selection2) {
40915         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
40916       }
40917       if (entity.tags.email) {
40918         var emails = entity.tags.email.split(";").map(function(s) {
40919           return s.trim();
40920         }).filter(function(x) {
40921           return !isValidEmail(x);
40922         });
40923         if (emails.length) {
40924           issues.push(new validationIssue({
40925             type: type3,
40926             subtype: "email",
40927             severity: "warning",
40928             message: function(context) {
40929               var entity2 = context.hasEntity(this.entityIds[0]);
40930               return entity2 ? _t.html("issues.invalid_format.email.message" + this.data, { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }) : "";
40931             },
40932             reference: showReferenceEmail,
40933             entityIds: [entity.id],
40934             hash: emails.join(),
40935             data: emails.length > 1 ? "_multi" : ""
40936           }));
40937         }
40938       }
40939       return issues;
40940     };
40941     validation.type = type3;
40942     return validation;
40943   }
40944
40945   // modules/validations/help_request.js
40946   function validationHelpRequest(context) {
40947     var type3 = "help_request";
40948     var validation = function checkFixmeTag(entity) {
40949       if (!entity.tags.fixme)
40950         return [];
40951       if (entity.version === void 0)
40952         return [];
40953       if (entity.v !== void 0) {
40954         var baseEntity = context.history().base().hasEntity(entity.id);
40955         if (!baseEntity || !baseEntity.tags.fixme)
40956           return [];
40957       }
40958       return [new validationIssue({
40959         type: type3,
40960         subtype: "fixme_tag",
40961         severity: "warning",
40962         message: function(context2) {
40963           var entity2 = context2.hasEntity(this.entityIds[0]);
40964           return entity2 ? _t.html("issues.fixme_tag.message", {
40965             feature: utilDisplayLabel(entity2, context2.graph(), true)
40966           }) : "";
40967         },
40968         dynamicFixes: function() {
40969           return [
40970             new validationIssueFix({
40971               title: _t.html("issues.fix.address_the_concern.title")
40972             })
40973           ];
40974         },
40975         reference: showReference,
40976         entityIds: [entity.id]
40977       })];
40978       function showReference(selection2) {
40979         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
40980       }
40981     };
40982     validation.type = type3;
40983     return validation;
40984   }
40985
40986   // modules/validations/impossible_oneway.js
40987   function validationImpossibleOneway() {
40988     var type3 = "impossible_oneway";
40989     var validation = function checkImpossibleOneway(entity, graph) {
40990       if (entity.type !== "way" || entity.geometry(graph) !== "line")
40991         return [];
40992       if (entity.isClosed())
40993         return [];
40994       if (!typeForWay(entity))
40995         return [];
40996       if (!isOneway(entity))
40997         return [];
40998       var firstIssues = issuesForNode(entity, entity.first());
40999       var lastIssues = issuesForNode(entity, entity.last());
41000       return firstIssues.concat(lastIssues);
41001       function typeForWay(way) {
41002         if (way.geometry(graph) !== "line")
41003           return null;
41004         if (osmRoutableHighwayTagValues[way.tags.highway])
41005           return "highway";
41006         if (osmFlowingWaterwayTagValues[way.tags.waterway])
41007           return "waterway";
41008         return null;
41009       }
41010       function isOneway(way) {
41011         if (way.tags.oneway === "yes")
41012           return true;
41013         if (way.tags.oneway)
41014           return false;
41015         for (var key in way.tags) {
41016           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
41017             return true;
41018           }
41019         }
41020         return false;
41021       }
41022       function nodeOccursMoreThanOnce(way, nodeID) {
41023         var occurrences = 0;
41024         for (var index in way.nodes) {
41025           if (way.nodes[index] === nodeID) {
41026             occurrences += 1;
41027             if (occurrences > 1)
41028               return true;
41029           }
41030         }
41031         return false;
41032       }
41033       function isConnectedViaOtherTypes(way, node) {
41034         var wayType = typeForWay(way);
41035         if (wayType === "highway") {
41036           if (node.tags.entrance && node.tags.entrance !== "no")
41037             return true;
41038           if (node.tags.amenity === "parking_entrance")
41039             return true;
41040         } else if (wayType === "waterway") {
41041           if (node.id === way.first()) {
41042             if (node.tags.natural === "spring")
41043               return true;
41044           } else {
41045             if (node.tags.manhole === "drain")
41046               return true;
41047           }
41048         }
41049         return graph.parentWays(node).some(function(parentWay) {
41050           if (parentWay.id === way.id)
41051             return false;
41052           if (wayType === "highway") {
41053             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
41054               return true;
41055             if (parentWay.tags.route === "ferry")
41056               return true;
41057             return graph.parentRelations(parentWay).some(function(parentRelation) {
41058               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41059                 return true;
41060               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
41061             });
41062           } else if (wayType === "waterway") {
41063             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
41064               return true;
41065           }
41066           return false;
41067         });
41068       }
41069       function issuesForNode(way, nodeID) {
41070         var isFirst = nodeID === way.first();
41071         var wayType = typeForWay(way);
41072         if (nodeOccursMoreThanOnce(way, nodeID))
41073           return [];
41074         var osm = services.osm;
41075         if (!osm)
41076           return [];
41077         var node = graph.hasEntity(nodeID);
41078         if (!node || !osm.isDataLoaded(node.loc))
41079           return [];
41080         if (isConnectedViaOtherTypes(way, node))
41081           return [];
41082         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
41083           if (parentWay.id === way.id)
41084             return false;
41085           return typeForWay(parentWay) === wayType;
41086         });
41087         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
41088           return [];
41089         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
41090           return isOneway(attachedWay);
41091         });
41092         if (attachedOneways.length < attachedWaysOfSameType.length)
41093           return [];
41094         if (attachedOneways.length) {
41095           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
41096             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
41097               return true;
41098             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
41099               return true;
41100             return false;
41101           });
41102           if (connectedEndpointsOkay)
41103             return [];
41104         }
41105         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
41106         if (wayType === "waterway") {
41107           messageID += "connected." + placement;
41108           referenceID += "connected";
41109         } else {
41110           messageID += placement;
41111           referenceID += placement;
41112         }
41113         return [new validationIssue({
41114           type: type3,
41115           subtype: wayType,
41116           severity: "warning",
41117           message: function(context) {
41118             var entity2 = context.hasEntity(this.entityIds[0]);
41119             return entity2 ? _t.html("issues.impossible_oneway." + messageID + ".message", {
41120               feature: utilDisplayLabel(entity2, context.graph())
41121             }) : "";
41122           },
41123           reference: getReference(referenceID),
41124           entityIds: [way.id, node.id],
41125           dynamicFixes: function() {
41126             var fixes = [];
41127             if (attachedOneways.length) {
41128               fixes.push(new validationIssueFix({
41129                 icon: "iD-operation-reverse",
41130                 title: _t.html("issues.fix.reverse_feature.title"),
41131                 entityIds: [way.id],
41132                 onClick: function(context) {
41133                   var id2 = this.issue.entityIds[0];
41134                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
41135                 }
41136               }));
41137             }
41138             if (node.tags.noexit !== "yes") {
41139               var textDirection = _mainLocalizer.textDirection();
41140               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
41141               fixes.push(new validationIssueFix({
41142                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41143                 title: _t.html("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
41144                 onClick: function(context) {
41145                   var entityID = this.issue.entityIds[0];
41146                   var vertexID = this.issue.entityIds[1];
41147                   var way2 = context.entity(entityID);
41148                   var vertex = context.entity(vertexID);
41149                   continueDrawing(way2, vertex, context);
41150                 }
41151               }));
41152             }
41153             return fixes;
41154           },
41155           loc: node.loc
41156         })];
41157         function getReference(referenceID2) {
41158           return function showReference(selection2) {
41159             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
41160           };
41161         }
41162       }
41163     };
41164     function continueDrawing(way, vertex, context) {
41165       var map2 = context.map();
41166       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
41167         map2.zoomToEase(vertex);
41168       }
41169       context.enter(modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true));
41170     }
41171     validation.type = type3;
41172     return validation;
41173   }
41174
41175   // modules/validations/incompatible_source.js
41176   function validationIncompatibleSource() {
41177     const type3 = "incompatible_source";
41178     const incompatibleRules = [
41179       {
41180         id: "amap",
41181         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
41182       },
41183       {
41184         id: "baidu",
41185         regex: /(baidu|mapbar|百度)/i
41186       },
41187       {
41188         id: "google",
41189         regex: /google/i,
41190         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
41191       }
41192     ];
41193     const validation = function checkIncompatibleSource(entity) {
41194       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
41195       if (!entitySources)
41196         return [];
41197       const entityID = entity.id;
41198       return entitySources.map((source) => {
41199         const matchRule = incompatibleRules.find((rule) => {
41200           if (!rule.regex.test(source))
41201             return false;
41202           if (rule.exceptRegex && rule.exceptRegex.test(source))
41203             return false;
41204           return true;
41205         });
41206         if (!matchRule)
41207           return null;
41208         return new validationIssue({
41209           type: type3,
41210           severity: "warning",
41211           message: (context) => {
41212             const entity2 = context.hasEntity(entityID);
41213             return entity2 ? _t.html("issues.incompatible_source.feature.message", {
41214               feature: utilDisplayLabel(entity2, context.graph(), true),
41215               value: source
41216             }) : "";
41217           },
41218           reference: getReference(matchRule.id),
41219           entityIds: [entityID],
41220           hash: source,
41221           dynamicFixes: () => {
41222             return [
41223               new validationIssueFix({ title: _t.html("issues.fix.remove_proprietary_data.title") })
41224             ];
41225           }
41226         });
41227       }).filter(Boolean);
41228       function getReference(id2) {
41229         return function showReference(selection2) {
41230           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
41231         };
41232       }
41233     };
41234     validation.type = type3;
41235     return validation;
41236   }
41237
41238   // modules/validations/maprules.js
41239   function validationMaprules() {
41240     var type3 = "maprules";
41241     var validation = function checkMaprules(entity, graph) {
41242       if (!services.maprules)
41243         return [];
41244       var rules = services.maprules.validationRules();
41245       var issues = [];
41246       for (var i2 = 0; i2 < rules.length; i2++) {
41247         var rule = rules[i2];
41248         rule.findIssues(entity, graph, issues);
41249       }
41250       return issues;
41251     };
41252     validation.type = type3;
41253     return validation;
41254   }
41255
41256   // modules/validations/mismatched_geometry.js
41257   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
41258   function validationMismatchedGeometry() {
41259     var type3 = "mismatched_geometry";
41260     function tagSuggestingLineIsArea(entity) {
41261       if (entity.type !== "way" || entity.isClosed())
41262         return null;
41263       var tagSuggestingArea = entity.tagSuggestingArea();
41264       if (!tagSuggestingArea) {
41265         return null;
41266       }
41267       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
41268       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
41269       if (asLine && asArea && asLine === asArea) {
41270         return null;
41271       }
41272       return tagSuggestingArea;
41273     }
41274     function makeConnectEndpointsFixOnClick(way, graph) {
41275       if (way.nodes.length < 3)
41276         return null;
41277       var nodes = graph.childNodes(way), testNodes;
41278       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
41279       if (firstToLastDistanceMeters < 0.75) {
41280         testNodes = nodes.slice();
41281         testNodes.pop();
41282         testNodes.push(testNodes[0]);
41283         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41284           return function(context) {
41285             var way2 = context.entity(this.issue.entityIds[0]);
41286             context.perform(actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc), _t("issues.fix.connect_endpoints.annotation"));
41287           };
41288         }
41289       }
41290       testNodes = nodes.slice();
41291       testNodes.push(testNodes[0]);
41292       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41293         return function(context) {
41294           var wayId = this.issue.entityIds[0];
41295           var way2 = context.entity(wayId);
41296           var nodeId = way2.nodes[0];
41297           var index = way2.nodes.length;
41298           context.perform(actionAddVertex(wayId, nodeId, index), _t("issues.fix.connect_endpoints.annotation"));
41299         };
41300       }
41301     }
41302     function lineTaggedAsAreaIssue(entity) {
41303       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
41304       if (!tagSuggestingArea)
41305         return null;
41306       return new validationIssue({
41307         type: type3,
41308         subtype: "area_as_line",
41309         severity: "warning",
41310         message: function(context) {
41311           var entity2 = context.hasEntity(this.entityIds[0]);
41312           return entity2 ? _t.html("issues.tag_suggests_area.message", {
41313             feature: utilDisplayLabel(entity2, "area", true),
41314             tag: utilTagText({ tags: tagSuggestingArea })
41315           }) : "";
41316         },
41317         reference: showReference,
41318         entityIds: [entity.id],
41319         hash: JSON.stringify(tagSuggestingArea),
41320         dynamicFixes: function(context) {
41321           var fixes = [];
41322           var entity2 = context.entity(this.entityIds[0]);
41323           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
41324           fixes.push(new validationIssueFix({
41325             title: _t.html("issues.fix.connect_endpoints.title"),
41326             onClick: connectEndsOnClick
41327           }));
41328           fixes.push(new validationIssueFix({
41329             icon: "iD-operation-delete",
41330             title: _t.html("issues.fix.remove_tag.title"),
41331             onClick: function(context2) {
41332               var entityId = this.issue.entityIds[0];
41333               var entity3 = context2.entity(entityId);
41334               var tags = Object.assign({}, entity3.tags);
41335               for (var key in tagSuggestingArea) {
41336                 delete tags[key];
41337               }
41338               context2.perform(actionChangeTags(entityId, tags), _t("issues.fix.remove_tag.annotation"));
41339             }
41340           }));
41341           return fixes;
41342         }
41343       });
41344       function showReference(selection2) {
41345         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
41346       }
41347     }
41348     function vertexPointIssue(entity, graph) {
41349       if (entity.type !== "node")
41350         return null;
41351       if (Object.keys(entity.tags).length === 0)
41352         return null;
41353       if (entity.isOnAddressLine(graph))
41354         return null;
41355       var geometry = entity.geometry(graph);
41356       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
41357       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
41358         return new validationIssue({
41359           type: type3,
41360           subtype: "vertex_as_point",
41361           severity: "warning",
41362           message: function(context) {
41363             var entity2 = context.hasEntity(this.entityIds[0]);
41364             return entity2 ? _t.html("issues.vertex_as_point.message", {
41365               feature: utilDisplayLabel(entity2, "vertex", true)
41366             }) : "";
41367           },
41368           reference: function showReference(selection2) {
41369             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
41370           },
41371           entityIds: [entity.id]
41372         });
41373       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
41374         return new validationIssue({
41375           type: type3,
41376           subtype: "point_as_vertex",
41377           severity: "warning",
41378           message: function(context) {
41379             var entity2 = context.hasEntity(this.entityIds[0]);
41380             return entity2 ? _t.html("issues.point_as_vertex.message", {
41381               feature: utilDisplayLabel(entity2, "point", true)
41382             }) : "";
41383           },
41384           reference: function showReference(selection2) {
41385             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
41386           },
41387           entityIds: [entity.id],
41388           dynamicFixes: extractPointDynamicFixes
41389         });
41390       }
41391       return null;
41392     }
41393     function otherMismatchIssue(entity, graph) {
41394       if (!entity.hasInterestingTags())
41395         return null;
41396       if (entity.type !== "node" && entity.type !== "way")
41397         return null;
41398       if (entity.type === "node" && entity.isOnAddressLine(graph))
41399         return null;
41400       var sourceGeom = entity.geometry(graph);
41401       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
41402       if (sourceGeom === "area")
41403         targetGeoms.unshift("line");
41404       var asSource = _mainPresetIndex.match(entity, graph);
41405       var targetGeom = targetGeoms.find((nodeGeom) => {
41406         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
41407         if (!asSource || !asTarget || asSource === asTarget || (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
41408           return false;
41409         if (asTarget.isFallback())
41410           return false;
41411         var primaryKey = Object.keys(asTarget.tags)[0];
41412         if (primaryKey === "building")
41413           return false;
41414         if (asTarget.tags[primaryKey] === "*")
41415           return false;
41416         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
41417       });
41418       if (!targetGeom)
41419         return null;
41420       var subtype = targetGeom + "_as_" + sourceGeom;
41421       if (targetGeom === "vertex")
41422         targetGeom = "point";
41423       if (sourceGeom === "vertex")
41424         sourceGeom = "point";
41425       var referenceId = targetGeom + "_as_" + sourceGeom;
41426       var dynamicFixes;
41427       if (targetGeom === "point") {
41428         dynamicFixes = extractPointDynamicFixes;
41429       } else if (sourceGeom === "area" && targetGeom === "line") {
41430         dynamicFixes = lineToAreaDynamicFixes;
41431       }
41432       return new validationIssue({
41433         type: type3,
41434         subtype,
41435         severity: "warning",
41436         message: function(context) {
41437           var entity2 = context.hasEntity(this.entityIds[0]);
41438           return entity2 ? _t.html("issues." + referenceId + ".message", {
41439             feature: utilDisplayLabel(entity2, targetGeom, true)
41440           }) : "";
41441         },
41442         reference: function showReference(selection2) {
41443           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
41444         },
41445         entityIds: [entity.id],
41446         dynamicFixes
41447       });
41448     }
41449     function lineToAreaDynamicFixes(context) {
41450       var convertOnClick;
41451       var entityId = this.entityIds[0];
41452       var entity = context.entity(entityId);
41453       var tags = Object.assign({}, entity.tags);
41454       delete tags.area;
41455       if (!osmTagSuggestingArea(tags)) {
41456         convertOnClick = function(context2) {
41457           var entityId2 = this.issue.entityIds[0];
41458           var entity2 = context2.entity(entityId2);
41459           var tags2 = Object.assign({}, entity2.tags);
41460           if (tags2.area) {
41461             delete tags2.area;
41462           }
41463           context2.perform(actionChangeTags(entityId2, tags2), _t("issues.fix.convert_to_line.annotation"));
41464         };
41465       }
41466       return [
41467         new validationIssueFix({
41468           icon: "iD-icon-line",
41469           title: _t.html("issues.fix.convert_to_line.title"),
41470           onClick: convertOnClick
41471         })
41472       ];
41473     }
41474     function extractPointDynamicFixes(context) {
41475       var entityId = this.entityIds[0];
41476       var extractOnClick = null;
41477       if (!context.hasHiddenConnections(entityId)) {
41478         extractOnClick = function(context2) {
41479           var entityId2 = this.issue.entityIds[0];
41480           var action = actionExtract(entityId2, context2.projection);
41481           context2.perform(action, _t("operations.extract.annotation", { n: 1 }));
41482           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
41483         };
41484       }
41485       return [
41486         new validationIssueFix({
41487           icon: "iD-operation-extract",
41488           title: _t.html("issues.fix.extract_point.title"),
41489           onClick: extractOnClick
41490         })
41491       ];
41492     }
41493     function unclosedMultipolygonPartIssues(entity, graph) {
41494       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || !entity.isComplete(graph))
41495         return [];
41496       var sequences = osmJoinWays(entity.members, graph);
41497       var issues = [];
41498       for (var i2 in sequences) {
41499         var sequence = sequences[i2];
41500         if (!sequence.nodes)
41501           continue;
41502         var firstNode = sequence.nodes[0];
41503         var lastNode = sequence.nodes[sequence.nodes.length - 1];
41504         if (firstNode === lastNode)
41505           continue;
41506         var issue = new validationIssue({
41507           type: type3,
41508           subtype: "unclosed_multipolygon_part",
41509           severity: "warning",
41510           message: function(context) {
41511             var entity2 = context.hasEntity(this.entityIds[0]);
41512             return entity2 ? _t.html("issues.unclosed_multipolygon_part.message", {
41513               feature: utilDisplayLabel(entity2, context.graph(), true)
41514             }) : "";
41515           },
41516           reference: showReference,
41517           loc: sequence.nodes[0].loc,
41518           entityIds: [entity.id],
41519           hash: sequence.map(function(way) {
41520             return way.id;
41521           }).join()
41522         });
41523         issues.push(issue);
41524       }
41525       return issues;
41526       function showReference(selection2) {
41527         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
41528       }
41529     }
41530     var validation = function checkMismatchedGeometry(entity, graph) {
41531       var vertexPoint = vertexPointIssue(entity, graph);
41532       if (vertexPoint)
41533         return [vertexPoint];
41534       var lineAsArea = lineTaggedAsAreaIssue(entity);
41535       if (lineAsArea)
41536         return [lineAsArea];
41537       var mismatch = otherMismatchIssue(entity, graph);
41538       if (mismatch)
41539         return [mismatch];
41540       return unclosedMultipolygonPartIssues(entity, graph);
41541     };
41542     validation.type = type3;
41543     return validation;
41544   }
41545
41546   // modules/validations/missing_role.js
41547   function validationMissingRole() {
41548     var type3 = "missing_role";
41549     var validation = function checkMissingRole(entity, graph) {
41550       var issues = [];
41551       if (entity.type === "way") {
41552         graph.parentRelations(entity).forEach(function(relation) {
41553           if (!relation.isMultipolygon())
41554             return;
41555           var member = relation.memberById(entity.id);
41556           if (member && isMissingRole(member)) {
41557             issues.push(makeIssue(entity, relation, member));
41558           }
41559         });
41560       } else if (entity.type === "relation" && entity.isMultipolygon()) {
41561         entity.indexedMembers().forEach(function(member) {
41562           var way = graph.hasEntity(member.id);
41563           if (way && isMissingRole(member)) {
41564             issues.push(makeIssue(way, entity, member));
41565           }
41566         });
41567       }
41568       return issues;
41569     };
41570     function isMissingRole(member) {
41571       return !member.role || !member.role.trim().length;
41572     }
41573     function makeIssue(way, relation, member) {
41574       return new validationIssue({
41575         type: type3,
41576         severity: "warning",
41577         message: function(context) {
41578           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
41579           return member2 && relation2 ? _t.html("issues.missing_role.message", {
41580             member: utilDisplayLabel(member2, context.graph()),
41581             relation: utilDisplayLabel(relation2, context.graph())
41582           }) : "";
41583         },
41584         reference: showReference,
41585         entityIds: [relation.id, way.id],
41586         data: {
41587           member
41588         },
41589         hash: member.index.toString(),
41590         dynamicFixes: function() {
41591           return [
41592             makeAddRoleFix("inner"),
41593             makeAddRoleFix("outer"),
41594             new validationIssueFix({
41595               icon: "iD-operation-delete",
41596               title: _t.html("issues.fix.remove_from_relation.title"),
41597               onClick: function(context) {
41598                 context.perform(actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index), _t("operations.delete_member.annotation", {
41599                   n: 1
41600                 }));
41601               }
41602             })
41603           ];
41604         }
41605       });
41606       function showReference(selection2) {
41607         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
41608       }
41609     }
41610     function makeAddRoleFix(role) {
41611       return new validationIssueFix({
41612         title: _t.html("issues.fix.set_as_" + role + ".title"),
41613         onClick: function(context) {
41614           var oldMember = this.issue.data.member;
41615           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
41616           context.perform(actionChangeMember(this.issue.entityIds[0], member, oldMember.index), _t("operations.change_role.annotation", {
41617             n: 1
41618           }));
41619         }
41620       });
41621     }
41622     validation.type = type3;
41623     return validation;
41624   }
41625
41626   // modules/validations/missing_tag.js
41627   function validationMissingTag(context) {
41628     var type3 = "missing_tag";
41629     function hasDescriptiveTags(entity, graph) {
41630       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
41631       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
41632         if (k === "area" || !osmIsInterestingTag(k))
41633           return false;
41634         return !onlyAttributeKeys.some(function(attributeKey) {
41635           return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
41636         });
41637       });
41638       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
41639         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
41640       }
41641       return entityDescriptiveKeys.length > 0;
41642     }
41643     function isUnknownRoad(entity) {
41644       return entity.type === "way" && entity.tags.highway === "road";
41645     }
41646     function isUntypedRelation(entity) {
41647       return entity.type === "relation" && !entity.tags.type;
41648     }
41649     var validation = function checkMissingTag(entity, graph) {
41650       var subtype;
41651       var osm = context.connection();
41652       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
41653       if (!isUnloadedNode && entity.geometry(graph) !== "vertex" && !entity.hasParentRelations(graph)) {
41654         if (Object.keys(entity.tags).length === 0) {
41655           subtype = "any";
41656         } else if (!hasDescriptiveTags(entity, graph)) {
41657           subtype = "descriptive";
41658         } else if (isUntypedRelation(entity)) {
41659           subtype = "relation_type";
41660         }
41661       }
41662       if (!subtype && isUnknownRoad(entity)) {
41663         subtype = "highway_classification";
41664       }
41665       if (!subtype)
41666         return [];
41667       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
41668       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
41669       var canDelete = entity.version === void 0 || entity.v !== void 0;
41670       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
41671       return [new validationIssue({
41672         type: type3,
41673         subtype,
41674         severity,
41675         message: function(context2) {
41676           var entity2 = context2.hasEntity(this.entityIds[0]);
41677           return entity2 ? _t.html("issues." + messageID + ".message", {
41678             feature: utilDisplayLabel(entity2, context2.graph())
41679           }) : "";
41680         },
41681         reference: showReference,
41682         entityIds: [entity.id],
41683         dynamicFixes: function(context2) {
41684           var fixes = [];
41685           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
41686           fixes.push(new validationIssueFix({
41687             icon: "iD-icon-search",
41688             title: _t.html("issues.fix." + selectFixType + ".title"),
41689             onClick: function(context3) {
41690               context3.ui().sidebar.showPresetList();
41691             }
41692           }));
41693           var deleteOnClick;
41694           var id2 = this.entityIds[0];
41695           var operation = operationDelete(context2, [id2]);
41696           var disabledReasonID = operation.disabled();
41697           if (!disabledReasonID) {
41698             deleteOnClick = function(context3) {
41699               var id3 = this.issue.entityIds[0];
41700               var operation2 = operationDelete(context3, [id3]);
41701               if (!operation2.disabled()) {
41702                 operation2();
41703               }
41704             };
41705           }
41706           fixes.push(new validationIssueFix({
41707             icon: "iD-operation-delete",
41708             title: _t.html("issues.fix.delete_feature.title"),
41709             disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
41710             onClick: deleteOnClick
41711           }));
41712           return fixes;
41713         }
41714       })];
41715       function showReference(selection2) {
41716         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
41717       }
41718     };
41719     validation.type = type3;
41720     return validation;
41721   }
41722
41723   // modules/validations/outdated_tags.js
41724   function validationOutdatedTags() {
41725     const type3 = "outdated_tags";
41726     let _waitingForDeprecated = true;
41727     let _dataDeprecated;
41728     _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
41729     }).finally(() => _waitingForDeprecated = false);
41730     function oldTagIssues(entity, graph) {
41731       const oldTags = Object.assign({}, entity.tags);
41732       let preset = _mainPresetIndex.match(entity, graph);
41733       let subtype = "deprecated_tags";
41734       if (!preset)
41735         return [];
41736       if (!entity.hasInterestingTags())
41737         return [];
41738       if (preset.replacement) {
41739         const newPreset = _mainPresetIndex.item(preset.replacement);
41740         graph = actionChangePreset(entity.id, preset, newPreset, true)(graph);
41741         entity = graph.entity(entity.id);
41742         preset = newPreset;
41743       }
41744       if (_dataDeprecated) {
41745         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
41746         if (deprecatedTags.length) {
41747           deprecatedTags.forEach((tag) => {
41748             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
41749           });
41750           entity = graph.entity(entity.id);
41751         }
41752       }
41753       let newTags = Object.assign({}, entity.tags);
41754       if (preset.tags !== preset.addTags) {
41755         Object.keys(preset.addTags).forEach((k) => {
41756           if (!newTags[k]) {
41757             if (preset.addTags[k] === "*") {
41758               newTags[k] = "yes";
41759             } else {
41760               newTags[k] = preset.addTags[k];
41761             }
41762           }
41763         });
41764       }
41765       const nsi = services.nsi;
41766       let waitingForNsi = false;
41767       let nsiResult;
41768       if (nsi) {
41769         waitingForNsi = nsi.status() === "loading";
41770         if (!waitingForNsi) {
41771           const loc = entity.extent(graph).center();
41772           nsiResult = nsi.upgradeTags(newTags, loc);
41773           if (nsiResult) {
41774             newTags = nsiResult.newTags;
41775             subtype = "noncanonical_brand";
41776           }
41777         }
41778       }
41779       let issues = [];
41780       issues.provisional = _waitingForDeprecated || waitingForNsi;
41781       const tagDiff = utilTagDiff(oldTags, newTags);
41782       if (!tagDiff.length)
41783         return issues;
41784       const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
41785       let prefix = "";
41786       if (nsiResult) {
41787         prefix = "noncanonical_brand.";
41788       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
41789         subtype = "incomplete_tags";
41790         prefix = "incomplete.";
41791       }
41792       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
41793       issues.push(new validationIssue({
41794         type: type3,
41795         subtype,
41796         severity: "warning",
41797         message: showMessage,
41798         reference: showReference,
41799         entityIds: [entity.id],
41800         hash: utilHashcode(JSON.stringify(tagDiff)),
41801         dynamicFixes: () => {
41802           let fixes = [
41803             new validationIssueFix({
41804               autoArgs,
41805               title: _t.html("issues.fix.upgrade_tags.title"),
41806               onClick: (context) => {
41807                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
41808               }
41809             })
41810           ];
41811           const item = nsiResult && nsiResult.matched;
41812           if (item) {
41813             fixes.push(new validationIssueFix({
41814               title: _t.html("issues.fix.tag_as_not.title", { name: item.displayName }),
41815               onClick: (context) => {
41816                 context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
41817               }
41818             }));
41819           }
41820           return fixes;
41821         }
41822       }));
41823       return issues;
41824       function doUpgrade(graph2) {
41825         const currEntity = graph2.hasEntity(entity.id);
41826         if (!currEntity)
41827           return graph2;
41828         let newTags2 = Object.assign({}, currEntity.tags);
41829         tagDiff.forEach((diff) => {
41830           if (diff.type === "-") {
41831             delete newTags2[diff.key];
41832           } else if (diff.type === "+") {
41833             newTags2[diff.key] = diff.newVal;
41834           }
41835         });
41836         return actionChangeTags(currEntity.id, newTags2)(graph2);
41837       }
41838       function addNotTag(graph2) {
41839         const currEntity = graph2.hasEntity(entity.id);
41840         if (!currEntity)
41841           return graph2;
41842         const item = nsiResult && nsiResult.matched;
41843         if (!item)
41844           return graph2;
41845         let newTags2 = Object.assign({}, currEntity.tags);
41846         const wd = item.mainTag;
41847         const notwd = `not:${wd}`;
41848         const qid = item.tags[wd];
41849         newTags2[notwd] = qid;
41850         if (newTags2[wd] === qid) {
41851           const wp = item.mainTag.replace("wikidata", "wikipedia");
41852           delete newTags2[wd];
41853           delete newTags2[wp];
41854         }
41855         return actionChangeTags(currEntity.id, newTags2)(graph2);
41856       }
41857       function showMessage(context) {
41858         const currEntity = context.hasEntity(entity.id);
41859         if (!currEntity)
41860           return "";
41861         let messageID = `issues.outdated_tags.${prefix}message`;
41862         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
41863           messageID += "_incomplete";
41864         }
41865         return _t.html(messageID, {
41866           feature: utilDisplayLabel(currEntity, context.graph(), true)
41867         });
41868       }
41869       function showReference(selection2) {
41870         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
41871         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
41872         enter.append("strong").call(_t.append("issues.suggested"));
41873         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
41874           let klass = d.type === "+" ? "add" : "remove";
41875           return `tagDiff-cell tagDiff-cell-${klass}`;
41876         }).html((d) => d.display);
41877       }
41878     }
41879     function oldMultipolygonIssues(entity, graph) {
41880       let multipolygon, outerWay;
41881       if (entity.type === "relation") {
41882         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
41883         multipolygon = entity;
41884       } else if (entity.type === "way") {
41885         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
41886         outerWay = entity;
41887       } else {
41888         return [];
41889       }
41890       if (!multipolygon || !outerWay)
41891         return [];
41892       return [new validationIssue({
41893         type: type3,
41894         subtype: "old_multipolygon",
41895         severity: "warning",
41896         message: showMessage,
41897         reference: showReference,
41898         entityIds: [outerWay.id, multipolygon.id],
41899         dynamicFixes: () => {
41900           return [
41901             new validationIssueFix({
41902               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
41903               title: _t.html("issues.fix.move_tags.title"),
41904               onClick: (context) => {
41905                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
41906               }
41907             })
41908           ];
41909         }
41910       })];
41911       function doUpgrade(graph2) {
41912         let currMultipolygon = graph2.hasEntity(multipolygon.id);
41913         let currOuterWay = graph2.hasEntity(outerWay.id);
41914         if (!currMultipolygon || !currOuterWay)
41915           return graph2;
41916         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
41917         graph2 = graph2.replace(currMultipolygon);
41918         return actionChangeTags(currOuterWay.id, {})(graph2);
41919       }
41920       function showMessage(context) {
41921         let currMultipolygon = context.hasEntity(multipolygon.id);
41922         if (!currMultipolygon)
41923           return "";
41924         return _t.html("issues.old_multipolygon.message", { multipolygon: utilDisplayLabel(currMultipolygon, context.graph(), true) });
41925       }
41926       function showReference(selection2) {
41927         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
41928       }
41929     }
41930     let validation = function checkOutdatedTags(entity, graph) {
41931       let issues = oldMultipolygonIssues(entity, graph);
41932       if (!issues.length)
41933         issues = oldTagIssues(entity, graph);
41934       return issues;
41935     };
41936     validation.type = type3;
41937     return validation;
41938   }
41939
41940   // modules/validations/private_data.js
41941   function validationPrivateData() {
41942     var type3 = "private_data";
41943     var privateBuildingValues = {
41944       detached: true,
41945       farm: true,
41946       house: true,
41947       houseboat: true,
41948       residential: true,
41949       semidetached_house: true,
41950       static_caravan: true
41951     };
41952     var publicKeys = {
41953       amenity: true,
41954       craft: true,
41955       historic: true,
41956       leisure: true,
41957       office: true,
41958       shop: true,
41959       tourism: true
41960     };
41961     var personalTags = {
41962       "contact:email": true,
41963       "contact:fax": true,
41964       "contact:phone": true,
41965       email: true,
41966       fax: true,
41967       phone: true
41968     };
41969     var validation = function checkPrivateData(entity) {
41970       var tags = entity.tags;
41971       if (!tags.building || !privateBuildingValues[tags.building])
41972         return [];
41973       var keepTags = {};
41974       for (var k in tags) {
41975         if (publicKeys[k])
41976           return [];
41977         if (!personalTags[k]) {
41978           keepTags[k] = tags[k];
41979         }
41980       }
41981       var tagDiff = utilTagDiff(tags, keepTags);
41982       if (!tagDiff.length)
41983         return [];
41984       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
41985       return [new validationIssue({
41986         type: type3,
41987         severity: "warning",
41988         message: showMessage,
41989         reference: showReference,
41990         entityIds: [entity.id],
41991         dynamicFixes: function() {
41992           return [
41993             new validationIssueFix({
41994               icon: "iD-operation-delete",
41995               title: _t.html("issues.fix." + fixID + ".title"),
41996               onClick: function(context) {
41997                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
41998               }
41999             })
42000           ];
42001         }
42002       })];
42003       function doUpgrade(graph) {
42004         var currEntity = graph.hasEntity(entity.id);
42005         if (!currEntity)
42006           return graph;
42007         var newTags = Object.assign({}, currEntity.tags);
42008         tagDiff.forEach(function(diff) {
42009           if (diff.type === "-") {
42010             delete newTags[diff.key];
42011           } else if (diff.type === "+") {
42012             newTags[diff.key] = diff.newVal;
42013           }
42014         });
42015         return actionChangeTags(currEntity.id, newTags)(graph);
42016       }
42017       function showMessage(context) {
42018         var currEntity = context.hasEntity(this.entityIds[0]);
42019         if (!currEntity)
42020           return "";
42021         return _t.html("issues.private_data.contact.message", { feature: utilDisplayLabel(currEntity, context.graph()) });
42022       }
42023       function showReference(selection2) {
42024         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
42025         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
42026         enter.append("strong").call(_t.append("issues.suggested"));
42027         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d) {
42028           var klass = d.type === "+" ? "add" : "remove";
42029           return "tagDiff-cell tagDiff-cell-" + klass;
42030         }).html(function(d) {
42031           return d.display;
42032         });
42033       }
42034     };
42035     validation.type = type3;
42036     return validation;
42037   }
42038
42039   // modules/validations/suspicious_name.js
42040   function validationSuspiciousName() {
42041     const type3 = "suspicious_name";
42042     const keysToTestForGenericValues = [
42043       "aerialway",
42044       "aeroway",
42045       "amenity",
42046       "building",
42047       "craft",
42048       "highway",
42049       "leisure",
42050       "railway",
42051       "man_made",
42052       "office",
42053       "shop",
42054       "tourism",
42055       "waterway"
42056     ];
42057     let _waitingForNsi = false;
42058     function isGenericMatchInNsi(tags) {
42059       const nsi = services.nsi;
42060       if (nsi) {
42061         _waitingForNsi = nsi.status() === "loading";
42062         if (!_waitingForNsi) {
42063           return nsi.isGenericName(tags);
42064         }
42065       }
42066       return false;
42067     }
42068     function nameMatchesRawTag(lowercaseName, tags) {
42069       for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
42070         let key = keysToTestForGenericValues[i2];
42071         let val = tags[key];
42072         if (val) {
42073           val = val.toLowerCase();
42074           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
42075             return true;
42076           }
42077         }
42078       }
42079       return false;
42080     }
42081     function isGenericName(name2, tags) {
42082       name2 = name2.toLowerCase();
42083       return nameMatchesRawTag(name2, tags) || isGenericMatchInNsi(tags);
42084     }
42085     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
42086       return new validationIssue({
42087         type: type3,
42088         subtype: "generic_name",
42089         severity: "warning",
42090         message: function(context) {
42091           let entity = context.hasEntity(this.entityIds[0]);
42092           if (!entity)
42093             return "";
42094           let preset = _mainPresetIndex.match(entity, context.graph());
42095           let langName = langCode && _mainLocalizer.languageName(langCode);
42096           return _t.html("issues.generic_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: genericName, language: langName });
42097         },
42098         reference: showReference,
42099         entityIds: [entityId],
42100         hash: `${nameKey}=${genericName}`,
42101         dynamicFixes: function() {
42102           return [
42103             new validationIssueFix({
42104               icon: "iD-operation-delete",
42105               title: _t.html("issues.fix.remove_the_name.title"),
42106               onClick: function(context) {
42107                 let entityId2 = this.issue.entityIds[0];
42108                 let entity = context.entity(entityId2);
42109                 let tags = Object.assign({}, entity.tags);
42110                 delete tags[nameKey];
42111                 context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_generic_name.annotation"));
42112               }
42113             })
42114           ];
42115         }
42116       });
42117       function showReference(selection2) {
42118         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42119       }
42120     }
42121     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
42122       return new validationIssue({
42123         type: type3,
42124         subtype: "not_name",
42125         severity: "warning",
42126         message: function(context) {
42127           const entity = context.hasEntity(this.entityIds[0]);
42128           if (!entity)
42129             return "";
42130           const preset = _mainPresetIndex.match(entity, context.graph());
42131           const langName = langCode && _mainLocalizer.languageName(langCode);
42132           return _t.html("issues.incorrect_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: incorrectName, language: langName });
42133         },
42134         reference: showReference,
42135         entityIds: [entityId],
42136         hash: `${nameKey}=${incorrectName}`,
42137         dynamicFixes: function() {
42138           return [
42139             new validationIssueFix({
42140               icon: "iD-operation-delete",
42141               title: _t.html("issues.fix.remove_the_name.title"),
42142               onClick: function(context) {
42143                 const entityId2 = this.issue.entityIds[0];
42144                 const entity = context.entity(entityId2);
42145                 let tags = Object.assign({}, entity.tags);
42146                 delete tags[nameKey];
42147                 context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_mistaken_name.annotation"));
42148               }
42149             })
42150           ];
42151         }
42152       });
42153       function showReference(selection2) {
42154         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42155       }
42156     }
42157     let validation = function checkGenericName(entity) {
42158       const tags = entity.tags;
42159       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
42160       if (hasWikidata)
42161         return [];
42162       let issues = [];
42163       const notNames2 = (tags["not:name"] || "").split(";");
42164       for (let key in tags) {
42165         const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
42166         if (!m)
42167           continue;
42168         const langCode = m.length >= 2 ? m[1] : null;
42169         const value = tags[key];
42170         if (notNames2.length) {
42171           for (let i2 in notNames2) {
42172             const notName = notNames2[i2];
42173             if (notName && value === notName) {
42174               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
42175               continue;
42176             }
42177           }
42178         }
42179         if (isGenericName(value, tags)) {
42180           issues.provisional = _waitingForNsi;
42181           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
42182         }
42183       }
42184       return issues;
42185     };
42186     validation.type = type3;
42187     return validation;
42188   }
42189
42190   // modules/validations/unsquare_way.js
42191   function validationUnsquareWay(context) {
42192     var type3 = "unsquare_way";
42193     var DEFAULT_DEG_THRESHOLD = 5;
42194     var epsilon3 = 0.05;
42195     var nodeThreshold = 10;
42196     function isBuilding(entity, graph) {
42197       if (entity.type !== "way" || entity.geometry(graph) !== "area")
42198         return false;
42199       return entity.tags.building && entity.tags.building !== "no";
42200     }
42201     var validation = function checkUnsquareWay(entity, graph) {
42202       if (!isBuilding(entity, graph))
42203         return [];
42204       if (entity.tags.nonsquare === "yes")
42205         return [];
42206       var isClosed = entity.isClosed();
42207       if (!isClosed)
42208         return [];
42209       var nodes = graph.childNodes(entity).slice();
42210       if (nodes.length > nodeThreshold + 1)
42211         return [];
42212       var osm = services.osm;
42213       if (!osm || nodes.some(function(node) {
42214         return !osm.isDataLoaded(node.loc);
42215       }))
42216         return [];
42217       var hasConnectedSquarableWays = nodes.some(function(node) {
42218         return graph.parentWays(node).some(function(way) {
42219           if (way.id === entity.id)
42220             return false;
42221           if (isBuilding(way, graph))
42222             return true;
42223           return graph.parentRelations(way).some(function(parentRelation) {
42224             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
42225           });
42226         });
42227       });
42228       if (hasConnectedSquarableWays)
42229         return [];
42230       var storedDegreeThreshold = corePreferences("validate-square-degrees");
42231       var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
42232       var points = nodes.map(function(node) {
42233         return context.projection(node.loc);
42234       });
42235       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
42236         return [];
42237       var autoArgs;
42238       if (!entity.tags.wikidata) {
42239         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
42240         autoAction.transitionable = false;
42241         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
42242       }
42243       return [new validationIssue({
42244         type: type3,
42245         subtype: "building",
42246         severity: "warning",
42247         message: function(context2) {
42248           var entity2 = context2.hasEntity(this.entityIds[0]);
42249           return entity2 ? _t.html("issues.unsquare_way.message", {
42250             feature: utilDisplayLabel(entity2, context2.graph())
42251           }) : "";
42252         },
42253         reference: showReference,
42254         entityIds: [entity.id],
42255         hash: degreeThreshold,
42256         dynamicFixes: function() {
42257           return [
42258             new validationIssueFix({
42259               icon: "iD-operation-orthogonalize",
42260               title: _t.html("issues.fix.square_feature.title"),
42261               autoArgs,
42262               onClick: function(context2, completionHandler) {
42263                 var entityId = this.issue.entityIds[0];
42264                 context2.perform(actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold), _t("operations.orthogonalize.annotation.feature", { n: 1 }));
42265                 window.setTimeout(function() {
42266                   completionHandler();
42267                 }, 175);
42268               }
42269             })
42270           ];
42271         }
42272       })];
42273       function showReference(selection2) {
42274         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
42275       }
42276     };
42277     validation.type = type3;
42278     return validation;
42279   }
42280
42281   // modules/core/validator.js
42282   function coreValidator(context) {
42283     let dispatch10 = dispatch_default("validated", "focusedIssue");
42284     let validator = utilRebind({}, dispatch10, "on");
42285     let _rules = {};
42286     let _disabledRules = {};
42287     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
42288     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
42289     let _baseCache = validationCache("base");
42290     let _headCache = validationCache("head");
42291     let _completeDiff = {};
42292     let _headIsCurrent = false;
42293     let _deferredRIC = {};
42294     let _deferredST = /* @__PURE__ */ new Set();
42295     let _headPromise;
42296     const RETRY = 5e3;
42297     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
42298     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
42299     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
42300     function parseHashParam(param) {
42301       let result = [];
42302       let rules = (param || "").split(",");
42303       rules.forEach((rule) => {
42304         rule = rule.trim();
42305         const parts = rule.split("/", 2);
42306         const type3 = parts[0];
42307         const subtype = parts[1] || "*";
42308         if (!type3 || !subtype)
42309           return;
42310         result.push({ type: makeRegExp(type3), subtype: makeRegExp(subtype) });
42311       });
42312       return result;
42313       function makeRegExp(str2) {
42314         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
42315         return new RegExp("^" + escaped + "$");
42316       }
42317     }
42318     validator.init = () => {
42319       Object.values(validations_exports).forEach((validation) => {
42320         if (typeof validation !== "function")
42321           return;
42322         const fn = validation(context);
42323         const key = fn.type;
42324         _rules[key] = fn;
42325       });
42326       let disabledRules = corePreferences("validate-disabledRules");
42327       if (disabledRules) {
42328         disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
42329       }
42330     };
42331     function reset(resetIgnored) {
42332       _baseCache.queue = [];
42333       _headCache.queue = [];
42334       Object.keys(_deferredRIC).forEach((key) => {
42335         window.cancelIdleCallback(key);
42336         _deferredRIC[key]();
42337       });
42338       _deferredRIC = {};
42339       _deferredST.forEach(window.clearTimeout);
42340       _deferredST.clear();
42341       if (resetIgnored)
42342         _ignoredIssueIDs.clear();
42343       _resolvedIssueIDs.clear();
42344       _baseCache = validationCache("base");
42345       _headCache = validationCache("head");
42346       _completeDiff = {};
42347       _headIsCurrent = false;
42348     }
42349     validator.reset = () => {
42350       reset(true);
42351     };
42352     validator.resetIgnoredIssues = () => {
42353       _ignoredIssueIDs.clear();
42354       dispatch10.call("validated");
42355     };
42356     validator.revalidateUnsquare = () => {
42357       revalidateUnsquare(_headCache);
42358       revalidateUnsquare(_baseCache);
42359       dispatch10.call("validated");
42360     };
42361     function revalidateUnsquare(cache) {
42362       const checkUnsquareWay = _rules.unsquare_way;
42363       if (!cache.graph || typeof checkUnsquareWay !== "function")
42364         return;
42365       cache.uncacheIssuesOfType("unsquare_way");
42366       const buildings = context.history().tree().intersects(geoExtent([-180, -90], [180, 90]), cache.graph).filter((entity) => entity.type === "way" && entity.tags.building && entity.tags.building !== "no");
42367       buildings.forEach((entity) => {
42368         const detected = checkUnsquareWay(entity, cache.graph);
42369         if (!detected.length)
42370           return;
42371         cache.cacheIssues(detected);
42372       });
42373     }
42374     validator.getIssues = (options2) => {
42375       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
42376       const view = context.map().extent();
42377       let seen = /* @__PURE__ */ new Set();
42378       let results = [];
42379       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
42380         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
42381           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42382           if (opts.what === "edited" && !userModified)
42383             return;
42384           if (!filter2(issue))
42385             return;
42386           seen.add(issue.id);
42387           results.push(issue);
42388         });
42389       }
42390       if (opts.what === "all") {
42391         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
42392           if (!filter2(issue))
42393             return;
42394           seen.add(issue.id);
42395           results.push(issue);
42396         });
42397       }
42398       return results;
42399       function filter2(issue) {
42400         if (!issue)
42401           return false;
42402         if (seen.has(issue.id))
42403           return false;
42404         if (_resolvedIssueIDs.has(issue.id))
42405           return false;
42406         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
42407           return false;
42408         if (!opts.includeDisabledRules && _disabledRules[issue.type])
42409           return false;
42410         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
42411           return false;
42412         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
42413           return false;
42414         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
42415           return false;
42416         if (opts.where === "visible") {
42417           const extent = issue.extent(context.graph());
42418           if (!view.intersects(extent))
42419             return false;
42420         }
42421         return true;
42422       }
42423     };
42424     validator.getResolvedIssues = () => {
42425       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
42426     };
42427     validator.focusIssue = (issue) => {
42428       const graph = context.graph();
42429       let selectID;
42430       let focusCenter;
42431       const issueExtent = issue.extent(graph);
42432       if (issueExtent) {
42433         focusCenter = issueExtent.center();
42434       }
42435       if (issue.entityIds && issue.entityIds.length) {
42436         selectID = issue.entityIds[0];
42437         if (selectID && selectID.charAt(0) === "r") {
42438           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
42439           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
42440           if (!nodeID) {
42441             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
42442             if (wayID) {
42443               nodeID = graph.entity(wayID).first();
42444             }
42445           }
42446           if (nodeID) {
42447             focusCenter = graph.entity(nodeID).loc;
42448           }
42449         }
42450       }
42451       if (focusCenter) {
42452         const setZoom = Math.max(context.map().zoom(), 19);
42453         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
42454       }
42455       if (selectID) {
42456         window.setTimeout(() => {
42457           context.enter(modeSelect(context, [selectID]));
42458           dispatch10.call("focusedIssue", this, issue);
42459         }, 250);
42460       }
42461     };
42462     validator.getIssuesBySeverity = (options2) => {
42463       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
42464       groups.error = groups.error || [];
42465       groups.warning = groups.warning || [];
42466       return groups;
42467     };
42468     validator.getSharedEntityIssues = (entityIDs, options2) => {
42469       const orderedIssueTypes = [
42470         "missing_tag",
42471         "missing_role",
42472         "outdated_tags",
42473         "mismatched_geometry",
42474         "crossing_ways",
42475         "almost_junction",
42476         "disconnected_way",
42477         "impossible_oneway"
42478       ];
42479       const allIssues = validator.getIssues(options2);
42480       const forEntityIDs = new Set(entityIDs);
42481       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
42482         if (issue1.type === issue2.type) {
42483           return issue1.id < issue2.id ? -1 : 1;
42484         }
42485         const index1 = orderedIssueTypes.indexOf(issue1.type);
42486         const index2 = orderedIssueTypes.indexOf(issue2.type);
42487         if (index1 !== -1 && index2 !== -1) {
42488           return index1 - index2;
42489         } else if (index1 === -1 && index2 === -1) {
42490           return issue1.type < issue2.type ? -1 : 1;
42491         } else {
42492           return index1 !== -1 ? -1 : 1;
42493         }
42494       });
42495     };
42496     validator.getEntityIssues = (entityID, options2) => {
42497       return validator.getSharedEntityIssues([entityID], options2);
42498     };
42499     validator.getRuleKeys = () => {
42500       return Object.keys(_rules);
42501     };
42502     validator.isRuleEnabled = (key) => {
42503       return !_disabledRules[key];
42504     };
42505     validator.toggleRule = (key) => {
42506       if (_disabledRules[key]) {
42507         delete _disabledRules[key];
42508       } else {
42509         _disabledRules[key] = true;
42510       }
42511       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42512       validator.validate();
42513     };
42514     validator.disableRules = (keys) => {
42515       _disabledRules = {};
42516       keys.forEach((k) => _disabledRules[k] = true);
42517       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42518       validator.validate();
42519     };
42520     validator.ignoreIssue = (issueID) => {
42521       _ignoredIssueIDs.add(issueID);
42522     };
42523     validator.validate = () => {
42524       const baseGraph = context.history().base();
42525       if (!_headCache.graph)
42526         _headCache.graph = baseGraph;
42527       if (!_baseCache.graph)
42528         _baseCache.graph = baseGraph;
42529       const prevGraph = _headCache.graph;
42530       const currGraph = context.graph();
42531       if (currGraph === prevGraph) {
42532         _headIsCurrent = true;
42533         dispatch10.call("validated");
42534         return Promise.resolve();
42535       }
42536       if (_headPromise) {
42537         _headIsCurrent = false;
42538         return _headPromise;
42539       }
42540       _headCache.graph = currGraph;
42541       _completeDiff = context.history().difference().complete();
42542       const incrementalDiff = coreDifference(prevGraph, currGraph);
42543       let entityIDs = Object.keys(incrementalDiff.complete());
42544       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
42545       if (!entityIDs.size) {
42546         dispatch10.call("validated");
42547         return Promise.resolve();
42548       }
42549       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
42550       }).then(() => {
42551         _headPromise = null;
42552         if (!_headIsCurrent) {
42553           validator.validate();
42554         }
42555       });
42556       return _headPromise;
42557     };
42558     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
42559       reset(false);
42560       validator.validate();
42561     });
42562     context.on("exit.validator", validator.validate);
42563     context.history().on("merge.validator", (entities) => {
42564       if (!entities)
42565         return;
42566       const baseGraph = context.history().base();
42567       if (!_headCache.graph)
42568         _headCache.graph = baseGraph;
42569       if (!_baseCache.graph)
42570         _baseCache.graph = baseGraph;
42571       let entityIDs = entities.map((entity) => entity.id);
42572       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
42573       validateEntitiesAsync(entityIDs, _baseCache);
42574     });
42575     function validateEntity(entity, graph) {
42576       let result = { issues: [], provisional: false };
42577       Object.keys(_rules).forEach(runValidation);
42578       return result;
42579       function runValidation(key) {
42580         const fn = _rules[key];
42581         if (typeof fn !== "function") {
42582           console.error("no such validation rule = " + key);
42583           return;
42584         }
42585         let detected = fn(entity, graph);
42586         if (detected.provisional) {
42587           result.provisional = true;
42588         }
42589         detected = detected.filter(applySeverityOverrides);
42590         result.issues = result.issues.concat(detected);
42591         function applySeverityOverrides(issue) {
42592           const type3 = issue.type;
42593           const subtype = issue.subtype || "";
42594           let i2;
42595           for (i2 = 0; i2 < _errorOverrides.length; i2++) {
42596             if (_errorOverrides[i2].type.test(type3) && _errorOverrides[i2].subtype.test(subtype)) {
42597               issue.severity = "error";
42598               return true;
42599             }
42600           }
42601           for (i2 = 0; i2 < _warningOverrides.length; i2++) {
42602             if (_warningOverrides[i2].type.test(type3) && _warningOverrides[i2].subtype.test(subtype)) {
42603               issue.severity = "warning";
42604               return true;
42605             }
42606           }
42607           for (i2 = 0; i2 < _disableOverrides.length; i2++) {
42608             if (_disableOverrides[i2].type.test(type3) && _disableOverrides[i2].subtype.test(subtype)) {
42609               return false;
42610             }
42611           }
42612           return true;
42613         }
42614       }
42615     }
42616     function updateResolvedIssues(entityIDs) {
42617       entityIDs.forEach((entityID) => {
42618         const baseIssues = _baseCache.issuesByEntityID[entityID];
42619         if (!baseIssues)
42620           return;
42621         baseIssues.forEach((issueID) => {
42622           const issue = _baseCache.issuesByIssueID[issueID];
42623           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42624           if (userModified && !_headCache.issuesByIssueID[issueID]) {
42625             _resolvedIssueIDs.add(issueID);
42626           } else {
42627             _resolvedIssueIDs.delete(issueID);
42628           }
42629         });
42630       });
42631     }
42632     function validateEntitiesAsync(entityIDs, cache) {
42633       const jobs = Array.from(entityIDs).map((entityID) => {
42634         if (cache.queuedEntityIDs.has(entityID))
42635           return null;
42636         cache.queuedEntityIDs.add(entityID);
42637         cache.uncacheEntityID(entityID);
42638         return () => {
42639           cache.queuedEntityIDs.delete(entityID);
42640           const graph = cache.graph;
42641           if (!graph)
42642             return;
42643           const entity = graph.hasEntity(entityID);
42644           if (!entity)
42645             return;
42646           const result = validateEntity(entity, graph);
42647           if (result.provisional) {
42648             cache.provisionalEntityIDs.add(entityID);
42649           }
42650           cache.cacheIssues(result.issues);
42651         };
42652       }).filter(Boolean);
42653       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
42654       if (cache.queuePromise)
42655         return cache.queuePromise;
42656       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
42657       }).finally(() => cache.queuePromise = null);
42658       return cache.queuePromise;
42659     }
42660     function revalidateProvisionalEntities(cache) {
42661       if (!cache.provisionalEntityIDs.size)
42662         return;
42663       const handle = window.setTimeout(() => {
42664         _deferredST.delete(handle);
42665         if (!cache.provisionalEntityIDs.size)
42666           return;
42667         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
42668       }, RETRY);
42669       _deferredST.add(handle);
42670     }
42671     function processQueue(cache) {
42672       if (!cache.queue.length)
42673         return Promise.resolve();
42674       const chunk = cache.queue.pop();
42675       return new Promise((resolvePromise, rejectPromise) => {
42676         const handle = window.requestIdleCallback(() => {
42677           delete _deferredRIC[handle];
42678           chunk.forEach((job) => job());
42679           resolvePromise();
42680         });
42681         _deferredRIC[handle] = rejectPromise;
42682       }).then(() => {
42683         if (cache.queue.length % 25 === 0)
42684           dispatch10.call("validated");
42685       }).then(() => processQueue(cache));
42686     }
42687     return validator;
42688   }
42689   function validationCache(which) {
42690     let cache = {
42691       which,
42692       graph: null,
42693       queue: [],
42694       queuePromise: null,
42695       queuedEntityIDs: /* @__PURE__ */ new Set(),
42696       provisionalEntityIDs: /* @__PURE__ */ new Set(),
42697       issuesByIssueID: {},
42698       issuesByEntityID: {}
42699     };
42700     cache.cacheIssue = (issue) => {
42701       (issue.entityIds || []).forEach((entityID) => {
42702         if (!cache.issuesByEntityID[entityID]) {
42703           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
42704         }
42705         cache.issuesByEntityID[entityID].add(issue.id);
42706       });
42707       cache.issuesByIssueID[issue.id] = issue;
42708     };
42709     cache.uncacheIssue = (issue) => {
42710       (issue.entityIds || []).forEach((entityID) => {
42711         if (cache.issuesByEntityID[entityID]) {
42712           cache.issuesByEntityID[entityID].delete(issue.id);
42713         }
42714       });
42715       delete cache.issuesByIssueID[issue.id];
42716     };
42717     cache.cacheIssues = (issues) => {
42718       issues.forEach(cache.cacheIssue);
42719     };
42720     cache.uncacheIssues = (issues) => {
42721       issues.forEach(cache.uncacheIssue);
42722     };
42723     cache.uncacheIssuesOfType = (type3) => {
42724       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type3);
42725       cache.uncacheIssues(issuesOfType);
42726     };
42727     cache.uncacheEntityID = (entityID) => {
42728       const entityIssueIDs = cache.issuesByEntityID[entityID];
42729       if (entityIssueIDs) {
42730         entityIssueIDs.forEach((issueID) => {
42731           const issue = cache.issuesByIssueID[issueID];
42732           if (issue) {
42733             cache.uncacheIssue(issue);
42734           } else {
42735             delete cache.issuesByIssueID[issueID];
42736           }
42737         });
42738       }
42739       delete cache.issuesByEntityID[entityID];
42740       cache.provisionalEntityIDs.delete(entityID);
42741     };
42742     cache.withAllRelatedEntities = (entityIDs) => {
42743       let result = /* @__PURE__ */ new Set();
42744       (entityIDs || []).forEach((entityID) => {
42745         result.add(entityID);
42746         const entityIssueIDs = cache.issuesByEntityID[entityID];
42747         if (entityIssueIDs) {
42748           entityIssueIDs.forEach((issueID) => {
42749             const issue = cache.issuesByIssueID[issueID];
42750             if (issue) {
42751               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
42752             } else {
42753               delete cache.issuesByIssueID[issueID];
42754             }
42755           });
42756         }
42757       });
42758       return result;
42759     };
42760     return cache;
42761   }
42762
42763   // modules/core/uploader.js
42764   function coreUploader(context) {
42765     var dispatch10 = dispatch_default("saveStarted", "saveEnded", "willAttemptUpload", "progressChanged", "resultNoChanges", "resultErrors", "resultConflicts", "resultSuccess");
42766     var _isSaving = false;
42767     var _conflicts = [];
42768     var _errors = [];
42769     var _origChanges;
42770     var _discardTags = {};
42771     _mainFileFetcher.get("discarded").then(function(d) {
42772       _discardTags = d;
42773     }).catch(function() {
42774     });
42775     var uploader = utilRebind({}, dispatch10, "on");
42776     uploader.isSaving = function() {
42777       return _isSaving;
42778     };
42779     uploader.save = function(changeset, tryAgain, checkConflicts) {
42780       if (_isSaving && !tryAgain) {
42781         return;
42782       }
42783       var osm = context.connection();
42784       if (!osm)
42785         return;
42786       if (!osm.authenticated()) {
42787         osm.authenticate(function(err) {
42788           if (!err) {
42789             uploader.save(changeset, tryAgain, checkConflicts);
42790           }
42791         });
42792         return;
42793       }
42794       if (!_isSaving) {
42795         _isSaving = true;
42796         dispatch10.call("saveStarted", this);
42797       }
42798       var history = context.history();
42799       _conflicts = [];
42800       _errors = [];
42801       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
42802       if (!tryAgain) {
42803         history.perform(actionNoop());
42804       }
42805       if (!checkConflicts) {
42806         upload(changeset);
42807       } else {
42808         performFullConflictCheck(changeset);
42809       }
42810     };
42811     function performFullConflictCheck(changeset) {
42812       var osm = context.connection();
42813       if (!osm)
42814         return;
42815       var history = context.history();
42816       var localGraph = context.graph();
42817       var remoteGraph = coreGraph(history.base(), true);
42818       var summary = history.difference().summary();
42819       var _toCheck = [];
42820       for (var i2 = 0; i2 < summary.length; i2++) {
42821         var item = summary[i2];
42822         if (item.changeType === "modified") {
42823           _toCheck.push(item.entity.id);
42824         }
42825       }
42826       var _toLoad = withChildNodes(_toCheck, localGraph);
42827       var _loaded = {};
42828       var _toLoadCount = 0;
42829       var _toLoadTotal = _toLoad.length;
42830       if (_toCheck.length) {
42831         dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
42832         _toLoad.forEach(function(id2) {
42833           _loaded[id2] = false;
42834         });
42835         osm.loadMultiple(_toLoad, loaded);
42836       } else {
42837         upload(changeset);
42838       }
42839       return;
42840       function withChildNodes(ids, graph) {
42841         var s = new Set(ids);
42842         ids.forEach(function(id2) {
42843           var entity = graph.entity(id2);
42844           if (entity.type !== "way")
42845             return;
42846           graph.childNodes(entity).forEach(function(child) {
42847             if (child.version !== void 0) {
42848               s.add(child.id);
42849             }
42850           });
42851         });
42852         return Array.from(s);
42853       }
42854       function loaded(err, result) {
42855         if (_errors.length)
42856           return;
42857         if (err) {
42858           _errors.push({
42859             msg: err.message || err.responseText,
42860             details: [_t("save.status_code", { code: err.status })]
42861           });
42862           didResultInErrors();
42863         } else {
42864           var loadMore = [];
42865           result.data.forEach(function(entity) {
42866             remoteGraph.replace(entity);
42867             _loaded[entity.id] = true;
42868             _toLoad = _toLoad.filter(function(val) {
42869               return val !== entity.id;
42870             });
42871             if (!entity.visible)
42872               return;
42873             var i3, id2;
42874             if (entity.type === "way") {
42875               for (i3 = 0; i3 < entity.nodes.length; i3++) {
42876                 id2 = entity.nodes[i3];
42877                 if (_loaded[id2] === void 0) {
42878                   _loaded[id2] = false;
42879                   loadMore.push(id2);
42880                 }
42881               }
42882             } else if (entity.type === "relation" && entity.isMultipolygon()) {
42883               for (i3 = 0; i3 < entity.members.length; i3++) {
42884                 id2 = entity.members[i3].id;
42885                 if (_loaded[id2] === void 0) {
42886                   _loaded[id2] = false;
42887                   loadMore.push(id2);
42888                 }
42889               }
42890             }
42891           });
42892           _toLoadCount += result.data.length;
42893           _toLoadTotal += loadMore.length;
42894           dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
42895           if (loadMore.length) {
42896             _toLoad.push.apply(_toLoad, loadMore);
42897             osm.loadMultiple(loadMore, loaded);
42898           }
42899           if (!_toLoad.length) {
42900             detectConflicts();
42901             upload(changeset);
42902           }
42903         }
42904       }
42905       function detectConflicts() {
42906         function choice(id2, text2, action) {
42907           return {
42908             id: id2,
42909             text: text2,
42910             action: function() {
42911               history.replace(action);
42912             }
42913           };
42914         }
42915         function formatUser(d) {
42916           return '<a href="' + osm.userURL(d) + '" target="_blank">' + escape_default(d) + "</a>";
42917         }
42918         function entityName(entity) {
42919           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
42920         }
42921         function sameVersions(local, remote) {
42922           if (local.version !== remote.version)
42923             return false;
42924           if (local.type === "way") {
42925             var children2 = utilArrayUnion(local.nodes, remote.nodes);
42926             for (var i3 = 0; i3 < children2.length; i3++) {
42927               var a = localGraph.hasEntity(children2[i3]);
42928               var b = remoteGraph.hasEntity(children2[i3]);
42929               if (a && b && a.version !== b.version)
42930                 return false;
42931             }
42932           }
42933           return true;
42934         }
42935         _toCheck.forEach(function(id2) {
42936           var local = localGraph.entity(id2);
42937           var remote = remoteGraph.entity(id2);
42938           if (sameVersions(local, remote))
42939             return;
42940           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
42941           history.replace(merge3);
42942           var mergeConflicts = merge3.conflicts();
42943           if (!mergeConflicts.length)
42944             return;
42945           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
42946           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
42947           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
42948           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
42949           _conflicts.push({
42950             id: id2,
42951             name: entityName(local),
42952             details: mergeConflicts,
42953             chosen: 1,
42954             choices: [
42955               choice(id2, keepMine, forceLocal),
42956               choice(id2, keepTheirs, forceRemote)
42957             ]
42958           });
42959         });
42960       }
42961     }
42962     function upload(changeset) {
42963       var osm = context.connection();
42964       if (!osm) {
42965         _errors.push({ msg: "No OSM Service" });
42966       }
42967       if (_conflicts.length) {
42968         didResultInConflicts(changeset);
42969       } else if (_errors.length) {
42970         didResultInErrors();
42971       } else {
42972         var history = context.history();
42973         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
42974         if (changes.modified.length || changes.created.length || changes.deleted.length) {
42975           dispatch10.call("willAttemptUpload", this);
42976           osm.putChangeset(changeset, changes, uploadCallback);
42977         } else {
42978           didResultInNoChanges();
42979         }
42980       }
42981     }
42982     function uploadCallback(err, changeset) {
42983       if (err) {
42984         if (err.status === 409) {
42985           uploader.save(changeset, true, true);
42986         } else {
42987           _errors.push({
42988             msg: err.message || err.responseText,
42989             details: [_t("save.status_code", { code: err.status })]
42990           });
42991           didResultInErrors();
42992         }
42993       } else {
42994         didResultInSuccess(changeset);
42995       }
42996     }
42997     function didResultInNoChanges() {
42998       dispatch10.call("resultNoChanges", this);
42999       endSave();
43000       context.flush();
43001     }
43002     function didResultInErrors() {
43003       context.history().pop();
43004       dispatch10.call("resultErrors", this, _errors);
43005       endSave();
43006     }
43007     function didResultInConflicts(changeset) {
43008       _conflicts.sort(function(a, b) {
43009         return b.id.localeCompare(a.id);
43010       });
43011       dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
43012       endSave();
43013     }
43014     function didResultInSuccess(changeset) {
43015       context.history().clearSaved();
43016       dispatch10.call("resultSuccess", this, changeset);
43017       window.setTimeout(function() {
43018         endSave();
43019         context.flush();
43020       }, 2500);
43021     }
43022     function endSave() {
43023       _isSaving = false;
43024       dispatch10.call("saveEnded", this);
43025     }
43026     uploader.cancelConflictResolution = function() {
43027       context.history().pop();
43028     };
43029     uploader.processResolvedConflicts = function(changeset) {
43030       var history = context.history();
43031       for (var i2 = 0; i2 < _conflicts.length; i2++) {
43032         if (_conflicts[i2].chosen === 1) {
43033           var entity = context.hasEntity(_conflicts[i2].id);
43034           if (entity && entity.type === "way") {
43035             var children2 = utilArrayUniq(entity.nodes);
43036             for (var j2 = 0; j2 < children2.length; j2++) {
43037               history.replace(actionRevert(children2[j2]));
43038             }
43039           }
43040           history.replace(actionRevert(_conflicts[i2].id));
43041         }
43042       }
43043       uploader.save(changeset, true, false);
43044     };
43045     uploader.reset = function() {
43046     };
43047     return uploader;
43048   }
43049
43050   // modules/renderer/background_source.js
43051   var import_lodash2 = __toESM(require_lodash());
43052
43053   // modules/util/IntervalTasksQueue.js
43054   var IntervalTasksQueue = class {
43055     constructor(intervalInMs) {
43056       this.intervalInMs = intervalInMs;
43057       this.pendingHandles = [];
43058       this.time = 0;
43059     }
43060     enqueue(task) {
43061       let taskTimeout = this.time;
43062       this.time += this.intervalInMs;
43063       this.pendingHandles.push(setTimeout(() => {
43064         this.time -= this.intervalInMs;
43065         task();
43066       }, taskTimeout));
43067     }
43068     clear() {
43069       this.pendingHandles.forEach((timeoutHandle) => {
43070         clearTimeout(timeoutHandle);
43071       });
43072       this.pendingHandles = [];
43073       this.time = 0;
43074     }
43075   };
43076
43077   // modules/renderer/background_source.js
43078   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43079   window.matchMedia(`
43080         (-webkit-min-device-pixel-ratio: 2), /* Safari */
43081         (min-resolution: 2dppx),             /* standard */
43082         (min-resolution: 192dpi)             /* fallback */
43083     `).addListener(function() {
43084     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43085   });
43086   function localeDateString(s) {
43087     if (!s)
43088       return null;
43089     var options2 = { day: "numeric", month: "short", year: "numeric" };
43090     var d = new Date(s);
43091     if (isNaN(d.getTime()))
43092       return null;
43093     return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
43094   }
43095   function vintageRange(vintage) {
43096     var s;
43097     if (vintage.start || vintage.end) {
43098       s = vintage.start || "?";
43099       if (vintage.start !== vintage.end) {
43100         s += " - " + (vintage.end || "?");
43101       }
43102     }
43103     return s;
43104   }
43105   function rendererBackgroundSource(data) {
43106     var source = Object.assign({}, data);
43107     var _offset = [0, 0];
43108     var _name = source.name;
43109     var _description = source.description;
43110     var _best = !!source.best;
43111     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
43112     source.tileSize = data.tileSize || 256;
43113     source.zoomExtent = data.zoomExtent || [0, 22];
43114     source.overzoom = data.overzoom !== false;
43115     source.offset = function(val) {
43116       if (!arguments.length)
43117         return _offset;
43118       _offset = val;
43119       return source;
43120     };
43121     source.nudge = function(val, zoomlevel) {
43122       _offset[0] += val[0] / Math.pow(2, zoomlevel);
43123       _offset[1] += val[1] / Math.pow(2, zoomlevel);
43124       return source;
43125     };
43126     source.name = function() {
43127       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43128       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43129     };
43130     source.label = function() {
43131       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43132       return _t.html("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43133     };
43134     source.description = function() {
43135       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43136       return _t.html("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) });
43137     };
43138     source.best = function() {
43139       return _best;
43140     };
43141     source.area = function() {
43142       if (!data.polygon)
43143         return Number.MAX_VALUE;
43144       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
43145       return isNaN(area) ? 0 : area;
43146     };
43147     source.imageryUsed = function() {
43148       return _name || source.id;
43149     };
43150     source.template = function(val) {
43151       if (!arguments.length)
43152         return _template;
43153       if (source.id === "custom" || source.id === "Bing") {
43154         _template = val;
43155       }
43156       return source;
43157     };
43158     source.url = function(coord2) {
43159       var result = _template.replace(/#[\s\S]*/u, "");
43160       if (result === "")
43161         return result;
43162       if (!source.type || source.id === "custom") {
43163         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
43164           source.type = "wms";
43165           source.projection = "EPSG:3857";
43166         } else if (/\{(x|y)\}/.test(result)) {
43167           source.type = "tms";
43168         } else if (/\{u\}/.test(result)) {
43169           source.type = "bing";
43170         }
43171       }
43172       if (source.type === "wms") {
43173         var tileToProjectedCoords = function(x, y, z) {
43174           var zoomSize = Math.pow(2, z);
43175           var lon = x / zoomSize * Math.PI * 2 - Math.PI;
43176           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
43177           switch (source.projection) {
43178             case "EPSG:4326":
43179               return {
43180                 x: lon * 180 / Math.PI,
43181                 y: lat * 180 / Math.PI
43182               };
43183             default:
43184               var mercCoords = mercatorRaw(lon, lat);
43185               return {
43186                 x: 2003750834e-2 / Math.PI * mercCoords[0],
43187                 y: 2003750834e-2 / Math.PI * mercCoords[1]
43188               };
43189           }
43190         };
43191         var tileSize = source.tileSize;
43192         var projection2 = source.projection;
43193         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
43194         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
43195         result = result.replace(/\{(\w+)\}/g, function(token, key) {
43196           switch (key) {
43197             case "width":
43198             case "height":
43199               return tileSize;
43200             case "proj":
43201               return projection2;
43202             case "wkid":
43203               return projection2.replace(/^EPSG:/, "");
43204             case "bbox":
43205               if (projection2 === "EPSG:4326" && /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
43206                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
43207               } else {
43208                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
43209               }
43210             case "w":
43211               return minXmaxY.x;
43212             case "s":
43213               return maxXminY.y;
43214             case "n":
43215               return maxXminY.x;
43216             case "e":
43217               return minXmaxY.y;
43218             default:
43219               return token;
43220           }
43221         });
43222       } else if (source.type === "tms") {
43223         result = result.replace("{x}", coord2[0]).replace("{y}", coord2[1]).replace(/\{[t-]y\}/, Math.pow(2, coord2[2]) - coord2[1] - 1).replace(/\{z(oom)?\}/, coord2[2]).replace(/\{@2x\}|\{r\}/, isRetina ? "@2x" : "");
43224       } else if (source.type === "bing") {
43225         result = result.replace("{u}", function() {
43226           var u = "";
43227           for (var zoom = coord2[2]; zoom > 0; zoom--) {
43228             var b = 0;
43229             var mask = 1 << zoom - 1;
43230             if ((coord2[0] & mask) !== 0)
43231               b++;
43232             if ((coord2[1] & mask) !== 0)
43233               b += 2;
43234             u += b.toString();
43235           }
43236           return u;
43237         });
43238       }
43239       result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
43240         var subdomains = r.split(",");
43241         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
43242       });
43243       return result;
43244     };
43245     source.validZoom = function(z) {
43246       return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
43247     };
43248     source.isLocatorOverlay = function() {
43249       return source.id === "mapbox_locator_overlay";
43250     };
43251     source.isHidden = function() {
43252       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
43253     };
43254     source.copyrightNotices = function() {
43255     };
43256     source.getMetadata = function(center, tileCoord, callback) {
43257       var vintage = {
43258         start: localeDateString(source.startDate),
43259         end: localeDateString(source.endDate)
43260       };
43261       vintage.range = vintageRange(vintage);
43262       var metadata = { vintage };
43263       callback(null, metadata);
43264     };
43265     return source;
43266   }
43267   rendererBackgroundSource.Bing = function(data, dispatch10) {
43268     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
43269     var bing = rendererBackgroundSource(data);
43270     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
43271     const strictParam = "n";
43272     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
43273     var cache = {};
43274     var inflight = {};
43275     var providers = [];
43276     var taskQueue = new IntervalTasksQueue(250);
43277     var metadataLastZoom = -1;
43278     json_default(url).then(function(json) {
43279       let imageryResource = json.resourceSets[0].resources[0];
43280       let template = imageryResource.imageUrl;
43281       let subDomains = imageryResource.imageUrlSubdomains;
43282       let subDomainNumbers = subDomains.map((subDomain) => {
43283         return subDomain.substring(1);
43284       }).join(",");
43285       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
43286       if (!new URLSearchParams(template).has(strictParam)) {
43287         template += `&${strictParam}=z`;
43288       }
43289       bing.template(template);
43290       providers = imageryResource.imageryProviders.map(function(provider) {
43291         return {
43292           attribution: provider.attribution,
43293           areas: provider.coverageAreas.map(function(area) {
43294             return {
43295               zoom: [area.zoomMin, area.zoomMax],
43296               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
43297             };
43298           })
43299         };
43300       });
43301       dispatch10.call("change");
43302     }).catch(function() {
43303     });
43304     bing.copyrightNotices = function(zoom, extent) {
43305       zoom = Math.min(zoom, 21);
43306       return providers.filter(function(provider) {
43307         return provider.areas.some(function(area) {
43308           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
43309         });
43310       }).map(function(provider) {
43311         return provider.attribution;
43312       }).join(", ");
43313     };
43314     bing.getMetadata = function(center, tileCoord, callback) {
43315       var tileID = tileCoord.slice(0, 3).join("/");
43316       var zoom = Math.min(tileCoord[2], 21);
43317       var centerPoint = center[1] + "," + center[0];
43318       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
43319       if (inflight[tileID])
43320         return;
43321       if (!cache[tileID]) {
43322         cache[tileID] = {};
43323       }
43324       if (cache[tileID] && cache[tileID].metadata) {
43325         return callback(null, cache[tileID].metadata);
43326       }
43327       inflight[tileID] = true;
43328       if (metadataLastZoom !== tileCoord[2]) {
43329         metadataLastZoom = tileCoord[2];
43330         taskQueue.clear();
43331       }
43332       taskQueue.enqueue(() => {
43333         json_default(url2).then(function(result) {
43334           delete inflight[tileID];
43335           if (!result) {
43336             throw new Error("Unknown Error");
43337           }
43338           var vintage = {
43339             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
43340             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
43341           };
43342           vintage.range = vintageRange(vintage);
43343           var metadata = { vintage };
43344           cache[tileID].metadata = metadata;
43345           if (callback)
43346             callback(null, metadata);
43347         }).catch(function(err) {
43348           delete inflight[tileID];
43349           if (callback)
43350             callback(err.message);
43351         });
43352       });
43353     };
43354     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
43355     return bing;
43356   };
43357   rendererBackgroundSource.Esri = function(data) {
43358     if (data.template.match(/blankTile/) === null) {
43359       data.template = data.template + "?blankTile=false";
43360     }
43361     var esri = rendererBackgroundSource(data);
43362     var cache = {};
43363     var inflight = {};
43364     var _prevCenter;
43365     esri.fetchTilemap = function(center) {
43366       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
43367         return;
43368       _prevCenter = center;
43369       var z = 20;
43370       var dummyUrl = esri.url([1, 2, 3]);
43371       var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
43372       var y = Math.floor((1 - Math.log(Math.tan(center[1] * Math.PI / 180) + 1 / Math.cos(center[1] * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, z));
43373       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
43374       json_default(tilemapUrl).then(function(tilemap) {
43375         if (!tilemap) {
43376           throw new Error("Unknown Error");
43377         }
43378         var hasTiles = true;
43379         for (var i2 = 0; i2 < tilemap.data.length; i2++) {
43380           if (!tilemap.data[i2]) {
43381             hasTiles = false;
43382             break;
43383           }
43384         }
43385         esri.zoomExtent[1] = hasTiles ? 22 : 19;
43386       }).catch(function() {
43387       });
43388     };
43389     esri.getMetadata = function(center, tileCoord, callback) {
43390       if (esri.id !== "EsriWorldImagery") {
43391         return callback(null, {});
43392       }
43393       var tileID = tileCoord.slice(0, 3).join("/");
43394       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
43395       var centerPoint = center[0] + "," + center[1];
43396       var unknown = _t("info_panels.background.unknown");
43397       var vintage = {};
43398       var metadata = {};
43399       if (inflight[tileID])
43400         return;
43401       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
43402       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
43403       if (!cache[tileID]) {
43404         cache[tileID] = {};
43405       }
43406       if (cache[tileID] && cache[tileID].metadata) {
43407         return callback(null, cache[tileID].metadata);
43408       }
43409       inflight[tileID] = true;
43410       json_default(url).then(function(result) {
43411         delete inflight[tileID];
43412         result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
43413         if (!result) {
43414           throw new Error("Unknown Error");
43415         } else if (result.features && result.features.length < 1) {
43416           throw new Error("No Results");
43417         } else if (result.error && result.error.message) {
43418           throw new Error(result.error.message);
43419         }
43420         var captureDate = localeDateString(result.SRC_DATE2);
43421         vintage = {
43422           start: captureDate,
43423           end: captureDate,
43424           range: captureDate
43425         };
43426         metadata = {
43427           vintage,
43428           source: clean2(result.NICE_NAME),
43429           description: clean2(result.NICE_DESC),
43430           resolution: clean2(+parseFloat(result.SRC_RES).toFixed(4)),
43431           accuracy: clean2(+parseFloat(result.SRC_ACC).toFixed(4))
43432         };
43433         if (isFinite(metadata.resolution)) {
43434           metadata.resolution += " m";
43435         }
43436         if (isFinite(metadata.accuracy)) {
43437           metadata.accuracy += " m";
43438         }
43439         cache[tileID].metadata = metadata;
43440         if (callback)
43441           callback(null, metadata);
43442       }).catch(function(err) {
43443         delete inflight[tileID];
43444         if (callback)
43445           callback(err.message);
43446       });
43447       function clean2(val) {
43448         return String(val).trim() || unknown;
43449       }
43450     };
43451     return esri;
43452   };
43453   rendererBackgroundSource.None = function() {
43454     var source = rendererBackgroundSource({ id: "none", template: "" });
43455     source.name = function() {
43456       return _t("background.none");
43457     };
43458     source.label = function() {
43459       return _t.html("background.none");
43460     };
43461     source.imageryUsed = function() {
43462       return null;
43463     };
43464     source.area = function() {
43465       return -1;
43466     };
43467     return source;
43468   };
43469   rendererBackgroundSource.Custom = function(template) {
43470     var source = rendererBackgroundSource({ id: "custom", template });
43471     source.name = function() {
43472       return _t("background.custom");
43473     };
43474     source.label = function() {
43475       return _t.html("background.custom");
43476     };
43477     source.imageryUsed = function() {
43478       var cleaned = source.template();
43479       if (cleaned.indexOf("?") !== -1) {
43480         var parts = cleaned.split("?", 2);
43481         var qs = utilStringQs(parts[1]);
43482         ["access_token", "connectId", "token"].forEach(function(param) {
43483           if (qs[param]) {
43484             qs[param] = "{apikey}";
43485           }
43486         });
43487         cleaned = parts[0] + "?" + utilQsString(qs, true);
43488       }
43489       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
43490       return "Custom (" + cleaned + " )";
43491     };
43492     source.area = function() {
43493       return -2;
43494     };
43495     return source;
43496   };
43497
43498   // modules/renderer/background.js
43499   var import_which_polygon4 = __toESM(require_which_polygon());
43500
43501   // modules/renderer/tile_layer.js
43502   function rendererTileLayer(context) {
43503     var transformProp = utilPrefixCSSProperty("Transform");
43504     var tiler8 = utilTiler();
43505     var _tileSize = 256;
43506     var _projection;
43507     var _cache4 = {};
43508     var _tileOrigin;
43509     var _zoom;
43510     var _source;
43511     function tileSizeAtZoom(d, z) {
43512       var EPSILON = 2e-3;
43513       return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
43514     }
43515     function atZoom(t, distance) {
43516       var power = Math.pow(2, distance);
43517       return [
43518         Math.floor(t[0] * power),
43519         Math.floor(t[1] * power),
43520         t[2] + distance
43521       ];
43522     }
43523     function lookUp(d) {
43524       for (var up = -1; up > -d[2]; up--) {
43525         var tile = atZoom(d, up);
43526         if (_cache4[_source.url(tile)] !== false) {
43527           return tile;
43528         }
43529       }
43530     }
43531     function uniqueBy(a, n2) {
43532       var o = [];
43533       var seen = {};
43534       for (var i2 = 0; i2 < a.length; i2++) {
43535         if (seen[a[i2][n2]] === void 0) {
43536           o.push(a[i2]);
43537           seen[a[i2][n2]] = true;
43538         }
43539       }
43540       return o;
43541     }
43542     function addSource(d) {
43543       d.push(_source.url(d));
43544       return d;
43545     }
43546     function background(selection2) {
43547       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
43548       var pixelOffset;
43549       if (_source) {
43550         pixelOffset = [
43551           _source.offset()[0] * Math.pow(2, _zoom),
43552           _source.offset()[1] * Math.pow(2, _zoom)
43553         ];
43554       } else {
43555         pixelOffset = [0, 0];
43556       }
43557       var translate = [
43558         _projection.translate()[0] + pixelOffset[0],
43559         _projection.translate()[1] + pixelOffset[1]
43560       ];
43561       tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
43562       _tileOrigin = [
43563         _projection.scale() * Math.PI - translate[0],
43564         _projection.scale() * Math.PI - translate[1]
43565       ];
43566       render(selection2);
43567     }
43568     function render(selection2) {
43569       if (!_source)
43570         return;
43571       var requests = [];
43572       var showDebug = context.getDebug("tile") && !_source.overlay;
43573       if (_source.validZoom(_zoom)) {
43574         tiler8.skipNullIsland(!!_source.overlay);
43575         tiler8().forEach(function(d) {
43576           addSource(d);
43577           if (d[3] === "")
43578             return;
43579           if (typeof d[3] !== "string")
43580             return;
43581           requests.push(d);
43582           if (_cache4[d[3]] === false && lookUp(d)) {
43583             requests.push(addSource(lookUp(d)));
43584           }
43585         });
43586         requests = uniqueBy(requests, 3).filter(function(r) {
43587           return _cache4[r[3]] !== false;
43588         });
43589       }
43590       function load(d3_event, d) {
43591         _cache4[d[3]] = true;
43592         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
43593         render(selection2);
43594       }
43595       function error(d3_event, d) {
43596         _cache4[d[3]] = false;
43597         select_default2(this).on("error", null).on("load", null).remove();
43598         render(selection2);
43599       }
43600       function imageTransform(d) {
43601         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43602         var scale = tileSizeAtZoom(d, _zoom);
43603         return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
43604       }
43605       function tileCenter(d) {
43606         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43607         return [
43608           d[0] * ts - _tileOrigin[0] + ts / 2,
43609           d[1] * ts - _tileOrigin[1] + ts / 2
43610         ];
43611       }
43612       function debugTransform(d) {
43613         var coord2 = tileCenter(d);
43614         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
43615       }
43616       var dims = tiler8.size();
43617       var mapCenter = [dims[0] / 2, dims[1] / 2];
43618       var minDist = Math.max(dims[0], dims[1]);
43619       var nearCenter;
43620       requests.forEach(function(d) {
43621         var c = tileCenter(d);
43622         var dist = geoVecLength(c, mapCenter);
43623         if (dist < minDist) {
43624           minDist = dist;
43625           nearCenter = d;
43626         }
43627       });
43628       var image = selection2.selectAll("img").data(requests, function(d) {
43629         return d[3];
43630       });
43631       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
43632         var tile = select_default2(this);
43633         window.setTimeout(function() {
43634           if (tile.classed("tile-removing")) {
43635             tile.remove();
43636           }
43637         }, 300);
43638       });
43639       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
43640         return d[3];
43641       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
43642         return d === nearCenter;
43643       });
43644       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
43645         return d[3];
43646       });
43647       debug2.exit().remove();
43648       if (showDebug) {
43649         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
43650         debugEnter.append("div").attr("class", "tile-label-debug-coord");
43651         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
43652         debug2 = debug2.merge(debugEnter);
43653         debug2.style(transformProp, debugTransform);
43654         debug2.selectAll(".tile-label-debug-coord").text(function(d) {
43655           return d[2] + " / " + d[0] + " / " + d[1];
43656         });
43657         debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
43658           var span = select_default2(this);
43659           var center = context.projection.invert(tileCenter(d));
43660           _source.getMetadata(center, d, function(err, result) {
43661             if (result && result.vintage && result.vintage.range) {
43662               span.text(result.vintage.range);
43663             } else {
43664               span.html(_t.html("info_panels.background.vintage") + ": " + _t.html("info_panels.background.unknown"));
43665             }
43666           });
43667         });
43668       }
43669     }
43670     background.projection = function(val) {
43671       if (!arguments.length)
43672         return _projection;
43673       _projection = val;
43674       return background;
43675     };
43676     background.dimensions = function(val) {
43677       if (!arguments.length)
43678         return tiler8.size();
43679       tiler8.size(val);
43680       return background;
43681     };
43682     background.source = function(val) {
43683       if (!arguments.length)
43684         return _source;
43685       _source = val;
43686       _tileSize = _source.tileSize;
43687       _cache4 = {};
43688       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
43689       return background;
43690     };
43691     return background;
43692   }
43693
43694   // modules/renderer/background.js
43695   var _imageryIndex = null;
43696   function rendererBackground(context) {
43697     const dispatch10 = dispatch_default("change");
43698     const baseLayer = rendererTileLayer(context).projection(context.projection);
43699     let _checkedBlocklists = [];
43700     let _isValid = true;
43701     let _overlayLayers = [];
43702     let _brightness = 1;
43703     let _contrast = 1;
43704     let _saturation = 1;
43705     let _sharpness = 1;
43706     function ensureImageryIndex() {
43707       return _mainFileFetcher.get("imagery").then((sources) => {
43708         if (_imageryIndex)
43709           return _imageryIndex;
43710         _imageryIndex = {
43711           imagery: sources,
43712           features: {}
43713         };
43714         const features2 = sources.map((source) => {
43715           if (!source.polygon)
43716             return null;
43717           const rings = source.polygon.map((ring) => [ring]);
43718           const feature3 = {
43719             type: "Feature",
43720             properties: { id: source.id },
43721             geometry: { type: "MultiPolygon", coordinates: rings }
43722           };
43723           _imageryIndex.features[source.id] = feature3;
43724           return feature3;
43725         }).filter(Boolean);
43726         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: features2 });
43727         _imageryIndex.backgrounds = sources.map((source) => {
43728           if (source.type === "bing") {
43729             return rendererBackgroundSource.Bing(source, dispatch10);
43730           } else if (/^EsriWorldImagery/.test(source.id)) {
43731             return rendererBackgroundSource.Esri(source);
43732           } else {
43733             return rendererBackgroundSource(source);
43734           }
43735         });
43736         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
43737         let template = corePreferences("background-custom-template") || "";
43738         const custom = rendererBackgroundSource.Custom(template);
43739         _imageryIndex.backgrounds.unshift(custom);
43740         return _imageryIndex;
43741       });
43742     }
43743     function background(selection2) {
43744       const currSource = baseLayer.source();
43745       if (context.map().zoom() > 18) {
43746         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
43747           const center = context.map().center();
43748           currSource.fetchTilemap(center);
43749         }
43750       }
43751       const sources = background.sources(context.map().extent());
43752       const wasValid = _isValid;
43753       _isValid = !!sources.filter((d) => d === currSource).length;
43754       if (wasValid !== _isValid) {
43755         background.updateImagery();
43756       }
43757       let baseFilter = "";
43758       if (_brightness !== 1) {
43759         baseFilter += ` brightness(${_brightness})`;
43760       }
43761       if (_contrast !== 1) {
43762         baseFilter += ` contrast(${_contrast})`;
43763       }
43764       if (_saturation !== 1) {
43765         baseFilter += ` saturate(${_saturation})`;
43766       }
43767       if (_sharpness < 1) {
43768         const blur = number_default(0.5, 5)(1 - _sharpness);
43769         baseFilter += ` blur(${blur}px)`;
43770       }
43771       let base = selection2.selectAll(".layer-background").data([0]);
43772       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
43773       base.style("filter", baseFilter || null);
43774       let imagery = base.selectAll(".layer-imagery").data([0]);
43775       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
43776       let maskFilter = "";
43777       let mixBlendMode = "";
43778       if (_sharpness > 1) {
43779         mixBlendMode = "overlay";
43780         maskFilter = "saturate(0) blur(3px) invert(1)";
43781         let contrast = _sharpness - 1;
43782         maskFilter += ` contrast(${contrast})`;
43783         let brightness = number_default(1, 0.85)(_sharpness - 1);
43784         maskFilter += ` brightness(${brightness})`;
43785       }
43786       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
43787       mask.exit().remove();
43788       mask.enter().append("div").attr("class", "layer layer-mask layer-unsharp-mask").merge(mask).call(baseLayer).style("filter", maskFilter || null).style("mix-blend-mode", mixBlendMode || null);
43789       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
43790       overlays.exit().remove();
43791       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
43792     }
43793     background.updateImagery = function() {
43794       let currSource = baseLayer.source();
43795       if (context.inIntro() || !currSource)
43796         return;
43797       let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
43798       const meters = geoOffsetToMeters(currSource.offset());
43799       const EPSILON = 0.01;
43800       const x = +meters[0].toFixed(2);
43801       const y = +meters[1].toFixed(2);
43802       let hash = utilStringQs(window.location.hash);
43803       let id2 = currSource.id;
43804       if (id2 === "custom") {
43805         id2 = `custom:${currSource.template()}`;
43806       }
43807       if (id2) {
43808         hash.background = id2;
43809       } else {
43810         delete hash.background;
43811       }
43812       if (o) {
43813         hash.overlays = o;
43814       } else {
43815         delete hash.overlays;
43816       }
43817       if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
43818         hash.offset = `${x},${y}`;
43819       } else {
43820         delete hash.offset;
43821       }
43822       if (!window.mocha) {
43823         window.location.replace("#" + utilQsString(hash, true));
43824       }
43825       let imageryUsed = [];
43826       let photoOverlaysUsed = [];
43827       const currUsed = currSource.imageryUsed();
43828       if (currUsed && _isValid) {
43829         imageryUsed.push(currUsed);
43830       }
43831       _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
43832       const dataLayer = context.layers().layer("data");
43833       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
43834         imageryUsed.push(dataLayer.getSrc());
43835       }
43836       const photoOverlayLayers = {
43837         streetside: "Bing Streetside",
43838         mapillary: "Mapillary Images",
43839         "mapillary-map-features": "Mapillary Map Features",
43840         "mapillary-signs": "Mapillary Signs",
43841         kartaview: "KartaView Images"
43842       };
43843       for (let layerID in photoOverlayLayers) {
43844         const layer = context.layers().layer(layerID);
43845         if (layer && layer.enabled()) {
43846           photoOverlaysUsed.push(layerID);
43847           imageryUsed.push(photoOverlayLayers[layerID]);
43848         }
43849       }
43850       context.history().imageryUsed(imageryUsed);
43851       context.history().photoOverlaysUsed(photoOverlaysUsed);
43852     };
43853     background.sources = (extent, zoom, includeCurrent) => {
43854       if (!_imageryIndex)
43855         return [];
43856       let visible = {};
43857       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
43858       const currSource = baseLayer.source();
43859       const osm = context.connection();
43860       const blocklists = osm && osm.imageryBlocklists() || [];
43861       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
43862       if (blocklistChanged) {
43863         _imageryIndex.backgrounds.forEach((source) => {
43864           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
43865         });
43866         _checkedBlocklists = blocklists.map((regex) => String(regex));
43867       }
43868       return _imageryIndex.backgrounds.filter((source) => {
43869         if (includeCurrent && currSource === source)
43870           return true;
43871         if (source.isBlocked)
43872           return false;
43873         if (!source.polygon)
43874           return true;
43875         if (zoom && zoom < 6)
43876           return false;
43877         return visible[source.id];
43878       });
43879     };
43880     background.dimensions = (val) => {
43881       if (!val)
43882         return;
43883       baseLayer.dimensions(val);
43884       _overlayLayers.forEach((layer) => layer.dimensions(val));
43885     };
43886     background.baseLayerSource = function(d) {
43887       if (!arguments.length)
43888         return baseLayer.source();
43889       const osm = context.connection();
43890       if (!osm)
43891         return background;
43892       const blocklists = osm.imageryBlocklists();
43893       const template = d.template();
43894       let fail = false;
43895       let tested = 0;
43896       let regex;
43897       for (let i2 = 0; i2 < blocklists.length; i2++) {
43898         regex = blocklists[i2];
43899         fail = regex.test(template);
43900         tested++;
43901         if (fail)
43902           break;
43903       }
43904       if (!tested) {
43905         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
43906         fail = regex.test(template);
43907       }
43908       baseLayer.source(!fail ? d : background.findSource("none"));
43909       dispatch10.call("change");
43910       background.updateImagery();
43911       return background;
43912     };
43913     background.findSource = (id2) => {
43914       if (!id2 || !_imageryIndex)
43915         return null;
43916       return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
43917     };
43918     background.bing = () => {
43919       background.baseLayerSource(background.findSource("Bing"));
43920     };
43921     background.showsLayer = (d) => {
43922       const currSource = baseLayer.source();
43923       if (!d || !currSource)
43924         return false;
43925       return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
43926     };
43927     background.overlayLayerSources = () => {
43928       return _overlayLayers.map((layer) => layer.source());
43929     };
43930     background.toggleOverlayLayer = (d) => {
43931       let layer;
43932       for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
43933         layer = _overlayLayers[i2];
43934         if (layer.source() === d) {
43935           _overlayLayers.splice(i2, 1);
43936           dispatch10.call("change");
43937           background.updateImagery();
43938           return;
43939         }
43940       }
43941       layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(baseLayer.dimensions());
43942       _overlayLayers.push(layer);
43943       dispatch10.call("change");
43944       background.updateImagery();
43945     };
43946     background.nudge = (d, zoom) => {
43947       const currSource = baseLayer.source();
43948       if (currSource) {
43949         currSource.nudge(d, zoom);
43950         dispatch10.call("change");
43951         background.updateImagery();
43952       }
43953       return background;
43954     };
43955     background.offset = function(d) {
43956       const currSource = baseLayer.source();
43957       if (!arguments.length) {
43958         return currSource && currSource.offset() || [0, 0];
43959       }
43960       if (currSource) {
43961         currSource.offset(d);
43962         dispatch10.call("change");
43963         background.updateImagery();
43964       }
43965       return background;
43966     };
43967     background.brightness = function(d) {
43968       if (!arguments.length)
43969         return _brightness;
43970       _brightness = d;
43971       if (context.mode())
43972         dispatch10.call("change");
43973       return background;
43974     };
43975     background.contrast = function(d) {
43976       if (!arguments.length)
43977         return _contrast;
43978       _contrast = d;
43979       if (context.mode())
43980         dispatch10.call("change");
43981       return background;
43982     };
43983     background.saturation = function(d) {
43984       if (!arguments.length)
43985         return _saturation;
43986       _saturation = d;
43987       if (context.mode())
43988         dispatch10.call("change");
43989       return background;
43990     };
43991     background.sharpness = function(d) {
43992       if (!arguments.length)
43993         return _sharpness;
43994       _sharpness = d;
43995       if (context.mode())
43996         dispatch10.call("change");
43997       return background;
43998     };
43999     let _loadPromise;
44000     background.ensureLoaded = () => {
44001       if (_loadPromise)
44002         return _loadPromise;
44003       function parseMapParams(qmap) {
44004         if (!qmap)
44005           return false;
44006         const params = qmap.split("/").map(Number);
44007         if (params.length < 3 || params.some(isNaN))
44008           return false;
44009         return geoExtent([params[2], params[1]]);
44010       }
44011       const hash = utilStringQs(window.location.hash);
44012       const requested = hash.background || hash.layer;
44013       let extent = parseMapParams(hash.map);
44014       return _loadPromise = ensureImageryIndex().then((imageryIndex) => {
44015         const first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0];
44016         let best;
44017         if (!requested && extent) {
44018           best = background.sources(extent).find((s) => s.best());
44019         }
44020         if (requested && requested.indexOf("custom:") === 0) {
44021           const template = requested.replace(/^custom:/, "");
44022           const custom = background.findSource("custom");
44023           background.baseLayerSource(custom.template(template));
44024           corePreferences("background-custom-template", template);
44025         } else {
44026           background.baseLayerSource(background.findSource(requested) || best || background.findSource(corePreferences("background-last-used")) || background.findSource("Bing") || first || background.findSource("none"));
44027         }
44028         const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
44029         if (locator) {
44030           background.toggleOverlayLayer(locator);
44031         }
44032         const overlays = (hash.overlays || "").split(",");
44033         overlays.forEach((overlay) => {
44034           overlay = background.findSource(overlay);
44035           if (overlay) {
44036             background.toggleOverlayLayer(overlay);
44037           }
44038         });
44039         if (hash.gpx) {
44040           const gpx2 = context.layers().layer("data");
44041           if (gpx2) {
44042             gpx2.url(hash.gpx, ".gpx");
44043           }
44044         }
44045         if (hash.offset) {
44046           const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
44047           if (offset.length === 2) {
44048             background.offset(geoMetersToOffset(offset));
44049           }
44050         }
44051       }).catch(() => {
44052       });
44053     };
44054     return utilRebind(background, dispatch10, "on");
44055   }
44056
44057   // modules/renderer/features.js
44058   function rendererFeatures(context) {
44059     var dispatch10 = dispatch_default("change", "redraw");
44060     var features2 = utilRebind({}, dispatch10, "on");
44061     var _deferred2 = /* @__PURE__ */ new Set();
44062     var traffic_roads = {
44063       "motorway": true,
44064       "motorway_link": true,
44065       "trunk": true,
44066       "trunk_link": true,
44067       "primary": true,
44068       "primary_link": true,
44069       "secondary": true,
44070       "secondary_link": true,
44071       "tertiary": true,
44072       "tertiary_link": true,
44073       "residential": true,
44074       "unclassified": true,
44075       "living_street": true
44076     };
44077     var service_roads = {
44078       "service": true,
44079       "road": true,
44080       "track": true
44081     };
44082     var paths = {
44083       "path": true,
44084       "footway": true,
44085       "cycleway": true,
44086       "bridleway": true,
44087       "steps": true,
44088       "pedestrian": true
44089     };
44090     var past_futures = {
44091       "proposed": true,
44092       "construction": true,
44093       "abandoned": true,
44094       "dismantled": true,
44095       "disused": true,
44096       "razed": true,
44097       "demolished": true,
44098       "obliterated": true
44099     };
44100     var _cullFactor = 1;
44101     var _cache4 = {};
44102     var _rules = {};
44103     var _stats = {};
44104     var _keys = [];
44105     var _hidden = [];
44106     var _forceVisible = {};
44107     function update() {
44108       if (!window.mocha) {
44109         var hash = utilStringQs(window.location.hash);
44110         var disabled = features2.disabled();
44111         if (disabled.length) {
44112           hash.disable_features = disabled.join(",");
44113         } else {
44114           delete hash.disable_features;
44115         }
44116         window.location.replace("#" + utilQsString(hash, true));
44117         corePreferences("disabled-features", disabled.join(","));
44118       }
44119       _hidden = features2.hidden();
44120       dispatch10.call("change");
44121       dispatch10.call("redraw");
44122     }
44123     function defineRule(k, filter2, max3) {
44124       var isEnabled = true;
44125       _keys.push(k);
44126       _rules[k] = {
44127         filter: filter2,
44128         enabled: isEnabled,
44129         count: 0,
44130         currentMax: max3 || Infinity,
44131         defaultMax: max3 || Infinity,
44132         enable: function() {
44133           this.enabled = true;
44134           this.currentMax = this.defaultMax;
44135         },
44136         disable: function() {
44137           this.enabled = false;
44138           this.currentMax = 0;
44139         },
44140         hidden: function() {
44141           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
44142         },
44143         autoHidden: function() {
44144           return this.hidden() && this.currentMax > 0;
44145         }
44146       };
44147     }
44148     defineRule("points", function isPoint(tags, geometry) {
44149       return geometry === "point";
44150     }, 200);
44151     defineRule("traffic_roads", function isTrafficRoad(tags) {
44152       return traffic_roads[tags.highway];
44153     });
44154     defineRule("service_roads", function isServiceRoad(tags) {
44155       return service_roads[tags.highway];
44156     });
44157     defineRule("paths", function isPath(tags) {
44158       return paths[tags.highway];
44159     });
44160     defineRule("buildings", function isBuilding(tags) {
44161       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
44162     }, 250);
44163     defineRule("building_parts", function isBuildingPart(tags) {
44164       return tags["building:part"];
44165     });
44166     defineRule("indoor", function isIndoor(tags) {
44167       return tags.indoor;
44168     });
44169     defineRule("landuse", function isLanduse(tags, geometry) {
44170       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
44171     });
44172     defineRule("boundaries", function isBoundary(tags) {
44173       return !!tags.boundary && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway] || tags.waterway || tags.railway || tags.landuse || tags.natural || tags.building || tags.power);
44174     });
44175     defineRule("water", function isWater(tags) {
44176       return !!tags.waterway || tags.natural === "water" || tags.natural === "coastline" || tags.natural === "bay" || tags.landuse === "pond" || tags.landuse === "basin" || tags.landuse === "reservoir" || tags.landuse === "salt_pond";
44177     });
44178     defineRule("rail", function isRail(tags) {
44179       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
44180     });
44181     defineRule("pistes", function isPiste(tags) {
44182       return tags["piste:type"];
44183     });
44184     defineRule("aerialways", function isPiste(tags) {
44185       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
44186     });
44187     defineRule("power", function isPower(tags) {
44188       return !!tags.power;
44189     });
44190     defineRule("past_future", function isPastFuture(tags) {
44191       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
44192         return false;
44193       }
44194       var strings = Object.keys(tags);
44195       for (var i2 = 0; i2 < strings.length; i2++) {
44196         var s = strings[i2];
44197         if (past_futures[s] || past_futures[tags[s]]) {
44198           return true;
44199         }
44200       }
44201       return false;
44202     });
44203     defineRule("others", function isOther(tags, geometry) {
44204       return geometry === "line" || geometry === "area";
44205     });
44206     features2.features = function() {
44207       return _rules;
44208     };
44209     features2.keys = function() {
44210       return _keys;
44211     };
44212     features2.enabled = function(k) {
44213       if (!arguments.length) {
44214         return _keys.filter(function(k2) {
44215           return _rules[k2].enabled;
44216         });
44217       }
44218       return _rules[k] && _rules[k].enabled;
44219     };
44220     features2.disabled = function(k) {
44221       if (!arguments.length) {
44222         return _keys.filter(function(k2) {
44223           return !_rules[k2].enabled;
44224         });
44225       }
44226       return _rules[k] && !_rules[k].enabled;
44227     };
44228     features2.hidden = function(k) {
44229       if (!arguments.length) {
44230         return _keys.filter(function(k2) {
44231           return _rules[k2].hidden();
44232         });
44233       }
44234       return _rules[k] && _rules[k].hidden();
44235     };
44236     features2.autoHidden = function(k) {
44237       if (!arguments.length) {
44238         return _keys.filter(function(k2) {
44239           return _rules[k2].autoHidden();
44240         });
44241       }
44242       return _rules[k] && _rules[k].autoHidden();
44243     };
44244     features2.enable = function(k) {
44245       if (_rules[k] && !_rules[k].enabled) {
44246         _rules[k].enable();
44247         update();
44248       }
44249     };
44250     features2.enableAll = function() {
44251       var didEnable = false;
44252       for (var k in _rules) {
44253         if (!_rules[k].enabled) {
44254           didEnable = true;
44255           _rules[k].enable();
44256         }
44257       }
44258       if (didEnable)
44259         update();
44260     };
44261     features2.disable = function(k) {
44262       if (_rules[k] && _rules[k].enabled) {
44263         _rules[k].disable();
44264         update();
44265       }
44266     };
44267     features2.disableAll = function() {
44268       var didDisable = false;
44269       for (var k in _rules) {
44270         if (_rules[k].enabled) {
44271           didDisable = true;
44272           _rules[k].disable();
44273         }
44274       }
44275       if (didDisable)
44276         update();
44277     };
44278     features2.toggle = function(k) {
44279       if (_rules[k]) {
44280         (function(f2) {
44281           return f2.enabled ? f2.disable() : f2.enable();
44282         })(_rules[k]);
44283         update();
44284       }
44285     };
44286     features2.resetStats = function() {
44287       for (var i2 = 0; i2 < _keys.length; i2++) {
44288         _rules[_keys[i2]].count = 0;
44289       }
44290       dispatch10.call("change");
44291     };
44292     features2.gatherStats = function(d, resolver, dimensions) {
44293       var needsRedraw = false;
44294       var types = utilArrayGroupBy(d, "type");
44295       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44296       var currHidden, geometry, matches, i2, j2;
44297       for (i2 = 0; i2 < _keys.length; i2++) {
44298         _rules[_keys[i2]].count = 0;
44299       }
44300       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
44301       for (i2 = 0; i2 < entities.length; i2++) {
44302         geometry = entities[i2].geometry(resolver);
44303         matches = Object.keys(features2.getMatches(entities[i2], resolver, geometry));
44304         for (j2 = 0; j2 < matches.length; j2++) {
44305           _rules[matches[j2]].count++;
44306         }
44307       }
44308       currHidden = features2.hidden();
44309       if (currHidden !== _hidden) {
44310         _hidden = currHidden;
44311         needsRedraw = true;
44312         dispatch10.call("change");
44313       }
44314       return needsRedraw;
44315     };
44316     features2.stats = function() {
44317       for (var i2 = 0; i2 < _keys.length; i2++) {
44318         _stats[_keys[i2]] = _rules[_keys[i2]].count;
44319       }
44320       return _stats;
44321     };
44322     features2.clear = function(d) {
44323       for (var i2 = 0; i2 < d.length; i2++) {
44324         features2.clearEntity(d[i2]);
44325       }
44326     };
44327     features2.clearEntity = function(entity) {
44328       delete _cache4[osmEntity.key(entity)];
44329     };
44330     features2.reset = function() {
44331       Array.from(_deferred2).forEach(function(handle) {
44332         window.cancelIdleCallback(handle);
44333         _deferred2.delete(handle);
44334       });
44335       _cache4 = {};
44336     };
44337     function relationShouldBeChecked(relation) {
44338       return relation.tags.type === "boundary";
44339     }
44340     features2.getMatches = function(entity, resolver, geometry) {
44341       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
44342         return {};
44343       var ent = osmEntity.key(entity);
44344       if (!_cache4[ent]) {
44345         _cache4[ent] = {};
44346       }
44347       if (!_cache4[ent].matches) {
44348         var matches = {};
44349         var hasMatch = false;
44350         for (var i2 = 0; i2 < _keys.length; i2++) {
44351           if (_keys[i2] === "others") {
44352             if (hasMatch)
44353               continue;
44354             if (entity.type === "way") {
44355               var parents = features2.getParents(entity, resolver, geometry);
44356               if (parents.length === 1 && parents[0].isMultipolygon() || parents.length > 0 && parents.every(function(parent) {
44357                 return parent.tags.type === "boundary";
44358               })) {
44359                 var pkey = osmEntity.key(parents[0]);
44360                 if (_cache4[pkey] && _cache4[pkey].matches) {
44361                   matches = Object.assign({}, _cache4[pkey].matches);
44362                   continue;
44363                 }
44364               }
44365             }
44366           }
44367           if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
44368             matches[_keys[i2]] = hasMatch = true;
44369           }
44370         }
44371         _cache4[ent].matches = matches;
44372       }
44373       return _cache4[ent].matches;
44374     };
44375     features2.getParents = function(entity, resolver, geometry) {
44376       if (geometry === "point")
44377         return [];
44378       var ent = osmEntity.key(entity);
44379       if (!_cache4[ent]) {
44380         _cache4[ent] = {};
44381       }
44382       if (!_cache4[ent].parents) {
44383         var parents = [];
44384         if (geometry === "vertex") {
44385           parents = resolver.parentWays(entity);
44386         } else {
44387           parents = resolver.parentRelations(entity);
44388         }
44389         _cache4[ent].parents = parents;
44390       }
44391       return _cache4[ent].parents;
44392     };
44393     features2.isHiddenPreset = function(preset, geometry) {
44394       if (!_hidden.length)
44395         return false;
44396       if (!preset.tags)
44397         return false;
44398       var test = preset.setTags({}, geometry);
44399       for (var key in _rules) {
44400         if (_rules[key].filter(test, geometry)) {
44401           if (_hidden.indexOf(key) !== -1) {
44402             return key;
44403           }
44404           return false;
44405         }
44406       }
44407       return false;
44408     };
44409     features2.isHiddenFeature = function(entity, resolver, geometry) {
44410       if (!_hidden.length)
44411         return false;
44412       if (!entity.version)
44413         return false;
44414       if (_forceVisible[entity.id])
44415         return false;
44416       var matches = Object.keys(features2.getMatches(entity, resolver, geometry));
44417       return matches.length && matches.every(function(k) {
44418         return features2.hidden(k);
44419       });
44420     };
44421     features2.isHiddenChild = function(entity, resolver, geometry) {
44422       if (!_hidden.length)
44423         return false;
44424       if (!entity.version || geometry === "point")
44425         return false;
44426       if (_forceVisible[entity.id])
44427         return false;
44428       var parents = features2.getParents(entity, resolver, geometry);
44429       if (!parents.length)
44430         return false;
44431       for (var i2 = 0; i2 < parents.length; i2++) {
44432         if (!features2.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
44433           return false;
44434         }
44435       }
44436       return true;
44437     };
44438     features2.hasHiddenConnections = function(entity, resolver) {
44439       if (!_hidden.length)
44440         return false;
44441       var childNodes, connections;
44442       if (entity.type === "midpoint") {
44443         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
44444         connections = [];
44445       } else {
44446         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
44447         connections = features2.getParents(entity, resolver, entity.geometry(resolver));
44448       }
44449       connections = childNodes.reduce(function(result, e) {
44450         return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
44451       }, connections);
44452       return connections.some(function(e) {
44453         return features2.isHidden(e, resolver, e.geometry(resolver));
44454       });
44455     };
44456     features2.isHidden = function(entity, resolver, geometry) {
44457       if (!_hidden.length)
44458         return false;
44459       if (!entity.version)
44460         return false;
44461       var fn = geometry === "vertex" ? features2.isHiddenChild : features2.isHiddenFeature;
44462       return fn(entity, resolver, geometry);
44463     };
44464     features2.filter = function(d, resolver) {
44465       if (!_hidden.length)
44466         return d;
44467       var result = [];
44468       for (var i2 = 0; i2 < d.length; i2++) {
44469         var entity = d[i2];
44470         if (!features2.isHidden(entity, resolver, entity.geometry(resolver))) {
44471           result.push(entity);
44472         }
44473       }
44474       return result;
44475     };
44476     features2.forceVisible = function(entityIDs) {
44477       if (!arguments.length)
44478         return Object.keys(_forceVisible);
44479       _forceVisible = {};
44480       for (var i2 = 0; i2 < entityIDs.length; i2++) {
44481         _forceVisible[entityIDs[i2]] = true;
44482         var entity = context.hasEntity(entityIDs[i2]);
44483         if (entity && entity.type === "relation") {
44484           for (var j2 in entity.members) {
44485             _forceVisible[entity.members[j2].id] = true;
44486           }
44487         }
44488       }
44489       return features2;
44490     };
44491     features2.init = function() {
44492       var storage = corePreferences("disabled-features");
44493       if (storage) {
44494         var storageDisabled = storage.replace(/;/g, ",").split(",");
44495         storageDisabled.forEach(features2.disable);
44496       }
44497       var hash = utilStringQs(window.location.hash);
44498       if (hash.disable_features) {
44499         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
44500         hashDisabled.forEach(features2.disable);
44501       }
44502     };
44503     context.history().on("merge.features", function(newEntities) {
44504       if (!newEntities)
44505         return;
44506       var handle = window.requestIdleCallback(function() {
44507         var graph = context.graph();
44508         var types = utilArrayGroupBy(newEntities, "type");
44509         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44510         for (var i2 = 0; i2 < entities.length; i2++) {
44511           var geometry = entities[i2].geometry(graph);
44512           features2.getMatches(entities[i2], graph, geometry);
44513         }
44514       });
44515       _deferred2.add(handle);
44516     });
44517     return features2;
44518   }
44519
44520   // modules/svg/areas.js
44521   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
44522
44523   // modules/svg/helpers.js
44524   function svgPassiveVertex(node, graph, activeID) {
44525     if (!activeID)
44526       return 1;
44527     if (activeID === node.id)
44528       return 0;
44529     var parents = graph.parentWays(node);
44530     var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
44531     for (i2 = 0; i2 < parents.length; i2++) {
44532       nodes = parents[i2].nodes;
44533       isClosed = parents[i2].isClosed();
44534       for (j2 = 0; j2 < nodes.length; j2++) {
44535         if (nodes[j2] === node.id) {
44536           ix1 = j2 - 2;
44537           ix2 = j2 - 1;
44538           ix3 = j2 + 1;
44539           ix4 = j2 + 2;
44540           if (isClosed) {
44541             max3 = nodes.length - 1;
44542             if (ix1 < 0)
44543               ix1 = max3 + ix1;
44544             if (ix2 < 0)
44545               ix2 = max3 + ix2;
44546             if (ix3 > max3)
44547               ix3 = ix3 - max3;
44548             if (ix4 > max3)
44549               ix4 = ix4 - max3;
44550           }
44551           if (nodes[ix1] === activeID)
44552             return 0;
44553           else if (nodes[ix2] === activeID)
44554             return 2;
44555           else if (nodes[ix3] === activeID)
44556             return 2;
44557           else if (nodes[ix4] === activeID)
44558             return 0;
44559           else if (isClosed && nodes.indexOf(activeID) !== -1)
44560             return 0;
44561         }
44562       }
44563     }
44564     return 1;
44565   }
44566   function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
44567     return function(entity) {
44568       var i2 = 0;
44569       var offset = dt;
44570       var segments = [];
44571       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
44572       var coordinates = graph.childNodes(entity).map(function(n2) {
44573         return n2.loc;
44574       });
44575       var a, b;
44576       if (shouldReverse(entity)) {
44577         coordinates.reverse();
44578       }
44579       stream_default({
44580         type: "LineString",
44581         coordinates
44582       }, projection2.stream(clip({
44583         lineStart: function() {
44584         },
44585         lineEnd: function() {
44586           a = null;
44587         },
44588         point: function(x, y) {
44589           b = [x, y];
44590           if (a) {
44591             var span = geoVecLength(a, b) - offset;
44592             if (span >= 0) {
44593               var heading = geoVecAngle(a, b);
44594               var dx = dt * Math.cos(heading);
44595               var dy = dt * Math.sin(heading);
44596               var p = [
44597                 a[0] + offset * Math.cos(heading),
44598                 a[1] + offset * Math.sin(heading)
44599               ];
44600               var coord2 = [a, p];
44601               for (span -= dt; span >= 0; span -= dt) {
44602                 p = geoVecAdd(p, [dx, dy]);
44603                 coord2.push(p);
44604               }
44605               coord2.push(b);
44606               var segment = "";
44607               var j2;
44608               for (j2 = 0; j2 < coord2.length; j2++) {
44609                 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44610               }
44611               segments.push({ id: entity.id, index: i2++, d: segment });
44612               if (bothDirections(entity)) {
44613                 segment = "";
44614                 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
44615                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44616                 }
44617                 segments.push({ id: entity.id, index: i2++, d: segment });
44618               }
44619             }
44620             offset = -span;
44621           }
44622           a = b;
44623         }
44624       })));
44625       return segments;
44626     };
44627   }
44628   function svgPath(projection2, graph, isArea) {
44629     var cache = {};
44630     var padding = isArea ? 65 : 5;
44631     var viewport = projection2.clipExtent();
44632     var paddedExtent = [
44633       [viewport[0][0] - padding, viewport[0][1] - padding],
44634       [viewport[1][0] + padding, viewport[1][1] + padding]
44635     ];
44636     var clip = identity_default2().clipExtent(paddedExtent).stream;
44637     var project = projection2.stream;
44638     var path = path_default().projection({ stream: function(output) {
44639       return project(clip(output));
44640     } });
44641     var svgpath = function(entity) {
44642       if (entity.id in cache) {
44643         return cache[entity.id];
44644       } else {
44645         return cache[entity.id] = path(entity.asGeoJSON(graph));
44646       }
44647     };
44648     svgpath.geojson = function(d) {
44649       if (d.__featurehash__ !== void 0) {
44650         if (d.__featurehash__ in cache) {
44651           return cache[d.__featurehash__];
44652         } else {
44653           return cache[d.__featurehash__] = path(d);
44654         }
44655       } else {
44656         return path(d);
44657       }
44658     };
44659     return svgpath;
44660   }
44661   function svgPointTransform(projection2) {
44662     var svgpoint = function(entity) {
44663       var pt = projection2(entity.loc);
44664       return "translate(" + pt[0] + "," + pt[1] + ")";
44665     };
44666     svgpoint.geojson = function(d) {
44667       return svgpoint(d.properties.entity);
44668     };
44669     return svgpoint;
44670   }
44671   function svgRelationMemberTags(graph) {
44672     return function(entity) {
44673       var tags = entity.tags;
44674       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
44675       graph.parentRelations(entity).forEach(function(relation) {
44676         var type3 = relation.tags.type;
44677         if (type3 === "multipolygon" && shouldCopyMultipolygonTags || type3 === "boundary") {
44678           tags = Object.assign({}, relation.tags, tags);
44679         }
44680       });
44681       return tags;
44682     };
44683   }
44684   function svgSegmentWay(way, graph, activeID) {
44685     if (activeID === void 0) {
44686       return graph.transient(way, "waySegments", getWaySegments);
44687     } else {
44688       return getWaySegments();
44689     }
44690     function getWaySegments() {
44691       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
44692       var features2 = { passive: [], active: [] };
44693       var start2 = {};
44694       var end = {};
44695       var node, type3;
44696       for (var i2 = 0; i2 < way.nodes.length; i2++) {
44697         node = graph.entity(way.nodes[i2]);
44698         type3 = svgPassiveVertex(node, graph, activeID);
44699         end = { node, type: type3 };
44700         if (start2.type !== void 0) {
44701           if (start2.node.id === activeID || end.node.id === activeID) {
44702           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
44703             pushActive(start2, end, i2);
44704           } else if (start2.type === 0 && end.type === 0) {
44705             pushActive(start2, end, i2);
44706           } else {
44707             pushPassive(start2, end, i2);
44708           }
44709         }
44710         start2 = end;
44711       }
44712       return features2;
44713       function pushActive(start3, end2, index) {
44714         features2.active.push({
44715           type: "Feature",
44716           id: way.id + "-" + index + "-nope",
44717           properties: {
44718             nope: true,
44719             target: true,
44720             entity: way,
44721             nodes: [start3.node, end2.node],
44722             index
44723           },
44724           geometry: {
44725             type: "LineString",
44726             coordinates: [start3.node.loc, end2.node.loc]
44727           }
44728         });
44729       }
44730       function pushPassive(start3, end2, index) {
44731         features2.passive.push({
44732           type: "Feature",
44733           id: way.id + "-" + index,
44734           properties: {
44735             target: true,
44736             entity: way,
44737             nodes: [start3.node, end2.node],
44738             index
44739           },
44740           geometry: {
44741             type: "LineString",
44742             coordinates: [start3.node.loc, end2.node.loc]
44743           }
44744         });
44745       }
44746     }
44747   }
44748
44749   // modules/svg/tag_classes.js
44750   function svgTagClasses() {
44751     var primaries = [
44752       "building",
44753       "highway",
44754       "railway",
44755       "waterway",
44756       "aeroway",
44757       "aerialway",
44758       "piste:type",
44759       "boundary",
44760       "power",
44761       "amenity",
44762       "natural",
44763       "landuse",
44764       "leisure",
44765       "military",
44766       "place",
44767       "man_made",
44768       "route",
44769       "attraction",
44770       "building:part",
44771       "indoor"
44772     ];
44773     var statuses = [
44774       "proposed",
44775       "planned",
44776       "construction",
44777       "disused",
44778       "abandoned",
44779       "dismantled",
44780       "razed",
44781       "demolished",
44782       "obliterated",
44783       "intermittent"
44784     ];
44785     var secondaries = [
44786       "oneway",
44787       "bridge",
44788       "tunnel",
44789       "embankment",
44790       "cutting",
44791       "barrier",
44792       "surface",
44793       "tracktype",
44794       "footway",
44795       "crossing",
44796       "service",
44797       "sport",
44798       "public_transport",
44799       "location",
44800       "parking",
44801       "golf",
44802       "type",
44803       "leisure",
44804       "man_made",
44805       "indoor",
44806       "construction",
44807       "proposed"
44808     ];
44809     var _tags = function(entity) {
44810       return entity.tags;
44811     };
44812     var tagClasses = function(selection2) {
44813       selection2.each(function tagClassesEach(entity) {
44814         var value = this.className;
44815         if (value.baseVal !== void 0) {
44816           value = value.baseVal;
44817         }
44818         var t = _tags(entity);
44819         var computed = tagClasses.getClassesString(t, value);
44820         if (computed !== value) {
44821           select_default2(this).attr("class", computed);
44822         }
44823       });
44824     };
44825     tagClasses.getClassesString = function(t, value) {
44826       var primary, status;
44827       var i2, j2, k, v;
44828       var overrideGeometry;
44829       if (/\bstroke\b/.test(value)) {
44830         if (!!t.barrier && t.barrier !== "no") {
44831           overrideGeometry = "line";
44832         }
44833       }
44834       var classes = value.trim().split(/\s+/).filter(function(klass) {
44835         return klass.length && !/^tag-/.test(klass);
44836       }).map(function(klass) {
44837         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
44838       });
44839       for (i2 = 0; i2 < primaries.length; i2++) {
44840         k = primaries[i2];
44841         v = t[k];
44842         if (!v || v === "no")
44843           continue;
44844         if (k === "piste:type") {
44845           k = "piste";
44846         } else if (k === "building:part") {
44847           k = "building_part";
44848         }
44849         primary = k;
44850         if (statuses.indexOf(v) !== -1) {
44851           status = v;
44852           classes.push("tag-" + k);
44853         } else {
44854           classes.push("tag-" + k);
44855           classes.push("tag-" + k + "-" + v);
44856         }
44857         break;
44858       }
44859       if (!primary) {
44860         for (i2 = 0; i2 < statuses.length; i2++) {
44861           for (j2 = 0; j2 < primaries.length; j2++) {
44862             k = statuses[i2] + ":" + primaries[j2];
44863             v = t[k];
44864             if (!v || v === "no")
44865               continue;
44866             status = statuses[i2];
44867             break;
44868           }
44869         }
44870       }
44871       if (!status) {
44872         for (i2 = 0; i2 < statuses.length; i2++) {
44873           k = statuses[i2];
44874           v = t[k];
44875           if (!v || v === "no")
44876             continue;
44877           if (v === "yes") {
44878             status = k;
44879           } else if (primary && primary === v) {
44880             status = k;
44881           } else if (!primary && primaries.indexOf(v) !== -1) {
44882             status = k;
44883             primary = v;
44884             classes.push("tag-" + v);
44885           }
44886           if (status)
44887             break;
44888         }
44889       }
44890       if (status) {
44891         classes.push("tag-status");
44892         classes.push("tag-status-" + status);
44893       }
44894       for (i2 = 0; i2 < secondaries.length; i2++) {
44895         k = secondaries[i2];
44896         v = t[k];
44897         if (!v || v === "no" || k === primary)
44898           continue;
44899         classes.push("tag-" + k);
44900         classes.push("tag-" + k + "-" + v);
44901       }
44902       if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
44903         var surface = t.highway === "track" ? "unpaved" : "paved";
44904         for (k in t) {
44905           v = t[k];
44906           if (k in osmPavedTags) {
44907             surface = osmPavedTags[k][v] ? "paved" : "unpaved";
44908           }
44909           if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
44910             surface = "semipaved";
44911           }
44912         }
44913         classes.push("tag-" + surface);
44914       }
44915       var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
44916       if (qid) {
44917         classes.push("tag-wikidata");
44918       }
44919       return classes.join(" ").trim();
44920     };
44921     tagClasses.tags = function(val) {
44922       if (!arguments.length)
44923         return _tags;
44924       _tags = val;
44925       return tagClasses;
44926     };
44927     return tagClasses;
44928   }
44929
44930   // modules/svg/tag_pattern.js
44931   var patterns = {
44932     amenity: {
44933       grave_yard: "cemetery",
44934       fountain: "water_standing"
44935     },
44936     landuse: {
44937       cemetery: [
44938         { religion: "christian", pattern: "cemetery_christian" },
44939         { religion: "buddhist", pattern: "cemetery_buddhist" },
44940         { religion: "muslim", pattern: "cemetery_muslim" },
44941         { religion: "jewish", pattern: "cemetery_jewish" },
44942         { pattern: "cemetery" }
44943       ],
44944       construction: "construction",
44945       farmland: "farmland",
44946       farmyard: "farmyard",
44947       forest: [
44948         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
44949         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
44950         { leaf_type: "leafless", pattern: "forest_leafless" },
44951         { pattern: "forest" }
44952       ],
44953       grave_yard: "cemetery",
44954       grass: "grass",
44955       landfill: "landfill",
44956       meadow: "meadow",
44957       military: "construction",
44958       orchard: "orchard",
44959       quarry: "quarry",
44960       vineyard: "vineyard"
44961     },
44962     leisure: {
44963       horse_riding: "farmyard"
44964     },
44965     natural: {
44966       beach: "beach",
44967       grassland: "grass",
44968       sand: "beach",
44969       scrub: "scrub",
44970       water: [
44971         { water: "pond", pattern: "pond" },
44972         { water: "reservoir", pattern: "water_standing" },
44973         { pattern: "waves" }
44974       ],
44975       wetland: [
44976         { wetland: "marsh", pattern: "wetland_marsh" },
44977         { wetland: "swamp", pattern: "wetland_swamp" },
44978         { wetland: "bog", pattern: "wetland_bog" },
44979         { wetland: "reedbed", pattern: "wetland_reedbed" },
44980         { pattern: "wetland" }
44981       ],
44982       wood: [
44983         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
44984         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
44985         { leaf_type: "leafless", pattern: "forest_leafless" },
44986         { pattern: "forest" }
44987       ]
44988     },
44989     golf: {
44990       green: "golf_green",
44991       tee: "grass",
44992       fairway: "grass",
44993       rough: "scrub"
44994     },
44995     surface: {
44996       grass: "grass",
44997       sand: "beach"
44998     }
44999   };
45000   function svgTagPattern(tags) {
45001     if (tags.building && tags.building !== "no") {
45002       return null;
45003     }
45004     for (var tag in patterns) {
45005       var entityValue = tags[tag];
45006       if (!entityValue)
45007         continue;
45008       if (typeof patterns[tag] === "string") {
45009         return "pattern-" + patterns[tag];
45010       } else {
45011         var values = patterns[tag];
45012         for (var value in values) {
45013           if (entityValue !== value)
45014             continue;
45015           var rules = values[value];
45016           if (typeof rules === "string") {
45017             return "pattern-" + rules;
45018           }
45019           for (var ruleKey in rules) {
45020             var rule = rules[ruleKey];
45021             var pass = true;
45022             for (var criterion in rule) {
45023               if (criterion !== "pattern") {
45024                 var v = tags[criterion];
45025                 if (!v || v !== rule[criterion]) {
45026                   pass = false;
45027                   break;
45028                 }
45029               }
45030             }
45031             if (pass) {
45032               return "pattern-" + rule.pattern;
45033             }
45034           }
45035         }
45036       }
45037     }
45038     return null;
45039   }
45040
45041   // modules/svg/areas.js
45042   function svgAreas(projection2, context) {
45043     function getPatternStyle(tags) {
45044       var imageID = svgTagPattern(tags);
45045       if (imageID) {
45046         return 'url("#ideditor-' + imageID + '")';
45047       }
45048       return "";
45049     }
45050     function drawTargets(selection2, graph, entities, filter2) {
45051       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
45052       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
45053       var getPath = svgPath(projection2).geojson;
45054       var activeID = context.activeID();
45055       var base = context.history().base();
45056       var data = { targets: [], nopes: [] };
45057       entities.forEach(function(way) {
45058         var features2 = svgSegmentWay(way, graph, activeID);
45059         data.targets.push.apply(data.targets, features2.passive);
45060         data.nopes.push.apply(data.nopes, features2.active);
45061       });
45062       var targetData = data.targets.filter(getPath);
45063       var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
45064         return filter2(d.properties.entity);
45065       }).data(targetData, function key(d) {
45066         return d.id;
45067       });
45068       targets.exit().remove();
45069       var segmentWasEdited = function(d) {
45070         var wayID = d.properties.entity.id;
45071         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
45072           return false;
45073         }
45074         return d.properties.nodes.some(function(n2) {
45075           return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
45076         });
45077       };
45078       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
45079         return "way area target target-allowed " + targetClass + d.id;
45080       }).classed("segment-edited", segmentWasEdited);
45081       var nopeData = data.nopes.filter(getPath);
45082       var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
45083         return filter2(d.properties.entity);
45084       }).data(nopeData, function key(d) {
45085         return d.id;
45086       });
45087       nopes.exit().remove();
45088       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
45089         return "way area target target-nope " + nopeClass + d.id;
45090       }).classed("segment-edited", segmentWasEdited);
45091     }
45092     function drawAreas(selection2, graph, entities, filter2) {
45093       var path = svgPath(projection2, graph, true);
45094       var areas = {};
45095       var multipolygon;
45096       var base = context.history().base();
45097       for (var i2 = 0; i2 < entities.length; i2++) {
45098         var entity = entities[i2];
45099         if (entity.geometry(graph) !== "area")
45100           continue;
45101         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
45102         if (multipolygon) {
45103           areas[multipolygon.id] = {
45104             entity: multipolygon.mergeTags(entity.tags),
45105             area: Math.abs(entity.area(graph))
45106           };
45107         } else if (!areas[entity.id]) {
45108           areas[entity.id] = {
45109             entity,
45110             area: Math.abs(entity.area(graph))
45111           };
45112         }
45113       }
45114       var fills = Object.values(areas).filter(function hasPath(a) {
45115         return path(a.entity);
45116       });
45117       fills.sort(function areaSort(a, b) {
45118         return b.area - a.area;
45119       });
45120       fills = fills.map(function(a) {
45121         return a.entity;
45122       });
45123       var strokes = fills.filter(function(area) {
45124         return area.type === "way";
45125       });
45126       var data = {
45127         clip: fills,
45128         shadow: strokes,
45129         stroke: strokes,
45130         fill: fills
45131       };
45132       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
45133       clipPaths.exit().remove();
45134       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
45135         return "ideditor-" + entity2.id + "-clippath";
45136       });
45137       clipPathsEnter.append("path");
45138       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
45139       var drawLayer = selection2.selectAll(".layer-osm.areas");
45140       var touchLayer = selection2.selectAll(".layer-touch.areas");
45141       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
45142       areagroup = areagroup.enter().append("g").attr("class", function(d) {
45143         return "areagroup area-" + d;
45144       }).merge(areagroup);
45145       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
45146         return data[layer];
45147       }, osmEntity.key);
45148       paths.exit().remove();
45149       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
45150       var bisect = bisector(function(node) {
45151         return -node.__data__.area(graph);
45152       }).left;
45153       function sortedByArea(entity2) {
45154         if (this._parent.__data__ === "fill") {
45155           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
45156         }
45157       }
45158       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
45159         var layer = this.parentNode.__data__;
45160         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
45161         if (layer === "fill") {
45162           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
45163           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
45164         }
45165       }).classed("added", function(d) {
45166         return !base.entities[d.id];
45167       }).classed("geometry-edited", function(d) {
45168         return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
45169       }).classed("retagged", function(d) {
45170         return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
45171       }).call(svgTagClasses()).attr("d", path);
45172       touchLayer.call(drawTargets, graph, data.stroke, filter2);
45173     }
45174     return drawAreas;
45175   }
45176
45177   // modules/svg/data.js
45178   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
45179
45180   // node_modules/@tmcw/togeojson/dist/togeojson.es.js
45181   function nodeVal(x) {
45182     if (x && x.normalize) {
45183       x.normalize();
45184     }
45185     return x && x.textContent || "";
45186   }
45187   function get1(x, y) {
45188     const n2 = x.getElementsByTagName(y);
45189     return n2.length ? n2[0] : null;
45190   }
45191   function getLineStyle(extensions) {
45192     const style = {};
45193     if (extensions) {
45194       const lineStyle = get1(extensions, "line");
45195       if (lineStyle) {
45196         const color2 = nodeVal(get1(lineStyle, "color")), opacity = parseFloat(nodeVal(get1(lineStyle, "opacity"))), width = parseFloat(nodeVal(get1(lineStyle, "width")));
45197         if (color2)
45198           style.stroke = color2;
45199         if (!isNaN(opacity))
45200           style["stroke-opacity"] = opacity;
45201         if (!isNaN(width))
45202           style["stroke-width"] = width * 96 / 25.4;
45203       }
45204     }
45205     return style;
45206   }
45207   function getExtensions(node) {
45208     let values = [];
45209     if (node !== null) {
45210       for (let i2 = 0; i2 < node.childNodes.length; i2++) {
45211         const child = node.childNodes[i2];
45212         if (child.nodeType !== 1)
45213           continue;
45214         const name2 = ["heart", "gpxtpx:hr", "hr"].includes(child.nodeName) ? "heart" : child.nodeName;
45215         if (name2 === "gpxtpx:TrackPointExtension") {
45216           values = values.concat(getExtensions(child));
45217         } else {
45218           const val = nodeVal(child);
45219           values.push([name2, isNaN(val) ? val : parseFloat(val)]);
45220         }
45221       }
45222     }
45223     return values;
45224   }
45225   function getMulti(x, ys) {
45226     const o = {};
45227     let n2;
45228     let k;
45229     for (k = 0; k < ys.length; k++) {
45230       n2 = get1(x, ys[k]);
45231       if (n2)
45232         o[ys[k]] = nodeVal(n2);
45233     }
45234     return o;
45235   }
45236   function getProperties$1(node) {
45237     const prop = getMulti(node, [
45238       "name",
45239       "cmt",
45240       "desc",
45241       "type",
45242       "time",
45243       "keywords"
45244     ]);
45245     const extensions = node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*");
45246     for (let i2 = 0; i2 < extensions.length; i2++) {
45247       const extension = extensions[i2];
45248       if (extension.parentNode.parentNode === node) {
45249         prop[extension.tagName.replace(":", "_")] = nodeVal(extension);
45250       }
45251     }
45252     const links = node.getElementsByTagName("link");
45253     if (links.length)
45254       prop.links = [];
45255     for (let i2 = 0; i2 < links.length; i2++) {
45256       prop.links.push(Object.assign({ href: links[i2].getAttribute("href") }, getMulti(links[i2], ["text", "type"])));
45257     }
45258     return prop;
45259   }
45260   function coordPair$1(x) {
45261     const ll = [
45262       parseFloat(x.getAttribute("lon")),
45263       parseFloat(x.getAttribute("lat"))
45264     ];
45265     const ele = get1(x, "ele");
45266     const time = get1(x, "time");
45267     if (ele) {
45268       const e = parseFloat(nodeVal(ele));
45269       if (!isNaN(e)) {
45270         ll.push(e);
45271       }
45272     }
45273     return {
45274       coordinates: ll,
45275       time: time ? nodeVal(time) : null,
45276       extendedValues: getExtensions(get1(x, "extensions"))
45277     };
45278   }
45279   function getRoute(node) {
45280     const line = getPoints$1(node, "rtept");
45281     if (!line)
45282       return;
45283     return {
45284       type: "Feature",
45285       properties: Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "rte" }),
45286       geometry: {
45287         type: "LineString",
45288         coordinates: line.line
45289       }
45290     };
45291   }
45292   function getPoints$1(node, pointname) {
45293     const pts = node.getElementsByTagName(pointname);
45294     if (pts.length < 2)
45295       return;
45296     const line = [];
45297     const times = [];
45298     const extendedValues = {};
45299     for (let i2 = 0; i2 < pts.length; i2++) {
45300       const c = coordPair$1(pts[i2]);
45301       line.push(c.coordinates);
45302       if (c.time)
45303         times.push(c.time);
45304       for (let j2 = 0; j2 < c.extendedValues.length; j2++) {
45305         const [name2, val] = c.extendedValues[j2];
45306         const plural = name2 === "heart" ? name2 : name2.replace("gpxtpx:", "") + "s";
45307         if (!extendedValues[plural]) {
45308           extendedValues[plural] = Array(pts.length).fill(null);
45309         }
45310         extendedValues[plural][i2] = val;
45311       }
45312     }
45313     return {
45314       line,
45315       times,
45316       extendedValues
45317     };
45318   }
45319   function getTrack(node) {
45320     const segments = node.getElementsByTagName("trkseg");
45321     const track = [];
45322     const times = [];
45323     const extractedLines = [];
45324     for (let i2 = 0; i2 < segments.length; i2++) {
45325       const line = getPoints$1(segments[i2], "trkpt");
45326       if (line) {
45327         extractedLines.push(line);
45328         if (line.times && line.times.length)
45329           times.push(line.times);
45330       }
45331     }
45332     if (extractedLines.length === 0)
45333       return;
45334     const multi = extractedLines.length > 1;
45335     const properties = Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "trk" }, times.length ? {
45336       coordinateProperties: {
45337         times: multi ? times : times[0]
45338       }
45339     } : {});
45340     for (let i2 = 0; i2 < extractedLines.length; i2++) {
45341       const line = extractedLines[i2];
45342       track.push(line.line);
45343       for (const [name2, val] of Object.entries(line.extendedValues)) {
45344         if (!properties.coordinateProperties) {
45345           properties.coordinateProperties = {};
45346         }
45347         const props = properties.coordinateProperties;
45348         if (multi) {
45349           if (!props[name2])
45350             props[name2] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
45351           props[name2][i2] = val;
45352         } else {
45353           props[name2] = val;
45354         }
45355       }
45356     }
45357     return {
45358       type: "Feature",
45359       properties,
45360       geometry: multi ? {
45361         type: "MultiLineString",
45362         coordinates: track
45363       } : {
45364         type: "LineString",
45365         coordinates: track[0]
45366       }
45367     };
45368   }
45369   function getPoint(node) {
45370     return {
45371       type: "Feature",
45372       properties: Object.assign(getProperties$1(node), getMulti(node, ["sym"])),
45373       geometry: {
45374         type: "Point",
45375         coordinates: coordPair$1(node).coordinates
45376       }
45377     };
45378   }
45379   function* gpxGen(doc) {
45380     const tracks = doc.getElementsByTagName("trk");
45381     const routes = doc.getElementsByTagName("rte");
45382     const waypoints = doc.getElementsByTagName("wpt");
45383     for (let i2 = 0; i2 < tracks.length; i2++) {
45384       const feature3 = getTrack(tracks[i2]);
45385       if (feature3)
45386         yield feature3;
45387     }
45388     for (let i2 = 0; i2 < routes.length; i2++) {
45389       const feature3 = getRoute(routes[i2]);
45390       if (feature3)
45391         yield feature3;
45392     }
45393     for (let i2 = 0; i2 < waypoints.length; i2++) {
45394       yield getPoint(waypoints[i2]);
45395     }
45396   }
45397   function gpx(doc) {
45398     return {
45399       type: "FeatureCollection",
45400       features: Array.from(gpxGen(doc))
45401     };
45402   }
45403   var removeSpace = /\s*/g;
45404   var trimSpace = /^\s*|\s*$/g;
45405   var splitSpace = /\s+/;
45406   function okhash(x) {
45407     if (!x || !x.length)
45408       return 0;
45409     let h = 0;
45410     for (let i2 = 0; i2 < x.length; i2++) {
45411       h = (h << 5) - h + x.charCodeAt(i2) | 0;
45412     }
45413     return h;
45414   }
45415   function coord1(v) {
45416     return v.replace(removeSpace, "").split(",").map(parseFloat);
45417   }
45418   function coord(v) {
45419     return v.replace(trimSpace, "").split(splitSpace).map(coord1);
45420   }
45421   function xml2str(node) {
45422     if (node.xml !== void 0)
45423       return node.xml;
45424     if (node.tagName) {
45425       let output = node.tagName;
45426       for (let i2 = 0; i2 < node.attributes.length; i2++) {
45427         output += node.attributes[i2].name + node.attributes[i2].value;
45428       }
45429       for (let i2 = 0; i2 < node.childNodes.length; i2++) {
45430         output += xml2str(node.childNodes[i2]);
45431       }
45432       return output;
45433     }
45434     if (node.nodeName === "#text") {
45435       return (node.nodeValue || node.value || "").trim();
45436     }
45437     if (node.nodeName === "#cdata-section") {
45438       return node.nodeValue;
45439     }
45440     return "";
45441   }
45442   var geotypes = ["Polygon", "LineString", "Point", "Track", "gx:Track"];
45443   function kmlColor(properties, elem, prefix) {
45444     let v = nodeVal(get1(elem, "color")) || "";
45445     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
45446     if (v.substr(0, 1) === "#") {
45447       v = v.substr(1);
45448     }
45449     if (v.length === 6 || v.length === 3) {
45450       properties[colorProp] = v;
45451     } else if (v.length === 8) {
45452       properties[prefix + "-opacity"] = parseInt(v.substr(0, 2), 16) / 255;
45453       properties[colorProp] = "#" + v.substr(6, 2) + v.substr(4, 2) + v.substr(2, 2);
45454     }
45455   }
45456   function numericProperty(properties, elem, source, target) {
45457     const val = parseFloat(nodeVal(get1(elem, source)));
45458     if (!isNaN(val))
45459       properties[target] = val;
45460   }
45461   function gxCoords(root3) {
45462     let elems = root3.getElementsByTagName("coord");
45463     const coords = [];
45464     const times = [];
45465     if (elems.length === 0)
45466       elems = root3.getElementsByTagName("gx:coord");
45467     for (let i2 = 0; i2 < elems.length; i2++) {
45468       coords.push(nodeVal(elems[i2]).split(" ").map(parseFloat));
45469     }
45470     const timeElems = root3.getElementsByTagName("when");
45471     for (let j2 = 0; j2 < timeElems.length; j2++)
45472       times.push(nodeVal(timeElems[j2]));
45473     return {
45474       coords,
45475       times
45476     };
45477   }
45478   function getGeometry(root3) {
45479     let geomNode;
45480     let geomNodes;
45481     let i2;
45482     let j2;
45483     let k;
45484     const geoms = [];
45485     const coordTimes = [];
45486     if (get1(root3, "MultiGeometry")) {
45487       return getGeometry(get1(root3, "MultiGeometry"));
45488     }
45489     if (get1(root3, "MultiTrack")) {
45490       return getGeometry(get1(root3, "MultiTrack"));
45491     }
45492     if (get1(root3, "gx:MultiTrack")) {
45493       return getGeometry(get1(root3, "gx:MultiTrack"));
45494     }
45495     for (i2 = 0; i2 < geotypes.length; i2++) {
45496       geomNodes = root3.getElementsByTagName(geotypes[i2]);
45497       if (geomNodes) {
45498         for (j2 = 0; j2 < geomNodes.length; j2++) {
45499           geomNode = geomNodes[j2];
45500           if (geotypes[i2] === "Point") {
45501             geoms.push({
45502               type: "Point",
45503               coordinates: coord1(nodeVal(get1(geomNode, "coordinates")))
45504             });
45505           } else if (geotypes[i2] === "LineString") {
45506             geoms.push({
45507               type: "LineString",
45508               coordinates: coord(nodeVal(get1(geomNode, "coordinates")))
45509             });
45510           } else if (geotypes[i2] === "Polygon") {
45511             const rings = geomNode.getElementsByTagName("LinearRing"), coords = [];
45512             for (k = 0; k < rings.length; k++) {
45513               coords.push(coord(nodeVal(get1(rings[k], "coordinates"))));
45514             }
45515             geoms.push({
45516               type: "Polygon",
45517               coordinates: coords
45518             });
45519           } else if (geotypes[i2] === "Track" || geotypes[i2] === "gx:Track") {
45520             const track = gxCoords(geomNode);
45521             geoms.push({
45522               type: "LineString",
45523               coordinates: track.coords
45524             });
45525             if (track.times.length)
45526               coordTimes.push(track.times);
45527           }
45528         }
45529       }
45530     }
45531     return {
45532       geoms,
45533       coordTimes
45534     };
45535   }
45536   function getPlacemark(root3, styleIndex, styleMapIndex, styleByHash) {
45537     const geomsAndTimes = getGeometry(root3);
45538     let i2;
45539     const properties = {};
45540     const name2 = nodeVal(get1(root3, "name"));
45541     const address = nodeVal(get1(root3, "address"));
45542     let styleUrl = nodeVal(get1(root3, "styleUrl"));
45543     const description2 = nodeVal(get1(root3, "description"));
45544     const timeSpan = get1(root3, "TimeSpan");
45545     const timeStamp = get1(root3, "TimeStamp");
45546     const extendedData = get1(root3, "ExtendedData");
45547     let iconStyle = get1(root3, "IconStyle");
45548     let labelStyle = get1(root3, "LabelStyle");
45549     let lineStyle = get1(root3, "LineStyle");
45550     let polyStyle = get1(root3, "PolyStyle");
45551     const visibility = get1(root3, "visibility");
45552     if (name2)
45553       properties.name = name2;
45554     if (address)
45555       properties.address = address;
45556     if (styleUrl) {
45557       if (styleUrl[0] !== "#") {
45558         styleUrl = "#" + styleUrl;
45559       }
45560       properties.styleUrl = styleUrl;
45561       if (styleIndex[styleUrl]) {
45562         properties.styleHash = styleIndex[styleUrl];
45563       }
45564       if (styleMapIndex[styleUrl]) {
45565         properties.styleMapHash = styleMapIndex[styleUrl];
45566         properties.styleHash = styleIndex[styleMapIndex[styleUrl].normal];
45567       }
45568       const style = styleByHash[properties.styleHash];
45569       if (style) {
45570         if (!iconStyle)
45571           iconStyle = get1(style, "IconStyle");
45572         if (!labelStyle)
45573           labelStyle = get1(style, "LabelStyle");
45574         if (!lineStyle)
45575           lineStyle = get1(style, "LineStyle");
45576         if (!polyStyle)
45577           polyStyle = get1(style, "PolyStyle");
45578       }
45579     }
45580     if (description2)
45581       properties.description = description2;
45582     if (timeSpan) {
45583       const begin = nodeVal(get1(timeSpan, "begin"));
45584       const end = nodeVal(get1(timeSpan, "end"));
45585       properties.timespan = { begin, end };
45586     }
45587     if (timeStamp) {
45588       properties.timestamp = nodeVal(get1(timeStamp, "when"));
45589     }
45590     if (iconStyle) {
45591       kmlColor(properties, iconStyle, "icon");
45592       numericProperty(properties, iconStyle, "scale", "icon-scale");
45593       numericProperty(properties, iconStyle, "heading", "icon-heading");
45594       const hotspot = get1(iconStyle, "hotSpot");
45595       if (hotspot) {
45596         const left = parseFloat(hotspot.getAttribute("x"));
45597         const top = parseFloat(hotspot.getAttribute("y"));
45598         if (!isNaN(left) && !isNaN(top))
45599           properties["icon-offset"] = [left, top];
45600       }
45601       const icon2 = get1(iconStyle, "Icon");
45602       if (icon2) {
45603         const href = nodeVal(get1(icon2, "href"));
45604         if (href)
45605           properties.icon = href;
45606       }
45607     }
45608     if (labelStyle) {
45609       kmlColor(properties, labelStyle, "label");
45610       numericProperty(properties, labelStyle, "scale", "label-scale");
45611     }
45612     if (lineStyle) {
45613       kmlColor(properties, lineStyle, "stroke");
45614       numericProperty(properties, lineStyle, "width", "stroke-width");
45615     }
45616     if (polyStyle) {
45617       kmlColor(properties, polyStyle, "fill");
45618       const fill = nodeVal(get1(polyStyle, "fill"));
45619       const outline = nodeVal(get1(polyStyle, "outline"));
45620       if (fill)
45621         properties["fill-opacity"] = fill === "1" ? properties["fill-opacity"] || 1 : 0;
45622       if (outline)
45623         properties["stroke-opacity"] = outline === "1" ? properties["stroke-opacity"] || 1 : 0;
45624     }
45625     if (extendedData) {
45626       const datas = extendedData.getElementsByTagName("Data"), simpleDatas = extendedData.getElementsByTagName("SimpleData");
45627       for (i2 = 0; i2 < datas.length; i2++) {
45628         properties[datas[i2].getAttribute("name")] = nodeVal(get1(datas[i2], "value"));
45629       }
45630       for (i2 = 0; i2 < simpleDatas.length; i2++) {
45631         properties[simpleDatas[i2].getAttribute("name")] = nodeVal(simpleDatas[i2]);
45632       }
45633     }
45634     if (visibility) {
45635       properties.visibility = nodeVal(visibility);
45636     }
45637     if (geomsAndTimes.coordTimes.length) {
45638       properties.coordinateProperties = {
45639         times: geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes
45640       };
45641     }
45642     const feature3 = {
45643       type: "Feature",
45644       geometry: geomsAndTimes.geoms.length === 0 ? null : geomsAndTimes.geoms.length === 1 ? geomsAndTimes.geoms[0] : {
45645         type: "GeometryCollection",
45646         geometries: geomsAndTimes.geoms
45647       },
45648       properties
45649     };
45650     if (root3.getAttribute("id"))
45651       feature3.id = root3.getAttribute("id");
45652     return feature3;
45653   }
45654   function* kmlGen(doc) {
45655     const styleIndex = {};
45656     const styleByHash = {};
45657     const styleMapIndex = {};
45658     const placemarks = doc.getElementsByTagName("Placemark");
45659     const styles = doc.getElementsByTagName("Style");
45660     const styleMaps = doc.getElementsByTagName("StyleMap");
45661     for (let k = 0; k < styles.length; k++) {
45662       const style = styles[k];
45663       const hash = okhash(xml2str(style)).toString(16);
45664       let id2 = style.getAttribute("id");
45665       if (!id2 && style.parentNode.tagName.replace("gx:", "") === "CascadingStyle") {
45666         id2 = style.parentNode.getAttribute("kml:id") || style.parentNode.getAttribute("id");
45667       }
45668       styleIndex["#" + id2] = hash;
45669       styleByHash[hash] = style;
45670     }
45671     for (let l = 0; l < styleMaps.length; l++) {
45672       styleIndex["#" + styleMaps[l].getAttribute("id")] = okhash(xml2str(styleMaps[l])).toString(16);
45673       const pairs = styleMaps[l].getElementsByTagName("Pair");
45674       const pairsMap = {};
45675       for (let m = 0; m < pairs.length; m++) {
45676         pairsMap[nodeVal(get1(pairs[m], "key"))] = nodeVal(get1(pairs[m], "styleUrl"));
45677       }
45678       styleMapIndex["#" + styleMaps[l].getAttribute("id")] = pairsMap;
45679     }
45680     for (let j2 = 0; j2 < placemarks.length; j2++) {
45681       const feature3 = getPlacemark(placemarks[j2], styleIndex, styleMapIndex, styleByHash);
45682       if (feature3)
45683         yield feature3;
45684     }
45685   }
45686   function kml(doc) {
45687     return {
45688       type: "FeatureCollection",
45689       features: Array.from(kmlGen(doc))
45690     };
45691   }
45692
45693   // modules/svg/data.js
45694   var _initialized = false;
45695   var _enabled = false;
45696   var _geojson;
45697   function svgData(projection2, context, dispatch10) {
45698     var throttledRedraw = throttle_default(function() {
45699       dispatch10.call("change");
45700     }, 1e3);
45701     var _showLabels = true;
45702     var detected = utilDetect();
45703     var layer = select_default2(null);
45704     var _vtService;
45705     var _fileList;
45706     var _template;
45707     var _src;
45708     function init2() {
45709       if (_initialized)
45710         return;
45711       _geojson = {};
45712       _enabled = true;
45713       function over(d3_event) {
45714         d3_event.stopPropagation();
45715         d3_event.preventDefault();
45716         d3_event.dataTransfer.dropEffect = "copy";
45717       }
45718       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
45719         d3_event.stopPropagation();
45720         d3_event.preventDefault();
45721         if (!detected.filedrop)
45722           return;
45723         drawData.fileList(d3_event.dataTransfer.files);
45724       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
45725       _initialized = true;
45726     }
45727     function getService() {
45728       if (services.vectorTile && !_vtService) {
45729         _vtService = services.vectorTile;
45730         _vtService.event.on("loadedData", throttledRedraw);
45731       } else if (!services.vectorTile && _vtService) {
45732         _vtService = null;
45733       }
45734       return _vtService;
45735     }
45736     function showLayer() {
45737       layerOn();
45738       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
45739         dispatch10.call("change");
45740       });
45741     }
45742     function hideLayer() {
45743       throttledRedraw.cancel();
45744       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
45745     }
45746     function layerOn() {
45747       layer.style("display", "block");
45748     }
45749     function layerOff() {
45750       layer.selectAll(".viewfield-group").remove();
45751       layer.style("display", "none");
45752     }
45753     function ensureIDs(gj) {
45754       if (!gj)
45755         return null;
45756       if (gj.type === "FeatureCollection") {
45757         for (var i2 = 0; i2 < gj.features.length; i2++) {
45758           ensureFeatureID(gj.features[i2]);
45759         }
45760       } else {
45761         ensureFeatureID(gj);
45762       }
45763       return gj;
45764     }
45765     function ensureFeatureID(feature3) {
45766       if (!feature3)
45767         return;
45768       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
45769       return feature3;
45770     }
45771     function getFeatures(gj) {
45772       if (!gj)
45773         return [];
45774       if (gj.type === "FeatureCollection") {
45775         return gj.features;
45776       } else {
45777         return [gj];
45778       }
45779     }
45780     function featureKey(d) {
45781       return d.__featurehash__;
45782     }
45783     function isPolygon(d) {
45784       return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
45785     }
45786     function clipPathID(d) {
45787       return "ideditor-data-" + d.__featurehash__ + "-clippath";
45788     }
45789     function featureClasses(d) {
45790       return [
45791         "data" + d.__featurehash__,
45792         d.geometry.type,
45793         isPolygon(d) ? "area" : "",
45794         d.__layerID__ || ""
45795       ].filter(Boolean).join(" ");
45796     }
45797     function drawData(selection2) {
45798       var vtService = getService();
45799       var getPath = svgPath(projection2).geojson;
45800       var getAreaPath = svgPath(projection2, null, true).geojson;
45801       var hasData = drawData.hasData();
45802       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
45803       layer.exit().remove();
45804       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
45805       var surface = context.surface();
45806       if (!surface || surface.empty())
45807         return;
45808       var geoData, polygonData;
45809       if (_template && vtService) {
45810         var sourceID = _template;
45811         vtService.loadTiles(sourceID, _template, projection2);
45812         geoData = vtService.data(sourceID, projection2);
45813       } else {
45814         geoData = getFeatures(_geojson);
45815       }
45816       geoData = geoData.filter(getPath);
45817       polygonData = geoData.filter(isPolygon);
45818       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
45819       clipPaths.exit().remove();
45820       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
45821       clipPathsEnter.append("path");
45822       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
45823       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
45824       datagroups = datagroups.enter().append("g").attr("class", function(d) {
45825         return "datagroup datagroup-" + d;
45826       }).merge(datagroups);
45827       var pathData = {
45828         fill: polygonData,
45829         shadow: geoData,
45830         stroke: geoData
45831       };
45832       var paths = datagroups.selectAll("path").data(function(layer2) {
45833         return pathData[layer2];
45834       }, featureKey);
45835       paths.exit().remove();
45836       paths = paths.enter().append("path").attr("class", function(d) {
45837         var datagroup = this.parentNode.__data__;
45838         return "pathdata " + datagroup + " " + featureClasses(d);
45839       }).attr("clip-path", function(d) {
45840         var datagroup = this.parentNode.__data__;
45841         return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
45842       }).merge(paths).attr("d", function(d) {
45843         var datagroup = this.parentNode.__data__;
45844         return datagroup === "fill" ? getAreaPath(d) : getPath(d);
45845       });
45846       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
45847       function drawLabels(selection3, textClass, data) {
45848         var labelPath = path_default(projection2);
45849         var labelData = data.filter(function(d) {
45850           return _showLabels && d.properties && (d.properties.desc || d.properties.name);
45851         });
45852         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
45853         labels.exit().remove();
45854         labels = labels.enter().append("text").attr("class", function(d) {
45855           return textClass + " " + featureClasses(d);
45856         }).merge(labels).text(function(d) {
45857           return d.properties.desc || d.properties.name;
45858         }).attr("x", function(d) {
45859           var centroid = labelPath.centroid(d);
45860           return centroid[0] + 11;
45861         }).attr("y", function(d) {
45862           var centroid = labelPath.centroid(d);
45863           return centroid[1];
45864         });
45865       }
45866     }
45867     function getExtension(fileName) {
45868       if (!fileName)
45869         return;
45870       var re2 = /\.(gpx|kml|(geo)?json)$/i;
45871       var match = fileName.toLowerCase().match(re2);
45872       return match && match.length && match[0];
45873     }
45874     function xmlToDom(textdata) {
45875       return new DOMParser().parseFromString(textdata, "text/xml");
45876     }
45877     function stringifyGeojsonProperties(feature3) {
45878       const properties = feature3.properties;
45879       for (const key in properties) {
45880         const property = properties[key];
45881         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
45882           properties[key] = property.toString();
45883         } else if (property === null) {
45884           properties[key] = "null";
45885         } else if (typeof property === "object") {
45886           properties[key] = JSON.stringify(property);
45887         }
45888       }
45889     }
45890     drawData.setFile = function(extension, data) {
45891       _template = null;
45892       _fileList = null;
45893       _geojson = null;
45894       _src = null;
45895       var gj;
45896       switch (extension) {
45897         case ".gpx":
45898           gj = gpx(xmlToDom(data));
45899           break;
45900         case ".kml":
45901           gj = kml(xmlToDom(data));
45902           break;
45903         case ".geojson":
45904         case ".json":
45905           gj = JSON.parse(data);
45906           if (gj.type === "FeatureCollection") {
45907             gj.features.forEach(stringifyGeojsonProperties);
45908           } else if (gj.type === "Feature") {
45909             stringifyGeojsonProperties(gj);
45910           }
45911           break;
45912       }
45913       gj = gj || {};
45914       if (Object.keys(gj).length) {
45915         _geojson = ensureIDs(gj);
45916         _src = extension + " data file";
45917         this.fitZoom();
45918       }
45919       dispatch10.call("change");
45920       return this;
45921     };
45922     drawData.showLabels = function(val) {
45923       if (!arguments.length)
45924         return _showLabels;
45925       _showLabels = val;
45926       return this;
45927     };
45928     drawData.enabled = function(val) {
45929       if (!arguments.length)
45930         return _enabled;
45931       _enabled = val;
45932       if (_enabled) {
45933         showLayer();
45934       } else {
45935         hideLayer();
45936       }
45937       dispatch10.call("change");
45938       return this;
45939     };
45940     drawData.hasData = function() {
45941       var gj = _geojson || {};
45942       return !!(_template || Object.keys(gj).length);
45943     };
45944     drawData.template = function(val, src) {
45945       if (!arguments.length)
45946         return _template;
45947       var osm = context.connection();
45948       if (osm) {
45949         var blocklists = osm.imageryBlocklists();
45950         var fail = false;
45951         var tested = 0;
45952         var regex;
45953         for (var i2 = 0; i2 < blocklists.length; i2++) {
45954           regex = blocklists[i2];
45955           fail = regex.test(val);
45956           tested++;
45957           if (fail)
45958             break;
45959         }
45960         if (!tested) {
45961           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
45962           fail = regex.test(val);
45963         }
45964       }
45965       _template = val;
45966       _fileList = null;
45967       _geojson = null;
45968       _src = src || "vectortile:" + val.split(/[?#]/)[0];
45969       dispatch10.call("change");
45970       return this;
45971     };
45972     drawData.geojson = function(gj, src) {
45973       if (!arguments.length)
45974         return _geojson;
45975       _template = null;
45976       _fileList = null;
45977       _geojson = null;
45978       _src = null;
45979       gj = gj || {};
45980       if (Object.keys(gj).length) {
45981         _geojson = ensureIDs(gj);
45982         _src = src || "unknown.geojson";
45983       }
45984       dispatch10.call("change");
45985       return this;
45986     };
45987     drawData.fileList = function(fileList) {
45988       if (!arguments.length)
45989         return _fileList;
45990       _template = null;
45991       _fileList = fileList;
45992       _geojson = null;
45993       _src = null;
45994       if (!fileList || !fileList.length)
45995         return this;
45996       var f2 = fileList[0];
45997       var extension = getExtension(f2.name);
45998       var reader = new FileReader();
45999       reader.onload = function() {
46000         return function(e) {
46001           drawData.setFile(extension, e.target.result);
46002         };
46003       }(f2);
46004       reader.readAsText(f2);
46005       return this;
46006     };
46007     drawData.url = function(url, defaultExtension) {
46008       _template = null;
46009       _fileList = null;
46010       _geojson = null;
46011       _src = null;
46012       var testUrl = url.split(/[?#]/)[0];
46013       var extension = getExtension(testUrl) || defaultExtension;
46014       if (extension) {
46015         _template = null;
46016         text_default3(url).then(function(data) {
46017           drawData.setFile(extension, data);
46018         }).catch(function() {
46019         });
46020       } else {
46021         drawData.template(url);
46022       }
46023       return this;
46024     };
46025     drawData.getSrc = function() {
46026       return _src || "";
46027     };
46028     drawData.fitZoom = function() {
46029       var features2 = getFeatures(_geojson);
46030       if (!features2.length)
46031         return;
46032       var map2 = context.map();
46033       var viewport = map2.trimmedExtent().polygon();
46034       var coords = features2.reduce(function(coords2, feature3) {
46035         var geom = feature3.geometry;
46036         if (!geom)
46037           return coords2;
46038         var c = geom.coordinates;
46039         switch (geom.type) {
46040           case "Point":
46041             c = [c];
46042           case "MultiPoint":
46043           case "LineString":
46044             break;
46045           case "MultiPolygon":
46046             c = utilArrayFlatten(c);
46047           case "Polygon":
46048           case "MultiLineString":
46049             c = utilArrayFlatten(c);
46050             break;
46051         }
46052         return utilArrayUnion(coords2, c);
46053       }, []);
46054       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
46055         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
46056         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
46057       }
46058       return this;
46059     };
46060     init2();
46061     return drawData;
46062   }
46063
46064   // modules/svg/debug.js
46065   function svgDebug(projection2, context) {
46066     function drawDebug(selection2) {
46067       const showTile = context.getDebug("tile");
46068       const showCollision = context.getDebug("collision");
46069       const showImagery = context.getDebug("imagery");
46070       const showTouchTargets = context.getDebug("target");
46071       const showDownloaded = context.getDebug("downloaded");
46072       let debugData = [];
46073       if (showTile) {
46074         debugData.push({ class: "red", label: "tile" });
46075       }
46076       if (showCollision) {
46077         debugData.push({ class: "yellow", label: "collision" });
46078       }
46079       if (showImagery) {
46080         debugData.push({ class: "orange", label: "imagery" });
46081       }
46082       if (showTouchTargets) {
46083         debugData.push({ class: "pink", label: "touchTargets" });
46084       }
46085       if (showDownloaded) {
46086         debugData.push({ class: "purple", label: "downloaded" });
46087       }
46088       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
46089       legend.exit().remove();
46090       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
46091       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
46092       legendItems.exit().remove();
46093       legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
46094       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
46095       layer.exit().remove();
46096       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
46097       const extent = context.map().extent();
46098       _mainFileFetcher.get("imagery").then((d) => {
46099         const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
46100         const features2 = hits.map((d2) => d2.features[d2.id]);
46101         let imagery = layer.selectAll("path.debug-imagery").data(features2);
46102         imagery.exit().remove();
46103         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
46104       }).catch(() => {
46105       });
46106       const osm = context.connection();
46107       let dataDownloaded = [];
46108       if (osm && showDownloaded) {
46109         const rtree = osm.caches("get").tile.rtree;
46110         dataDownloaded = rtree.all().map((bbox) => {
46111           return {
46112             type: "Feature",
46113             properties: { id: bbox.id },
46114             geometry: {
46115               type: "Polygon",
46116               coordinates: [[
46117                 [bbox.minX, bbox.minY],
46118                 [bbox.minX, bbox.maxY],
46119                 [bbox.maxX, bbox.maxY],
46120                 [bbox.maxX, bbox.minY],
46121                 [bbox.minX, bbox.minY]
46122               ]]
46123             }
46124           };
46125         });
46126       }
46127       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
46128       downloaded.exit().remove();
46129       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
46130       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
46131     }
46132     drawDebug.enabled = function() {
46133       if (!arguments.length) {
46134         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
46135       } else {
46136         return this;
46137       }
46138     };
46139     return drawDebug;
46140   }
46141
46142   // modules/svg/defs.js
46143   function svgDefs(context) {
46144     var _defsSelection = select_default2(null);
46145     var _spritesheetIds = [
46146       "iD-sprite",
46147       "maki-sprite",
46148       "temaki-sprite",
46149       "fa-sprite",
46150       "community-sprite"
46151     ];
46152     function drawDefs(selection2) {
46153       _defsSelection = selection2.append("defs");
46154       _defsSelection.append("marker").attr("id", "ideditor-oneway-marker").attr("viewBox", "0 0 10 5").attr("refX", 2.5).attr("refY", 2.5).attr("markerWidth", 2).attr("markerHeight", 2).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "oneway-marker-path").attr("d", "M 5,3 L 0,3 L 0,2 L 5,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", "#000").attr("opacity", "0.75");
46155       function addSidedMarker(name2, color2, offset) {
46156         _defsSelection.append("marker").attr("id", "ideditor-sided-marker-" + name2).attr("viewBox", "0 0 2 2").attr("refX", 1).attr("refY", -offset).attr("markerWidth", 1.5).attr("markerHeight", 1.5).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "sided-marker-path sided-marker-" + name2 + "-path").attr("d", "M 0,0 L 1,1 L 2,0 z").attr("stroke", "none").attr("fill", color2);
46157       }
46158       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
46159       addSidedMarker("coastline", "#77dede", 1);
46160       addSidedMarker("waterway", "#77dede", 1);
46161       addSidedMarker("barrier", "#ddd", 1);
46162       addSidedMarker("man_made", "#fff", 0);
46163       _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "#333").attr("fill-opacity", "0.75").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
46164       _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker-wireframe").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "none").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
46165       var patterns2 = _defsSelection.selectAll("pattern").data([
46166         ["beach", "dots"],
46167         ["construction", "construction"],
46168         ["cemetery", "cemetery"],
46169         ["cemetery_christian", "cemetery_christian"],
46170         ["cemetery_buddhist", "cemetery_buddhist"],
46171         ["cemetery_muslim", "cemetery_muslim"],
46172         ["cemetery_jewish", "cemetery_jewish"],
46173         ["farmland", "farmland"],
46174         ["farmyard", "farmyard"],
46175         ["forest", "forest"],
46176         ["forest_broadleaved", "forest_broadleaved"],
46177         ["forest_needleleaved", "forest_needleleaved"],
46178         ["forest_leafless", "forest_leafless"],
46179         ["golf_green", "grass"],
46180         ["grass", "grass"],
46181         ["landfill", "landfill"],
46182         ["meadow", "grass"],
46183         ["orchard", "orchard"],
46184         ["pond", "pond"],
46185         ["quarry", "quarry"],
46186         ["scrub", "bushes"],
46187         ["vineyard", "vineyard"],
46188         ["water_standing", "lines"],
46189         ["waves", "waves"],
46190         ["wetland", "wetland"],
46191         ["wetland_marsh", "wetland_marsh"],
46192         ["wetland_swamp", "wetland_swamp"],
46193         ["wetland_bog", "wetland_bog"],
46194         ["wetland_reedbed", "wetland_reedbed"]
46195       ]).enter().append("pattern").attr("id", function(d) {
46196         return "ideditor-pattern-" + d[0];
46197       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
46198       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
46199         return "pattern-color-" + d[0];
46200       });
46201       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
46202         return context.imagePath("pattern/" + d[1] + ".png");
46203       });
46204       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
46205         return "ideditor-clip-square-" + d;
46206       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
46207         return d;
46208       }).attr("height", function(d) {
46209         return d;
46210       });
46211       addSprites(_spritesheetIds, true);
46212     }
46213     function addSprites(ids, overrideColors) {
46214       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
46215       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
46216       spritesheets.enter().append("g").attr("class", function(d) {
46217         return "spritesheet spritesheet-" + d;
46218       }).each(function(d) {
46219         var url = context.imagePath(d + ".svg");
46220         var node = select_default2(this).node();
46221         svg(url).then(function(svg2) {
46222           node.appendChild(select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node());
46223           if (overrideColors && d !== "iD-sprite") {
46224             select_default2(node).selectAll("path").attr("fill", "currentColor");
46225           }
46226         }).catch(function() {
46227         });
46228       });
46229       spritesheets.exit().remove();
46230     }
46231     drawDefs.addSprites = addSprites;
46232     return drawDefs;
46233   }
46234
46235   // modules/svg/keepRight.js
46236   var _layerEnabled = false;
46237   var _qaService;
46238   function svgKeepRight(projection2, context, dispatch10) {
46239     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
46240     const minZoom3 = 12;
46241     let touchLayer = select_default2(null);
46242     let drawLayer = select_default2(null);
46243     let layerVisible = false;
46244     function markerPath(selection2, klass) {
46245       selection2.attr("class", klass).attr("transform", "translate(-4, -24)").attr("d", "M11.6,6.2H7.1l1.4-5.1C8.6,0.6,8.1,0,7.5,0H2.2C1.7,0,1.3,0.3,1.3,0.8L0,10.2c-0.1,0.6,0.4,1.1,0.9,1.1h4.6l-1.8,7.6C3.6,19.4,4.1,20,4.7,20c0.3,0,0.6-0.2,0.8-0.5l6.9-11.9C12.7,7,12.3,6.2,11.6,6.2z");
46246     }
46247     function getService() {
46248       if (services.keepRight && !_qaService) {
46249         _qaService = services.keepRight;
46250         _qaService.on("loaded", throttledRedraw);
46251       } else if (!services.keepRight && _qaService) {
46252         _qaService = null;
46253       }
46254       return _qaService;
46255     }
46256     function editOn() {
46257       if (!layerVisible) {
46258         layerVisible = true;
46259         drawLayer.style("display", "block");
46260       }
46261     }
46262     function editOff() {
46263       if (layerVisible) {
46264         layerVisible = false;
46265         drawLayer.style("display", "none");
46266         drawLayer.selectAll(".qaItem.keepRight").remove();
46267         touchLayer.selectAll(".qaItem.keepRight").remove();
46268       }
46269     }
46270     function layerOn() {
46271       editOn();
46272       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
46273     }
46274     function layerOff() {
46275       throttledRedraw.cancel();
46276       drawLayer.interrupt();
46277       touchLayer.selectAll(".qaItem.keepRight").remove();
46278       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
46279         editOff();
46280         dispatch10.call("change");
46281       });
46282     }
46283     function updateMarkers() {
46284       if (!layerVisible || !_layerEnabled)
46285         return;
46286       const service = getService();
46287       const selectedID = context.selectedErrorID();
46288       const data = service ? service.getItems(projection2) : [];
46289       const getTransform = svgPointTransform(projection2);
46290       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46291       markers.exit().remove();
46292       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
46293       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
46294       markersEnter.append("path").call(markerPath, "shadow");
46295       markersEnter.append("use").attr("class", "qaItem-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-bolt");
46296       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
46297       if (touchLayer.empty())
46298         return;
46299       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
46300       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46301       targets.exit().remove();
46302       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
46303       function sortY(a, b) {
46304         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : a.severity === "error" && b.severity !== "error" ? 1 : b.severity === "error" && a.severity !== "error" ? -1 : b.loc[1] - a.loc[1];
46305       }
46306     }
46307     function drawKeepRight(selection2) {
46308       const service = getService();
46309       const surface = context.surface();
46310       if (surface && !surface.empty()) {
46311         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
46312       }
46313       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
46314       drawLayer.exit().remove();
46315       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
46316       if (_layerEnabled) {
46317         if (service && ~~context.map().zoom() >= minZoom3) {
46318           editOn();
46319           service.loadIssues(projection2);
46320           updateMarkers();
46321         } else {
46322           editOff();
46323         }
46324       }
46325     }
46326     drawKeepRight.enabled = function(val) {
46327       if (!arguments.length)
46328         return _layerEnabled;
46329       _layerEnabled = val;
46330       if (_layerEnabled) {
46331         layerOn();
46332       } else {
46333         layerOff();
46334         if (context.selectedErrorID()) {
46335           context.enter(modeBrowse(context));
46336         }
46337       }
46338       dispatch10.call("change");
46339       return this;
46340     };
46341     drawKeepRight.supported = () => !!getService();
46342     return drawKeepRight;
46343   }
46344
46345   // modules/svg/geolocate.js
46346   function svgGeolocate(projection2) {
46347     var layer = select_default2(null);
46348     var _position;
46349     function init2() {
46350       if (svgGeolocate.initialized)
46351         return;
46352       svgGeolocate.enabled = false;
46353       svgGeolocate.initialized = true;
46354     }
46355     function showLayer() {
46356       layer.style("display", "block");
46357     }
46358     function hideLayer() {
46359       layer.transition().duration(250).style("opacity", 0);
46360     }
46361     function layerOn() {
46362       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
46363     }
46364     function layerOff() {
46365       layer.style("display", "none");
46366     }
46367     function transform2(d) {
46368       return svgPointTransform(projection2)(d);
46369     }
46370     function accuracy(accuracy2, loc) {
46371       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
46372       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
46373     }
46374     function update() {
46375       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
46376       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
46377       groups.exit().remove();
46378       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
46379       pointsEnter.append("circle").attr("class", "geolocate-radius").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("fill-opacity", "0.3").attr("r", "0");
46380       pointsEnter.append("circle").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("stroke", "white").attr("stroke-width", "1.5").attr("r", "6");
46381       groups.merge(pointsEnter).attr("transform", transform2);
46382       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
46383     }
46384     function drawLocation(selection2) {
46385       var enabled = svgGeolocate.enabled;
46386       layer = selection2.selectAll(".layer-geolocate").data([0]);
46387       layer.exit().remove();
46388       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
46389       layerEnter.append("g").attr("class", "geolocations");
46390       layer = layerEnter.merge(layer);
46391       if (enabled) {
46392         update();
46393       } else {
46394         layerOff();
46395       }
46396     }
46397     drawLocation.enabled = function(position, enabled) {
46398       if (!arguments.length)
46399         return svgGeolocate.enabled;
46400       _position = position;
46401       svgGeolocate.enabled = enabled;
46402       if (svgGeolocate.enabled) {
46403         showLayer();
46404         layerOn();
46405       } else {
46406         hideLayer();
46407       }
46408       return this;
46409     };
46410     init2();
46411     return drawLocation;
46412   }
46413
46414   // modules/svg/labels.js
46415   var import_rbush7 = __toESM(require_rbush_min());
46416   function svgLabels(projection2, context) {
46417     var path = path_default(projection2);
46418     var detected = utilDetect();
46419     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
46420     var _rdrawn = new import_rbush7.default();
46421     var _rskipped = new import_rbush7.default();
46422     var _textWidthCache = {};
46423     var _entitybboxes = {};
46424     var labelStack = [
46425       ["line", "aeroway", "*", 12],
46426       ["line", "highway", "motorway", 12],
46427       ["line", "highway", "trunk", 12],
46428       ["line", "highway", "primary", 12],
46429       ["line", "highway", "secondary", 12],
46430       ["line", "highway", "tertiary", 12],
46431       ["line", "highway", "*", 12],
46432       ["line", "railway", "*", 12],
46433       ["line", "waterway", "*", 12],
46434       ["area", "aeroway", "*", 12],
46435       ["area", "amenity", "*", 12],
46436       ["area", "building", "*", 12],
46437       ["area", "historic", "*", 12],
46438       ["area", "leisure", "*", 12],
46439       ["area", "man_made", "*", 12],
46440       ["area", "natural", "*", 12],
46441       ["area", "shop", "*", 12],
46442       ["area", "tourism", "*", 12],
46443       ["area", "camp_site", "*", 12],
46444       ["point", "aeroway", "*", 10],
46445       ["point", "amenity", "*", 10],
46446       ["point", "building", "*", 10],
46447       ["point", "historic", "*", 10],
46448       ["point", "leisure", "*", 10],
46449       ["point", "man_made", "*", 10],
46450       ["point", "natural", "*", 10],
46451       ["point", "shop", "*", 10],
46452       ["point", "tourism", "*", 10],
46453       ["point", "camp_site", "*", 10],
46454       ["line", "name", "*", 12],
46455       ["area", "name", "*", 12],
46456       ["point", "name", "*", 10]
46457     ];
46458     function shouldSkipIcon(preset) {
46459       var noIcons = ["building", "landuse", "natural"];
46460       return noIcons.some(function(s) {
46461         return preset.id.indexOf(s) >= 0;
46462       });
46463     }
46464     function get3(array2, prop) {
46465       return function(d, i2) {
46466         return array2[i2][prop];
46467       };
46468     }
46469     function textWidth(text2, size, elem) {
46470       var c = _textWidthCache[size];
46471       if (!c)
46472         c = _textWidthCache[size] = {};
46473       if (c[text2]) {
46474         return c[text2];
46475       } else if (elem) {
46476         c[text2] = elem.getComputedTextLength();
46477         return c[text2];
46478       } else {
46479         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
46480         if (str2 === null) {
46481           return size / 3 * 2 * text2.length;
46482         } else {
46483           return size / 3 * (2 * text2.length + str2.length);
46484         }
46485       }
46486     }
46487     function drawLinePaths(selection2, entities, filter2, classes, labels) {
46488       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
46489       paths.exit().remove();
46490       paths.enter().append("path").style("stroke-width", get3(labels, "font-size")).attr("id", function(d) {
46491         return "ideditor-labelpath-" + d.id;
46492       }).attr("class", classes).merge(paths).attr("d", get3(labels, "lineString"));
46493     }
46494     function drawLineLabels(selection2, entities, filter2, classes, labels) {
46495       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46496       texts.exit().remove();
46497       texts.enter().append("text").attr("class", function(d, i2) {
46498         return classes + " " + labels[i2].classes + " " + d.id;
46499       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
46500       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
46501         return "#ideditor-labelpath-" + d.id;
46502       }).text(utilDisplayNameForPath);
46503     }
46504     function drawPointLabels(selection2, entities, filter2, classes, labels) {
46505       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46506       texts.exit().remove();
46507       texts.enter().append("text").attr("class", function(d, i2) {
46508         return classes + " " + labels[i2].classes + " " + d.id;
46509       }).merge(texts).attr("x", get3(labels, "x")).attr("y", get3(labels, "y")).style("text-anchor", get3(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
46510         textWidth(utilDisplayName(d), labels[i2].height, this);
46511       });
46512     }
46513     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
46514       entities = entities.filter(hasText);
46515       labels = labels.filter(hasText);
46516       drawPointLabels(selection2, entities, filter2, classes, labels);
46517       function hasText(d, i2) {
46518         return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
46519       }
46520     }
46521     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
46522       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
46523       icons.exit().remove();
46524       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get3(labels, "transform")).attr("xlink:href", function(d) {
46525         var preset = _mainPresetIndex.match(d, context.graph());
46526         var picon = preset && preset.icon;
46527         return picon ? "#" + picon : "";
46528       });
46529     }
46530     function drawCollisionBoxes(selection2, rtree, which) {
46531       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
46532       var gj = [];
46533       if (context.getDebug("collision")) {
46534         gj = rtree.all().map(function(d) {
46535           return { type: "Polygon", coordinates: [[
46536             [d.minX, d.minY],
46537             [d.maxX, d.minY],
46538             [d.maxX, d.maxY],
46539             [d.minX, d.maxY],
46540             [d.minX, d.minY]
46541           ]] };
46542         });
46543       }
46544       var boxes = selection2.selectAll("." + which).data(gj);
46545       boxes.exit().remove();
46546       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
46547     }
46548     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
46549       var wireframe = context.surface().classed("fill-wireframe");
46550       var zoom = geoScaleToZoom(projection2.scale());
46551       var labelable = [];
46552       var renderNodeAs = {};
46553       var i2, j2, k, entity, geometry;
46554       for (i2 = 0; i2 < labelStack.length; i2++) {
46555         labelable.push([]);
46556       }
46557       if (fullRedraw) {
46558         _rdrawn.clear();
46559         _rskipped.clear();
46560         _entitybboxes = {};
46561       } else {
46562         for (i2 = 0; i2 < entities.length; i2++) {
46563           entity = entities[i2];
46564           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
46565           for (j2 = 0; j2 < toRemove.length; j2++) {
46566             _rdrawn.remove(toRemove[j2]);
46567             _rskipped.remove(toRemove[j2]);
46568           }
46569         }
46570       }
46571       for (i2 = 0; i2 < entities.length; i2++) {
46572         entity = entities[i2];
46573         geometry = entity.geometry(graph);
46574         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
46575           var hasDirections = entity.directions(graph, projection2).length;
46576           var markerPadding;
46577           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
46578             renderNodeAs[entity.id] = "point";
46579             markerPadding = 20;
46580           } else {
46581             renderNodeAs[entity.id] = "vertex";
46582             markerPadding = 0;
46583           }
46584           var coord2 = projection2(entity.loc);
46585           var nodePadding = 10;
46586           var bbox = {
46587             minX: coord2[0] - nodePadding,
46588             minY: coord2[1] - nodePadding - markerPadding,
46589             maxX: coord2[0] + nodePadding,
46590             maxY: coord2[1] + nodePadding
46591           };
46592           doInsert(bbox, entity.id + "P");
46593         }
46594         if (geometry === "vertex") {
46595           geometry = "point";
46596         }
46597         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
46598         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
46599         if (!icon2 && !utilDisplayName(entity))
46600           continue;
46601         for (k = 0; k < labelStack.length; k++) {
46602           var matchGeom = labelStack[k][0];
46603           var matchKey = labelStack[k][1];
46604           var matchVal = labelStack[k][2];
46605           var hasVal = entity.tags[matchKey];
46606           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
46607             labelable[k].push(entity);
46608             break;
46609           }
46610         }
46611       }
46612       var positions = {
46613         point: [],
46614         line: [],
46615         area: []
46616       };
46617       var labelled = {
46618         point: [],
46619         line: [],
46620         area: []
46621       };
46622       for (k = 0; k < labelable.length; k++) {
46623         var fontSize = labelStack[k][3];
46624         for (i2 = 0; i2 < labelable[k].length; i2++) {
46625           entity = labelable[k][i2];
46626           geometry = entity.geometry(graph);
46627           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
46628           var name2 = getName(entity);
46629           var width = name2 && textWidth(name2, fontSize);
46630           var p = null;
46631           if (geometry === "point" || geometry === "vertex") {
46632             if (wireframe)
46633               continue;
46634             var renderAs = renderNodeAs[entity.id];
46635             if (renderAs === "vertex" && zoom < 17)
46636               continue;
46637             p = getPointLabel(entity, width, fontSize, renderAs);
46638           } else if (geometry === "line") {
46639             p = getLineLabel(entity, width, fontSize);
46640           } else if (geometry === "area") {
46641             p = getAreaLabel(entity, width, fontSize);
46642           }
46643           if (p) {
46644             if (geometry === "vertex") {
46645               geometry = "point";
46646             }
46647             p.classes = geometry + " tag-" + labelStack[k][1];
46648             positions[geometry].push(p);
46649             labelled[geometry].push(entity);
46650           }
46651         }
46652       }
46653       function isInterestingVertex(entity2) {
46654         var selectedIDs = context.selectedIDs();
46655         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
46656           return selectedIDs.indexOf(parent.id) !== -1;
46657         });
46658       }
46659       function getPointLabel(entity2, width2, height, geometry2) {
46660         var y = geometry2 === "point" ? -12 : 0;
46661         var pointOffsets = {
46662           ltr: [15, y, "start"],
46663           rtl: [-15, y, "end"]
46664         };
46665         var textDirection = _mainLocalizer.textDirection();
46666         var coord3 = projection2(entity2.loc);
46667         var textPadding = 2;
46668         var offset = pointOffsets[textDirection];
46669         var p2 = {
46670           height,
46671           width: width2,
46672           x: coord3[0] + offset[0],
46673           y: coord3[1] + offset[1],
46674           textAnchor: offset[2]
46675         };
46676         var bbox2;
46677         if (textDirection === "rtl") {
46678           bbox2 = {
46679             minX: p2.x - width2 - textPadding,
46680             minY: p2.y - height / 2 - textPadding,
46681             maxX: p2.x + textPadding,
46682             maxY: p2.y + height / 2 + textPadding
46683           };
46684         } else {
46685           bbox2 = {
46686             minX: p2.x - textPadding,
46687             minY: p2.y - height / 2 - textPadding,
46688             maxX: p2.x + width2 + textPadding,
46689             maxY: p2.y + height / 2 + textPadding
46690           };
46691         }
46692         if (tryInsert([bbox2], entity2.id, true)) {
46693           return p2;
46694         }
46695       }
46696       function getLineLabel(entity2, width2, height) {
46697         var viewport = geoExtent(context.projection.clipExtent()).polygon();
46698         var points = graph.childNodes(entity2).map(function(node) {
46699           return projection2(node.loc);
46700         });
46701         var length = geoPathLength(points);
46702         if (length < width2 + 20)
46703           return;
46704         var lineOffsets = [
46705           50,
46706           45,
46707           55,
46708           40,
46709           60,
46710           35,
46711           65,
46712           30,
46713           70,
46714           25,
46715           75,
46716           20,
46717           80,
46718           15,
46719           95,
46720           10,
46721           90,
46722           5,
46723           95
46724         ];
46725         var padding = 3;
46726         for (var i3 = 0; i3 < lineOffsets.length; i3++) {
46727           var offset = lineOffsets[i3];
46728           var middle = offset / 100 * length;
46729           var start2 = middle - width2 / 2;
46730           if (start2 < 0 || start2 + width2 > length)
46731             continue;
46732           var sub = subpath(points, start2, start2 + width2);
46733           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
46734             continue;
46735           }
46736           var isReverse = reverse(sub);
46737           if (isReverse) {
46738             sub = sub.reverse();
46739           }
46740           var bboxes = [];
46741           var boxsize = (height + 2) / 2;
46742           for (var j3 = 0; j3 < sub.length - 1; j3++) {
46743             var a = sub[j3];
46744             var b = sub[j3 + 1];
46745             var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
46746             for (var box = 0; box < num; box++) {
46747               var p2 = geoVecInterp(a, b, box / num);
46748               var x05 = p2[0] - boxsize - padding;
46749               var y05 = p2[1] - boxsize - padding;
46750               var x12 = p2[0] + boxsize + padding;
46751               var y12 = p2[1] + boxsize + padding;
46752               bboxes.push({
46753                 minX: Math.min(x05, x12),
46754                 minY: Math.min(y05, y12),
46755                 maxX: Math.max(x05, x12),
46756                 maxY: Math.max(y05, y12)
46757               });
46758             }
46759           }
46760           if (tryInsert(bboxes, entity2.id, false)) {
46761             return {
46762               "font-size": height + 2,
46763               lineString: lineString2(sub),
46764               startOffset: offset + "%"
46765             };
46766           }
46767         }
46768         function reverse(p3) {
46769           var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
46770           return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
46771         }
46772         function lineString2(points2) {
46773           return "M" + points2.join("L");
46774         }
46775         function subpath(points2, from, to) {
46776           var sofar = 0;
46777           var start3, end, i0, i1;
46778           for (var i4 = 0; i4 < points2.length - 1; i4++) {
46779             var a2 = points2[i4];
46780             var b2 = points2[i4 + 1];
46781             var current = geoVecLength(a2, b2);
46782             var portion;
46783             if (!start3 && sofar + current >= from) {
46784               portion = (from - sofar) / current;
46785               start3 = [
46786                 a2[0] + portion * (b2[0] - a2[0]),
46787                 a2[1] + portion * (b2[1] - a2[1])
46788               ];
46789               i0 = i4 + 1;
46790             }
46791             if (!end && sofar + current >= to) {
46792               portion = (to - sofar) / current;
46793               end = [
46794                 a2[0] + portion * (b2[0] - a2[0]),
46795                 a2[1] + portion * (b2[1] - a2[1])
46796               ];
46797               i1 = i4 + 1;
46798             }
46799             sofar += current;
46800           }
46801           var result = points2.slice(i0, i1);
46802           result.unshift(start3);
46803           result.push(end);
46804           return result;
46805         }
46806       }
46807       function getAreaLabel(entity2, width2, height) {
46808         var centroid = path.centroid(entity2.asGeoJSON(graph));
46809         var extent = entity2.extent(graph);
46810         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
46811         if (isNaN(centroid[0]) || areaWidth < 20)
46812           return;
46813         var preset2 = _mainPresetIndex.match(entity2, context.graph());
46814         var picon = preset2 && preset2.icon;
46815         var iconSize = 17;
46816         var padding = 2;
46817         var p2 = {};
46818         if (picon) {
46819           if (addIcon()) {
46820             addLabel(iconSize + padding);
46821             return p2;
46822           }
46823         } else {
46824           if (addLabel(0)) {
46825             return p2;
46826           }
46827         }
46828         function addIcon() {
46829           var iconX = centroid[0] - iconSize / 2;
46830           var iconY = centroid[1] - iconSize / 2;
46831           var bbox2 = {
46832             minX: iconX,
46833             minY: iconY,
46834             maxX: iconX + iconSize,
46835             maxY: iconY + iconSize
46836           };
46837           if (tryInsert([bbox2], entity2.id + "I", true)) {
46838             p2.transform = "translate(" + iconX + "," + iconY + ")";
46839             return true;
46840           }
46841           return false;
46842         }
46843         function addLabel(yOffset) {
46844           if (width2 && areaWidth >= width2 + 20) {
46845             var labelX = centroid[0];
46846             var labelY = centroid[1] + yOffset;
46847             var bbox2 = {
46848               minX: labelX - width2 / 2 - padding,
46849               minY: labelY - height / 2 - padding,
46850               maxX: labelX + width2 / 2 + padding,
46851               maxY: labelY + height / 2 + padding
46852             };
46853             if (tryInsert([bbox2], entity2.id, true)) {
46854               p2.x = labelX;
46855               p2.y = labelY;
46856               p2.textAnchor = "middle";
46857               p2.height = height;
46858               return true;
46859             }
46860           }
46861           return false;
46862         }
46863       }
46864       function doInsert(bbox2, id2) {
46865         bbox2.id = id2;
46866         var oldbox = _entitybboxes[id2];
46867         if (oldbox) {
46868           _rdrawn.remove(oldbox);
46869         }
46870         _entitybboxes[id2] = bbox2;
46871         _rdrawn.insert(bbox2);
46872       }
46873       function tryInsert(bboxes, id2, saveSkipped) {
46874         var skipped = false;
46875         for (var i3 = 0; i3 < bboxes.length; i3++) {
46876           var bbox2 = bboxes[i3];
46877           bbox2.id = id2;
46878           if (bbox2.minX < 0 || bbox2.minY < 0 || bbox2.maxX > dimensions[0] || bbox2.maxY > dimensions[1]) {
46879             skipped = true;
46880             break;
46881           }
46882           if (_rdrawn.collides(bbox2)) {
46883             skipped = true;
46884             break;
46885           }
46886         }
46887         _entitybboxes[id2] = bboxes;
46888         if (skipped) {
46889           if (saveSkipped) {
46890             _rskipped.load(bboxes);
46891           }
46892         } else {
46893           _rdrawn.load(bboxes);
46894         }
46895         return !skipped;
46896       }
46897       var layer = selection2.selectAll(".layer-osm.labels");
46898       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
46899         return "labels-group " + d;
46900       });
46901       var halo = layer.selectAll(".labels-group.halo");
46902       var label = layer.selectAll(".labels-group.label");
46903       var debug2 = layer.selectAll(".labels-group.debug");
46904       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
46905       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
46906       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
46907       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
46908       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
46909       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
46910       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
46911       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
46912       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
46913       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
46914       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
46915       layer.call(filterLabels);
46916     }
46917     function filterLabels(selection2) {
46918       var drawLayer = selection2.selectAll(".layer-osm.labels");
46919       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
46920       layers.selectAll(".nolabel").classed("nolabel", false);
46921       var mouse = context.map().mouse();
46922       var graph = context.graph();
46923       var selectedIDs = context.selectedIDs();
46924       var ids = [];
46925       var pad2, bbox;
46926       if (mouse) {
46927         pad2 = 20;
46928         bbox = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
46929         var nearMouse = _rdrawn.search(bbox).map(function(entity2) {
46930           return entity2.id;
46931         });
46932         ids.push.apply(ids, nearMouse);
46933       }
46934       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
46935         var entity = graph.hasEntity(selectedIDs[i2]);
46936         if (entity && entity.type === "node") {
46937           ids.push(selectedIDs[i2]);
46938         }
46939       }
46940       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
46941       var debug2 = selection2.selectAll(".labels-group.debug");
46942       var gj = [];
46943       if (context.getDebug("collision")) {
46944         gj = bbox ? [{
46945           type: "Polygon",
46946           coordinates: [[
46947             [bbox.minX, bbox.minY],
46948             [bbox.maxX, bbox.minY],
46949             [bbox.maxX, bbox.maxY],
46950             [bbox.minX, bbox.maxY],
46951             [bbox.minX, bbox.minY]
46952           ]]
46953         }] : [];
46954       }
46955       var box = debug2.selectAll(".debug-mouse").data(gj);
46956       box.exit().remove();
46957       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
46958     }
46959     var throttleFilterLabels = throttle_default(filterLabels, 100);
46960     drawLabels.observe = function(selection2) {
46961       var listener = function() {
46962         throttleFilterLabels(selection2);
46963       };
46964       selection2.on("mousemove.hidelabels", listener);
46965       context.on("enter.hidelabels", listener);
46966     };
46967     drawLabels.off = function(selection2) {
46968       throttleFilterLabels.cancel();
46969       selection2.on("mousemove.hidelabels", null);
46970       context.on("enter.hidelabels", null);
46971     };
46972     return drawLabels;
46973   }
46974
46975   // modules/svg/improveOSM.js
46976   var _layerEnabled2 = false;
46977   var _qaService2;
46978   function svgImproveOSM(projection2, context, dispatch10) {
46979     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
46980     const minZoom3 = 12;
46981     let touchLayer = select_default2(null);
46982     let drawLayer = select_default2(null);
46983     let layerVisible = false;
46984     function markerPath(selection2, klass) {
46985       selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
46986     }
46987     function getService() {
46988       if (services.improveOSM && !_qaService2) {
46989         _qaService2 = services.improveOSM;
46990         _qaService2.on("loaded", throttledRedraw);
46991       } else if (!services.improveOSM && _qaService2) {
46992         _qaService2 = null;
46993       }
46994       return _qaService2;
46995     }
46996     function editOn() {
46997       if (!layerVisible) {
46998         layerVisible = true;
46999         drawLayer.style("display", "block");
47000       }
47001     }
47002     function editOff() {
47003       if (layerVisible) {
47004         layerVisible = false;
47005         drawLayer.style("display", "none");
47006         drawLayer.selectAll(".qaItem.improveOSM").remove();
47007         touchLayer.selectAll(".qaItem.improveOSM").remove();
47008       }
47009     }
47010     function layerOn() {
47011       editOn();
47012       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47013     }
47014     function layerOff() {
47015       throttledRedraw.cancel();
47016       drawLayer.interrupt();
47017       touchLayer.selectAll(".qaItem.improveOSM").remove();
47018       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47019         editOff();
47020         dispatch10.call("change");
47021       });
47022     }
47023     function updateMarkers() {
47024       if (!layerVisible || !_layerEnabled2)
47025         return;
47026       const service = getService();
47027       const selectedID = context.selectedErrorID();
47028       const data = service ? service.getItems(projection2) : [];
47029       const getTransform = svgPointTransform(projection2);
47030       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47031       markers.exit().remove();
47032       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47033       markersEnter.append("polygon").call(markerPath, "shadow");
47034       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47035       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
47036       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
47037       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47038       if (touchLayer.empty())
47039         return;
47040       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
47041       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47042       targets.exit().remove();
47043       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
47044       function sortY(a, b) {
47045         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47046       }
47047     }
47048     function drawImproveOSM(selection2) {
47049       const service = getService();
47050       const surface = context.surface();
47051       if (surface && !surface.empty()) {
47052         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47053       }
47054       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
47055       drawLayer.exit().remove();
47056       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
47057       if (_layerEnabled2) {
47058         if (service && ~~context.map().zoom() >= minZoom3) {
47059           editOn();
47060           service.loadIssues(projection2);
47061           updateMarkers();
47062         } else {
47063           editOff();
47064         }
47065       }
47066     }
47067     drawImproveOSM.enabled = function(val) {
47068       if (!arguments.length)
47069         return _layerEnabled2;
47070       _layerEnabled2 = val;
47071       if (_layerEnabled2) {
47072         layerOn();
47073       } else {
47074         layerOff();
47075         if (context.selectedErrorID()) {
47076           context.enter(modeBrowse(context));
47077         }
47078       }
47079       dispatch10.call("change");
47080       return this;
47081     };
47082     drawImproveOSM.supported = () => !!getService();
47083     return drawImproveOSM;
47084   }
47085
47086   // modules/svg/osmose.js
47087   var _layerEnabled3 = false;
47088   var _qaService3;
47089   function svgOsmose(projection2, context, dispatch10) {
47090     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47091     const minZoom3 = 12;
47092     let touchLayer = select_default2(null);
47093     let drawLayer = select_default2(null);
47094     let layerVisible = false;
47095     function markerPath(selection2, klass) {
47096       selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
47097     }
47098     function getService() {
47099       if (services.osmose && !_qaService3) {
47100         _qaService3 = services.osmose;
47101         _qaService3.on("loaded", throttledRedraw);
47102       } else if (!services.osmose && _qaService3) {
47103         _qaService3 = null;
47104       }
47105       return _qaService3;
47106     }
47107     function editOn() {
47108       if (!layerVisible) {
47109         layerVisible = true;
47110         drawLayer.style("display", "block");
47111       }
47112     }
47113     function editOff() {
47114       if (layerVisible) {
47115         layerVisible = false;
47116         drawLayer.style("display", "none");
47117         drawLayer.selectAll(".qaItem.osmose").remove();
47118         touchLayer.selectAll(".qaItem.osmose").remove();
47119       }
47120     }
47121     function layerOn() {
47122       editOn();
47123       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47124     }
47125     function layerOff() {
47126       throttledRedraw.cancel();
47127       drawLayer.interrupt();
47128       touchLayer.selectAll(".qaItem.osmose").remove();
47129       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47130         editOff();
47131         dispatch10.call("change");
47132       });
47133     }
47134     function updateMarkers() {
47135       if (!layerVisible || !_layerEnabled3)
47136         return;
47137       const service = getService();
47138       const selectedID = context.selectedErrorID();
47139       const data = service ? service.getItems(projection2) : [];
47140       const getTransform = svgPointTransform(projection2);
47141       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47142       markers.exit().remove();
47143       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47144       markersEnter.append("polygon").call(markerPath, "shadow");
47145       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47146       markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
47147       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
47148       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47149       if (touchLayer.empty())
47150         return;
47151       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
47152       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47153       targets.exit().remove();
47154       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
47155       function sortY(a, b) {
47156         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47157       }
47158     }
47159     function drawOsmose(selection2) {
47160       const service = getService();
47161       const surface = context.surface();
47162       if (surface && !surface.empty()) {
47163         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47164       }
47165       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
47166       drawLayer.exit().remove();
47167       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
47168       if (_layerEnabled3) {
47169         if (service && ~~context.map().zoom() >= minZoom3) {
47170           editOn();
47171           service.loadIssues(projection2);
47172           updateMarkers();
47173         } else {
47174           editOff();
47175         }
47176       }
47177     }
47178     drawOsmose.enabled = function(val) {
47179       if (!arguments.length)
47180         return _layerEnabled3;
47181       _layerEnabled3 = val;
47182       if (_layerEnabled3) {
47183         getService().loadStrings().then(layerOn).catch((err) => {
47184           console.log(err);
47185         });
47186       } else {
47187         layerOff();
47188         if (context.selectedErrorID()) {
47189           context.enter(modeBrowse(context));
47190         }
47191       }
47192       dispatch10.call("change");
47193       return this;
47194     };
47195     drawOsmose.supported = () => !!getService();
47196     return drawOsmose;
47197   }
47198
47199   // modules/svg/streetside.js
47200   function svgStreetside(projection2, context, dispatch10) {
47201     var throttledRedraw = throttle_default(function() {
47202       dispatch10.call("change");
47203     }, 1e3);
47204     var minZoom3 = 14;
47205     var minMarkerZoom = 16;
47206     var minViewfieldZoom = 18;
47207     var layer = select_default2(null);
47208     var _viewerYaw = 0;
47209     var _selectedSequence = null;
47210     var _streetside;
47211     function init2() {
47212       if (svgStreetside.initialized)
47213         return;
47214       svgStreetside.enabled = false;
47215       svgStreetside.initialized = true;
47216     }
47217     function getService() {
47218       if (services.streetside && !_streetside) {
47219         _streetside = services.streetside;
47220         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
47221       } else if (!services.streetside && _streetside) {
47222         _streetside = null;
47223       }
47224       return _streetside;
47225     }
47226     function showLayer() {
47227       var service = getService();
47228       if (!service)
47229         return;
47230       editOn();
47231       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47232         dispatch10.call("change");
47233       });
47234     }
47235     function hideLayer() {
47236       throttledRedraw.cancel();
47237       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47238     }
47239     function editOn() {
47240       layer.style("display", "block");
47241     }
47242     function editOff() {
47243       layer.selectAll(".viewfield-group").remove();
47244       layer.style("display", "none");
47245     }
47246     function click(d3_event, d) {
47247       var service = getService();
47248       if (!service)
47249         return;
47250       if (d.sequenceKey !== _selectedSequence) {
47251         _viewerYaw = 0;
47252       }
47253       _selectedSequence = d.sequenceKey;
47254       service.ensureViewerLoaded(context).then(function() {
47255         service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
47256       });
47257       context.map().centerEase(d.loc);
47258     }
47259     function mouseover(d3_event, d) {
47260       var service = getService();
47261       if (service)
47262         service.setStyles(context, d);
47263     }
47264     function mouseout() {
47265       var service = getService();
47266       if (service)
47267         service.setStyles(context, null);
47268     }
47269     function transform2(d) {
47270       var t = svgPointTransform(projection2)(d);
47271       var rot = d.ca + _viewerYaw;
47272       if (rot) {
47273         t += " rotate(" + Math.floor(rot) + ",0,0)";
47274       }
47275       return t;
47276     }
47277     function viewerChanged() {
47278       var service = getService();
47279       if (!service)
47280         return;
47281       var viewer = service.viewer();
47282       if (!viewer)
47283         return;
47284       _viewerYaw = viewer.getYaw();
47285       if (context.map().isTransformed())
47286         return;
47287       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
47288     }
47289     function filterBubbles(bubbles) {
47290       var fromDate = context.photos().fromDate();
47291       var toDate = context.photos().toDate();
47292       var usernames = context.photos().usernames();
47293       if (fromDate) {
47294         var fromTimestamp = new Date(fromDate).getTime();
47295         bubbles = bubbles.filter(function(bubble) {
47296           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
47297         });
47298       }
47299       if (toDate) {
47300         var toTimestamp = new Date(toDate).getTime();
47301         bubbles = bubbles.filter(function(bubble) {
47302           return new Date(bubble.captured_at).getTime() <= toTimestamp;
47303         });
47304       }
47305       if (usernames) {
47306         bubbles = bubbles.filter(function(bubble) {
47307           return usernames.indexOf(bubble.captured_by) !== -1;
47308         });
47309       }
47310       return bubbles;
47311     }
47312     function filterSequences(sequences) {
47313       var fromDate = context.photos().fromDate();
47314       var toDate = context.photos().toDate();
47315       var usernames = context.photos().usernames();
47316       if (fromDate) {
47317         var fromTimestamp = new Date(fromDate).getTime();
47318         sequences = sequences.filter(function(sequences2) {
47319           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
47320         });
47321       }
47322       if (toDate) {
47323         var toTimestamp = new Date(toDate).getTime();
47324         sequences = sequences.filter(function(sequences2) {
47325           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
47326         });
47327       }
47328       if (usernames) {
47329         sequences = sequences.filter(function(sequences2) {
47330           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
47331         });
47332       }
47333       return sequences;
47334     }
47335     function update() {
47336       var viewer = context.container().select(".photoviewer");
47337       var selected = viewer.empty() ? void 0 : viewer.datum();
47338       var z = ~~context.map().zoom();
47339       var showMarkers = z >= minMarkerZoom;
47340       var showViewfields = z >= minViewfieldZoom;
47341       var service = getService();
47342       var sequences = [];
47343       var bubbles = [];
47344       if (context.photos().showsPanoramic()) {
47345         sequences = service ? service.sequences(projection2) : [];
47346         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
47347         sequences = filterSequences(sequences);
47348         bubbles = filterBubbles(bubbles);
47349       }
47350       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47351         return d.properties.key;
47352       });
47353       traces.exit().remove();
47354       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47355       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
47356         return d.key + (d.sequenceKey ? "v1" : "v0");
47357       });
47358       groups.exit().remove();
47359       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47360       groupsEnter.append("g").attr("class", "viewfield-scale");
47361       var markers = groups.merge(groupsEnter).sort(function(a, b) {
47362         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
47363       }).attr("transform", transform2).select(".viewfield-scale");
47364       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47365       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47366       viewfields.exit().remove();
47367       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
47368       function viewfieldPath() {
47369         var d = this.parentNode.__data__;
47370         if (d.pano) {
47371           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
47372         } else {
47373           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
47374         }
47375       }
47376     }
47377     function drawImages(selection2) {
47378       var enabled = svgStreetside.enabled;
47379       var service = getService();
47380       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
47381       layer.exit().remove();
47382       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
47383       layerEnter.append("g").attr("class", "sequences");
47384       layerEnter.append("g").attr("class", "markers");
47385       layer = layerEnter.merge(layer);
47386       if (enabled) {
47387         if (service && ~~context.map().zoom() >= minZoom3) {
47388           editOn();
47389           update();
47390           service.loadBubbles(projection2);
47391         } else {
47392           editOff();
47393         }
47394       }
47395     }
47396     drawImages.enabled = function(_) {
47397       if (!arguments.length)
47398         return svgStreetside.enabled;
47399       svgStreetside.enabled = _;
47400       if (svgStreetside.enabled) {
47401         showLayer();
47402         context.photos().on("change.streetside", update);
47403       } else {
47404         hideLayer();
47405         context.photos().on("change.streetside", null);
47406       }
47407       dispatch10.call("change");
47408       return this;
47409     };
47410     drawImages.supported = function() {
47411       return !!getService();
47412     };
47413     init2();
47414     return drawImages;
47415   }
47416
47417   // modules/svg/mapillary_images.js
47418   function svgMapillaryImages(projection2, context, dispatch10) {
47419     const throttledRedraw = throttle_default(function() {
47420       dispatch10.call("change");
47421     }, 1e3);
47422     const minZoom3 = 12;
47423     const minMarkerZoom = 16;
47424     const minViewfieldZoom = 18;
47425     let layer = select_default2(null);
47426     let _mapillary;
47427     function init2() {
47428       if (svgMapillaryImages.initialized)
47429         return;
47430       svgMapillaryImages.enabled = false;
47431       svgMapillaryImages.initialized = true;
47432     }
47433     function getService() {
47434       if (services.mapillary && !_mapillary) {
47435         _mapillary = services.mapillary;
47436         _mapillary.event.on("loadedImages", throttledRedraw);
47437       } else if (!services.mapillary && _mapillary) {
47438         _mapillary = null;
47439       }
47440       return _mapillary;
47441     }
47442     function showLayer() {
47443       const service = getService();
47444       if (!service)
47445         return;
47446       editOn();
47447       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47448         dispatch10.call("change");
47449       });
47450     }
47451     function hideLayer() {
47452       throttledRedraw.cancel();
47453       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47454     }
47455     function editOn() {
47456       layer.style("display", "block");
47457     }
47458     function editOff() {
47459       layer.selectAll(".viewfield-group").remove();
47460       layer.style("display", "none");
47461     }
47462     function click(d3_event, image) {
47463       const service = getService();
47464       if (!service)
47465         return;
47466       service.ensureViewerLoaded(context).then(function() {
47467         service.selectImage(context, image.id).showViewer(context);
47468       });
47469       context.map().centerEase(image.loc);
47470     }
47471     function mouseover(d3_event, image) {
47472       const service = getService();
47473       if (service)
47474         service.setStyles(context, image);
47475     }
47476     function mouseout() {
47477       const service = getService();
47478       if (service)
47479         service.setStyles(context, null);
47480     }
47481     function transform2(d) {
47482       let t = svgPointTransform(projection2)(d);
47483       if (d.ca) {
47484         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
47485       }
47486       return t;
47487     }
47488     function filterImages(images) {
47489       const showsPano = context.photos().showsPanoramic();
47490       const showsFlat = context.photos().showsFlat();
47491       const fromDate = context.photos().fromDate();
47492       const toDate = context.photos().toDate();
47493       if (!showsPano || !showsFlat) {
47494         images = images.filter(function(image) {
47495           if (image.is_pano)
47496             return showsPano;
47497           return showsFlat;
47498         });
47499       }
47500       if (fromDate) {
47501         images = images.filter(function(image) {
47502           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
47503         });
47504       }
47505       if (toDate) {
47506         images = images.filter(function(image) {
47507           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
47508         });
47509       }
47510       return images;
47511     }
47512     function filterSequences(sequences) {
47513       const showsPano = context.photos().showsPanoramic();
47514       const showsFlat = context.photos().showsFlat();
47515       const fromDate = context.photos().fromDate();
47516       const toDate = context.photos().toDate();
47517       if (!showsPano || !showsFlat) {
47518         sequences = sequences.filter(function(sequence) {
47519           if (sequence.properties.hasOwnProperty("is_pano")) {
47520             if (sequence.properties.is_pano)
47521               return showsPano;
47522             return showsFlat;
47523           }
47524           return false;
47525         });
47526       }
47527       if (fromDate) {
47528         sequences = sequences.filter(function(sequence) {
47529           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
47530         });
47531       }
47532       if (toDate) {
47533         sequences = sequences.filter(function(sequence) {
47534           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
47535         });
47536       }
47537       return sequences;
47538     }
47539     function update() {
47540       const z = ~~context.map().zoom();
47541       const showMarkers = z >= minMarkerZoom;
47542       const showViewfields = z >= minViewfieldZoom;
47543       const service = getService();
47544       let sequences = service ? service.sequences(projection2) : [];
47545       let images = service && showMarkers ? service.images(projection2) : [];
47546       images = filterImages(images);
47547       sequences = filterSequences(sequences, service);
47548       service.filterViewer(context);
47549       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47550         return d.properties.id;
47551       });
47552       traces.exit().remove();
47553       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47554       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
47555         return d.id;
47556       });
47557       groups.exit().remove();
47558       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47559       groupsEnter.append("g").attr("class", "viewfield-scale");
47560       const markers = groups.merge(groupsEnter).sort(function(a, b) {
47561         return b.loc[1] - a.loc[1];
47562       }).attr("transform", transform2).select(".viewfield-scale");
47563       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47564       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47565       viewfields.exit().remove();
47566       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
47567         return this.parentNode.__data__.is_pano;
47568       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
47569       function viewfieldPath() {
47570         if (this.parentNode.__data__.is_pano) {
47571           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
47572         } else {
47573           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
47574         }
47575       }
47576     }
47577     function drawImages(selection2) {
47578       const enabled = svgMapillaryImages.enabled;
47579       const service = getService();
47580       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
47581       layer.exit().remove();
47582       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
47583       layerEnter.append("g").attr("class", "sequences");
47584       layerEnter.append("g").attr("class", "markers");
47585       layer = layerEnter.merge(layer);
47586       if (enabled) {
47587         if (service && ~~context.map().zoom() >= minZoom3) {
47588           editOn();
47589           update();
47590           service.loadImages(projection2);
47591         } else {
47592           editOff();
47593         }
47594       }
47595     }
47596     drawImages.enabled = function(_) {
47597       if (!arguments.length)
47598         return svgMapillaryImages.enabled;
47599       svgMapillaryImages.enabled = _;
47600       if (svgMapillaryImages.enabled) {
47601         showLayer();
47602         context.photos().on("change.mapillary_images", update);
47603       } else {
47604         hideLayer();
47605         context.photos().on("change.mapillary_images", null);
47606       }
47607       dispatch10.call("change");
47608       return this;
47609     };
47610     drawImages.supported = function() {
47611       return !!getService();
47612     };
47613     init2();
47614     return drawImages;
47615   }
47616
47617   // modules/svg/mapillary_position.js
47618   function svgMapillaryPosition(projection2, context) {
47619     const throttledRedraw = throttle_default(function() {
47620       update();
47621     }, 1e3);
47622     const minZoom3 = 12;
47623     const minViewfieldZoom = 18;
47624     let layer = select_default2(null);
47625     let _mapillary;
47626     let viewerCompassAngle;
47627     function init2() {
47628       if (svgMapillaryPosition.initialized)
47629         return;
47630       svgMapillaryPosition.initialized = true;
47631     }
47632     function getService() {
47633       if (services.mapillary && !_mapillary) {
47634         _mapillary = services.mapillary;
47635         _mapillary.event.on("imageChanged", throttledRedraw);
47636         _mapillary.event.on("bearingChanged", function(e) {
47637           viewerCompassAngle = e.bearing;
47638           if (context.map().isTransformed())
47639             return;
47640           layer.selectAll(".viewfield-group.currentView").filter(function(d) {
47641             return d.is_pano;
47642           }).attr("transform", transform2);
47643         });
47644       } else if (!services.mapillary && _mapillary) {
47645         _mapillary = null;
47646       }
47647       return _mapillary;
47648     }
47649     function editOn() {
47650       layer.style("display", "block");
47651     }
47652     function editOff() {
47653       layer.selectAll(".viewfield-group").remove();
47654       layer.style("display", "none");
47655     }
47656     function transform2(d) {
47657       let t = svgPointTransform(projection2)(d);
47658       if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
47659         t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
47660       } else if (d.ca) {
47661         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
47662       }
47663       return t;
47664     }
47665     function update() {
47666       const z = ~~context.map().zoom();
47667       const showViewfields = z >= minViewfieldZoom;
47668       const service = getService();
47669       const image = service && service.getActiveImage();
47670       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
47671         return d.id;
47672       });
47673       groups.exit().remove();
47674       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
47675       groupsEnter.append("g").attr("class", "viewfield-scale");
47676       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
47677       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47678       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47679       viewfields.exit().remove();
47680       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
47681     }
47682     function drawImages(selection2) {
47683       const service = getService();
47684       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
47685       layer.exit().remove();
47686       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
47687       layerEnter.append("g").attr("class", "markers");
47688       layer = layerEnter.merge(layer);
47689       if (service && ~~context.map().zoom() >= minZoom3) {
47690         editOn();
47691         update();
47692       } else {
47693         editOff();
47694       }
47695     }
47696     drawImages.enabled = function() {
47697       update();
47698       return this;
47699     };
47700     drawImages.supported = function() {
47701       return !!getService();
47702     };
47703     init2();
47704     return drawImages;
47705   }
47706
47707   // modules/svg/mapillary_signs.js
47708   function svgMapillarySigns(projection2, context, dispatch10) {
47709     const throttledRedraw = throttle_default(function() {
47710       dispatch10.call("change");
47711     }, 1e3);
47712     const minZoom3 = 12;
47713     let layer = select_default2(null);
47714     let _mapillary;
47715     function init2() {
47716       if (svgMapillarySigns.initialized)
47717         return;
47718       svgMapillarySigns.enabled = false;
47719       svgMapillarySigns.initialized = true;
47720     }
47721     function getService() {
47722       if (services.mapillary && !_mapillary) {
47723         _mapillary = services.mapillary;
47724         _mapillary.event.on("loadedSigns", throttledRedraw);
47725       } else if (!services.mapillary && _mapillary) {
47726         _mapillary = null;
47727       }
47728       return _mapillary;
47729     }
47730     function showLayer() {
47731       const service = getService();
47732       if (!service)
47733         return;
47734       service.loadSignResources(context);
47735       editOn();
47736     }
47737     function hideLayer() {
47738       throttledRedraw.cancel();
47739       editOff();
47740     }
47741     function editOn() {
47742       layer.style("display", "block");
47743     }
47744     function editOff() {
47745       layer.selectAll(".icon-sign").remove();
47746       layer.style("display", "none");
47747     }
47748     function click(d3_event, d) {
47749       const service = getService();
47750       if (!service)
47751         return;
47752       context.map().centerEase(d.loc);
47753       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
47754       service.getDetections(d.id).then((detections) => {
47755         if (detections.length) {
47756           const imageId = detections[0].image.id;
47757           if (imageId === selectedImageId) {
47758             service.highlightDetection(detections[0]).selectImage(context, imageId);
47759           } else {
47760             service.ensureViewerLoaded(context).then(function() {
47761               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
47762             });
47763           }
47764         }
47765       });
47766     }
47767     function filterData(detectedFeatures) {
47768       var fromDate = context.photos().fromDate();
47769       var toDate = context.photos().toDate();
47770       if (fromDate) {
47771         var fromTimestamp = new Date(fromDate).getTime();
47772         detectedFeatures = detectedFeatures.filter(function(feature3) {
47773           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
47774         });
47775       }
47776       if (toDate) {
47777         var toTimestamp = new Date(toDate).getTime();
47778         detectedFeatures = detectedFeatures.filter(function(feature3) {
47779           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
47780         });
47781       }
47782       return detectedFeatures;
47783     }
47784     function update() {
47785       const service = getService();
47786       let data = service ? service.signs(projection2) : [];
47787       data = filterData(data);
47788       const transform2 = svgPointTransform(projection2);
47789       const signs = layer.selectAll(".icon-sign").data(data, function(d) {
47790         return d.id;
47791       });
47792       signs.exit().remove();
47793       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
47794       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
47795         return "#" + d.value;
47796       });
47797       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
47798       signs.merge(enter).attr("transform", transform2);
47799     }
47800     function drawSigns(selection2) {
47801       const enabled = svgMapillarySigns.enabled;
47802       const service = getService();
47803       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
47804       layer.exit().remove();
47805       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
47806       if (enabled) {
47807         if (service && ~~context.map().zoom() >= minZoom3) {
47808           editOn();
47809           update();
47810           service.loadSigns(projection2);
47811           service.showSignDetections(true);
47812         } else {
47813           editOff();
47814         }
47815       } else if (service) {
47816         service.showSignDetections(false);
47817       }
47818     }
47819     drawSigns.enabled = function(_) {
47820       if (!arguments.length)
47821         return svgMapillarySigns.enabled;
47822       svgMapillarySigns.enabled = _;
47823       if (svgMapillarySigns.enabled) {
47824         showLayer();
47825         context.photos().on("change.mapillary_signs", update);
47826       } else {
47827         hideLayer();
47828         context.photos().on("change.mapillary_signs", null);
47829       }
47830       dispatch10.call("change");
47831       return this;
47832     };
47833     drawSigns.supported = function() {
47834       return !!getService();
47835     };
47836     init2();
47837     return drawSigns;
47838   }
47839
47840   // modules/svg/mapillary_map_features.js
47841   function svgMapillaryMapFeatures(projection2, context, dispatch10) {
47842     const throttledRedraw = throttle_default(function() {
47843       dispatch10.call("change");
47844     }, 1e3);
47845     const minZoom3 = 12;
47846     let layer = select_default2(null);
47847     let _mapillary;
47848     function init2() {
47849       if (svgMapillaryMapFeatures.initialized)
47850         return;
47851       svgMapillaryMapFeatures.enabled = false;
47852       svgMapillaryMapFeatures.initialized = true;
47853     }
47854     function getService() {
47855       if (services.mapillary && !_mapillary) {
47856         _mapillary = services.mapillary;
47857         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
47858       } else if (!services.mapillary && _mapillary) {
47859         _mapillary = null;
47860       }
47861       return _mapillary;
47862     }
47863     function showLayer() {
47864       const service = getService();
47865       if (!service)
47866         return;
47867       service.loadObjectResources(context);
47868       editOn();
47869     }
47870     function hideLayer() {
47871       throttledRedraw.cancel();
47872       editOff();
47873     }
47874     function editOn() {
47875       layer.style("display", "block");
47876     }
47877     function editOff() {
47878       layer.selectAll(".icon-map-feature").remove();
47879       layer.style("display", "none");
47880     }
47881     function click(d3_event, d) {
47882       const service = getService();
47883       if (!service)
47884         return;
47885       context.map().centerEase(d.loc);
47886       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
47887       service.getDetections(d.id).then((detections) => {
47888         if (detections.length) {
47889           const imageId = detections[0].image.id;
47890           if (imageId === selectedImageId) {
47891             service.highlightDetection(detections[0]).selectImage(context, imageId);
47892           } else {
47893             service.ensureViewerLoaded(context).then(function() {
47894               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
47895             });
47896           }
47897         }
47898       });
47899     }
47900     function filterData(detectedFeatures) {
47901       const fromDate = context.photos().fromDate();
47902       const toDate = context.photos().toDate();
47903       if (fromDate) {
47904         detectedFeatures = detectedFeatures.filter(function(feature3) {
47905           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
47906         });
47907       }
47908       if (toDate) {
47909         detectedFeatures = detectedFeatures.filter(function(feature3) {
47910           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
47911         });
47912       }
47913       return detectedFeatures;
47914     }
47915     function update() {
47916       const service = getService();
47917       let data = service ? service.mapFeatures(projection2) : [];
47918       data = filterData(data);
47919       const transform2 = svgPointTransform(projection2);
47920       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
47921         return d.id;
47922       });
47923       mapFeatures.exit().remove();
47924       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
47925       enter.append("title").text(function(d) {
47926         var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
47927         return _t("mapillary_map_features." + id2);
47928       });
47929       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
47930         if (d.value === "object--billboard") {
47931           return "#object--sign--advertisement";
47932         }
47933         return "#" + d.value;
47934       });
47935       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
47936       mapFeatures.merge(enter).attr("transform", transform2);
47937     }
47938     function drawMapFeatures(selection2) {
47939       const enabled = svgMapillaryMapFeatures.enabled;
47940       const service = getService();
47941       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
47942       layer.exit().remove();
47943       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
47944       if (enabled) {
47945         if (service && ~~context.map().zoom() >= minZoom3) {
47946           editOn();
47947           update();
47948           service.loadMapFeatures(projection2);
47949           service.showFeatureDetections(true);
47950         } else {
47951           editOff();
47952         }
47953       } else if (service) {
47954         service.showFeatureDetections(false);
47955       }
47956     }
47957     drawMapFeatures.enabled = function(_) {
47958       if (!arguments.length)
47959         return svgMapillaryMapFeatures.enabled;
47960       svgMapillaryMapFeatures.enabled = _;
47961       if (svgMapillaryMapFeatures.enabled) {
47962         showLayer();
47963         context.photos().on("change.mapillary_map_features", update);
47964       } else {
47965         hideLayer();
47966         context.photos().on("change.mapillary_map_features", null);
47967       }
47968       dispatch10.call("change");
47969       return this;
47970     };
47971     drawMapFeatures.supported = function() {
47972       return !!getService();
47973     };
47974     init2();
47975     return drawMapFeatures;
47976   }
47977
47978   // modules/svg/kartaview_images.js
47979   function svgKartaviewImages(projection2, context, dispatch10) {
47980     var throttledRedraw = throttle_default(function() {
47981       dispatch10.call("change");
47982     }, 1e3);
47983     var minZoom3 = 12;
47984     var minMarkerZoom = 16;
47985     var minViewfieldZoom = 18;
47986     var layer = select_default2(null);
47987     var _kartaview;
47988     function init2() {
47989       if (svgKartaviewImages.initialized)
47990         return;
47991       svgKartaviewImages.enabled = false;
47992       svgKartaviewImages.initialized = true;
47993     }
47994     function getService() {
47995       if (services.kartaview && !_kartaview) {
47996         _kartaview = services.kartaview;
47997         _kartaview.event.on("loadedImages", throttledRedraw);
47998       } else if (!services.kartaview && _kartaview) {
47999         _kartaview = null;
48000       }
48001       return _kartaview;
48002     }
48003     function showLayer() {
48004       var service = getService();
48005       if (!service)
48006         return;
48007       editOn();
48008       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48009         dispatch10.call("change");
48010       });
48011     }
48012     function hideLayer() {
48013       throttledRedraw.cancel();
48014       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
48015     }
48016     function editOn() {
48017       layer.style("display", "block");
48018     }
48019     function editOff() {
48020       layer.selectAll(".viewfield-group").remove();
48021       layer.style("display", "none");
48022     }
48023     function click(d3_event, d) {
48024       var service = getService();
48025       if (!service)
48026         return;
48027       service.ensureViewerLoaded(context).then(function() {
48028         service.selectImage(context, d.key).showViewer(context);
48029       });
48030       context.map().centerEase(d.loc);
48031     }
48032     function mouseover(d3_event, d) {
48033       var service = getService();
48034       if (service)
48035         service.setStyles(context, d);
48036     }
48037     function mouseout() {
48038       var service = getService();
48039       if (service)
48040         service.setStyles(context, null);
48041     }
48042     function transform2(d) {
48043       var t = svgPointTransform(projection2)(d);
48044       if (d.ca) {
48045         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48046       }
48047       return t;
48048     }
48049     function filterImages(images) {
48050       var fromDate = context.photos().fromDate();
48051       var toDate = context.photos().toDate();
48052       var usernames = context.photos().usernames();
48053       if (fromDate) {
48054         var fromTimestamp = new Date(fromDate).getTime();
48055         images = images.filter(function(item) {
48056           return new Date(item.captured_at).getTime() >= fromTimestamp;
48057         });
48058       }
48059       if (toDate) {
48060         var toTimestamp = new Date(toDate).getTime();
48061         images = images.filter(function(item) {
48062           return new Date(item.captured_at).getTime() <= toTimestamp;
48063         });
48064       }
48065       if (usernames) {
48066         images = images.filter(function(item) {
48067           return usernames.indexOf(item.captured_by) !== -1;
48068         });
48069       }
48070       return images;
48071     }
48072     function filterSequences(sequences) {
48073       var fromDate = context.photos().fromDate();
48074       var toDate = context.photos().toDate();
48075       var usernames = context.photos().usernames();
48076       if (fromDate) {
48077         var fromTimestamp = new Date(fromDate).getTime();
48078         sequences = sequences.filter(function(image) {
48079           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
48080         });
48081       }
48082       if (toDate) {
48083         var toTimestamp = new Date(toDate).getTime();
48084         sequences = sequences.filter(function(image) {
48085           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
48086         });
48087       }
48088       if (usernames) {
48089         sequences = sequences.filter(function(image) {
48090           return usernames.indexOf(image.properties.captured_by) !== -1;
48091         });
48092       }
48093       return sequences;
48094     }
48095     function update() {
48096       var viewer = context.container().select(".photoviewer");
48097       var selected = viewer.empty() ? void 0 : viewer.datum();
48098       var z = ~~context.map().zoom();
48099       var showMarkers = z >= minMarkerZoom;
48100       var showViewfields = z >= minViewfieldZoom;
48101       var service = getService();
48102       var sequences = [];
48103       var images = [];
48104       if (context.photos().showsFlat()) {
48105         sequences = service ? service.sequences(projection2) : [];
48106         images = service && showMarkers ? service.images(projection2) : [];
48107         sequences = filterSequences(sequences);
48108         images = filterImages(images);
48109       }
48110       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
48111         return d.properties.key;
48112       });
48113       traces.exit().remove();
48114       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
48115       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
48116         return d.key;
48117       });
48118       groups.exit().remove();
48119       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
48120       groupsEnter.append("g").attr("class", "viewfield-scale");
48121       var markers = groups.merge(groupsEnter).sort(function(a, b) {
48122         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
48123       }).attr("transform", transform2).select(".viewfield-scale");
48124       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48125       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48126       viewfields.exit().remove();
48127       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
48128     }
48129     function drawImages(selection2) {
48130       var enabled = svgKartaviewImages.enabled, service = getService();
48131       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
48132       layer.exit().remove();
48133       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
48134       layerEnter.append("g").attr("class", "sequences");
48135       layerEnter.append("g").attr("class", "markers");
48136       layer = layerEnter.merge(layer);
48137       if (enabled) {
48138         if (service && ~~context.map().zoom() >= minZoom3) {
48139           editOn();
48140           update();
48141           service.loadImages(projection2);
48142         } else {
48143           editOff();
48144         }
48145       }
48146     }
48147     drawImages.enabled = function(_) {
48148       if (!arguments.length)
48149         return svgKartaviewImages.enabled;
48150       svgKartaviewImages.enabled = _;
48151       if (svgKartaviewImages.enabled) {
48152         showLayer();
48153         context.photos().on("change.kartaview_images", update);
48154       } else {
48155         hideLayer();
48156         context.photos().on("change.kartaview_images", null);
48157       }
48158       dispatch10.call("change");
48159       return this;
48160     };
48161     drawImages.supported = function() {
48162       return !!getService();
48163     };
48164     init2();
48165     return drawImages;
48166   }
48167
48168   // modules/svg/osm.js
48169   function svgOsm(projection2, context, dispatch10) {
48170     var enabled = true;
48171     function drawOsm(selection2) {
48172       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
48173         return "layer-osm " + d;
48174       });
48175       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
48176         return "points-group " + d;
48177       });
48178     }
48179     function showLayer() {
48180       var layer = context.surface().selectAll(".data-layer.osm");
48181       layer.interrupt();
48182       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48183         dispatch10.call("change");
48184       });
48185     }
48186     function hideLayer() {
48187       var layer = context.surface().selectAll(".data-layer.osm");
48188       layer.interrupt();
48189       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48190         layer.classed("disabled", true);
48191         dispatch10.call("change");
48192       });
48193     }
48194     drawOsm.enabled = function(val) {
48195       if (!arguments.length)
48196         return enabled;
48197       enabled = val;
48198       if (enabled) {
48199         showLayer();
48200       } else {
48201         hideLayer();
48202       }
48203       dispatch10.call("change");
48204       return this;
48205     };
48206     return drawOsm;
48207   }
48208
48209   // modules/svg/notes.js
48210   var _notesEnabled = false;
48211   var _osmService;
48212   function svgNotes(projection2, context, dispatch10) {
48213     if (!dispatch10) {
48214       dispatch10 = dispatch_default("change");
48215     }
48216     var throttledRedraw = throttle_default(function() {
48217       dispatch10.call("change");
48218     }, 1e3);
48219     var minZoom3 = 12;
48220     var touchLayer = select_default2(null);
48221     var drawLayer = select_default2(null);
48222     var _notesVisible = false;
48223     function markerPath(selection2, klass) {
48224       selection2.attr("class", klass).attr("transform", "translate(-8, -22)").attr("d", "m17.5,0l-15,0c-1.37,0 -2.5,1.12 -2.5,2.5l0,11.25c0,1.37 1.12,2.5 2.5,2.5l3.75,0l0,3.28c0,0.38 0.43,0.6 0.75,0.37l4.87,-3.65l5.62,0c1.37,0 2.5,-1.12 2.5,-2.5l0,-11.25c0,-1.37 -1.12,-2.5 -2.5,-2.5z");
48225     }
48226     function getService() {
48227       if (services.osm && !_osmService) {
48228         _osmService = services.osm;
48229         _osmService.on("loadedNotes", throttledRedraw);
48230       } else if (!services.osm && _osmService) {
48231         _osmService = null;
48232       }
48233       return _osmService;
48234     }
48235     function editOn() {
48236       if (!_notesVisible) {
48237         _notesVisible = true;
48238         drawLayer.style("display", "block");
48239       }
48240     }
48241     function editOff() {
48242       if (_notesVisible) {
48243         _notesVisible = false;
48244         drawLayer.style("display", "none");
48245         drawLayer.selectAll(".note").remove();
48246         touchLayer.selectAll(".note").remove();
48247       }
48248     }
48249     function layerOn() {
48250       editOn();
48251       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48252         dispatch10.call("change");
48253       });
48254     }
48255     function layerOff() {
48256       throttledRedraw.cancel();
48257       drawLayer.interrupt();
48258       touchLayer.selectAll(".note").remove();
48259       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48260         editOff();
48261         dispatch10.call("change");
48262       });
48263     }
48264     function updateMarkers() {
48265       if (!_notesVisible || !_notesEnabled)
48266         return;
48267       var service = getService();
48268       var selectedID = context.selectedNoteID();
48269       var data = service ? service.notes(projection2) : [];
48270       var getTransform = svgPointTransform(projection2);
48271       var notes = drawLayer.selectAll(".note").data(data, function(d) {
48272         return d.status + d.id;
48273       });
48274       notes.exit().remove();
48275       var notesEnter = notes.enter().append("g").attr("class", function(d) {
48276         return "note note-" + d.id + " " + d.status;
48277       }).classed("new", function(d) {
48278         return d.id < 0;
48279       });
48280       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48281       notesEnter.append("path").call(markerPath, "shadow");
48282       notesEnter.append("use").attr("class", "note-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-note");
48283       notesEnter.selectAll(".icon-annotation").data(function(d) {
48284         return [d];
48285       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
48286         if (d.id < 0)
48287           return "#iD-icon-plus";
48288         if (d.status === "open")
48289           return "#iD-icon-close";
48290         return "#iD-icon-apply";
48291       });
48292       notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
48293         var mode = context.mode();
48294         var isMoving = mode && mode.id === "drag-note";
48295         return !isMoving && d.id === selectedID;
48296       }).attr("transform", getTransform);
48297       if (touchLayer.empty())
48298         return;
48299       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48300       var targets = touchLayer.selectAll(".note").data(data, function(d) {
48301         return d.id;
48302       });
48303       targets.exit().remove();
48304       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
48305         var newClass = d.id < 0 ? "new" : "";
48306         return "note target note-" + d.id + " " + fillClass + newClass;
48307       }).attr("transform", getTransform);
48308       function sortY(a, b) {
48309         if (a.id === selectedID)
48310           return 1;
48311         if (b.id === selectedID)
48312           return -1;
48313         return b.loc[1] - a.loc[1];
48314       }
48315     }
48316     function drawNotes(selection2) {
48317       var service = getService();
48318       var surface = context.surface();
48319       if (surface && !surface.empty()) {
48320         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48321       }
48322       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
48323       drawLayer.exit().remove();
48324       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
48325       if (_notesEnabled) {
48326         if (service && ~~context.map().zoom() >= minZoom3) {
48327           editOn();
48328           service.loadNotes(projection2);
48329           updateMarkers();
48330         } else {
48331           editOff();
48332         }
48333       }
48334     }
48335     drawNotes.enabled = function(val) {
48336       if (!arguments.length)
48337         return _notesEnabled;
48338       _notesEnabled = val;
48339       if (_notesEnabled) {
48340         layerOn();
48341       } else {
48342         layerOff();
48343         if (context.selectedNoteID()) {
48344           context.enter(modeBrowse(context));
48345         }
48346       }
48347       dispatch10.call("change");
48348       return this;
48349     };
48350     return drawNotes;
48351   }
48352
48353   // modules/svg/touch.js
48354   function svgTouch() {
48355     function drawTouch(selection2) {
48356       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
48357         return "layer-touch " + d;
48358       });
48359     }
48360     return drawTouch;
48361   }
48362
48363   // modules/util/dimensions.js
48364   function refresh(selection2, node) {
48365     var cr = node.getBoundingClientRect();
48366     var prop = [cr.width, cr.height];
48367     selection2.property("__dimensions__", prop);
48368     return prop;
48369   }
48370   function utilGetDimensions(selection2, force) {
48371     if (!selection2 || selection2.empty()) {
48372       return [0, 0];
48373     }
48374     var node = selection2.node(), cached = selection2.property("__dimensions__");
48375     return !cached || force ? refresh(selection2, node) : cached;
48376   }
48377   function utilSetDimensions(selection2, dimensions) {
48378     if (!selection2 || selection2.empty()) {
48379       return selection2;
48380     }
48381     var node = selection2.node();
48382     if (dimensions === null) {
48383       refresh(selection2, node);
48384       return selection2;
48385     }
48386     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
48387   }
48388
48389   // modules/svg/layers.js
48390   function svgLayers(projection2, context) {
48391     var dispatch10 = dispatch_default("change");
48392     var svg2 = select_default2(null);
48393     var _layers = [
48394       { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
48395       { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
48396       { id: "data", layer: svgData(projection2, context, dispatch10) },
48397       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
48398       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
48399       { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
48400       { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
48401       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
48402       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
48403       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
48404       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
48405       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
48406       { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
48407       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
48408       { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
48409     ];
48410     function drawLayers(selection2) {
48411       svg2 = selection2.selectAll(".surface").data([0]);
48412       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
48413       var defs = svg2.selectAll(".surface-defs").data([0]);
48414       defs.enter().append("defs").attr("class", "surface-defs");
48415       var groups = svg2.selectAll(".data-layer").data(_layers);
48416       groups.exit().remove();
48417       groups.enter().append("g").attr("class", function(d) {
48418         return "data-layer " + d.id;
48419       }).merge(groups).each(function(d) {
48420         select_default2(this).call(d.layer);
48421       });
48422     }
48423     drawLayers.all = function() {
48424       return _layers;
48425     };
48426     drawLayers.layer = function(id2) {
48427       var obj = _layers.find(function(o) {
48428         return o.id === id2;
48429       });
48430       return obj && obj.layer;
48431     };
48432     drawLayers.only = function(what) {
48433       var arr = [].concat(what);
48434       var all = _layers.map(function(layer) {
48435         return layer.id;
48436       });
48437       return drawLayers.remove(utilArrayDifference(all, arr));
48438     };
48439     drawLayers.remove = function(what) {
48440       var arr = [].concat(what);
48441       arr.forEach(function(id2) {
48442         _layers = _layers.filter(function(o) {
48443           return o.id !== id2;
48444         });
48445       });
48446       dispatch10.call("change");
48447       return this;
48448     };
48449     drawLayers.add = function(what) {
48450       var arr = [].concat(what);
48451       arr.forEach(function(obj) {
48452         if ("id" in obj && "layer" in obj) {
48453           _layers.push(obj);
48454         }
48455       });
48456       dispatch10.call("change");
48457       return this;
48458     };
48459     drawLayers.dimensions = function(val) {
48460       if (!arguments.length)
48461         return utilGetDimensions(svg2);
48462       utilSetDimensions(svg2, val);
48463       return this;
48464     };
48465     return utilRebind(drawLayers, dispatch10, "on");
48466   }
48467
48468   // modules/svg/lines.js
48469   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
48470   function svgLines(projection2, context) {
48471     var detected = utilDetect();
48472     var highway_stack = {
48473       motorway: 0,
48474       motorway_link: 1,
48475       trunk: 2,
48476       trunk_link: 3,
48477       primary: 4,
48478       primary_link: 5,
48479       secondary: 6,
48480       tertiary: 7,
48481       unclassified: 8,
48482       residential: 9,
48483       service: 10,
48484       footway: 11
48485     };
48486     function drawTargets(selection2, graph, entities, filter2) {
48487       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
48488       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
48489       var getPath = svgPath(projection2).geojson;
48490       var activeID = context.activeID();
48491       var base = context.history().base();
48492       var data = { targets: [], nopes: [] };
48493       entities.forEach(function(way) {
48494         var features2 = svgSegmentWay(way, graph, activeID);
48495         data.targets.push.apply(data.targets, features2.passive);
48496         data.nopes.push.apply(data.nopes, features2.active);
48497       });
48498       var targetData = data.targets.filter(getPath);
48499       var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
48500         return filter2(d.properties.entity);
48501       }).data(targetData, function key(d) {
48502         return d.id;
48503       });
48504       targets.exit().remove();
48505       var segmentWasEdited = function(d) {
48506         var wayID = d.properties.entity.id;
48507         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
48508           return false;
48509         }
48510         return d.properties.nodes.some(function(n2) {
48511           return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
48512         });
48513       };
48514       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
48515         return "way line target target-allowed " + targetClass + d.id;
48516       }).classed("segment-edited", segmentWasEdited);
48517       var nopeData = data.nopes.filter(getPath);
48518       var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
48519         return filter2(d.properties.entity);
48520       }).data(nopeData, function key(d) {
48521         return d.id;
48522       });
48523       nopes.exit().remove();
48524       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
48525         return "way line target target-nope " + nopeClass + d.id;
48526       }).classed("segment-edited", segmentWasEdited);
48527     }
48528     function drawLines(selection2, graph, entities, filter2) {
48529       var base = context.history().base();
48530       function waystack(a, b) {
48531         var selected = context.selectedIDs();
48532         var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
48533         var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
48534         if (a.tags.highway) {
48535           scoreA -= highway_stack[a.tags.highway];
48536         }
48537         if (b.tags.highway) {
48538           scoreB -= highway_stack[b.tags.highway];
48539         }
48540         return scoreA - scoreB;
48541       }
48542       function drawLineGroup(selection3, klass, isSelected) {
48543         var mode = context.mode();
48544         var isDrawing = mode && /^draw/.test(mode.id);
48545         var selectedClass = !isDrawing && isSelected ? "selected " : "";
48546         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
48547         lines.exit().remove();
48548         lines.enter().append("path").attr("class", function(d) {
48549           var prefix = "way line";
48550           if (!d.hasInterestingTags()) {
48551             var parentRelations = graph.parentRelations(d);
48552             var parentMultipolygons = parentRelations.filter(function(relation) {
48553               return relation.isMultipolygon();
48554             });
48555             if (parentMultipolygons.length > 0 && parentRelations.length === parentMultipolygons.length) {
48556               prefix = "relation area";
48557             }
48558           }
48559           var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
48560           return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
48561         }).classed("added", function(d) {
48562           return !base.entities[d.id];
48563         }).classed("geometry-edited", function(d) {
48564           return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
48565         }).classed("retagged", function(d) {
48566           return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
48567         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
48568         return selection3;
48569       }
48570       function getPathData(isSelected) {
48571         return function() {
48572           var layer = this.parentNode.__data__;
48573           var data = pathdata[layer] || [];
48574           return data.filter(function(d) {
48575             if (isSelected) {
48576               return context.selectedIDs().indexOf(d.id) !== -1;
48577             } else {
48578               return context.selectedIDs().indexOf(d.id) === -1;
48579             }
48580           });
48581         };
48582       }
48583       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
48584         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
48585         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
48586         var markers = markergroup.selectAll("path").filter(filter2).data(function data() {
48587           return groupdata[this.parentNode.__data__] || [];
48588         }, function key(d) {
48589           return [d.id, d.index];
48590         });
48591         markers.exit().remove();
48592         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
48593           return d.d;
48594         });
48595         if (detected.ie) {
48596           markers.each(function() {
48597             this.parentNode.insertBefore(this, this);
48598           });
48599         }
48600       }
48601       var getPath = svgPath(projection2, graph);
48602       var ways = [];
48603       var onewaydata = {};
48604       var sideddata = {};
48605       var oldMultiPolygonOuters = {};
48606       for (var i2 = 0; i2 < entities.length; i2++) {
48607         var entity = entities[i2];
48608         var outer = osmOldMultipolygonOuterMember(entity, graph);
48609         if (outer) {
48610           ways.push(entity.mergeTags(outer.tags));
48611           oldMultiPolygonOuters[outer.id] = true;
48612         } else if (entity.geometry(graph) === "line") {
48613           ways.push(entity);
48614         }
48615       }
48616       ways = ways.filter(getPath);
48617       var pathdata = utilArrayGroupBy(ways, function(way) {
48618         return way.layer();
48619       });
48620       Object.keys(pathdata).forEach(function(k) {
48621         var v = pathdata[k];
48622         var onewayArr = v.filter(function(d) {
48623           return d.isOneWay();
48624         });
48625         var onewaySegments = svgMarkerSegments(projection2, graph, 35, function shouldReverse(entity2) {
48626           return entity2.tags.oneway === "-1";
48627         }, function bothDirections(entity2) {
48628           return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
48629         });
48630         onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
48631         var sidedArr = v.filter(function(d) {
48632           return d.isSided();
48633         });
48634         var sidedSegments = svgMarkerSegments(projection2, graph, 30, function shouldReverse() {
48635           return false;
48636         }, function bothDirections() {
48637           return false;
48638         });
48639         sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
48640       });
48641       var covered = selection2.selectAll(".layer-osm.covered");
48642       var uncovered = selection2.selectAll(".layer-osm.lines");
48643       var touchLayer = selection2.selectAll(".layer-touch.lines");
48644       [covered, uncovered].forEach(function(selection3) {
48645         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
48646         var layergroup = selection3.selectAll("g.layergroup").data(range3);
48647         layergroup = layergroup.enter().append("g").attr("class", function(d) {
48648           return "layergroup layer" + String(d);
48649         }).merge(layergroup);
48650         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
48651           return "linegroup line-" + d;
48652         });
48653         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
48654         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
48655         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
48656         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
48657         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
48658         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
48659         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
48660         addMarkers(layergroup, "sided", "sidedgroup", sideddata, function marker(d) {
48661           var category = graph.entity(d.id).sidednessIdentifier();
48662           return "url(#ideditor-sided-marker-" + category + ")";
48663         });
48664       });
48665       touchLayer.call(drawTargets, graph, ways, filter2);
48666     }
48667     return drawLines;
48668   }
48669
48670   // modules/svg/midpoints.js
48671   function svgMidpoints(projection2, context) {
48672     var targetRadius = 8;
48673     function drawTargets(selection2, graph, entities, filter2) {
48674       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48675       var getTransform = svgPointTransform(projection2).geojson;
48676       var data = entities.map(function(midpoint) {
48677         return {
48678           type: "Feature",
48679           id: midpoint.id,
48680           properties: {
48681             target: true,
48682             entity: midpoint
48683           },
48684           geometry: {
48685             type: "Point",
48686             coordinates: midpoint.loc
48687           }
48688         };
48689       });
48690       var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
48691         return filter2(d.properties.entity);
48692       }).data(data, function key(d) {
48693         return d.id;
48694       });
48695       targets.exit().remove();
48696       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
48697         return "node midpoint target " + fillClass + d.id;
48698       }).attr("transform", getTransform);
48699     }
48700     function drawMidpoints(selection2, graph, entities, filter2, extent) {
48701       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
48702       var touchLayer = selection2.selectAll(".layer-touch.points");
48703       var mode = context.mode();
48704       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
48705         drawLayer.selectAll(".midpoint").remove();
48706         touchLayer.selectAll(".midpoint.target").remove();
48707         return;
48708       }
48709       var poly = extent.polygon();
48710       var midpoints = {};
48711       for (var i2 = 0; i2 < entities.length; i2++) {
48712         var entity = entities[i2];
48713         if (entity.type !== "way")
48714           continue;
48715         if (!filter2(entity))
48716           continue;
48717         if (context.selectedIDs().indexOf(entity.id) < 0)
48718           continue;
48719         var nodes = graph.childNodes(entity);
48720         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
48721           var a = nodes[j2];
48722           var b = nodes[j2 + 1];
48723           var id2 = [a.id, b.id].sort().join("-");
48724           if (midpoints[id2]) {
48725             midpoints[id2].parents.push(entity);
48726           } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
48727             var point = geoVecInterp(a.loc, b.loc, 0.5);
48728             var loc = null;
48729             if (extent.intersects(point)) {
48730               loc = point;
48731             } else {
48732               for (var k = 0; k < 4; k++) {
48733                 point = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
48734                 if (point && geoVecLength(projection2(a.loc), projection2(point)) > 20 && geoVecLength(projection2(b.loc), projection2(point)) > 20) {
48735                   loc = point;
48736                   break;
48737                 }
48738               }
48739             }
48740             if (loc) {
48741               midpoints[id2] = {
48742                 type: "midpoint",
48743                 id: id2,
48744                 loc,
48745                 edge: [a.id, b.id],
48746                 parents: [entity]
48747               };
48748             }
48749           }
48750         }
48751       }
48752       function midpointFilter(d) {
48753         if (midpoints[d.id])
48754           return true;
48755         for (var i3 = 0; i3 < d.parents.length; i3++) {
48756           if (filter2(d.parents[i3])) {
48757             return true;
48758           }
48759         }
48760         return false;
48761       }
48762       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
48763         return d.id;
48764       });
48765       groups.exit().remove();
48766       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
48767       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
48768       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
48769       groups = groups.merge(enter).attr("transform", function(d) {
48770         var translate = svgPointTransform(projection2);
48771         var a2 = graph.entity(d.edge[0]);
48772         var b2 = graph.entity(d.edge[1]);
48773         var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
48774         return translate(d) + " rotate(" + angle2 + ")";
48775       }).call(svgTagClasses().tags(function(d) {
48776         return d.parents[0].tags;
48777       }));
48778       groups.select("polygon.shadow");
48779       groups.select("polygon.fill");
48780       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
48781     }
48782     return drawMidpoints;
48783   }
48784
48785   // modules/svg/points.js
48786   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
48787   function svgPoints(projection2, context) {
48788     function markerPath(selection2, klass) {
48789       selection2.attr("class", klass).attr("transform", "translate(-8, -23)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
48790     }
48791     function sortY(a, b) {
48792       return b.loc[1] - a.loc[1];
48793     }
48794     function fastEntityKey(d) {
48795       var mode = context.mode();
48796       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
48797       return isMoving ? d.id : osmEntity.key(d);
48798     }
48799     function drawTargets(selection2, graph, entities, filter2) {
48800       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48801       var getTransform = svgPointTransform(projection2).geojson;
48802       var activeID = context.activeID();
48803       var data = [];
48804       entities.forEach(function(node) {
48805         if (activeID === node.id)
48806           return;
48807         data.push({
48808           type: "Feature",
48809           id: node.id,
48810           properties: {
48811             target: true,
48812             entity: node
48813           },
48814           geometry: node.asGeoJSON()
48815         });
48816       });
48817       var targets = selection2.selectAll(".point.target").filter(function(d) {
48818         return filter2(d.properties.entity);
48819       }).data(data, function key(d) {
48820         return d.id;
48821       });
48822       targets.exit().remove();
48823       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
48824         return "node point target " + fillClass + d.id;
48825       }).attr("transform", getTransform);
48826     }
48827     function drawPoints(selection2, graph, entities, filter2) {
48828       var wireframe = context.surface().classed("fill-wireframe");
48829       var zoom = geoScaleToZoom(projection2.scale());
48830       var base = context.history().base();
48831       function renderAsPoint(entity) {
48832         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
48833       }
48834       var points = wireframe ? [] : entities.filter(renderAsPoint);
48835       points.sort(sortY);
48836       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
48837       var touchLayer = selection2.selectAll(".layer-touch.points");
48838       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
48839       groups.exit().remove();
48840       var enter = groups.enter().append("g").attr("class", function(d) {
48841         return "node point " + d.id;
48842       }).order();
48843       enter.append("path").call(markerPath, "shadow");
48844       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48845       enter.append("path").call(markerPath, "stroke");
48846       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
48847       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
48848         return !base.entities[d.id];
48849       }).classed("moved", function(d) {
48850         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
48851       }).classed("retagged", function(d) {
48852         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
48853       }).call(svgTagClasses());
48854       groups.select(".shadow");
48855       groups.select(".stroke");
48856       groups.select(".icon").attr("xlink:href", function(entity) {
48857         var preset = _mainPresetIndex.match(entity, graph);
48858         var picon = preset && preset.icon;
48859         return picon ? "#" + picon : "";
48860       });
48861       touchLayer.call(drawTargets, graph, points, filter2);
48862     }
48863     return drawPoints;
48864   }
48865
48866   // modules/svg/turns.js
48867   function svgTurns(projection2, context) {
48868     function icon2(turn) {
48869       var u = turn.u ? "-u" : "";
48870       if (turn.no)
48871         return "#iD-turn-no" + u;
48872       if (turn.only)
48873         return "#iD-turn-only" + u;
48874       return "#iD-turn-yes" + u;
48875     }
48876     function drawTurns(selection2, graph, turns) {
48877       function turnTransform(d) {
48878         var pxRadius = 50;
48879         var toWay = graph.entity(d.to.way);
48880         var toPoints = graph.childNodes(toWay).map(function(n2) {
48881           return n2.loc;
48882         }).map(projection2);
48883         var toLength = geoPathLength(toPoints);
48884         var mid = toLength / 2;
48885         var toNode = graph.entity(d.to.node);
48886         var toVertex = graph.entity(d.to.vertex);
48887         var a = geoAngle(toVertex, toNode, projection2);
48888         var o = projection2(toVertex.loc);
48889         var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
48890         return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
48891       }
48892       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
48893       var touchLayer = selection2.selectAll(".layer-touch.turns");
48894       var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
48895         return d.key;
48896       });
48897       groups.exit().remove();
48898       var groupsEnter = groups.enter().append("g").attr("class", function(d) {
48899         return "turn " + d.key;
48900       });
48901       var turnsEnter = groupsEnter.filter(function(d) {
48902         return !d.u;
48903       });
48904       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48905       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48906       var uEnter = groupsEnter.filter(function(d) {
48907         return d.u;
48908       });
48909       uEnter.append("circle").attr("r", "16");
48910       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
48911       groups = groups.merge(groupsEnter).attr("opacity", function(d) {
48912         return d.direct === false ? "0.7" : null;
48913       }).attr("transform", turnTransform);
48914       groups.select("use").attr("xlink:href", icon2);
48915       groups.select("rect");
48916       groups.select("circle");
48917       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48918       groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
48919         return d.key;
48920       });
48921       groups.exit().remove();
48922       groupsEnter = groups.enter().append("g").attr("class", function(d) {
48923         return "turn " + d.key;
48924       });
48925       turnsEnter = groupsEnter.filter(function(d) {
48926         return !d.u;
48927       });
48928       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48929       uEnter = groupsEnter.filter(function(d) {
48930         return d.u;
48931       });
48932       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
48933       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
48934       groups.select("rect");
48935       groups.select("circle");
48936       return this;
48937     }
48938     return drawTurns;
48939   }
48940
48941   // modules/svg/vertices.js
48942   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
48943   function svgVertices(projection2, context) {
48944     var radiuses = {
48945       shadow: [6, 7.5, 7.5, 12],
48946       stroke: [2.5, 3.5, 3.5, 8],
48947       fill: [1, 1.5, 1.5, 1.5]
48948     };
48949     var _currHoverTarget;
48950     var _currPersistent = {};
48951     var _currHover = {};
48952     var _prevHover = {};
48953     var _currSelected = {};
48954     var _prevSelected = {};
48955     var _radii = {};
48956     function sortY(a, b) {
48957       return b.loc[1] - a.loc[1];
48958     }
48959     function fastEntityKey(d) {
48960       var mode = context.mode();
48961       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
48962       return isMoving ? d.id : osmEntity.key(d);
48963     }
48964     function draw(selection2, graph, vertices, sets2, filter2) {
48965       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
48966       var icons = {};
48967       var directions = {};
48968       var wireframe = context.surface().classed("fill-wireframe");
48969       var zoom = geoScaleToZoom(projection2.scale());
48970       var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
48971       var activeID = context.activeID();
48972       var base = context.history().base();
48973       function getIcon(d) {
48974         var entity = graph.entity(d.id);
48975         if (entity.id in icons)
48976           return icons[entity.id];
48977         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
48978         return icons[entity.id];
48979       }
48980       function getDirections(entity) {
48981         if (entity.id in directions)
48982           return directions[entity.id];
48983         var angles = entity.directions(graph, projection2);
48984         directions[entity.id] = angles.length ? angles : false;
48985         return angles;
48986       }
48987       function updateAttributes(selection3) {
48988         ["shadow", "stroke", "fill"].forEach(function(klass) {
48989           var rads = radiuses[klass];
48990           selection3.selectAll("." + klass).each(function(entity) {
48991             var i2 = z && getIcon(entity);
48992             var r = rads[i2 ? 3 : z];
48993             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
48994               r += 1.5;
48995             }
48996             if (klass === "shadow") {
48997               _radii[entity.id] = r;
48998             }
48999             select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
49000           });
49001         });
49002       }
49003       vertices.sort(sortY);
49004       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
49005       groups.exit().remove();
49006       var enter = groups.enter().append("g").attr("class", function(d) {
49007         return "node vertex " + d.id;
49008       }).order();
49009       enter.append("circle").attr("class", "shadow");
49010       enter.append("circle").attr("class", "stroke");
49011       enter.filter(function(d) {
49012         return d.hasInterestingTags();
49013       }).append("circle").attr("class", "fill");
49014       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
49015         return d.id in sets2.selected;
49016       }).classed("shared", function(d) {
49017         return graph.isShared(d);
49018       }).classed("endpoint", function(d) {
49019         return d.isEndpoint(graph);
49020       }).classed("added", function(d) {
49021         return !base.entities[d.id];
49022       }).classed("moved", function(d) {
49023         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
49024       }).classed("retagged", function(d) {
49025         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49026       }).call(updateAttributes);
49027       var iconUse = groups.selectAll(".icon").data(function data(d) {
49028         return zoom >= 17 && getIcon(d) ? [d] : [];
49029       }, fastEntityKey);
49030       iconUse.exit().remove();
49031       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
49032         var picon = getIcon(d);
49033         return picon ? "#" + picon : "";
49034       });
49035       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
49036         return zoom >= 18 && getDirections(d) ? [d] : [];
49037       }, fastEntityKey);
49038       dgroups.exit().remove();
49039       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
49040       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
49041         return osmEntity.key(d);
49042       });
49043       viewfields.exit().remove();
49044       viewfields.enter().append("path").attr("class", "viewfield").attr("d", "M0,0H0").merge(viewfields).attr("marker-start", "url(#ideditor-viewfield-marker" + (wireframe ? "-wireframe" : "") + ")").attr("transform", function(d) {
49045         return "rotate(" + d + ")";
49046       });
49047     }
49048     function drawTargets(selection2, graph, entities, filter2) {
49049       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
49050       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
49051       var getTransform = svgPointTransform(projection2).geojson;
49052       var activeID = context.activeID();
49053       var data = { targets: [], nopes: [] };
49054       entities.forEach(function(node) {
49055         if (activeID === node.id)
49056           return;
49057         var vertexType = svgPassiveVertex(node, graph, activeID);
49058         if (vertexType !== 0) {
49059           data.targets.push({
49060             type: "Feature",
49061             id: node.id,
49062             properties: {
49063               target: true,
49064               entity: node
49065             },
49066             geometry: node.asGeoJSON()
49067           });
49068         } else {
49069           data.nopes.push({
49070             type: "Feature",
49071             id: node.id + "-nope",
49072             properties: {
49073               nope: true,
49074               target: true,
49075               entity: node
49076             },
49077             geometry: node.asGeoJSON()
49078           });
49079         }
49080       });
49081       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
49082         return filter2(d.properties.entity);
49083       }).data(data.targets, function key(d) {
49084         return d.id;
49085       });
49086       targets.exit().remove();
49087       targets.enter().append("circle").attr("r", function(d) {
49088         return _radii[d.id] || radiuses.shadow[3];
49089       }).merge(targets).attr("class", function(d) {
49090         return "node vertex target target-allowed " + targetClass + d.id;
49091       }).attr("transform", getTransform);
49092       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
49093         return filter2(d.properties.entity);
49094       }).data(data.nopes, function key(d) {
49095         return d.id;
49096       });
49097       nopes.exit().remove();
49098       nopes.enter().append("circle").attr("r", function(d) {
49099         return _radii[d.properties.entity.id] || radiuses.shadow[3];
49100       }).merge(nopes).attr("class", function(d) {
49101         return "node vertex target target-nope " + nopeClass + d.id;
49102       }).attr("transform", getTransform);
49103     }
49104     function renderAsVertex(entity, graph, wireframe, zoom) {
49105       var geometry = entity.geometry(graph);
49106       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
49107     }
49108     function isEditedNode(node, base, head) {
49109       var baseNode = base.entities[node.id];
49110       var headNode = head.entities[node.id];
49111       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
49112     }
49113     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
49114       var results = {};
49115       var seenIds = {};
49116       function addChildVertices(entity) {
49117         if (seenIds[entity.id])
49118           return;
49119         seenIds[entity.id] = true;
49120         var geometry = entity.geometry(graph);
49121         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
49122           var i2;
49123           if (entity.type === "way") {
49124             for (i2 = 0; i2 < entity.nodes.length; i2++) {
49125               var child = graph.hasEntity(entity.nodes[i2]);
49126               if (child) {
49127                 addChildVertices(child);
49128               }
49129             }
49130           } else if (entity.type === "relation") {
49131             for (i2 = 0; i2 < entity.members.length; i2++) {
49132               var member = graph.hasEntity(entity.members[i2].id);
49133               if (member) {
49134                 addChildVertices(member);
49135               }
49136             }
49137           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
49138             results[entity.id] = entity;
49139           }
49140         }
49141       }
49142       ids.forEach(function(id2) {
49143         var entity = graph.hasEntity(id2);
49144         if (!entity)
49145           return;
49146         if (entity.type === "node") {
49147           if (renderAsVertex(entity, graph, wireframe, zoom)) {
49148             results[entity.id] = entity;
49149             graph.parentWays(entity).forEach(function(entity2) {
49150               addChildVertices(entity2);
49151             });
49152           }
49153         } else {
49154           addChildVertices(entity);
49155         }
49156       });
49157       return results;
49158     }
49159     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
49160       var wireframe = context.surface().classed("fill-wireframe");
49161       var visualDiff = context.surface().classed("highlight-edited");
49162       var zoom = geoScaleToZoom(projection2.scale());
49163       var mode = context.mode();
49164       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49165       var base = context.history().base();
49166       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
49167       var touchLayer = selection2.selectAll(".layer-touch.points");
49168       if (fullRedraw) {
49169         _currPersistent = {};
49170         _radii = {};
49171       }
49172       for (var i2 = 0; i2 < entities.length; i2++) {
49173         var entity = entities[i2];
49174         var geometry = entity.geometry(graph);
49175         var keep = false;
49176         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
49177           _currPersistent[entity.id] = entity;
49178           keep = true;
49179         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
49180           _currPersistent[entity.id] = entity;
49181           keep = true;
49182         }
49183         if (!keep && !fullRedraw) {
49184           delete _currPersistent[entity.id];
49185         }
49186       }
49187       var sets2 = {
49188         persistent: _currPersistent,
49189         selected: _currSelected,
49190         hovered: _currHover
49191       };
49192       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
49193       var filterRendered = function(d) {
49194         return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
49195       };
49196       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
49197       var filterTouch = function(d) {
49198         return isMoving ? true : filterRendered(d);
49199       };
49200       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
49201       function currentVisible(which) {
49202         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
49203           return entity2 && entity2.intersects(extent, graph);
49204         });
49205       }
49206     }
49207     drawVertices.drawSelected = function(selection2, graph, extent) {
49208       var wireframe = context.surface().classed("fill-wireframe");
49209       var zoom = geoScaleToZoom(projection2.scale());
49210       _prevSelected = _currSelected || {};
49211       if (context.map().isInWideSelection()) {
49212         _currSelected = {};
49213         context.selectedIDs().forEach(function(id2) {
49214           var entity = graph.hasEntity(id2);
49215           if (!entity)
49216             return;
49217           if (entity.type === "node") {
49218             if (renderAsVertex(entity, graph, wireframe, zoom)) {
49219               _currSelected[entity.id] = entity;
49220             }
49221           }
49222         });
49223       } else {
49224         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
49225       }
49226       var filter2 = function(d) {
49227         return d.id in _prevSelected;
49228       };
49229       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
49230     };
49231     drawVertices.drawHover = function(selection2, graph, target, extent) {
49232       if (target === _currHoverTarget)
49233         return;
49234       var wireframe = context.surface().classed("fill-wireframe");
49235       var zoom = geoScaleToZoom(projection2.scale());
49236       _prevHover = _currHover || {};
49237       _currHoverTarget = target;
49238       var entity = target && target.properties && target.properties.entity;
49239       if (entity) {
49240         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
49241       } else {
49242         _currHover = {};
49243       }
49244       var filter2 = function(d) {
49245         return d.id in _prevHover;
49246       };
49247       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
49248     };
49249     return drawVertices;
49250   }
49251
49252   // modules/util/bind_once.js
49253   function utilBindOnce(target, type3, listener, capture) {
49254     var typeOnce = type3 + ".once";
49255     function one2() {
49256       target.on(typeOnce, null);
49257       listener.apply(this, arguments);
49258     }
49259     target.on(typeOnce, one2, capture);
49260     return this;
49261   }
49262
49263   // modules/util/zoom_pan.js
49264   function defaultFilter3(d3_event) {
49265     return !d3_event.ctrlKey && !d3_event.button;
49266   }
49267   function defaultExtent2() {
49268     var e = this;
49269     if (e instanceof SVGElement) {
49270       e = e.ownerSVGElement || e;
49271       if (e.hasAttribute("viewBox")) {
49272         e = e.viewBox.baseVal;
49273         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
49274       }
49275       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
49276     }
49277     return [[0, 0], [e.clientWidth, e.clientHeight]];
49278   }
49279   function defaultWheelDelta2(d3_event) {
49280     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
49281   }
49282   function defaultConstrain2(transform2, extent, translateExtent) {
49283     var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
49284     return transform2.translate(dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1));
49285   }
49286   function utilZoomPan() {
49287     var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch10 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
49288     function zoom(selection2) {
49289       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
49290       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
49291     }
49292     zoom.transform = function(collection, transform2, point) {
49293       var selection2 = collection.selection ? collection.selection() : collection;
49294       if (collection !== selection2) {
49295         schedule(collection, transform2, point);
49296       } else {
49297         selection2.interrupt().each(function() {
49298           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
49299         });
49300       }
49301     };
49302     zoom.scaleBy = function(selection2, k, p) {
49303       zoom.scaleTo(selection2, function() {
49304         var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
49305         return k0 * k1;
49306       }, p);
49307     };
49308     zoom.scaleTo = function(selection2, k, p) {
49309       zoom.transform(selection2, function() {
49310         var e = extent.apply(this, arguments), t0 = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p02), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
49311         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
49312       }, p);
49313     };
49314     zoom.translateBy = function(selection2, x, y) {
49315       zoom.transform(selection2, function() {
49316         return constrain(_transform.translate(typeof x === "function" ? x.apply(this, arguments) : x, typeof y === "function" ? y.apply(this, arguments) : y), extent.apply(this, arguments), translateExtent);
49317       });
49318     };
49319     zoom.translateTo = function(selection2, x, y, p) {
49320       zoom.transform(selection2, function() {
49321         var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
49322         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
49323       }, p);
49324     };
49325     function scale(transform2, k) {
49326       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
49327       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
49328     }
49329     function translate(transform2, p02, p1) {
49330       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
49331       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
49332     }
49333     function centroid(extent2) {
49334       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
49335     }
49336     function schedule(transition2, transform2, point) {
49337       transition2.on("start.zoom", function() {
49338         gesture(this, arguments).start(null);
49339       }).on("interrupt.zoom end.zoom", function() {
49340         gesture(this, arguments).end(null);
49341       }).tween("zoom", function() {
49342         var that = this, args = arguments, g = gesture(that, args), e = extent.apply(that, args), p = !point ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = _transform, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i2 = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
49343         return function(t) {
49344           if (t === 1) {
49345             t = b;
49346           } else {
49347             var l = i2(t);
49348             var k = w / l[2];
49349             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
49350           }
49351           g.zoom(null, null, t);
49352         };
49353       });
49354     }
49355     function gesture(that, args, clean2) {
49356       return !clean2 && _activeGesture || new Gesture(that, args);
49357     }
49358     function Gesture(that, args) {
49359       this.that = that;
49360       this.args = args;
49361       this.active = 0;
49362       this.extent = extent.apply(that, args);
49363     }
49364     Gesture.prototype = {
49365       start: function(d3_event) {
49366         if (++this.active === 1) {
49367           _activeGesture = this;
49368           dispatch10.call("start", this, d3_event);
49369         }
49370         return this;
49371       },
49372       zoom: function(d3_event, key, transform2) {
49373         if (this.mouse && key !== "mouse")
49374           this.mouse[1] = transform2.invert(this.mouse[0]);
49375         if (this.pointer0 && key !== "touch")
49376           this.pointer0[1] = transform2.invert(this.pointer0[0]);
49377         if (this.pointer1 && key !== "touch")
49378           this.pointer1[1] = transform2.invert(this.pointer1[0]);
49379         _transform = transform2;
49380         dispatch10.call("zoom", this, d3_event, key, transform2);
49381         return this;
49382       },
49383       end: function(d3_event) {
49384         if (--this.active === 0) {
49385           _activeGesture = null;
49386           dispatch10.call("end", this, d3_event);
49387         }
49388         return this;
49389       }
49390     };
49391     function wheeled(d3_event) {
49392       if (!filter2.apply(this, arguments))
49393         return;
49394       var g = gesture(this, arguments), t = _transform, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = utilFastMouse(this)(d3_event);
49395       if (g.wheel) {
49396         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
49397           g.mouse[1] = t.invert(g.mouse[0] = p);
49398         }
49399         clearTimeout(g.wheel);
49400       } else {
49401         g.mouse = [p, t.invert(p)];
49402         interrupt_default(this);
49403         g.start(d3_event);
49404       }
49405       d3_event.preventDefault();
49406       d3_event.stopImmediatePropagation();
49407       g.wheel = setTimeout(wheelidled, _wheelDelay);
49408       g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
49409       function wheelidled() {
49410         g.wheel = null;
49411         g.end(d3_event);
49412       }
49413     }
49414     var _downPointerIDs = /* @__PURE__ */ new Set();
49415     var _pointerLocGetter;
49416     function pointerdown(d3_event) {
49417       _downPointerIDs.add(d3_event.pointerId);
49418       if (!filter2.apply(this, arguments))
49419         return;
49420       var g = gesture(this, arguments, _downPointerIDs.size === 1);
49421       var started;
49422       d3_event.stopImmediatePropagation();
49423       _pointerLocGetter = utilFastMouse(this);
49424       var loc = _pointerLocGetter(d3_event);
49425       var p = [loc, _transform.invert(loc), d3_event.pointerId];
49426       if (!g.pointer0) {
49427         g.pointer0 = p;
49428         started = true;
49429       } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
49430         g.pointer1 = p;
49431       }
49432       if (started) {
49433         interrupt_default(this);
49434         g.start(d3_event);
49435       }
49436     }
49437     function pointermove(d3_event) {
49438       if (!_downPointerIDs.has(d3_event.pointerId))
49439         return;
49440       if (!_activeGesture || !_pointerLocGetter)
49441         return;
49442       var g = gesture(this, arguments);
49443       var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
49444       var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
49445       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
49446         if (g.pointer0)
49447           _downPointerIDs.delete(g.pointer0[2]);
49448         if (g.pointer1)
49449           _downPointerIDs.delete(g.pointer1[2]);
49450         g.end(d3_event);
49451         return;
49452       }
49453       d3_event.preventDefault();
49454       d3_event.stopImmediatePropagation();
49455       var loc = _pointerLocGetter(d3_event);
49456       var t, p, l;
49457       if (isPointer0)
49458         g.pointer0[0] = loc;
49459       else if (isPointer1)
49460         g.pointer1[0] = loc;
49461       t = _transform;
49462       if (g.pointer1) {
49463         var p02 = g.pointer0[0], l0 = g.pointer0[1], p1 = g.pointer1[0], l1 = g.pointer1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
49464         t = scale(t, Math.sqrt(dp / dl));
49465         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
49466         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
49467       } else if (g.pointer0) {
49468         p = g.pointer0[0];
49469         l = g.pointer0[1];
49470       } else {
49471         return;
49472       }
49473       g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
49474     }
49475     function pointerup(d3_event) {
49476       if (!_downPointerIDs.has(d3_event.pointerId))
49477         return;
49478       _downPointerIDs.delete(d3_event.pointerId);
49479       if (!_activeGesture)
49480         return;
49481       var g = gesture(this, arguments);
49482       d3_event.stopImmediatePropagation();
49483       if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
49484         delete g.pointer0;
49485       else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
49486         delete g.pointer1;
49487       if (g.pointer1 && !g.pointer0) {
49488         g.pointer0 = g.pointer1;
49489         delete g.pointer1;
49490       }
49491       if (g.pointer0) {
49492         g.pointer0[1] = _transform.invert(g.pointer0[0]);
49493       } else {
49494         g.end(d3_event);
49495       }
49496     }
49497     zoom.wheelDelta = function(_) {
49498       return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
49499     };
49500     zoom.filter = function(_) {
49501       return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
49502     };
49503     zoom.extent = function(_) {
49504       return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
49505     };
49506     zoom.scaleExtent = function(_) {
49507       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
49508     };
49509     zoom.translateExtent = function(_) {
49510       return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
49511     };
49512     zoom.constrain = function(_) {
49513       return arguments.length ? (constrain = _, zoom) : constrain;
49514     };
49515     zoom.interpolate = function(_) {
49516       return arguments.length ? (interpolate = _, zoom) : interpolate;
49517     };
49518     zoom._transform = function(_) {
49519       return arguments.length ? (_transform = _, zoom) : _transform;
49520     };
49521     return utilRebind(zoom, dispatch10, "on");
49522   }
49523
49524   // modules/util/double_up.js
49525   function utilDoubleUp() {
49526     var dispatch10 = dispatch_default("doubleUp");
49527     var _maxTimespan = 500;
49528     var _maxDistance = 20;
49529     var _pointer;
49530     function pointerIsValidFor(loc) {
49531       return new Date().getTime() - _pointer.startTime <= _maxTimespan && geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
49532     }
49533     function pointerdown(d3_event) {
49534       if (d3_event.ctrlKey || d3_event.button === 2)
49535         return;
49536       var loc = [d3_event.clientX, d3_event.clientY];
49537       if (_pointer && !pointerIsValidFor(loc)) {
49538         _pointer = void 0;
49539       }
49540       if (!_pointer) {
49541         _pointer = {
49542           startLoc: loc,
49543           startTime: new Date().getTime(),
49544           upCount: 0,
49545           pointerId: d3_event.pointerId
49546         };
49547       } else {
49548         _pointer.pointerId = d3_event.pointerId;
49549       }
49550     }
49551     function pointerup(d3_event) {
49552       if (d3_event.ctrlKey || d3_event.button === 2)
49553         return;
49554       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
49555         return;
49556       _pointer.upCount += 1;
49557       if (_pointer.upCount === 2) {
49558         var loc = [d3_event.clientX, d3_event.clientY];
49559         if (pointerIsValidFor(loc)) {
49560           var locInThis = utilFastMouse(this)(d3_event);
49561           dispatch10.call("doubleUp", this, d3_event, locInThis);
49562         }
49563         _pointer = void 0;
49564       }
49565     }
49566     function doubleUp(selection2) {
49567       if ("PointerEvent" in window) {
49568         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
49569       } else {
49570         selection2.on("dblclick.doubleUp", function(d3_event) {
49571           dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
49572         });
49573       }
49574     }
49575     doubleUp.off = function(selection2) {
49576       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
49577     };
49578     return utilRebind(doubleUp, dispatch10, "on");
49579   }
49580
49581   // modules/renderer/map.js
49582   var TILESIZE = 256;
49583   var minZoom2 = 2;
49584   var maxZoom = 24;
49585   var kMin = geoZoomToScale(minZoom2, TILESIZE);
49586   var kMax = geoZoomToScale(maxZoom, TILESIZE);
49587   function clamp(num, min3, max3) {
49588     return Math.max(min3, Math.min(num, max3));
49589   }
49590   function rendererMap(context) {
49591     var dispatch10 = dispatch_default("move", "drawn", "crossEditableZoom", "hitMinZoom", "changeHighlighting", "changeAreaFill");
49592     var projection2 = context.projection;
49593     var curtainProjection = context.curtainProjection;
49594     var drawLayers;
49595     var drawPoints;
49596     var drawVertices;
49597     var drawLines;
49598     var drawAreas;
49599     var drawMidpoints;
49600     var drawLabels;
49601     var _selection = select_default2(null);
49602     var supersurface = select_default2(null);
49603     var wrapper = select_default2(null);
49604     var surface = select_default2(null);
49605     var _dimensions = [1, 1];
49606     var _dblClickZoomEnabled = true;
49607     var _redrawEnabled = true;
49608     var _gestureTransformStart;
49609     var _transformStart = projection2.transform();
49610     var _transformLast;
49611     var _isTransformed = false;
49612     var _minzoom = 0;
49613     var _getMouseCoords;
49614     var _lastPointerEvent;
49615     var _lastWithinEditableZoom;
49616     var _pointerDown = false;
49617     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
49618     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
49619     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
49620       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
49621     }).on("end.map", function() {
49622       _pointerDown = false;
49623     });
49624     var _doubleUpHandler = utilDoubleUp();
49625     var scheduleRedraw = throttle_default(redraw, 750);
49626     function cancelPendingRedraw() {
49627       scheduleRedraw.cancel();
49628     }
49629     function map2(selection2) {
49630       _selection = selection2;
49631       context.on("change.map", immediateRedraw);
49632       var osm = context.connection();
49633       if (osm) {
49634         osm.on("change.map", immediateRedraw);
49635       }
49636       function didUndoOrRedo(targetTransform) {
49637         var mode = context.mode().id;
49638         if (mode !== "browse" && mode !== "select")
49639           return;
49640         if (targetTransform) {
49641           map2.transformEase(targetTransform);
49642         }
49643       }
49644       context.history().on("merge.map", function() {
49645         scheduleRedraw();
49646       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
49647         didUndoOrRedo(fromStack.transform);
49648       }).on("redone.map", function(stack) {
49649         didUndoOrRedo(stack.transform);
49650       });
49651       context.background().on("change.map", immediateRedraw);
49652       context.features().on("redraw.map", immediateRedraw);
49653       drawLayers.on("change.map", function() {
49654         context.background().updateImagery();
49655         immediateRedraw();
49656       });
49657       selection2.on("wheel.map mousewheel.map", function(d3_event) {
49658         d3_event.preventDefault();
49659       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
49660       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
49661       wrapper = supersurface.append("div").attr("class", "layer layer-data");
49662       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
49663       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
49664         _lastPointerEvent = d3_event;
49665         if (d3_event.button === 2) {
49666           d3_event.stopPropagation();
49667         }
49668       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
49669         _lastPointerEvent = d3_event;
49670         if (resetTransform()) {
49671           immediateRedraw();
49672         }
49673       }).on(_pointerPrefix + "move.map", function(d3_event) {
49674         _lastPointerEvent = d3_event;
49675       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
49676         if (map2.editableDataEnabled() && !_isTransformed) {
49677           var hover = d3_event.target.__data__;
49678           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
49679           dispatch10.call("drawn", this, { full: false });
49680         }
49681       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
49682         if (map2.editableDataEnabled() && !_isTransformed) {
49683           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
49684           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
49685           dispatch10.call("drawn", this, { full: false });
49686         }
49687       });
49688       var detected = utilDetect();
49689       if ("GestureEvent" in window && !detected.isMobileWebKit) {
49690         surface.on("gesturestart.surface", function(d3_event) {
49691           d3_event.preventDefault();
49692           _gestureTransformStart = projection2.transform();
49693         }).on("gesturechange.surface", gestureChange);
49694       }
49695       updateAreaFill();
49696       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
49697         if (!_dblClickZoomEnabled)
49698           return;
49699         if (typeof d3_event.target.__data__ === "object" && !select_default2(d3_event.target).classed("fill"))
49700           return;
49701         var zoomOut2 = d3_event.shiftKey;
49702         var t = projection2.transform();
49703         var p1 = t.invert(p02);
49704         t = t.scale(zoomOut2 ? 0.5 : 2);
49705         t.x = p02[0] - p1[0] * t.k;
49706         t.y = p02[1] - p1[1] * t.k;
49707         map2.transformEase(t);
49708       });
49709       context.on("enter.map", function() {
49710         if (!map2.editableDataEnabled(true))
49711           return;
49712         if (_isTransformed)
49713           return;
49714         var graph = context.graph();
49715         var selectedAndParents = {};
49716         context.selectedIDs().forEach(function(id2) {
49717           var entity = graph.hasEntity(id2);
49718           if (entity) {
49719             selectedAndParents[entity.id] = entity;
49720             if (entity.type === "node") {
49721               graph.parentWays(entity).forEach(function(parent) {
49722                 selectedAndParents[parent.id] = parent;
49723               });
49724             }
49725           }
49726         });
49727         var data = Object.values(selectedAndParents);
49728         var filter2 = function(d) {
49729           return d.id in selectedAndParents;
49730         };
49731         data = context.features().filter(data, graph);
49732         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
49733         dispatch10.call("drawn", this, { full: false });
49734         scheduleRedraw();
49735       });
49736       map2.dimensions(utilGetDimensions(selection2));
49737     }
49738     function zoomEventFilter(d3_event) {
49739       if (d3_event.type === "mousedown") {
49740         var hasOrphan = false;
49741         var listeners = window.__on;
49742         for (var i2 = 0; i2 < listeners.length; i2++) {
49743           var listener = listeners[i2];
49744           if (listener.name === "zoom" && listener.type === "mouseup") {
49745             hasOrphan = true;
49746             break;
49747           }
49748         }
49749         if (hasOrphan) {
49750           var event = window.CustomEvent;
49751           if (event) {
49752             event = new event("mouseup");
49753           } else {
49754             event = window.document.createEvent("Event");
49755             event.initEvent("mouseup", false, false);
49756           }
49757           event.view = window;
49758           window.dispatchEvent(event);
49759         }
49760       }
49761       return d3_event.button !== 2;
49762     }
49763     function pxCenter() {
49764       return [_dimensions[0] / 2, _dimensions[1] / 2];
49765     }
49766     function drawEditable(difference, extent) {
49767       var mode = context.mode();
49768       var graph = context.graph();
49769       var features2 = context.features();
49770       var all = context.history().intersects(map2.extent());
49771       var fullRedraw = false;
49772       var data;
49773       var set3;
49774       var filter2;
49775       var applyFeatureLayerFilters = true;
49776       if (map2.isInWideSelection()) {
49777         data = [];
49778         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
49779           var entity = context.hasEntity(id2);
49780           if (entity)
49781             data.push(entity);
49782         });
49783         fullRedraw = true;
49784         filter2 = utilFunctor(true);
49785         applyFeatureLayerFilters = false;
49786       } else if (difference) {
49787         var complete = difference.complete(map2.extent());
49788         data = Object.values(complete).filter(Boolean);
49789         set3 = new Set(Object.keys(complete));
49790         filter2 = function(d) {
49791           return set3.has(d.id);
49792         };
49793         features2.clear(data);
49794       } else {
49795         if (features2.gatherStats(all, graph, _dimensions)) {
49796           extent = void 0;
49797         }
49798         if (extent) {
49799           data = context.history().intersects(map2.extent().intersection(extent));
49800           set3 = new Set(data.map(function(entity) {
49801             return entity.id;
49802           }));
49803           filter2 = function(d) {
49804             return set3.has(d.id);
49805           };
49806         } else {
49807           data = all;
49808           fullRedraw = true;
49809           filter2 = utilFunctor(true);
49810         }
49811       }
49812       if (applyFeatureLayerFilters) {
49813         data = features2.filter(data, graph);
49814       } else {
49815         context.features().resetStats();
49816       }
49817       if (mode && mode.id === "select") {
49818         surface.call(drawVertices.drawSelected, graph, map2.extent());
49819       }
49820       surface.call(drawVertices, graph, data, filter2, map2.extent(), fullRedraw).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent()).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw).call(drawPoints, graph, data, filter2);
49821       dispatch10.call("drawn", this, { full: true });
49822     }
49823     map2.init = function() {
49824       drawLayers = svgLayers(projection2, context);
49825       drawPoints = svgPoints(projection2, context);
49826       drawVertices = svgVertices(projection2, context);
49827       drawLines = svgLines(projection2, context);
49828       drawAreas = svgAreas(projection2, context);
49829       drawMidpoints = svgMidpoints(projection2, context);
49830       drawLabels = svgLabels(projection2, context);
49831     };
49832     function editOff() {
49833       context.features().resetStats();
49834       surface.selectAll(".layer-osm *").remove();
49835       surface.selectAll(".layer-touch:not(.markers) *").remove();
49836       var allowed = {
49837         "browse": true,
49838         "save": true,
49839         "select-note": true,
49840         "select-data": true,
49841         "select-error": true
49842       };
49843       var mode = context.mode();
49844       if (mode && !allowed[mode.id]) {
49845         context.enter(modeBrowse(context));
49846       }
49847       dispatch10.call("drawn", this, { full: true });
49848     }
49849     function gestureChange(d3_event) {
49850       var e = d3_event;
49851       e.preventDefault();
49852       var props = {
49853         deltaMode: 0,
49854         deltaY: 1,
49855         clientX: e.clientX,
49856         clientY: e.clientY,
49857         screenX: e.screenX,
49858         screenY: e.screenY,
49859         x: e.x,
49860         y: e.y
49861       };
49862       var e22 = new WheelEvent("wheel", props);
49863       e22._scale = e.scale;
49864       e22._rotation = e.rotation;
49865       _selection.node().dispatchEvent(e22);
49866     }
49867     function zoomPan(event, key, transform2) {
49868       var source = event && event.sourceEvent || event;
49869       var eventTransform = transform2 || event && event.transform;
49870       var x = eventTransform.x;
49871       var y = eventTransform.y;
49872       var k = eventTransform.k;
49873       if (source && source.type === "wheel") {
49874         if (_pointerDown)
49875           return;
49876         var detected = utilDetect();
49877         var dX = source.deltaX;
49878         var dY = source.deltaY;
49879         var x2 = x;
49880         var y2 = y;
49881         var k2 = k;
49882         var t0, p02, p1;
49883         if (source.deltaMode === 1) {
49884           var lines = Math.abs(source.deltaY);
49885           var sign2 = source.deltaY > 0 ? 1 : -1;
49886           dY = sign2 * clamp(Math.exp((lines - 1) * 0.75) * 4.000244140625, 4.000244140625, 350.000244140625);
49887           if (detected.os !== "mac") {
49888             dY *= 5;
49889           }
49890           t0 = _isTransformed ? _transformLast : _transformStart;
49891           p02 = _getMouseCoords(source);
49892           p1 = t0.invert(p02);
49893           k2 = t0.k * Math.pow(2, -dY / 500);
49894           k2 = clamp(k2, kMin, kMax);
49895           x2 = p02[0] - p1[0] * k2;
49896           y2 = p02[1] - p1[1] * k2;
49897         } else if (source._scale) {
49898           t0 = _gestureTransformStart;
49899           p02 = _getMouseCoords(source);
49900           p1 = t0.invert(p02);
49901           k2 = t0.k * source._scale;
49902           k2 = clamp(k2, kMin, kMax);
49903           x2 = p02[0] - p1[0] * k2;
49904           y2 = p02[1] - p1[1] * k2;
49905         } else if (source.ctrlKey && !isInteger(dY)) {
49906           dY *= 6;
49907           t0 = _isTransformed ? _transformLast : _transformStart;
49908           p02 = _getMouseCoords(source);
49909           p1 = t0.invert(p02);
49910           k2 = t0.k * Math.pow(2, -dY / 500);
49911           k2 = clamp(k2, kMin, kMax);
49912           x2 = p02[0] - p1[0] * k2;
49913           y2 = p02[1] - p1[1] * k2;
49914         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
49915           t0 = _isTransformed ? _transformLast : _transformStart;
49916           p02 = _getMouseCoords(source);
49917           p1 = t0.invert(p02);
49918           k2 = t0.k * Math.pow(2, -dY / 500);
49919           k2 = clamp(k2, kMin, kMax);
49920           x2 = p02[0] - p1[0] * k2;
49921           y2 = p02[1] - p1[1] * k2;
49922         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
49923           p1 = projection2.translate();
49924           x2 = p1[0] - dX;
49925           y2 = p1[1] - dY;
49926           k2 = projection2.scale();
49927           k2 = clamp(k2, kMin, kMax);
49928         }
49929         if (x2 !== x || y2 !== y || k2 !== k) {
49930           x = x2;
49931           y = y2;
49932           k = k2;
49933           eventTransform = identity2.translate(x2, y2).scale(k2);
49934           if (_zoomerPanner._transform) {
49935             _zoomerPanner._transform(eventTransform);
49936           } else {
49937             _selection.node().__zoom = eventTransform;
49938           }
49939         }
49940       }
49941       if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
49942         return;
49943       }
49944       if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
49945         surface.interrupt();
49946         dispatch10.call("hitMinZoom", this, map2);
49947         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
49948         scheduleRedraw();
49949         dispatch10.call("move", this, map2);
49950         return;
49951       }
49952       projection2.transform(eventTransform);
49953       var withinEditableZoom = map2.withinEditableZoom();
49954       if (_lastWithinEditableZoom !== withinEditableZoom) {
49955         if (_lastWithinEditableZoom !== void 0) {
49956           dispatch10.call("crossEditableZoom", this, withinEditableZoom);
49957         }
49958         _lastWithinEditableZoom = withinEditableZoom;
49959       }
49960       var scale = k / _transformStart.k;
49961       var tX = (x / scale - _transformStart.x) * scale;
49962       var tY = (y / scale - _transformStart.y) * scale;
49963       if (context.inIntro()) {
49964         curtainProjection.transform({
49965           x: x - tX,
49966           y: y - tY,
49967           k
49968         });
49969       }
49970       if (source) {
49971         _lastPointerEvent = event;
49972       }
49973       _isTransformed = true;
49974       _transformLast = eventTransform;
49975       utilSetTransform(supersurface, tX, tY, scale);
49976       scheduleRedraw();
49977       dispatch10.call("move", this, map2);
49978       function isInteger(val) {
49979         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
49980       }
49981     }
49982     function resetTransform() {
49983       if (!_isTransformed)
49984         return false;
49985       utilSetTransform(supersurface, 0, 0);
49986       _isTransformed = false;
49987       if (context.inIntro()) {
49988         curtainProjection.transform(projection2.transform());
49989       }
49990       return true;
49991     }
49992     function redraw(difference, extent) {
49993       if (surface.empty() || !_redrawEnabled)
49994         return;
49995       if (resetTransform()) {
49996         difference = extent = void 0;
49997       }
49998       var zoom = map2.zoom();
49999       var z = String(~~zoom);
50000       if (surface.attr("data-zoom") !== z) {
50001         surface.attr("data-zoom", z);
50002       }
50003       var lat = map2.center()[1];
50004       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
50005       surface.classed("low-zoom", zoom <= lowzoom(lat));
50006       if (!difference) {
50007         supersurface.call(context.background());
50008         wrapper.call(drawLayers);
50009       }
50010       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
50011         context.loadTiles(projection2);
50012         drawEditable(difference, extent);
50013       } else {
50014         editOff();
50015       }
50016       _transformStart = projection2.transform();
50017       return map2;
50018     }
50019     var immediateRedraw = function(difference, extent) {
50020       if (!difference && !extent)
50021         cancelPendingRedraw();
50022       redraw(difference, extent);
50023     };
50024     map2.lastPointerEvent = function() {
50025       return _lastPointerEvent;
50026     };
50027     map2.mouse = function(d3_event) {
50028       var event = d3_event || _lastPointerEvent;
50029       if (event) {
50030         var s;
50031         while (s = event.sourceEvent) {
50032           event = s;
50033         }
50034         return _getMouseCoords(event);
50035       }
50036       return null;
50037     };
50038     map2.mouseCoordinates = function() {
50039       var coord2 = map2.mouse() || pxCenter();
50040       return projection2.invert(coord2);
50041     };
50042     map2.dblclickZoomEnable = function(val) {
50043       if (!arguments.length)
50044         return _dblClickZoomEnabled;
50045       _dblClickZoomEnabled = val;
50046       return map2;
50047     };
50048     map2.redrawEnable = function(val) {
50049       if (!arguments.length)
50050         return _redrawEnabled;
50051       _redrawEnabled = val;
50052       return map2;
50053     };
50054     map2.isTransformed = function() {
50055       return _isTransformed;
50056     };
50057     function setTransform(t2, duration, force) {
50058       var t = projection2.transform();
50059       if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
50060         return false;
50061       if (duration) {
50062         _selection.transition().duration(duration).on("start", function() {
50063           map2.startEase();
50064         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
50065       } else {
50066         projection2.transform(t2);
50067         _transformStart = t2;
50068         _selection.call(_zoomerPanner.transform, _transformStart);
50069       }
50070       return true;
50071     }
50072     function setCenterZoom(loc2, z2, duration, force) {
50073       var c = map2.center();
50074       var z = map2.zoom();
50075       if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
50076         return false;
50077       var proj = geoRawMercator().transform(projection2.transform());
50078       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
50079       proj.scale(k2);
50080       var t = proj.translate();
50081       var point = proj(loc2);
50082       var center = pxCenter();
50083       t[0] += center[0] - point[0];
50084       t[1] += center[1] - point[1];
50085       return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
50086     }
50087     map2.pan = function(delta, duration) {
50088       var t = projection2.translate();
50089       var k = projection2.scale();
50090       t[0] += delta[0];
50091       t[1] += delta[1];
50092       if (duration) {
50093         _selection.transition().duration(duration).on("start", function() {
50094           map2.startEase();
50095         }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
50096       } else {
50097         projection2.translate(t);
50098         _transformStart = projection2.transform();
50099         _selection.call(_zoomerPanner.transform, _transformStart);
50100         dispatch10.call("move", this, map2);
50101         immediateRedraw();
50102       }
50103       return map2;
50104     };
50105     map2.dimensions = function(val) {
50106       if (!arguments.length)
50107         return _dimensions;
50108       _dimensions = val;
50109       drawLayers.dimensions(_dimensions);
50110       context.background().dimensions(_dimensions);
50111       projection2.clipExtent([[0, 0], _dimensions]);
50112       _getMouseCoords = utilFastMouse(supersurface.node());
50113       scheduleRedraw();
50114       return map2;
50115     };
50116     function zoomIn(delta) {
50117       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
50118     }
50119     function zoomOut(delta) {
50120       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
50121     }
50122     map2.zoomIn = function() {
50123       zoomIn(1);
50124     };
50125     map2.zoomInFurther = function() {
50126       zoomIn(4);
50127     };
50128     map2.canZoomIn = function() {
50129       return map2.zoom() < maxZoom;
50130     };
50131     map2.zoomOut = function() {
50132       zoomOut(1);
50133     };
50134     map2.zoomOutFurther = function() {
50135       zoomOut(4);
50136     };
50137     map2.canZoomOut = function() {
50138       return map2.zoom() > minZoom2;
50139     };
50140     map2.center = function(loc2) {
50141       if (!arguments.length) {
50142         return projection2.invert(pxCenter());
50143       }
50144       if (setCenterZoom(loc2, map2.zoom())) {
50145         dispatch10.call("move", this, map2);
50146       }
50147       scheduleRedraw();
50148       return map2;
50149     };
50150     map2.unobscuredCenterZoomEase = function(loc, zoom) {
50151       var offset = map2.unobscuredOffsetPx();
50152       var proj = geoRawMercator().transform(projection2.transform());
50153       proj.scale(geoZoomToScale(zoom, TILESIZE));
50154       var locPx = proj(loc);
50155       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
50156       var offsetLoc = proj.invert(offsetLocPx);
50157       map2.centerZoomEase(offsetLoc, zoom);
50158     };
50159     map2.unobscuredOffsetPx = function() {
50160       var openPane = context.container().select(".map-panes .map-pane.shown");
50161       if (!openPane.empty()) {
50162         return [openPane.node().offsetWidth / 2, 0];
50163       }
50164       return [0, 0];
50165     };
50166     map2.zoom = function(z2) {
50167       if (!arguments.length) {
50168         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
50169       }
50170       if (z2 < _minzoom) {
50171         surface.interrupt();
50172         dispatch10.call("hitMinZoom", this, map2);
50173         z2 = context.minEditableZoom();
50174       }
50175       if (setCenterZoom(map2.center(), z2)) {
50176         dispatch10.call("move", this, map2);
50177       }
50178       scheduleRedraw();
50179       return map2;
50180     };
50181     map2.centerZoom = function(loc2, z2) {
50182       if (setCenterZoom(loc2, z2)) {
50183         dispatch10.call("move", this, map2);
50184       }
50185       scheduleRedraw();
50186       return map2;
50187     };
50188     map2.zoomTo = function(entity) {
50189       var extent = entity.extent(context.graph());
50190       if (!isFinite(extent.area()))
50191         return map2;
50192       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50193       return map2.centerZoom(extent.center(), z2);
50194     };
50195     map2.centerEase = function(loc2, duration) {
50196       duration = duration || 250;
50197       setCenterZoom(loc2, map2.zoom(), duration);
50198       return map2;
50199     };
50200     map2.zoomEase = function(z2, duration) {
50201       duration = duration || 250;
50202       setCenterZoom(map2.center(), z2, duration, false);
50203       return map2;
50204     };
50205     map2.centerZoomEase = function(loc2, z2, duration) {
50206       duration = duration || 250;
50207       setCenterZoom(loc2, z2, duration, false);
50208       return map2;
50209     };
50210     map2.transformEase = function(t2, duration) {
50211       duration = duration || 250;
50212       setTransform(t2, duration, false);
50213       return map2;
50214     };
50215     map2.zoomToEase = function(obj, duration) {
50216       var extent;
50217       if (Array.isArray(obj)) {
50218         obj.forEach(function(entity) {
50219           var entityExtent = entity.extent(context.graph());
50220           if (!extent) {
50221             extent = entityExtent;
50222           } else {
50223             extent = extent.extend(entityExtent);
50224           }
50225         });
50226       } else {
50227         extent = obj.extent(context.graph());
50228       }
50229       if (!isFinite(extent.area()))
50230         return map2;
50231       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50232       return map2.centerZoomEase(extent.center(), z2, duration);
50233     };
50234     map2.startEase = function() {
50235       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
50236         map2.cancelEase();
50237       });
50238       return map2;
50239     };
50240     map2.cancelEase = function() {
50241       _selection.interrupt();
50242       return map2;
50243     };
50244     map2.extent = function(val) {
50245       if (!arguments.length) {
50246         return new geoExtent(projection2.invert([0, _dimensions[1]]), projection2.invert([_dimensions[0], 0]));
50247       } else {
50248         var extent = geoExtent(val);
50249         map2.centerZoom(extent.center(), map2.extentZoom(extent));
50250       }
50251     };
50252     map2.trimmedExtent = function(val) {
50253       if (!arguments.length) {
50254         var headerY = 71;
50255         var footerY = 30;
50256         var pad2 = 10;
50257         return new geoExtent(projection2.invert([pad2, _dimensions[1] - footerY - pad2]), projection2.invert([_dimensions[0] - pad2, headerY + pad2]));
50258       } else {
50259         var extent = geoExtent(val);
50260         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
50261       }
50262     };
50263     function calcExtentZoom(extent, dim) {
50264       var tl = projection2([extent[0][0], extent[1][1]]);
50265       var br = projection2([extent[1][0], extent[0][1]]);
50266       var hFactor = (br[0] - tl[0]) / dim[0];
50267       var vFactor = (br[1] - tl[1]) / dim[1];
50268       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
50269       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
50270       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
50271       return newZoom;
50272     }
50273     map2.extentZoom = function(val) {
50274       return calcExtentZoom(geoExtent(val), _dimensions);
50275     };
50276     map2.trimmedExtentZoom = function(val) {
50277       var trimY = 120;
50278       var trimX = 40;
50279       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
50280       return calcExtentZoom(geoExtent(val), trimmed);
50281     };
50282     map2.withinEditableZoom = function() {
50283       return map2.zoom() >= context.minEditableZoom();
50284     };
50285     map2.isInWideSelection = function() {
50286       return !map2.withinEditableZoom() && context.selectedIDs().length;
50287     };
50288     map2.editableDataEnabled = function(skipZoomCheck) {
50289       var layer = context.layers().layer("osm");
50290       if (!layer || !layer.enabled())
50291         return false;
50292       return skipZoomCheck || map2.withinEditableZoom();
50293     };
50294     map2.notesEditable = function() {
50295       var layer = context.layers().layer("notes");
50296       if (!layer || !layer.enabled())
50297         return false;
50298       return map2.withinEditableZoom();
50299     };
50300     map2.minzoom = function(val) {
50301       if (!arguments.length)
50302         return _minzoom;
50303       _minzoom = val;
50304       return map2;
50305     };
50306     map2.toggleHighlightEdited = function() {
50307       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
50308       map2.pan([0, 0]);
50309       dispatch10.call("changeHighlighting", this);
50310     };
50311     map2.areaFillOptions = ["wireframe", "partial", "full"];
50312     map2.activeAreaFill = function(val) {
50313       if (!arguments.length)
50314         return corePreferences("area-fill") || "partial";
50315       corePreferences("area-fill", val);
50316       if (val !== "wireframe") {
50317         corePreferences("area-fill-toggle", val);
50318       }
50319       updateAreaFill();
50320       map2.pan([0, 0]);
50321       dispatch10.call("changeAreaFill", this);
50322       return map2;
50323     };
50324     map2.toggleWireframe = function() {
50325       var activeFill = map2.activeAreaFill();
50326       if (activeFill === "wireframe") {
50327         activeFill = corePreferences("area-fill-toggle") || "partial";
50328       } else {
50329         activeFill = "wireframe";
50330       }
50331       map2.activeAreaFill(activeFill);
50332     };
50333     function updateAreaFill() {
50334       var activeFill = map2.activeAreaFill();
50335       map2.areaFillOptions.forEach(function(opt) {
50336         surface.classed("fill-" + opt, Boolean(opt === activeFill));
50337       });
50338     }
50339     map2.layers = () => drawLayers;
50340     map2.doubleUpHandler = function() {
50341       return _doubleUpHandler;
50342     };
50343     return utilRebind(map2, dispatch10, "on");
50344   }
50345
50346   // modules/renderer/photos.js
50347   function rendererPhotos(context) {
50348     var dispatch10 = dispatch_default("change");
50349     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
50350     var _allPhotoTypes = ["flat", "panoramic"];
50351     var _shownPhotoTypes = _allPhotoTypes.slice();
50352     var _dateFilters = ["fromDate", "toDate"];
50353     var _fromDate;
50354     var _toDate;
50355     var _usernames;
50356     function photos() {
50357     }
50358     function updateStorage() {
50359       if (window.mocha)
50360         return;
50361       var hash = utilStringQs(window.location.hash);
50362       var enabled = context.layers().all().filter(function(d) {
50363         return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
50364       }).map(function(d) {
50365         return d.id;
50366       });
50367       if (enabled.length) {
50368         hash.photo_overlay = enabled.join(",");
50369       } else {
50370         delete hash.photo_overlay;
50371       }
50372       window.location.replace("#" + utilQsString(hash, true));
50373     }
50374     photos.overlayLayerIDs = function() {
50375       return _layerIDs;
50376     };
50377     photos.allPhotoTypes = function() {
50378       return _allPhotoTypes;
50379     };
50380     photos.dateFilters = function() {
50381       return _dateFilters;
50382     };
50383     photos.dateFilterValue = function(val) {
50384       return val === _dateFilters[0] ? _fromDate : _toDate;
50385     };
50386     photos.setDateFilter = function(type3, val, updateUrl) {
50387       var date = val && new Date(val);
50388       if (date && !isNaN(date)) {
50389         val = date.toISOString().substr(0, 10);
50390       } else {
50391         val = null;
50392       }
50393       if (type3 === _dateFilters[0]) {
50394         _fromDate = val;
50395         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50396           _toDate = _fromDate;
50397         }
50398       }
50399       if (type3 === _dateFilters[1]) {
50400         _toDate = val;
50401         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50402           _fromDate = _toDate;
50403         }
50404       }
50405       dispatch10.call("change", this);
50406       if (updateUrl) {
50407         var rangeString;
50408         if (_fromDate || _toDate) {
50409           rangeString = (_fromDate || "") + "_" + (_toDate || "");
50410         }
50411         setUrlFilterValue("photo_dates", rangeString);
50412       }
50413     };
50414     photos.setUsernameFilter = function(val, updateUrl) {
50415       if (val && typeof val === "string")
50416         val = val.replace(/;/g, ",").split(",");
50417       if (val) {
50418         val = val.map((d) => d.trim()).filter(Boolean);
50419         if (!val.length) {
50420           val = null;
50421         }
50422       }
50423       _usernames = val;
50424       dispatch10.call("change", this);
50425       if (updateUrl) {
50426         var hashString;
50427         if (_usernames) {
50428           hashString = _usernames.join(",");
50429         }
50430         setUrlFilterValue("photo_username", hashString);
50431       }
50432     };
50433     function setUrlFilterValue(property, val) {
50434       if (!window.mocha) {
50435         var hash = utilStringQs(window.location.hash);
50436         if (val) {
50437           if (hash[property] === val)
50438             return;
50439           hash[property] = val;
50440         } else {
50441           if (!(property in hash))
50442             return;
50443           delete hash[property];
50444         }
50445         window.location.replace("#" + utilQsString(hash, true));
50446       }
50447     }
50448     function showsLayer(id2) {
50449       var layer = context.layers().layer(id2);
50450       return layer && layer.supported() && layer.enabled();
50451     }
50452     photos.shouldFilterByDate = function() {
50453       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
50454     };
50455     photos.shouldFilterByPhotoType = function() {
50456       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
50457     };
50458     photos.shouldFilterByUsername = function() {
50459       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
50460     };
50461     photos.showsPhotoType = function(val) {
50462       if (!photos.shouldFilterByPhotoType())
50463         return true;
50464       return _shownPhotoTypes.indexOf(val) !== -1;
50465     };
50466     photos.showsFlat = function() {
50467       return photos.showsPhotoType("flat");
50468     };
50469     photos.showsPanoramic = function() {
50470       return photos.showsPhotoType("panoramic");
50471     };
50472     photos.fromDate = function() {
50473       return _fromDate;
50474     };
50475     photos.toDate = function() {
50476       return _toDate;
50477     };
50478     photos.togglePhotoType = function(val) {
50479       var index = _shownPhotoTypes.indexOf(val);
50480       if (index !== -1) {
50481         _shownPhotoTypes.splice(index, 1);
50482       } else {
50483         _shownPhotoTypes.push(val);
50484       }
50485       dispatch10.call("change", this);
50486       return photos;
50487     };
50488     photos.usernames = function() {
50489       return _usernames;
50490     };
50491     photos.init = function() {
50492       var hash = utilStringQs(window.location.hash);
50493       if (hash.photo_dates) {
50494         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
50495         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
50496         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
50497       }
50498       if (hash.photo_username) {
50499         this.setUsernameFilter(hash.photo_username, false);
50500       }
50501       if (hash.photo_overlay) {
50502         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
50503         hashOverlayIDs.forEach(function(id2) {
50504           if (id2 === "openstreetcam")
50505             id2 = "kartaview";
50506           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
50507           if (layer2 && !layer2.enabled())
50508             layer2.enabled(true);
50509         });
50510       }
50511       if (hash.photo) {
50512         var photoIds = hash.photo.replace(/;/g, ",").split(",");
50513         var photoId = photoIds.length && photoIds[0].trim();
50514         var results = /(.*)\/(.*)/g.exec(photoId);
50515         if (results && results.length >= 3) {
50516           var serviceId = results[1];
50517           if (serviceId === "openstreetcam")
50518             serviceId = "kartaview";
50519           var photoKey = results[2];
50520           var service = services[serviceId];
50521           if (service && service.ensureViewerLoaded) {
50522             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
50523             if (layer && !layer.enabled())
50524               layer.enabled(true);
50525             var baselineTime = Date.now();
50526             service.on("loadedImages.rendererPhotos", function() {
50527               if (Date.now() - baselineTime > 45e3) {
50528                 service.on("loadedImages.rendererPhotos", null);
50529                 return;
50530               }
50531               if (!service.cachedImage(photoKey))
50532                 return;
50533               service.on("loadedImages.rendererPhotos", null);
50534               service.ensureViewerLoaded(context).then(function() {
50535                 service.selectImage(context, photoKey).showViewer(context);
50536               });
50537             });
50538           }
50539         }
50540       }
50541       context.layers().on("change.rendererPhotos", updateStorage);
50542     };
50543     return utilRebind(photos, dispatch10, "on");
50544   }
50545
50546   // modules/ui/account.js
50547   function uiAccount(context) {
50548     const osm = context.connection();
50549     function updateUserDetails(selection2) {
50550       if (!osm)
50551         return;
50552       if (!osm.authenticated()) {
50553         render(selection2, null);
50554       } else {
50555         osm.userDetails((err, user) => render(selection2, user));
50556       }
50557     }
50558     function render(selection2, user) {
50559       let userInfo = selection2.select(".userInfo");
50560       let loginLogout = selection2.select(".loginLogout");
50561       if (user) {
50562         userInfo.html("").classed("hide", false);
50563         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
50564         if (user.image_url) {
50565           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
50566         } else {
50567           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
50568         }
50569         userLink.append("span").attr("class", "label").html(user.display_name);
50570         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
50571           e.preventDefault();
50572           osm.logout();
50573           tryLogout();
50574         });
50575       } else {
50576         userInfo.html("").classed("hide", true);
50577         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
50578           e.preventDefault();
50579           osm.authenticate();
50580         });
50581       }
50582     }
50583     function tryLogout() {
50584       if (!osm)
50585         return;
50586       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
50587       const w = 600;
50588       const h = 550;
50589       const settings = [
50590         ["width", w],
50591         ["height", h],
50592         ["left", window.screen.width / 2 - w / 2],
50593         ["top", window.screen.height / 2 - h / 2]
50594       ].map((x) => x.join("=")).join(",");
50595       window.open(url, "_blank", settings);
50596     }
50597     return function(selection2) {
50598       if (!osm)
50599         return;
50600       selection2.append("li").attr("class", "userInfo").classed("hide", true);
50601       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
50602       osm.on("change.account", () => updateUserDetails(selection2));
50603       updateUserDetails(selection2);
50604     };
50605   }
50606
50607   // modules/ui/attribution.js
50608   function uiAttribution(context) {
50609     let _selection = select_default2(null);
50610     function render(selection2, data, klass) {
50611       let div = selection2.selectAll(`.${klass}`).data([0]);
50612       div = div.enter().append("div").attr("class", klass).merge(div);
50613       let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
50614       attributions.exit().remove();
50615       attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
50616         let attribution = select_default2(nodes[i2]);
50617         if (d.terms_html) {
50618           attribution.html(d.terms_html);
50619           return;
50620         }
50621         if (d.terms_url) {
50622           attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
50623         }
50624         const sourceID = d.id.replace(/\./g, "<TX_DOT>");
50625         const terms_text = _t(`imagery.${sourceID}.attribution.text`, { default: d.terms_text || d.id || d.name() });
50626         if (d.icon && !d.overlay) {
50627           attribution.append("img").attr("class", "source-image").attr("src", d.icon);
50628         }
50629         attribution.append("span").attr("class", "attribution-text").text(terms_text);
50630       }).merge(attributions);
50631       let copyright = attributions.selectAll(".copyright-notice").data((d) => {
50632         let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
50633         return notice ? [notice] : [];
50634       });
50635       copyright.exit().remove();
50636       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
50637       copyright.text(String);
50638     }
50639     function update() {
50640       let baselayer = context.background().baseLayerSource();
50641       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
50642       const z = context.map().zoom();
50643       let overlays = context.background().overlayLayerSources() || [];
50644       _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
50645     }
50646     return function(selection2) {
50647       _selection = selection2;
50648       context.background().on("change.attribution", update);
50649       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
50650       update();
50651     };
50652   }
50653
50654   // modules/ui/contributors.js
50655   function uiContributors(context) {
50656     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
50657       update();
50658     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
50659     function update() {
50660       if (!osm)
50661         return;
50662       var users = {}, entities = context.history().intersects(context.map().extent());
50663       entities.forEach(function(entity) {
50664         if (entity && entity.user)
50665           users[entity.user] = true;
50666       });
50667       var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
50668       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
50669       var userList = select_default2(document.createElement("span"));
50670       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
50671         return osm.userURL(d);
50672       }).attr("target", "_blank").text(String);
50673       if (u.length > limit) {
50674         var count = select_default2(document.createElement("span"));
50675         var othersNum = u.length - limit + 1;
50676         count.append("a").attr("target", "_blank").attr("href", function() {
50677           return osm.changesetsURL(context.map().center(), context.map().zoom());
50678         }).text(othersNum);
50679         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
50680       } else {
50681         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
50682       }
50683       if (!u.length) {
50684         hidden = true;
50685         wrap2.transition().style("opacity", 0);
50686       } else if (hidden) {
50687         wrap2.transition().style("opacity", 1);
50688       }
50689     }
50690     return function(selection2) {
50691       if (!osm)
50692         return;
50693       wrap2 = selection2;
50694       update();
50695       osm.on("loaded.contributors", debouncedUpdate);
50696       context.map().on("move.contributors", debouncedUpdate);
50697     };
50698   }
50699
50700   // modules/ui/popover.js
50701   var _popoverID = 0;
50702   function uiPopover(klass) {
50703     var _id = _popoverID++;
50704     var _anchorSelection = select_default2(null);
50705     var popover = function(selection2) {
50706       _anchorSelection = selection2;
50707       selection2.each(setup);
50708     };
50709     var _animation = utilFunctor(false);
50710     var _placement = utilFunctor("top");
50711     var _alignment = utilFunctor("center");
50712     var _scrollContainer = utilFunctor(select_default2(null));
50713     var _content;
50714     var _displayType = utilFunctor("");
50715     var _hasArrow = utilFunctor(true);
50716     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50717     popover.displayType = function(val) {
50718       if (arguments.length) {
50719         _displayType = utilFunctor(val);
50720         return popover;
50721       } else {
50722         return _displayType;
50723       }
50724     };
50725     popover.hasArrow = function(val) {
50726       if (arguments.length) {
50727         _hasArrow = utilFunctor(val);
50728         return popover;
50729       } else {
50730         return _hasArrow;
50731       }
50732     };
50733     popover.placement = function(val) {
50734       if (arguments.length) {
50735         _placement = utilFunctor(val);
50736         return popover;
50737       } else {
50738         return _placement;
50739       }
50740     };
50741     popover.alignment = function(val) {
50742       if (arguments.length) {
50743         _alignment = utilFunctor(val);
50744         return popover;
50745       } else {
50746         return _alignment;
50747       }
50748     };
50749     popover.scrollContainer = function(val) {
50750       if (arguments.length) {
50751         _scrollContainer = utilFunctor(val);
50752         return popover;
50753       } else {
50754         return _scrollContainer;
50755       }
50756     };
50757     popover.content = function(val) {
50758       if (arguments.length) {
50759         _content = val;
50760         return popover;
50761       } else {
50762         return _content;
50763       }
50764     };
50765     popover.isShown = function() {
50766       var popoverSelection = _anchorSelection.select(".popover-" + _id);
50767       return !popoverSelection.empty() && popoverSelection.classed("in");
50768     };
50769     popover.show = function() {
50770       _anchorSelection.each(show);
50771     };
50772     popover.updateContent = function() {
50773       _anchorSelection.each(updateContent);
50774     };
50775     popover.hide = function() {
50776       _anchorSelection.each(hide);
50777     };
50778     popover.toggle = function() {
50779       _anchorSelection.each(toggle);
50780     };
50781     popover.destroy = function(selection2, selector) {
50782       selector = selector || ".popover-" + _id;
50783       selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("click.popover", null).attr("title", function() {
50784         return this.getAttribute("data-original-title") || this.getAttribute("title");
50785       }).attr("data-original-title", null).selectAll(selector).remove();
50786     };
50787     popover.destroyAny = function(selection2) {
50788       selection2.call(popover.destroy, ".popover");
50789     };
50790     function setup() {
50791       var anchor = select_default2(this);
50792       var animate = _animation.apply(this, arguments);
50793       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
50794       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
50795       enter.append("div").attr("class", "popover-arrow");
50796       enter.append("div").attr("class", "popover-inner");
50797       popoverSelection = enter.merge(popoverSelection);
50798       if (animate) {
50799         popoverSelection.classed("fade", true);
50800       }
50801       var display = _displayType.apply(this, arguments);
50802       if (display === "hover") {
50803         var _lastNonMouseEnterTime;
50804         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
50805           if (d3_event.pointerType) {
50806             if (d3_event.pointerType !== "mouse") {
50807               _lastNonMouseEnterTime = d3_event.timeStamp;
50808               return;
50809             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
50810               return;
50811             }
50812           }
50813           if (d3_event.buttons !== 0)
50814             return;
50815           show.apply(this, arguments);
50816         }).on(_pointerPrefix + "leave.popover", function() {
50817           hide.apply(this, arguments);
50818         }).on("focus.popover", function() {
50819           show.apply(this, arguments);
50820         }).on("blur.popover", function() {
50821           hide.apply(this, arguments);
50822         });
50823       } else if (display === "clickFocus") {
50824         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
50825           d3_event.preventDefault();
50826           d3_event.stopPropagation();
50827         }).on(_pointerPrefix + "up.popover", function(d3_event) {
50828           d3_event.preventDefault();
50829           d3_event.stopPropagation();
50830         }).on("click.popover", toggle);
50831         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
50832           anchor.each(function() {
50833             hide.apply(this, arguments);
50834           });
50835         });
50836       }
50837     }
50838     function show() {
50839       var anchor = select_default2(this);
50840       var popoverSelection = anchor.selectAll(".popover-" + _id);
50841       if (popoverSelection.empty()) {
50842         anchor.call(popover.destroy);
50843         anchor.each(setup);
50844         popoverSelection = anchor.selectAll(".popover-" + _id);
50845       }
50846       popoverSelection.classed("in", true);
50847       var displayType = _displayType.apply(this, arguments);
50848       if (displayType === "clickFocus") {
50849         anchor.classed("active", true);
50850         popoverSelection.node().focus();
50851       }
50852       anchor.each(updateContent);
50853     }
50854     function updateContent() {
50855       var anchor = select_default2(this);
50856       if (_content) {
50857         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
50858       }
50859       updatePosition.apply(this, arguments);
50860       updatePosition.apply(this, arguments);
50861       updatePosition.apply(this, arguments);
50862     }
50863     function updatePosition() {
50864       var anchor = select_default2(this);
50865       var popoverSelection = anchor.selectAll(".popover-" + _id);
50866       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
50867       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
50868       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
50869       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
50870       var placement = _placement.apply(this, arguments);
50871       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
50872       var alignment = _alignment.apply(this, arguments);
50873       var alignFactor = 0.5;
50874       if (alignment === "leading") {
50875         alignFactor = 0;
50876       } else if (alignment === "trailing") {
50877         alignFactor = 1;
50878       }
50879       var anchorFrame = getFrame(anchor.node());
50880       var popoverFrame = getFrame(popoverSelection.node());
50881       var position;
50882       switch (placement) {
50883         case "top":
50884           position = {
50885             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
50886             y: anchorFrame.y - popoverFrame.h
50887           };
50888           break;
50889         case "bottom":
50890           position = {
50891             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
50892             y: anchorFrame.y + anchorFrame.h
50893           };
50894           break;
50895         case "left":
50896           position = {
50897             x: anchorFrame.x - popoverFrame.w,
50898             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
50899           };
50900           break;
50901         case "right":
50902           position = {
50903             x: anchorFrame.x + anchorFrame.w,
50904             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
50905           };
50906           break;
50907       }
50908       if (position) {
50909         if (scrollNode && (placement === "top" || placement === "bottom")) {
50910           var initialPosX = position.x;
50911           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
50912             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
50913           } else if (position.x < 10) {
50914             position.x = 10;
50915           }
50916           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
50917           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
50918           arrow.style("left", ~~arrowPosX + "px");
50919         }
50920         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
50921       } else {
50922         popoverSelection.style("left", null).style("top", null);
50923       }
50924       function getFrame(node) {
50925         var positionStyle = select_default2(node).style("position");
50926         if (positionStyle === "absolute" || positionStyle === "static") {
50927           return {
50928             x: node.offsetLeft - scrollLeft,
50929             y: node.offsetTop - scrollTop,
50930             w: node.offsetWidth,
50931             h: node.offsetHeight
50932           };
50933         } else {
50934           return {
50935             x: 0,
50936             y: 0,
50937             w: node.offsetWidth,
50938             h: node.offsetHeight
50939           };
50940         }
50941       }
50942     }
50943     function hide() {
50944       var anchor = select_default2(this);
50945       if (_displayType.apply(this, arguments) === "clickFocus") {
50946         anchor.classed("active", false);
50947       }
50948       anchor.selectAll(".popover-" + _id).classed("in", false);
50949     }
50950     function toggle() {
50951       if (select_default2(this).select(".popover-" + _id).classed("in")) {
50952         hide.apply(this, arguments);
50953       } else {
50954         show.apply(this, arguments);
50955       }
50956     }
50957     return popover;
50958   }
50959
50960   // modules/ui/tooltip.js
50961   function uiTooltip(klass) {
50962     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
50963     var _title = function() {
50964       var title = this.getAttribute("data-original-title");
50965       if (title) {
50966         return title;
50967       } else {
50968         title = this.getAttribute("title");
50969         this.removeAttribute("title");
50970         this.setAttribute("data-original-title", title);
50971       }
50972       return title;
50973     };
50974     var _heading = utilFunctor(null);
50975     var _keys = utilFunctor(null);
50976     tooltip.title = function(val) {
50977       if (!arguments.length)
50978         return _title;
50979       _title = utilFunctor(val);
50980       return tooltip;
50981     };
50982     tooltip.heading = function(val) {
50983       if (!arguments.length)
50984         return _heading;
50985       _heading = utilFunctor(val);
50986       return tooltip;
50987     };
50988     tooltip.keys = function(val) {
50989       if (!arguments.length)
50990         return _keys;
50991       _keys = utilFunctor(val);
50992       return tooltip;
50993     };
50994     tooltip.content(function() {
50995       var heading = _heading.apply(this, arguments);
50996       var text2 = _title.apply(this, arguments);
50997       var keys = _keys.apply(this, arguments);
50998       return function(selection2) {
50999         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
51000         headingSelect.exit().remove();
51001         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).html(heading);
51002         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
51003         textSelect.exit().remove();
51004         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).html(text2);
51005         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []);
51006         keyhintWrap.exit().remove();
51007         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
51008         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
51009         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
51010         keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").html(function(d) {
51011           return d;
51012         });
51013       };
51014     });
51015     return tooltip;
51016   }
51017
51018   // modules/ui/edit_menu.js
51019   function uiEditMenu(context) {
51020     var dispatch10 = dispatch_default("toggled");
51021     var _menu = select_default2(null);
51022     var _operations = [];
51023     var _anchorLoc = [0, 0];
51024     var _anchorLocLonLat = [0, 0];
51025     var _triggerType = "";
51026     var _vpTopMargin = 85;
51027     var _vpBottomMargin = 45;
51028     var _vpSideMargin = 35;
51029     var _menuTop = false;
51030     var _menuHeight;
51031     var _menuWidth;
51032     var _verticalPadding = 4;
51033     var _tooltipWidth = 210;
51034     var _menuSideMargin = 10;
51035     var _tooltips = [];
51036     var editMenu = function(selection2) {
51037       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
51038       var ops = _operations.filter(function(op) {
51039         return !isTouchMenu || !op.mouseOnly;
51040       });
51041       if (!ops.length)
51042         return;
51043       _tooltips = [];
51044       _menuTop = isTouchMenu;
51045       var showLabels = isTouchMenu;
51046       var buttonHeight = showLabels ? 32 : 34;
51047       if (showLabels) {
51048         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
51049           return op.title.length;
51050         })));
51051       } else {
51052         _menuWidth = 44;
51053       }
51054       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
51055       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
51056       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
51057       var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
51058         return "edit-menu-item edit-menu-item-" + d.id;
51059       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
51060         d3_event.stopPropagation();
51061       }).on("mouseenter.highlight", function(d3_event, d) {
51062         if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
51063           return;
51064         utilHighlightEntities(d.relatedEntityIds(), true, context);
51065       }).on("mouseleave.highlight", function(d3_event, d) {
51066         if (!d.relatedEntityIds)
51067           return;
51068         utilHighlightEntities(d.relatedEntityIds(), false, context);
51069       });
51070       buttonsEnter.each(function(d) {
51071         var tooltip = uiTooltip().heading(d.title).title(d.tooltip()).keys([d.keys[0]]);
51072         _tooltips.push(tooltip);
51073         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
51074       });
51075       if (showLabels) {
51076         buttonsEnter.append("span").attr("class", "label").html(function(d) {
51077           return d.title;
51078         });
51079       }
51080       buttonsEnter.merge(buttons).classed("disabled", function(d) {
51081         return d.disabled();
51082       });
51083       updatePosition();
51084       var initialScale = context.projection.scale();
51085       context.map().on("move.edit-menu", function() {
51086         if (initialScale !== context.projection.scale()) {
51087           editMenu.close();
51088         }
51089       }).on("drawn.edit-menu", function(info) {
51090         if (info.full)
51091           updatePosition();
51092       });
51093       var lastPointerUpType;
51094       function pointerup(d3_event) {
51095         lastPointerUpType = d3_event.pointerType;
51096       }
51097       function click(d3_event, operation) {
51098         d3_event.stopPropagation();
51099         if (operation.relatedEntityIds) {
51100           utilHighlightEntities(operation.relatedEntityIds(), false, context);
51101         }
51102         if (operation.disabled()) {
51103           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51104             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip)();
51105           }
51106         } else {
51107           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51108             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
51109           }
51110           operation();
51111           editMenu.close();
51112         }
51113         lastPointerUpType = null;
51114       }
51115       dispatch10.call("toggled", this, true);
51116     };
51117     function updatePosition() {
51118       if (!_menu || _menu.empty())
51119         return;
51120       var anchorLoc = context.projection(_anchorLocLonLat);
51121       var viewport = context.surfaceRect();
51122       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
51123         editMenu.close();
51124         return;
51125       }
51126       var menuLeft = displayOnLeft(viewport);
51127       var offset = [0, 0];
51128       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
51129       if (_menuTop) {
51130         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
51131           offset[1] = -anchorLoc[1] + _vpTopMargin;
51132         } else {
51133           offset[1] = -_menuHeight;
51134         }
51135       } else {
51136         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
51137           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
51138         } else {
51139           offset[1] = 0;
51140         }
51141       }
51142       var origin = geoVecAdd(anchorLoc, offset);
51143       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
51144       var tooltipSide = tooltipPosition(viewport, menuLeft);
51145       _tooltips.forEach(function(tooltip) {
51146         tooltip.placement(tooltipSide);
51147       });
51148       function displayOnLeft(viewport2) {
51149         if (_mainLocalizer.textDirection() === "ltr") {
51150           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
51151             return true;
51152           }
51153           return false;
51154         } else {
51155           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
51156             return false;
51157           }
51158           return true;
51159         }
51160       }
51161       function tooltipPosition(viewport2, menuLeft2) {
51162         if (_mainLocalizer.textDirection() === "ltr") {
51163           if (menuLeft2) {
51164             return "left";
51165           }
51166           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
51167             return "left";
51168           }
51169           return "right";
51170         } else {
51171           if (!menuLeft2) {
51172             return "right";
51173           }
51174           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
51175             return "right";
51176           }
51177           return "left";
51178         }
51179       }
51180     }
51181     editMenu.close = function() {
51182       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
51183       _menu.remove();
51184       _tooltips = [];
51185       dispatch10.call("toggled", this, false);
51186     };
51187     editMenu.anchorLoc = function(val) {
51188       if (!arguments.length)
51189         return _anchorLoc;
51190       _anchorLoc = val;
51191       _anchorLocLonLat = context.projection.invert(_anchorLoc);
51192       return editMenu;
51193     };
51194     editMenu.triggerType = function(val) {
51195       if (!arguments.length)
51196         return _triggerType;
51197       _triggerType = val;
51198       return editMenu;
51199     };
51200     editMenu.operations = function(val) {
51201       if (!arguments.length)
51202         return _operations;
51203       _operations = val;
51204       return editMenu;
51205     };
51206     return utilRebind(editMenu, dispatch10, "on");
51207   }
51208
51209   // modules/ui/feature_info.js
51210   function uiFeatureInfo(context) {
51211     function update(selection2) {
51212       var features2 = context.features();
51213       var stats = features2.stats();
51214       var count = 0;
51215       var hiddenList = features2.hidden().map(function(k) {
51216         if (stats[k]) {
51217           count += stats[k];
51218           return _t.html("inspector.title_count", { title: { html: _t.html("feature." + k + ".description") }, count: stats[k] });
51219         }
51220         return null;
51221       }).filter(Boolean);
51222       selection2.html("");
51223       if (hiddenList.length) {
51224         var tooltipBehavior = uiTooltip().placement("top").title(function() {
51225           return hiddenList.join("<br/>");
51226         });
51227         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
51228           tooltipBehavior.hide();
51229           d3_event.preventDefault();
51230           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
51231         });
51232       }
51233       selection2.classed("hide", !hiddenList.length);
51234     }
51235     return function(selection2) {
51236       update(selection2);
51237       context.features().on("change.feature_info", function() {
51238         update(selection2);
51239       });
51240     };
51241   }
51242
51243   // modules/ui/flash.js
51244   function uiFlash(context) {
51245     var _flashTimer;
51246     var _duration = 2e3;
51247     var _iconName = "#iD-icon-no";
51248     var _iconClass = "disabled";
51249     var _label = "";
51250     function flash() {
51251       if (_flashTimer) {
51252         _flashTimer.stop();
51253       }
51254       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
51255       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
51256       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
51257       var contentEnter = content.enter().append("div").attr("class", "flash-content");
51258       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
51259       iconEnter.append("circle").attr("r", 9);
51260       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
51261       contentEnter.append("div").attr("class", "flash-text");
51262       content = content.merge(contentEnter);
51263       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
51264       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
51265       content.selectAll(".flash-text").attr("class", "flash-text").html(_label);
51266       _flashTimer = timeout_default(function() {
51267         _flashTimer = null;
51268         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
51269         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
51270       }, _duration);
51271       return content;
51272     }
51273     flash.duration = function(_) {
51274       if (!arguments.length)
51275         return _duration;
51276       _duration = _;
51277       return flash;
51278     };
51279     flash.label = function(_) {
51280       if (!arguments.length)
51281         return _label;
51282       _label = _;
51283       return flash;
51284     };
51285     flash.iconName = function(_) {
51286       if (!arguments.length)
51287         return _iconName;
51288       _iconName = _;
51289       return flash;
51290     };
51291     flash.iconClass = function(_) {
51292       if (!arguments.length)
51293         return _iconClass;
51294       _iconClass = _;
51295       return flash;
51296     };
51297     return flash;
51298   }
51299
51300   // modules/ui/full_screen.js
51301   function uiFullScreen(context) {
51302     var element = context.container().node();
51303     function getFullScreenFn() {
51304       if (element.requestFullscreen) {
51305         return element.requestFullscreen;
51306       } else if (element.msRequestFullscreen) {
51307         return element.msRequestFullscreen;
51308       } else if (element.mozRequestFullScreen) {
51309         return element.mozRequestFullScreen;
51310       } else if (element.webkitRequestFullscreen) {
51311         return element.webkitRequestFullscreen;
51312       }
51313     }
51314     function getExitFullScreenFn() {
51315       if (document.exitFullscreen) {
51316         return document.exitFullscreen;
51317       } else if (document.msExitFullscreen) {
51318         return document.msExitFullscreen;
51319       } else if (document.mozCancelFullScreen) {
51320         return document.mozCancelFullScreen;
51321       } else if (document.webkitExitFullscreen) {
51322         return document.webkitExitFullscreen;
51323       }
51324     }
51325     function isFullScreen() {
51326       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
51327     }
51328     function isSupported() {
51329       return !!getFullScreenFn();
51330     }
51331     function fullScreen(d3_event) {
51332       d3_event.preventDefault();
51333       if (!isFullScreen()) {
51334         getFullScreenFn().apply(element);
51335       } else {
51336         getExitFullScreenFn().apply(document);
51337       }
51338     }
51339     return function() {
51340       if (!isSupported())
51341         return;
51342       var detected = utilDetect();
51343       var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
51344       context.keybinding().on(keys, fullScreen);
51345     };
51346   }
51347
51348   // modules/ui/geolocate.js
51349   function uiGeolocate(context) {
51350     var _geolocationOptions = {
51351       enableHighAccuracy: false,
51352       timeout: 6e3
51353     };
51354     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
51355     var _layer = context.layers().layer("geolocate");
51356     var _position;
51357     var _extent;
51358     var _timeoutID;
51359     var _button = select_default2(null);
51360     function click() {
51361       if (context.inIntro())
51362         return;
51363       if (!_layer.enabled() && !_locating.isShown()) {
51364         _timeoutID = setTimeout(error, 1e4);
51365         context.container().call(_locating);
51366         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
51367       } else {
51368         _locating.close();
51369         _layer.enabled(null, false);
51370         updateButtonState();
51371       }
51372     }
51373     function zoomTo() {
51374       context.enter(modeBrowse(context));
51375       var map2 = context.map();
51376       _layer.enabled(_position, true);
51377       updateButtonState();
51378       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
51379     }
51380     function success(geolocation) {
51381       _position = geolocation;
51382       var coords = _position.coords;
51383       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
51384       zoomTo();
51385       finish();
51386     }
51387     function error() {
51388       if (_position) {
51389         zoomTo();
51390       } else {
51391         context.ui().flash.label(_t.html("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
51392       }
51393       finish();
51394     }
51395     function finish() {
51396       _locating.close();
51397       if (_timeoutID) {
51398         clearTimeout(_timeoutID);
51399       }
51400       _timeoutID = void 0;
51401     }
51402     function updateButtonState() {
51403       _button.classed("active", _layer.enabled());
51404       _button.attr("aria-pressed", _layer.enabled());
51405     }
51406     return function(selection2) {
51407       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
51408         return;
51409       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(_t.html("geolocate.title")).keys([_t("geolocate.key")]));
51410       context.keybinding().on(_t("geolocate.key"), click);
51411     };
51412   }
51413
51414   // modules/ui/panels/background.js
51415   function uiPanelBackground(context) {
51416     var background = context.background();
51417     var _currSourceName = null;
51418     var _metadata = {};
51419     var _metadataKeys = [
51420       "zoom",
51421       "vintage",
51422       "source",
51423       "description",
51424       "resolution",
51425       "accuracy"
51426     ];
51427     var debouncedRedraw = debounce_default(redraw, 250);
51428     function redraw(selection2) {
51429       var source = background.baseLayerSource();
51430       if (!source)
51431         return;
51432       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
51433       var sourceLabel = source.label();
51434       if (_currSourceName !== sourceLabel) {
51435         _currSourceName = sourceLabel;
51436         _metadata = {};
51437       }
51438       selection2.html("");
51439       var list = selection2.append("ul").attr("class", "background-info");
51440       list.append("li").html(_currSourceName);
51441       _metadataKeys.forEach(function(k) {
51442         if (isDG && k === "vintage")
51443           return;
51444         list.append("li").attr("class", "background-info-list-" + k).classed("hide", !_metadata[k]).call(_t.append("info_panels.background." + k, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k).text(_metadata[k]);
51445       });
51446       debouncedGetMetadata(selection2);
51447       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
51448       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
51449         d3_event.preventDefault();
51450         context.setDebug("tile", !context.getDebug("tile"));
51451         selection2.call(redraw);
51452       });
51453       if (isDG) {
51454         var key = source.id + "-vintage";
51455         var sourceVintage = context.background().findSource(key);
51456         var showsVintage = context.background().showsLayer(sourceVintage);
51457         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
51458         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
51459           d3_event.preventDefault();
51460           context.background().toggleOverlayLayer(sourceVintage);
51461           selection2.call(redraw);
51462         });
51463       }
51464       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
51465         if (source.id !== layerId) {
51466           var key2 = layerId + "-vintage";
51467           var sourceVintage2 = context.background().findSource(key2);
51468           if (context.background().showsLayer(sourceVintage2)) {
51469             context.background().toggleOverlayLayer(sourceVintage2);
51470           }
51471         }
51472       });
51473     }
51474     var debouncedGetMetadata = debounce_default(getMetadata, 250);
51475     function getMetadata(selection2) {
51476       var tile = context.container().select(".layer-background img.tile-center");
51477       if (tile.empty())
51478         return;
51479       var sourceName = _currSourceName;
51480       var d = tile.datum();
51481       var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
51482       var center = context.map().center();
51483       _metadata.zoom = String(zoom);
51484       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
51485       if (!d || !d.length >= 3)
51486         return;
51487       background.baseLayerSource().getMetadata(center, d, function(err, result) {
51488         if (err || _currSourceName !== sourceName)
51489           return;
51490         var vintage = result.vintage;
51491         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
51492         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
51493         _metadataKeys.forEach(function(k) {
51494           if (k === "zoom" || k === "vintage")
51495             return;
51496           var val = result[k];
51497           _metadata[k] = val;
51498           selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
51499         });
51500       });
51501     }
51502     var panel = function(selection2) {
51503       selection2.call(redraw);
51504       context.map().on("drawn.info-background", function() {
51505         selection2.call(debouncedRedraw);
51506       }).on("move.info-background", function() {
51507         selection2.call(debouncedGetMetadata);
51508       });
51509     };
51510     panel.off = function() {
51511       context.map().on("drawn.info-background", null).on("move.info-background", null);
51512     };
51513     panel.id = "background";
51514     panel.label = _t.html("info_panels.background.title");
51515     panel.key = _t("info_panels.background.key");
51516     return panel;
51517   }
51518
51519   // modules/ui/panels/history.js
51520   function uiPanelHistory(context) {
51521     var osm;
51522     function displayTimestamp(timestamp) {
51523       if (!timestamp)
51524         return _t("info_panels.history.unknown");
51525       var options2 = {
51526         day: "numeric",
51527         month: "short",
51528         year: "numeric",
51529         hour: "numeric",
51530         minute: "numeric",
51531         second: "numeric"
51532       };
51533       var d = new Date(timestamp);
51534       if (isNaN(d.getTime()))
51535         return _t("info_panels.history.unknown");
51536       return d.toLocaleString(_mainLocalizer.localeCode(), options2);
51537     }
51538     function displayUser(selection2, userName) {
51539       if (!userName) {
51540         selection2.append("span").call(_t.append("info_panels.history.unknown"));
51541         return;
51542       }
51543       selection2.append("span").attr("class", "user-name").text(userName);
51544       var links = selection2.append("div").attr("class", "links");
51545       if (osm) {
51546         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
51547       }
51548       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
51549     }
51550     function displayChangeset(selection2, changeset) {
51551       if (!changeset) {
51552         selection2.append("span").call(_t.append("info_panels.history.unknown"));
51553         return;
51554       }
51555       selection2.append("span").attr("class", "changeset-id").text(changeset);
51556       var links = selection2.append("div").attr("class", "links");
51557       if (osm) {
51558         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
51559       }
51560       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
51561       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
51562     }
51563     function redraw(selection2) {
51564       var selectedNoteID = context.selectedNoteID();
51565       osm = context.connection();
51566       var selected, note, entity;
51567       if (selectedNoteID && osm) {
51568         selected = [_t.html("note.note") + " " + selectedNoteID];
51569         note = osm.getNote(selectedNoteID);
51570       } else {
51571         selected = context.selectedIDs().filter(function(e) {
51572           return context.hasEntity(e);
51573         });
51574         if (selected.length) {
51575           entity = context.entity(selected[0]);
51576         }
51577       }
51578       var singular = selected.length === 1 ? selected[0] : null;
51579       selection2.html("");
51580       if (singular) {
51581         selection2.append("h4").attr("class", "history-heading").html(singular);
51582       } else {
51583         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
51584       }
51585       if (!singular)
51586         return;
51587       if (entity) {
51588         selection2.call(redrawEntity, entity);
51589       } else if (note) {
51590         selection2.call(redrawNote, note);
51591       }
51592     }
51593     function redrawNote(selection2, note) {
51594       if (!note || note.isNew()) {
51595         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
51596         return;
51597       }
51598       var list = selection2.append("ul");
51599       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
51600       if (note.comments.length) {
51601         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
51602         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
51603       }
51604       if (osm) {
51605         selection2.append("a").attr("class", "view-history-on-osm").attr("target", "_blank").attr("href", osm.noteURL(note)).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("info_panels.history.note_link_text"));
51606       }
51607     }
51608     function redrawEntity(selection2, entity) {
51609       if (!entity || entity.isNew()) {
51610         selection2.append("div").call(_t.append("info_panels.history.no_history"));
51611         return;
51612       }
51613       var links = selection2.append("div").attr("class", "links");
51614       if (osm) {
51615         links.append("a").attr("class", "view-history-on-osm").attr("href", osm.historyURL(entity)).attr("target", "_blank").call(_t.append("info_panels.history.history_link"));
51616       }
51617       links.append("a").attr("class", "pewu-history-viewer-link").attr("href", "https://pewu.github.io/osm-history/#/" + entity.type + "/" + entity.osmId()).attr("target", "_blank").attr("tabindex", -1).text("PeWu");
51618       var list = selection2.append("ul");
51619       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
51620       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
51621       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
51622       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
51623     }
51624     var panel = function(selection2) {
51625       selection2.call(redraw);
51626       context.map().on("drawn.info-history", function() {
51627         selection2.call(redraw);
51628       });
51629       context.on("enter.info-history", function() {
51630         selection2.call(redraw);
51631       });
51632     };
51633     panel.off = function() {
51634       context.map().on("drawn.info-history", null);
51635       context.on("enter.info-history", null);
51636     };
51637     panel.id = "history";
51638     panel.label = _t.html("info_panels.history.title");
51639     panel.key = _t("info_panels.history.key");
51640     return panel;
51641   }
51642
51643   // modules/util/units.js
51644   var OSM_PRECISION = 7;
51645   function displayLength(m, isImperial) {
51646     var d = m * (isImperial ? 3.28084 : 1);
51647     var unit2;
51648     if (isImperial) {
51649       if (d >= 5280) {
51650         d /= 5280;
51651         unit2 = "miles";
51652       } else {
51653         unit2 = "feet";
51654       }
51655     } else {
51656       if (d >= 1e3) {
51657         d /= 1e3;
51658         unit2 = "kilometers";
51659       } else {
51660         unit2 = "meters";
51661       }
51662     }
51663     return _t("units." + unit2, {
51664       quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
51665         maximumSignificantDigits: 4
51666       })
51667     });
51668   }
51669   function displayArea(m2, isImperial) {
51670     var locale2 = _mainLocalizer.localeCode();
51671     var d = m2 * (isImperial ? 10.7639111056 : 1);
51672     var d1, d2, area;
51673     var unit1 = "";
51674     var unit2 = "";
51675     if (isImperial) {
51676       if (d >= 6969600) {
51677         d1 = d / 27878400;
51678         unit1 = "square_miles";
51679       } else {
51680         d1 = d;
51681         unit1 = "square_feet";
51682       }
51683       if (d > 4356 && d < 4356e4) {
51684         d2 = d / 43560;
51685         unit2 = "acres";
51686       }
51687     } else {
51688       if (d >= 25e4) {
51689         d1 = d / 1e6;
51690         unit1 = "square_kilometers";
51691       } else {
51692         d1 = d;
51693         unit1 = "square_meters";
51694       }
51695       if (d > 1e3 && d < 1e7) {
51696         d2 = d / 1e4;
51697         unit2 = "hectares";
51698       }
51699     }
51700     area = _t("units." + unit1, {
51701       quantity: d1.toLocaleString(locale2, {
51702         maximumSignificantDigits: 4
51703       })
51704     });
51705     if (d2) {
51706       return _t("units.area_pair", {
51707         area1: area,
51708         area2: _t("units." + unit2, {
51709           quantity: d2.toLocaleString(locale2, {
51710             maximumSignificantDigits: 2
51711           })
51712         })
51713       });
51714     } else {
51715       return area;
51716     }
51717   }
51718   function wrap(x, min3, max3) {
51719     var d = max3 - min3;
51720     return ((x - min3) % d + d) % d + min3;
51721   }
51722   function clamp2(x, min3, max3) {
51723     return Math.max(min3, Math.min(x, max3));
51724   }
51725   function displayCoordinate(deg, pos, neg) {
51726     var locale2 = _mainLocalizer.localeCode();
51727     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
51728     var sec = (min3 - Math.floor(min3)) * 60;
51729     var displayDegrees = _t("units.arcdegrees", {
51730       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
51731     });
51732     var displayCoordinate2;
51733     if (Math.floor(sec) > 0) {
51734       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
51735         quantity: Math.floor(min3).toLocaleString(locale2)
51736       }) + _t("units.arcseconds", {
51737         quantity: Math.round(sec).toLocaleString(locale2)
51738       });
51739     } else if (Math.floor(min3) > 0) {
51740       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
51741         quantity: Math.round(min3).toLocaleString(locale2)
51742       });
51743     } else {
51744       displayCoordinate2 = _t("units.arcdegrees", {
51745         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
51746       });
51747     }
51748     if (deg === 0) {
51749       return displayCoordinate2;
51750     } else {
51751       return _t("units.coordinate", {
51752         coordinate: displayCoordinate2,
51753         direction: _t("units." + (deg > 0 ? pos : neg))
51754       });
51755     }
51756   }
51757   function dmsCoordinatePair(coord2) {
51758     return _t("units.coordinate_pair", {
51759       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
51760       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
51761     });
51762   }
51763   function decimalCoordinatePair(coord2) {
51764     return _t("units.coordinate_pair", {
51765       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
51766       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
51767     });
51768   }
51769
51770   // modules/ui/panels/location.js
51771   function uiPanelLocation(context) {
51772     var currLocation = "";
51773     function redraw(selection2) {
51774       selection2.html("");
51775       var list = selection2.append("ul");
51776       var coord2 = context.map().mouseCoordinates();
51777       if (coord2.some(isNaN)) {
51778         coord2 = context.map().center();
51779       }
51780       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
51781       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
51782       debouncedGetLocation(selection2, coord2);
51783     }
51784     var debouncedGetLocation = debounce_default(getLocation, 250);
51785     function getLocation(selection2, coord2) {
51786       if (!services.geocoder) {
51787         currLocation = _t("info_panels.location.unknown_location");
51788         selection2.selectAll(".location-info").text(currLocation);
51789       } else {
51790         services.geocoder.reverse(coord2, function(err, result) {
51791           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
51792           selection2.selectAll(".location-info").text(currLocation);
51793         });
51794       }
51795     }
51796     var panel = function(selection2) {
51797       selection2.call(redraw);
51798       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
51799         selection2.call(redraw);
51800       });
51801     };
51802     panel.off = function() {
51803       context.surface().on(".info-location", null);
51804     };
51805     panel.id = "location";
51806     panel.label = _t.html("info_panels.location.title");
51807     panel.key = _t("info_panels.location.key");
51808     return panel;
51809   }
51810
51811   // modules/ui/panels/measurement.js
51812   function uiPanelMeasurement(context) {
51813     function radiansToMeters(r) {
51814       return r * 63710071809e-4;
51815     }
51816     function steradiansToSqmeters(r) {
51817       return r / (4 * Math.PI) * 510065621724e3;
51818     }
51819     function toLineString(feature3) {
51820       if (feature3.type === "LineString")
51821         return feature3;
51822       var result = { type: "LineString", coordinates: [] };
51823       if (feature3.type === "Polygon") {
51824         result.coordinates = feature3.coordinates[0];
51825       } else if (feature3.type === "MultiPolygon") {
51826         result.coordinates = feature3.coordinates[0][0];
51827       }
51828       return result;
51829     }
51830     var _isImperial = !_mainLocalizer.usesMetric();
51831     function redraw(selection2) {
51832       var graph = context.graph();
51833       var selectedNoteID = context.selectedNoteID();
51834       var osm = services.osm;
51835       var localeCode = _mainLocalizer.localeCode();
51836       var heading;
51837       var center, location, centroid;
51838       var closed, geometry;
51839       var totalNodeCount, length = 0, area = 0, distance;
51840       if (selectedNoteID && osm) {
51841         var note = osm.getNote(selectedNoteID);
51842         heading = _t.html("note.note") + " " + selectedNoteID;
51843         location = note.loc;
51844         geometry = "note";
51845       } else {
51846         var selectedIDs = context.selectedIDs().filter(function(id2) {
51847           return context.hasEntity(id2);
51848         });
51849         var selected = selectedIDs.map(function(id2) {
51850           return context.entity(id2);
51851         });
51852         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
51853         if (selected.length) {
51854           var extent = geoExtent();
51855           for (var i2 in selected) {
51856             var entity = selected[i2];
51857             extent._extend(entity.extent(graph));
51858             geometry = entity.geometry(graph);
51859             if (geometry === "line" || geometry === "area") {
51860               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
51861               var feature3 = entity.asGeoJSON(graph);
51862               length += radiansToMeters(length_default(toLineString(feature3)));
51863               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
51864               centroid = centroid && context.projection.invert(centroid);
51865               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
51866                 centroid = entity.extent(graph).center();
51867               }
51868               if (closed) {
51869                 area += steradiansToSqmeters(entity.area(graph));
51870               }
51871             }
51872           }
51873           if (selected.length > 1) {
51874             geometry = null;
51875             closed = null;
51876             centroid = null;
51877           }
51878           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
51879             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
51880           }
51881           if (selected.length === 1 && selected[0].type === "node") {
51882             location = selected[0].loc;
51883           } else {
51884             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
51885           }
51886           if (!location && !centroid) {
51887             center = extent.center();
51888           }
51889         }
51890       }
51891       selection2.html("");
51892       if (heading) {
51893         selection2.append("h4").attr("class", "measurement-heading").html(heading);
51894       }
51895       var list = selection2.append("ul");
51896       var coordItem;
51897       if (geometry) {
51898         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry));
51899       }
51900       if (totalNodeCount) {
51901         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
51902       }
51903       if (area) {
51904         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
51905       }
51906       if (length) {
51907         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
51908       }
51909       if (typeof distance === "number") {
51910         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
51911       }
51912       if (location) {
51913         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
51914         coordItem.append("span").text(dmsCoordinatePair(location));
51915         coordItem.append("span").text(decimalCoordinatePair(location));
51916       }
51917       if (centroid) {
51918         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
51919         coordItem.append("span").text(dmsCoordinatePair(centroid));
51920         coordItem.append("span").text(decimalCoordinatePair(centroid));
51921       }
51922       if (center) {
51923         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
51924         coordItem.append("span").text(dmsCoordinatePair(center));
51925         coordItem.append("span").text(decimalCoordinatePair(center));
51926       }
51927       if (length || area || typeof distance === "number") {
51928         var toggle = _isImperial ? "imperial" : "metric";
51929         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
51930           d3_event.preventDefault();
51931           _isImperial = !_isImperial;
51932           selection2.call(redraw);
51933         });
51934       }
51935     }
51936     var panel = function(selection2) {
51937       selection2.call(redraw);
51938       context.map().on("drawn.info-measurement", function() {
51939         selection2.call(redraw);
51940       });
51941       context.on("enter.info-measurement", function() {
51942         selection2.call(redraw);
51943       });
51944     };
51945     panel.off = function() {
51946       context.map().on("drawn.info-measurement", null);
51947       context.on("enter.info-measurement", null);
51948     };
51949     panel.id = "measurement";
51950     panel.label = _t.html("info_panels.measurement.title");
51951     panel.key = _t("info_panels.measurement.key");
51952     return panel;
51953   }
51954
51955   // modules/ui/panels/index.js
51956   var uiInfoPanels = {
51957     background: uiPanelBackground,
51958     history: uiPanelHistory,
51959     location: uiPanelLocation,
51960     measurement: uiPanelMeasurement
51961   };
51962
51963   // modules/ui/info.js
51964   function uiInfo(context) {
51965     var ids = Object.keys(uiInfoPanels);
51966     var wasActive = ["measurement"];
51967     var panels = {};
51968     var active = {};
51969     ids.forEach(function(k) {
51970       if (!panels[k]) {
51971         panels[k] = uiInfoPanels[k](context);
51972         active[k] = false;
51973       }
51974     });
51975     function info(selection2) {
51976       function redraw() {
51977         var activeids = ids.filter(function(k) {
51978           return active[k];
51979         }).sort();
51980         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
51981           return k;
51982         });
51983         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
51984           select_default2(this).call(panels[d].off).remove();
51985         });
51986         var enter = containers.enter().append("div").attr("class", function(d) {
51987           return "fillD2 panel-container panel-container-" + d;
51988         });
51989         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
51990         var title = enter.append("div").attr("class", "panel-title fillD2");
51991         title.append("h3").html(function(d) {
51992           return panels[d].label;
51993         });
51994         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
51995           d3_event.stopImmediatePropagation();
51996           d3_event.preventDefault();
51997           info.toggle(d);
51998         }).call(svgIcon("#iD-icon-close"));
51999         enter.append("div").attr("class", function(d) {
52000           return "panel-content panel-content-" + d;
52001         });
52002         infoPanels.selectAll(".panel-content").each(function(d) {
52003           select_default2(this).call(panels[d]);
52004         });
52005       }
52006       info.toggle = function(which) {
52007         var activeids = ids.filter(function(k) {
52008           return active[k];
52009         });
52010         if (which) {
52011           active[which] = !active[which];
52012           if (activeids.length === 1 && activeids[0] === which) {
52013             wasActive = [which];
52014           }
52015           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
52016         } else {
52017           if (activeids.length) {
52018             wasActive = activeids;
52019             activeids.forEach(function(k) {
52020               active[k] = false;
52021             });
52022           } else {
52023             wasActive.forEach(function(k) {
52024               active[k] = true;
52025             });
52026           }
52027         }
52028         redraw();
52029       };
52030       var infoPanels = selection2.selectAll(".info-panels").data([0]);
52031       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
52032       redraw();
52033       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
52034         d3_event.stopImmediatePropagation();
52035         d3_event.preventDefault();
52036         info.toggle();
52037       });
52038       ids.forEach(function(k) {
52039         var key = _t("info_panels." + k + ".key", { default: null });
52040         if (!key)
52041           return;
52042         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
52043           d3_event.stopImmediatePropagation();
52044           d3_event.preventDefault();
52045           info.toggle(k);
52046         });
52047       });
52048     }
52049     return info;
52050   }
52051
52052   // modules/ui/intro/helper.js
52053   function pointBox(loc, context) {
52054     var rect = context.surfaceRect();
52055     var point = context.curtainProjection(loc);
52056     return {
52057       left: point[0] + rect.left - 40,
52058       top: point[1] + rect.top - 60,
52059       width: 80,
52060       height: 90
52061     };
52062   }
52063   function pad(locOrBox, padding, context) {
52064     var box;
52065     if (locOrBox instanceof Array) {
52066       var rect = context.surfaceRect();
52067       var point = context.curtainProjection(locOrBox);
52068       box = {
52069         left: point[0] + rect.left,
52070         top: point[1] + rect.top
52071       };
52072     } else {
52073       box = locOrBox;
52074     }
52075     return {
52076       left: box.left - padding,
52077       top: box.top - padding,
52078       width: (box.width || 0) + 2 * padding,
52079       height: (box.width || 0) + 2 * padding
52080     };
52081   }
52082   function icon(name2, svgklass, useklass) {
52083     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name2 + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
52084   }
52085   var helpStringReplacements;
52086   function helpHtml(id2, replacements) {
52087     if (!helpStringReplacements) {
52088       helpStringReplacements = {
52089         point_icon: icon("#iD-icon-point", "inline"),
52090         line_icon: icon("#iD-icon-line", "inline"),
52091         area_icon: icon("#iD-icon-area", "inline"),
52092         note_icon: icon("#iD-icon-note", "inline add-note"),
52093         plus: icon("#iD-icon-plus", "inline"),
52094         minus: icon("#iD-icon-minus", "inline"),
52095         layers_icon: icon("#iD-icon-layers", "inline"),
52096         data_icon: icon("#iD-icon-data", "inline"),
52097         inspect: icon("#iD-icon-inspect", "inline"),
52098         help_icon: icon("#iD-icon-help", "inline"),
52099         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
52100         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
52101         save_icon: icon("#iD-icon-save", "inline"),
52102         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
52103         continue_icon: icon("#iD-operation-continue", "inline operation"),
52104         copy_icon: icon("#iD-operation-copy", "inline operation"),
52105         delete_icon: icon("#iD-operation-delete", "inline operation"),
52106         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
52107         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
52108         extract_icon: icon("#iD-operation-extract", "inline operation"),
52109         merge_icon: icon("#iD-operation-merge", "inline operation"),
52110         move_icon: icon("#iD-operation-move", "inline operation"),
52111         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
52112         paste_icon: icon("#iD-operation-paste", "inline operation"),
52113         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
52114         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
52115         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
52116         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
52117         split_icon: icon("#iD-operation-split", "inline operation"),
52118         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
52119         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
52120         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
52121         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
52122         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
52123         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
52124         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
52125         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
52126         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
52127         shift: uiCmd.display("\u21E7"),
52128         alt: uiCmd.display("\u2325"),
52129         return: uiCmd.display("\u21B5"),
52130         esc: _t.html("shortcuts.key.esc"),
52131         space: _t.html("shortcuts.key.space"),
52132         add_note_key: _t.html("modes.add_note.key"),
52133         help_key: _t.html("help.key"),
52134         shortcuts_key: _t.html("shortcuts.toggle.key"),
52135         save: _t.html("save.title"),
52136         undo: _t.html("undo.title"),
52137         redo: _t.html("redo.title"),
52138         upload: _t.html("commit.save"),
52139         point: _t.html("modes.add_point.title"),
52140         line: _t.html("modes.add_line.title"),
52141         area: _t.html("modes.add_area.title"),
52142         note: _t.html("modes.add_note.label"),
52143         circularize: _t.html("operations.circularize.title"),
52144         continue: _t.html("operations.continue.title"),
52145         copy: _t.html("operations.copy.title"),
52146         delete: _t.html("operations.delete.title"),
52147         disconnect: _t.html("operations.disconnect.title"),
52148         downgrade: _t.html("operations.downgrade.title"),
52149         extract: _t.html("operations.extract.title"),
52150         merge: _t.html("operations.merge.title"),
52151         move: _t.html("operations.move.title"),
52152         orthogonalize: _t.html("operations.orthogonalize.title"),
52153         paste: _t.html("operations.paste.title"),
52154         reflect_long: _t.html("operations.reflect.title.long"),
52155         reflect_short: _t.html("operations.reflect.title.short"),
52156         reverse: _t.html("operations.reverse.title"),
52157         rotate: _t.html("operations.rotate.title"),
52158         split: _t.html("operations.split.title"),
52159         straighten: _t.html("operations.straighten.title"),
52160         map_data: _t.html("map_data.title"),
52161         osm_notes: _t.html("map_data.layers.notes.title"),
52162         fields: _t.html("inspector.fields"),
52163         tags: _t.html("inspector.tags"),
52164         relations: _t.html("inspector.relations"),
52165         new_relation: _t.html("inspector.new_relation"),
52166         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
52167         background_settings: _t.html("background.description"),
52168         imagery_offset: _t.html("background.fix_misalignment"),
52169         start_the_walkthrough: _t.html("splash.walkthrough"),
52170         help: _t.html("help.title"),
52171         ok: _t.html("intro.ok")
52172       };
52173       for (var key in helpStringReplacements) {
52174         helpStringReplacements[key] = { html: helpStringReplacements[key] };
52175       }
52176     }
52177     var reps;
52178     if (replacements) {
52179       reps = Object.assign(replacements, helpStringReplacements);
52180     } else {
52181       reps = helpStringReplacements;
52182     }
52183     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
52184   }
52185   function slugify(text2) {
52186     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
52187   }
52188   var missingStrings = {};
52189   function checkKey(key, text2) {
52190     if (_t(key, { default: void 0 }) === void 0) {
52191       if (missingStrings.hasOwnProperty(key))
52192         return;
52193       missingStrings[key] = text2;
52194       var missing = key + ": " + text2;
52195       if (typeof console !== "undefined")
52196         console.log(missing);
52197     }
52198   }
52199   function localize(obj) {
52200     var key;
52201     var name2 = obj.tags && obj.tags.name;
52202     if (name2) {
52203       key = "intro.graph.name." + slugify(name2);
52204       obj.tags.name = _t(key, { default: name2 });
52205       checkKey(key, name2);
52206     }
52207     var street = obj.tags && obj.tags["addr:street"];
52208     if (street) {
52209       key = "intro.graph.name." + slugify(street);
52210       obj.tags["addr:street"] = _t(key, { default: street });
52211       checkKey(key, street);
52212       var addrTags = [
52213         "block_number",
52214         "city",
52215         "county",
52216         "district",
52217         "hamlet",
52218         "neighbourhood",
52219         "postcode",
52220         "province",
52221         "quarter",
52222         "state",
52223         "subdistrict",
52224         "suburb"
52225       ];
52226       addrTags.forEach(function(k) {
52227         var key2 = "intro.graph." + k;
52228         var tag = "addr:" + k;
52229         var val = obj.tags && obj.tags[tag];
52230         var str2 = _t(key2, { default: val });
52231         if (str2) {
52232           if (str2.match(/^<.*>$/) !== null) {
52233             delete obj.tags[tag];
52234           } else {
52235             obj.tags[tag] = str2;
52236           }
52237         }
52238       });
52239     }
52240     return obj;
52241   }
52242   function isMostlySquare(points) {
52243     var threshold = 15;
52244     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
52245     var upperBound = Math.cos(threshold * Math.PI / 180);
52246     for (var i2 = 0; i2 < points.length; i2++) {
52247       var a = points[(i2 - 1 + points.length) % points.length];
52248       var origin = points[i2];
52249       var b = points[(i2 + 1) % points.length];
52250       var dotp = geoVecNormalizedDot(a, b, origin);
52251       var mag = Math.abs(dotp);
52252       if (mag > lowerBound && mag < upperBound) {
52253         return false;
52254       }
52255     }
52256     return true;
52257   }
52258   function selectMenuItem(context, operation) {
52259     return context.container().select(".edit-menu .edit-menu-item-" + operation);
52260   }
52261   function transitionTime(point1, point2) {
52262     var distance = geoSphericalDistance(point1, point2);
52263     if (distance === 0) {
52264       return 0;
52265     } else if (distance < 80) {
52266       return 500;
52267     } else {
52268       return 1e3;
52269     }
52270   }
52271
52272   // modules/ui/toggle.js
52273   function uiToggle(show, callback) {
52274     return function(selection2) {
52275       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
52276         select_default2(this).classed("hide", !show).style("opacity", null);
52277         if (callback)
52278           callback.apply(this);
52279       });
52280     };
52281   }
52282
52283   // modules/ui/curtain.js
52284   function uiCurtain(containerNode) {
52285     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
52286     function curtain(selection2) {
52287       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
52288       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
52289       select_default2(window).on("resize.curtain", resize);
52290       tooltip = selection2.append("div").attr("class", "tooltip");
52291       tooltip.append("div").attr("class", "popover-arrow");
52292       tooltip.append("div").attr("class", "popover-inner");
52293       resize();
52294       function resize() {
52295         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
52296         curtain.cut(darkness.datum());
52297       }
52298     }
52299     curtain.reveal = function(box, html2, options2) {
52300       options2 = options2 || {};
52301       if (typeof box === "string") {
52302         box = select_default2(box).node();
52303       }
52304       if (box && box.getBoundingClientRect) {
52305         box = copyBox(box.getBoundingClientRect());
52306         var containerRect = containerNode.getBoundingClientRect();
52307         box.top -= containerRect.top;
52308         box.left -= containerRect.left;
52309       }
52310       if (box && options2.padding) {
52311         box.top -= options2.padding;
52312         box.left -= options2.padding;
52313         box.bottom += options2.padding;
52314         box.right += options2.padding;
52315         box.height += options2.padding * 2;
52316         box.width += options2.padding * 2;
52317       }
52318       var tooltipBox;
52319       if (options2.tooltipBox) {
52320         tooltipBox = options2.tooltipBox;
52321         if (typeof tooltipBox === "string") {
52322           tooltipBox = select_default2(tooltipBox).node();
52323         }
52324         if (tooltipBox && tooltipBox.getBoundingClientRect) {
52325           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
52326         }
52327       } else {
52328         tooltipBox = box;
52329       }
52330       if (tooltipBox && html2) {
52331         if (html2.indexOf("**") !== -1) {
52332           if (html2.indexOf("<span") === 0) {
52333             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
52334           } else {
52335             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
52336           }
52337           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
52338         }
52339         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
52340         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
52341         if (options2.buttonText && options2.buttonCallback) {
52342           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
52343         }
52344         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
52345         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
52346         if (options2.buttonText && options2.buttonCallback) {
52347           var button = tooltip.selectAll(".button-section .button.action");
52348           button.on("click", function(d3_event) {
52349             d3_event.preventDefault();
52350             options2.buttonCallback();
52351           });
52352         }
52353         var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
52354         if (options2.tooltipClass === "intro-mouse") {
52355           tip.height += 80;
52356         }
52357         if (tooltipBox.top + tooltipBox.height > h) {
52358           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
52359         }
52360         if (tooltipBox.left + tooltipBox.width > w) {
52361           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
52362         }
52363         if (tooltipBox.top + tooltipBox.height < 100) {
52364           side = "bottom";
52365           pos = [
52366             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52367             tooltipBox.top + tooltipBox.height
52368           ];
52369         } else if (tooltipBox.top > h - 140) {
52370           side = "top";
52371           pos = [
52372             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52373             tooltipBox.top - tip.height
52374           ];
52375         } else {
52376           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
52377           if (_mainLocalizer.textDirection() === "rtl") {
52378             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
52379               side = "right";
52380               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52381             } else {
52382               side = "left";
52383               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52384             }
52385           } else {
52386             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
52387               side = "left";
52388               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52389             } else {
52390               side = "right";
52391               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52392             }
52393           }
52394         }
52395         if (options2.duration !== 0 || !tooltip.classed(side)) {
52396           tooltip.call(uiToggle(true));
52397         }
52398         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
52399         var shiftY = 0;
52400         if (side === "left" || side === "right") {
52401           if (pos[1] < 60) {
52402             shiftY = 60 - pos[1];
52403           } else if (pos[1] + tip.height > h - 100) {
52404             shiftY = h - pos[1] - tip.height - 100;
52405           }
52406         }
52407         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
52408       } else {
52409         tooltip.classed("in", false).call(uiToggle(false));
52410       }
52411       curtain.cut(box, options2.duration);
52412       return tooltip;
52413     };
52414     curtain.cut = function(datum2, duration) {
52415       darkness.datum(datum2).interrupt();
52416       var selection2;
52417       if (duration === 0) {
52418         selection2 = darkness;
52419       } else {
52420         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
52421       }
52422       selection2.attr("d", function(d) {
52423         var containerWidth = containerNode.clientWidth;
52424         var containerHeight = containerNode.clientHeight;
52425         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
52426         if (!d)
52427           return string;
52428         return string + "M" + d.left + "," + d.top + "L" + d.left + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + d.top + "Z";
52429       });
52430     };
52431     curtain.remove = function() {
52432       surface.remove();
52433       tooltip.remove();
52434       select_default2(window).on("resize.curtain", null);
52435     };
52436     function copyBox(src) {
52437       return {
52438         top: src.top,
52439         right: src.right,
52440         bottom: src.bottom,
52441         left: src.left,
52442         width: src.width,
52443         height: src.height
52444       };
52445     }
52446     return curtain;
52447   }
52448
52449   // modules/ui/intro/welcome.js
52450   function uiIntroWelcome(context, reveal) {
52451     var dispatch10 = dispatch_default("done");
52452     var chapter = {
52453       title: "intro.welcome.title"
52454     };
52455     function welcome() {
52456       context.map().centerZoom([-85.63591, 41.94285], 19);
52457       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.welcome"), { buttonText: _t.html("intro.ok"), buttonCallback: practice });
52458     }
52459     function practice() {
52460       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.practice"), { buttonText: _t.html("intro.ok"), buttonCallback: words });
52461     }
52462     function words() {
52463       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.words"), { buttonText: _t.html("intro.ok"), buttonCallback: chapters });
52464     }
52465     function chapters() {
52466       dispatch10.call("done");
52467       reveal(".intro-nav-wrap .chapter-navigation", helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") }));
52468     }
52469     chapter.enter = function() {
52470       welcome();
52471     };
52472     chapter.exit = function() {
52473       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
52474     };
52475     chapter.restart = function() {
52476       chapter.exit();
52477       chapter.enter();
52478     };
52479     return utilRebind(chapter, dispatch10, "on");
52480   }
52481
52482   // modules/ui/intro/navigation.js
52483   function uiIntroNavigation(context, reveal) {
52484     var dispatch10 = dispatch_default("done");
52485     var timeouts = [];
52486     var hallId = "n2061";
52487     var townHall = [-85.63591, 41.94285];
52488     var springStreetId = "w397";
52489     var springStreetEndId = "n1834";
52490     var springStreet = [-85.63582, 41.94255];
52491     var onewayField = _mainPresetIndex.field("oneway");
52492     var maxspeedField = _mainPresetIndex.field("maxspeed");
52493     var chapter = {
52494       title: "intro.navigation.title"
52495     };
52496     function timeout2(f2, t) {
52497       timeouts.push(window.setTimeout(f2, t));
52498     }
52499     function eventCancel(d3_event) {
52500       d3_event.stopPropagation();
52501       d3_event.preventDefault();
52502     }
52503     function isTownHallSelected() {
52504       var ids = context.selectedIDs();
52505       return ids.length === 1 && ids[0] === hallId;
52506     }
52507     function dragMap() {
52508       context.enter(modeBrowse(context));
52509       context.history().reset("initial");
52510       var msec = transitionTime(townHall, context.map().center());
52511       if (msec) {
52512         reveal(null, null, { duration: 0 });
52513       }
52514       context.map().centerZoomEase(townHall, 19, msec);
52515       timeout2(function() {
52516         var centerStart = context.map().center();
52517         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
52518         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
52519         reveal(".surface", dragString);
52520         context.map().on("drawn.intro", function() {
52521           reveal(".surface", dragString, { duration: 0 });
52522         });
52523         context.map().on("move.intro", function() {
52524           var centerNow = context.map().center();
52525           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
52526             context.map().on("move.intro", null);
52527             timeout2(function() {
52528               continueTo(zoomMap);
52529             }, 3e3);
52530           }
52531         });
52532       }, msec + 100);
52533       function continueTo(nextStep) {
52534         context.map().on("move.intro drawn.intro", null);
52535         nextStep();
52536       }
52537     }
52538     function zoomMap() {
52539       var zoomStart = context.map().zoom();
52540       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
52541       var zoomString = helpHtml("intro.navigation." + textId);
52542       reveal(".surface", zoomString);
52543       context.map().on("drawn.intro", function() {
52544         reveal(".surface", zoomString, { duration: 0 });
52545       });
52546       context.map().on("move.intro", function() {
52547         if (context.map().zoom() !== zoomStart) {
52548           context.map().on("move.intro", null);
52549           timeout2(function() {
52550             continueTo(features2);
52551           }, 3e3);
52552         }
52553       });
52554       function continueTo(nextStep) {
52555         context.map().on("move.intro drawn.intro", null);
52556         nextStep();
52557       }
52558     }
52559     function features2() {
52560       var onClick = function() {
52561         continueTo(pointsLinesAreas);
52562       };
52563       reveal(".surface", helpHtml("intro.navigation.features"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52564       context.map().on("drawn.intro", function() {
52565         reveal(".surface", helpHtml("intro.navigation.features"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52566       });
52567       function continueTo(nextStep) {
52568         context.map().on("drawn.intro", null);
52569         nextStep();
52570       }
52571     }
52572     function pointsLinesAreas() {
52573       var onClick = function() {
52574         continueTo(nodesWays);
52575       };
52576       reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52577       context.map().on("drawn.intro", function() {
52578         reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52579       });
52580       function continueTo(nextStep) {
52581         context.map().on("drawn.intro", null);
52582         nextStep();
52583       }
52584     }
52585     function nodesWays() {
52586       var onClick = function() {
52587         continueTo(clickTownHall);
52588       };
52589       reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52590       context.map().on("drawn.intro", function() {
52591         reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52592       });
52593       function continueTo(nextStep) {
52594         context.map().on("drawn.intro", null);
52595         nextStep();
52596       }
52597     }
52598     function clickTownHall() {
52599       context.enter(modeBrowse(context));
52600       context.history().reset("initial");
52601       var entity = context.hasEntity(hallId);
52602       if (!entity)
52603         return;
52604       reveal(null, null, { duration: 0 });
52605       context.map().centerZoomEase(entity.loc, 19, 500);
52606       timeout2(function() {
52607         var entity2 = context.hasEntity(hallId);
52608         if (!entity2)
52609           return;
52610         var box = pointBox(entity2.loc, context);
52611         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
52612         reveal(box, helpHtml("intro.navigation." + textId));
52613         context.map().on("move.intro drawn.intro", function() {
52614           var entity3 = context.hasEntity(hallId);
52615           if (!entity3)
52616             return;
52617           var box2 = pointBox(entity3.loc, context);
52618           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
52619         });
52620         context.on("enter.intro", function() {
52621           if (isTownHallSelected())
52622             continueTo(selectedTownHall);
52623         });
52624       }, 550);
52625       context.history().on("change.intro", function() {
52626         if (!context.hasEntity(hallId)) {
52627           continueTo(clickTownHall);
52628         }
52629       });
52630       function continueTo(nextStep) {
52631         context.on("enter.intro", null);
52632         context.map().on("move.intro drawn.intro", null);
52633         context.history().on("change.intro", null);
52634         nextStep();
52635       }
52636     }
52637     function selectedTownHall() {
52638       if (!isTownHallSelected())
52639         return clickTownHall();
52640       var entity = context.hasEntity(hallId);
52641       if (!entity)
52642         return clickTownHall();
52643       var box = pointBox(entity.loc, context);
52644       var onClick = function() {
52645         continueTo(editorTownHall);
52646       };
52647       reveal(box, helpHtml("intro.navigation.selected_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52648       context.map().on("move.intro drawn.intro", function() {
52649         var entity2 = context.hasEntity(hallId);
52650         if (!entity2)
52651           return;
52652         var box2 = pointBox(entity2.loc, context);
52653         reveal(box2, helpHtml("intro.navigation.selected_townhall"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52654       });
52655       context.history().on("change.intro", function() {
52656         if (!context.hasEntity(hallId)) {
52657           continueTo(clickTownHall);
52658         }
52659       });
52660       function continueTo(nextStep) {
52661         context.map().on("move.intro drawn.intro", null);
52662         context.history().on("change.intro", null);
52663         nextStep();
52664       }
52665     }
52666     function editorTownHall() {
52667       if (!isTownHallSelected())
52668         return clickTownHall();
52669       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52670       var onClick = function() {
52671         continueTo(presetTownHall);
52672       };
52673       reveal(".entity-editor-pane", helpHtml("intro.navigation.editor_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52674       context.on("exit.intro", function() {
52675         continueTo(clickTownHall);
52676       });
52677       context.history().on("change.intro", function() {
52678         if (!context.hasEntity(hallId)) {
52679           continueTo(clickTownHall);
52680         }
52681       });
52682       function continueTo(nextStep) {
52683         context.on("exit.intro", null);
52684         context.history().on("change.intro", null);
52685         context.container().select(".inspector-wrap").on("wheel.intro", null);
52686         nextStep();
52687       }
52688     }
52689     function presetTownHall() {
52690       if (!isTownHallSelected())
52691         return clickTownHall();
52692       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
52693       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52694       var entity = context.entity(context.selectedIDs()[0]);
52695       var preset = _mainPresetIndex.match(entity, context.graph());
52696       var onClick = function() {
52697         continueTo(fieldsTownHall);
52698       };
52699       reveal(".entity-editor-pane .section-feature-type", helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52700       context.on("exit.intro", function() {
52701         continueTo(clickTownHall);
52702       });
52703       context.history().on("change.intro", function() {
52704         if (!context.hasEntity(hallId)) {
52705           continueTo(clickTownHall);
52706         }
52707       });
52708       function continueTo(nextStep) {
52709         context.on("exit.intro", null);
52710         context.history().on("change.intro", null);
52711         context.container().select(".inspector-wrap").on("wheel.intro", null);
52712         nextStep();
52713       }
52714     }
52715     function fieldsTownHall() {
52716       if (!isTownHallSelected())
52717         return clickTownHall();
52718       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
52719       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52720       var onClick = function() {
52721         continueTo(closeTownHall);
52722       };
52723       reveal(".entity-editor-pane .section-preset-fields", helpHtml("intro.navigation.fields_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52724       context.on("exit.intro", function() {
52725         continueTo(clickTownHall);
52726       });
52727       context.history().on("change.intro", function() {
52728         if (!context.hasEntity(hallId)) {
52729           continueTo(clickTownHall);
52730         }
52731       });
52732       function continueTo(nextStep) {
52733         context.on("exit.intro", null);
52734         context.history().on("change.intro", null);
52735         context.container().select(".inspector-wrap").on("wheel.intro", null);
52736         nextStep();
52737       }
52738     }
52739     function closeTownHall() {
52740       if (!isTownHallSelected())
52741         return clickTownHall();
52742       var selector = ".entity-editor-pane button.close svg use";
52743       var href = select_default2(selector).attr("href") || "#iD-icon-close";
52744       reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } }));
52745       context.on("exit.intro", function() {
52746         continueTo(searchStreet);
52747       });
52748       context.history().on("change.intro", function() {
52749         var selector2 = ".entity-editor-pane button.close svg use";
52750         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
52751         reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }), { duration: 0 });
52752       });
52753       function continueTo(nextStep) {
52754         context.on("exit.intro", null);
52755         context.history().on("change.intro", null);
52756         nextStep();
52757       }
52758     }
52759     function searchStreet() {
52760       context.enter(modeBrowse(context));
52761       context.history().reset("initial");
52762       var msec = transitionTime(springStreet, context.map().center());
52763       if (msec) {
52764         reveal(null, null, { duration: 0 });
52765       }
52766       context.map().centerZoomEase(springStreet, 19, msec);
52767       timeout2(function() {
52768         reveal(".search-header input", helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") }));
52769         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
52770       }, msec + 100);
52771     }
52772     function checkSearchResult() {
52773       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
52774       var firstName = first.select(".entity-name");
52775       var name2 = _t("intro.graph.name.spring-street");
52776       if (!firstName.empty() && firstName.html() === name2) {
52777         reveal(first.node(), helpHtml("intro.navigation.choose_street", { name: name2 }), { duration: 300 });
52778         context.on("exit.intro", function() {
52779           continueTo(selectedStreet);
52780         });
52781         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
52782       }
52783       function continueTo(nextStep) {
52784         context.on("exit.intro", null);
52785         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
52786         nextStep();
52787       }
52788     }
52789     function selectedStreet() {
52790       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
52791         return searchStreet();
52792       }
52793       var onClick = function() {
52794         continueTo(editorStreet);
52795       };
52796       var entity = context.entity(springStreetEndId);
52797       var box = pointBox(entity.loc, context);
52798       box.height = 500;
52799       reveal(box, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52800       timeout2(function() {
52801         context.map().on("move.intro drawn.intro", function() {
52802           var entity2 = context.hasEntity(springStreetEndId);
52803           if (!entity2)
52804             return;
52805           var box2 = pointBox(entity2.loc, context);
52806           box2.height = 500;
52807           reveal(box2, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52808         });
52809       }, 600);
52810       context.on("enter.intro", function(mode) {
52811         if (!context.hasEntity(springStreetId)) {
52812           return continueTo(searchStreet);
52813         }
52814         var ids = context.selectedIDs();
52815         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
52816           context.enter(modeSelect(context, [springStreetId]));
52817         }
52818       });
52819       context.history().on("change.intro", function() {
52820         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
52821           timeout2(function() {
52822             continueTo(searchStreet);
52823           }, 300);
52824         }
52825       });
52826       function continueTo(nextStep) {
52827         context.map().on("move.intro drawn.intro", null);
52828         context.on("enter.intro", null);
52829         context.history().on("change.intro", null);
52830         nextStep();
52831       }
52832     }
52833     function editorStreet() {
52834       var selector = ".entity-editor-pane button.close svg use";
52835       var href = select_default2(selector).attr("href") || "#iD-icon-close";
52836       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
52837         button: { html: icon(href, "inline") },
52838         field1: { html: onewayField.label() },
52839         field2: { html: maxspeedField.label() }
52840       }));
52841       context.on("exit.intro", function() {
52842         continueTo(play);
52843       });
52844       context.history().on("change.intro", function() {
52845         var selector2 = ".entity-editor-pane button.close svg use";
52846         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
52847         reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
52848           button: { html: icon(href2, "inline") },
52849           field1: { html: onewayField.label() },
52850           field2: { html: maxspeedField.label() }
52851         }), { duration: 0 });
52852       });
52853       function continueTo(nextStep) {
52854         context.on("exit.intro", null);
52855         context.history().on("change.intro", null);
52856         nextStep();
52857       }
52858     }
52859     function play() {
52860       dispatch10.call("done");
52861       reveal(".ideditor", helpHtml("intro.navigation.play", { next: _t("intro.points.title") }), {
52862         tooltipBox: ".intro-nav-wrap .chapter-point",
52863         buttonText: _t.html("intro.ok"),
52864         buttonCallback: function() {
52865           reveal(".ideditor");
52866         }
52867       });
52868     }
52869     chapter.enter = function() {
52870       dragMap();
52871     };
52872     chapter.exit = function() {
52873       timeouts.forEach(window.clearTimeout);
52874       context.on("enter.intro exit.intro", null);
52875       context.map().on("move.intro drawn.intro", null);
52876       context.history().on("change.intro", null);
52877       context.container().select(".inspector-wrap").on("wheel.intro", null);
52878       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
52879     };
52880     chapter.restart = function() {
52881       chapter.exit();
52882       chapter.enter();
52883     };
52884     return utilRebind(chapter, dispatch10, "on");
52885   }
52886
52887   // modules/ui/intro/point.js
52888   function uiIntroPoint(context, reveal) {
52889     var dispatch10 = dispatch_default("done");
52890     var timeouts = [];
52891     var intersection = [-85.63279, 41.94394];
52892     var building = [-85.632422, 41.944045];
52893     var cafePreset = _mainPresetIndex.item("amenity/cafe");
52894     var _pointID = null;
52895     var chapter = {
52896       title: "intro.points.title"
52897     };
52898     function timeout2(f2, t) {
52899       timeouts.push(window.setTimeout(f2, t));
52900     }
52901     function eventCancel(d3_event) {
52902       d3_event.stopPropagation();
52903       d3_event.preventDefault();
52904     }
52905     function addPoint() {
52906       context.enter(modeBrowse(context));
52907       context.history().reset("initial");
52908       var msec = transitionTime(intersection, context.map().center());
52909       if (msec) {
52910         reveal(null, null, { duration: 0 });
52911       }
52912       context.map().centerZoomEase(intersection, 19, msec);
52913       timeout2(function() {
52914         var tooltip = reveal("button.add-point", helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point"));
52915         _pointID = null;
52916         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
52917         context.on("enter.intro", function(mode) {
52918           if (mode.id !== "add-point")
52919             return;
52920           continueTo(placePoint);
52921         });
52922       }, msec + 100);
52923       function continueTo(nextStep) {
52924         context.on("enter.intro", null);
52925         nextStep();
52926       }
52927     }
52928     function placePoint() {
52929       if (context.mode().id !== "add-point") {
52930         return chapter.restart();
52931       }
52932       var pointBox2 = pad(building, 150, context);
52933       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
52934       reveal(pointBox2, helpHtml("intro.points." + textId));
52935       context.map().on("move.intro drawn.intro", function() {
52936         pointBox2 = pad(building, 150, context);
52937         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
52938       });
52939       context.on("enter.intro", function(mode) {
52940         if (mode.id !== "select")
52941           return chapter.restart();
52942         _pointID = context.mode().selectedIDs()[0];
52943         continueTo(searchPreset);
52944       });
52945       function continueTo(nextStep) {
52946         context.map().on("move.intro drawn.intro", null);
52947         context.on("enter.intro", null);
52948         nextStep();
52949       }
52950     }
52951     function searchPreset() {
52952       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
52953         return addPoint();
52954       }
52955       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52956       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
52957       reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
52958       context.on("enter.intro", function(mode) {
52959         if (!_pointID || !context.hasEntity(_pointID)) {
52960           return continueTo(addPoint);
52961         }
52962         var ids = context.selectedIDs();
52963         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
52964           context.enter(modeSelect(context, [_pointID]));
52965           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52966           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
52967           reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
52968           context.history().on("change.intro", null);
52969         }
52970       });
52971       function checkPresetSearch() {
52972         var first = context.container().select(".preset-list-item:first-child");
52973         if (first.classed("preset-amenity-cafe")) {
52974           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
52975           reveal(first.select(".preset-list-button").node(), helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }), { duration: 300 });
52976           context.history().on("change.intro", function() {
52977             continueTo(aboutFeatureEditor);
52978           });
52979         }
52980       }
52981       function continueTo(nextStep) {
52982         context.on("enter.intro", null);
52983         context.history().on("change.intro", null);
52984         context.container().select(".inspector-wrap").on("wheel.intro", null);
52985         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
52986         nextStep();
52987       }
52988     }
52989     function aboutFeatureEditor() {
52990       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
52991         return addPoint();
52992       }
52993       timeout2(function() {
52994         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
52995           tooltipClass: "intro-points-describe",
52996           buttonText: _t.html("intro.ok"),
52997           buttonCallback: function() {
52998             continueTo(addName);
52999           }
53000         });
53001       }, 400);
53002       context.on("exit.intro", function() {
53003         continueTo(reselectPoint);
53004       });
53005       function continueTo(nextStep) {
53006         context.on("exit.intro", null);
53007         nextStep();
53008       }
53009     }
53010     function addName() {
53011       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53012         return addPoint();
53013       }
53014       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53015       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
53016       timeout2(function() {
53017         var entity = context.entity(_pointID);
53018         if (entity.tags.name) {
53019           var tooltip = reveal(".entity-editor-pane", addNameString, {
53020             tooltipClass: "intro-points-describe",
53021             buttonText: _t.html("intro.ok"),
53022             buttonCallback: function() {
53023               continueTo(addCloseEditor);
53024             }
53025           });
53026           tooltip.select(".instruction").style("display", "none");
53027         } else {
53028           reveal(".entity-editor-pane", addNameString, { tooltipClass: "intro-points-describe" });
53029         }
53030       }, 400);
53031       context.history().on("change.intro", function() {
53032         continueTo(addCloseEditor);
53033       });
53034       context.on("exit.intro", function() {
53035         continueTo(reselectPoint);
53036       });
53037       function continueTo(nextStep) {
53038         context.on("exit.intro", null);
53039         context.history().on("change.intro", null);
53040         nextStep();
53041       }
53042     }
53043     function addCloseEditor() {
53044       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53045       var selector = ".entity-editor-pane button.close svg use";
53046       var href = select_default2(selector).attr("href") || "#iD-icon-close";
53047       context.on("exit.intro", function() {
53048         continueTo(reselectPoint);
53049       });
53050       reveal(".entity-editor-pane", helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } }));
53051       function continueTo(nextStep) {
53052         context.on("exit.intro", null);
53053         nextStep();
53054       }
53055     }
53056     function reselectPoint() {
53057       if (!_pointID)
53058         return chapter.restart();
53059       var entity = context.hasEntity(_pointID);
53060       if (!entity)
53061         return chapter.restart();
53062       var oldPreset = _mainPresetIndex.match(entity, context.graph());
53063       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
53064       context.enter(modeBrowse(context));
53065       var msec = transitionTime(entity.loc, context.map().center());
53066       if (msec) {
53067         reveal(null, null, { duration: 0 });
53068       }
53069       context.map().centerEase(entity.loc, msec);
53070       timeout2(function() {
53071         var box = pointBox(entity.loc, context);
53072         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
53073         timeout2(function() {
53074           context.map().on("move.intro drawn.intro", function() {
53075             var entity2 = context.hasEntity(_pointID);
53076             if (!entity2)
53077               return chapter.restart();
53078             var box2 = pointBox(entity2.loc, context);
53079             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
53080           });
53081         }, 600);
53082         context.on("enter.intro", function(mode) {
53083           if (mode.id !== "select")
53084             return;
53085           continueTo(updatePoint);
53086         });
53087       }, msec + 100);
53088       function continueTo(nextStep) {
53089         context.map().on("move.intro drawn.intro", null);
53090         context.on("enter.intro", null);
53091         nextStep();
53092       }
53093     }
53094     function updatePoint() {
53095       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53096         return continueTo(reselectPoint);
53097       }
53098       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53099       context.on("exit.intro", function() {
53100         continueTo(reselectPoint);
53101       });
53102       context.history().on("change.intro", function() {
53103         continueTo(updateCloseEditor);
53104       });
53105       timeout2(function() {
53106         reveal(".entity-editor-pane", helpHtml("intro.points.update"), { tooltipClass: "intro-points-describe" });
53107       }, 400);
53108       function continueTo(nextStep) {
53109         context.on("exit.intro", null);
53110         context.history().on("change.intro", null);
53111         nextStep();
53112       }
53113     }
53114     function updateCloseEditor() {
53115       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53116         return continueTo(reselectPoint);
53117       }
53118       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53119       context.on("exit.intro", function() {
53120         continueTo(rightClickPoint);
53121       });
53122       timeout2(function() {
53123         reveal(".entity-editor-pane", helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } }));
53124       }, 500);
53125       function continueTo(nextStep) {
53126         context.on("exit.intro", null);
53127         nextStep();
53128       }
53129     }
53130     function rightClickPoint() {
53131       if (!_pointID)
53132         return chapter.restart();
53133       var entity = context.hasEntity(_pointID);
53134       if (!entity)
53135         return chapter.restart();
53136       context.enter(modeBrowse(context));
53137       var box = pointBox(entity.loc, context);
53138       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
53139       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
53140       timeout2(function() {
53141         context.map().on("move.intro", function() {
53142           var entity2 = context.hasEntity(_pointID);
53143           if (!entity2)
53144             return chapter.restart();
53145           var box2 = pointBox(entity2.loc, context);
53146           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
53147         });
53148       }, 600);
53149       context.on("enter.intro", function(mode) {
53150         if (mode.id !== "select")
53151           return;
53152         var ids = context.selectedIDs();
53153         if (ids.length !== 1 || ids[0] !== _pointID)
53154           return;
53155         timeout2(function() {
53156           var node = selectMenuItem(context, "delete").node();
53157           if (!node)
53158             return;
53159           continueTo(enterDelete);
53160         }, 50);
53161       });
53162       function continueTo(nextStep) {
53163         context.on("enter.intro", null);
53164         context.map().on("move.intro", null);
53165         nextStep();
53166       }
53167     }
53168     function enterDelete() {
53169       if (!_pointID)
53170         return chapter.restart();
53171       var entity = context.hasEntity(_pointID);
53172       if (!entity)
53173         return chapter.restart();
53174       var node = selectMenuItem(context, "delete").node();
53175       if (!node) {
53176         return continueTo(rightClickPoint);
53177       }
53178       reveal(".edit-menu", helpHtml("intro.points.delete"), { padding: 50 });
53179       timeout2(function() {
53180         context.map().on("move.intro", function() {
53181           reveal(".edit-menu", helpHtml("intro.points.delete"), { duration: 0, padding: 50 });
53182         });
53183       }, 300);
53184       context.on("exit.intro", function() {
53185         if (!_pointID)
53186           return chapter.restart();
53187         var entity2 = context.hasEntity(_pointID);
53188         if (entity2)
53189           return continueTo(rightClickPoint);
53190       });
53191       context.history().on("change.intro", function(changed) {
53192         if (changed.deleted().length) {
53193           continueTo(undo);
53194         }
53195       });
53196       function continueTo(nextStep) {
53197         context.map().on("move.intro", null);
53198         context.history().on("change.intro", null);
53199         context.on("exit.intro", null);
53200         nextStep();
53201       }
53202     }
53203     function undo() {
53204       context.history().on("change.intro", function() {
53205         continueTo(play);
53206       });
53207       reveal(".top-toolbar button.undo-button", helpHtml("intro.points.undo"));
53208       function continueTo(nextStep) {
53209         context.history().on("change.intro", null);
53210         nextStep();
53211       }
53212     }
53213     function play() {
53214       dispatch10.call("done");
53215       reveal(".ideditor", helpHtml("intro.points.play", { next: _t("intro.areas.title") }), {
53216         tooltipBox: ".intro-nav-wrap .chapter-area",
53217         buttonText: _t.html("intro.ok"),
53218         buttonCallback: function() {
53219           reveal(".ideditor");
53220         }
53221       });
53222     }
53223     chapter.enter = function() {
53224       addPoint();
53225     };
53226     chapter.exit = function() {
53227       timeouts.forEach(window.clearTimeout);
53228       context.on("enter.intro exit.intro", null);
53229       context.map().on("move.intro drawn.intro", null);
53230       context.history().on("change.intro", null);
53231       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53232       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53233     };
53234     chapter.restart = function() {
53235       chapter.exit();
53236       chapter.enter();
53237     };
53238     return utilRebind(chapter, dispatch10, "on");
53239   }
53240
53241   // modules/ui/intro/area.js
53242   function uiIntroArea(context, reveal) {
53243     var dispatch10 = dispatch_default("done");
53244     var playground = [-85.63552, 41.94159];
53245     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
53246     var nameField = _mainPresetIndex.field("name");
53247     var descriptionField = _mainPresetIndex.field("description");
53248     var timeouts = [];
53249     var _areaID;
53250     var chapter = {
53251       title: "intro.areas.title"
53252     };
53253     function timeout2(f2, t) {
53254       timeouts.push(window.setTimeout(f2, t));
53255     }
53256     function eventCancel(d3_event) {
53257       d3_event.stopPropagation();
53258       d3_event.preventDefault();
53259     }
53260     function revealPlayground(center, text2, options2) {
53261       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
53262       var box = pad(center, padding, context);
53263       reveal(box, text2, options2);
53264     }
53265     function addArea() {
53266       context.enter(modeBrowse(context));
53267       context.history().reset("initial");
53268       _areaID = null;
53269       var msec = transitionTime(playground, context.map().center());
53270       if (msec) {
53271         reveal(null, null, { duration: 0 });
53272       }
53273       context.map().centerZoomEase(playground, 19, msec);
53274       timeout2(function() {
53275         var tooltip = reveal("button.add-area", helpHtml("intro.areas.add_playground"));
53276         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
53277         context.on("enter.intro", function(mode) {
53278           if (mode.id !== "add-area")
53279             return;
53280           continueTo(startPlayground);
53281         });
53282       }, msec + 100);
53283       function continueTo(nextStep) {
53284         context.on("enter.intro", null);
53285         nextStep();
53286       }
53287     }
53288     function startPlayground() {
53289       if (context.mode().id !== "add-area") {
53290         return chapter.restart();
53291       }
53292       _areaID = null;
53293       context.map().zoomEase(19.5, 500);
53294       timeout2(function() {
53295         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
53296         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
53297         revealPlayground(playground, startDrawString, { duration: 250 });
53298         timeout2(function() {
53299           context.map().on("move.intro drawn.intro", function() {
53300             revealPlayground(playground, startDrawString, { duration: 0 });
53301           });
53302           context.on("enter.intro", function(mode) {
53303             if (mode.id !== "draw-area")
53304               return chapter.restart();
53305             continueTo(continuePlayground);
53306           });
53307         }, 250);
53308       }, 550);
53309       function continueTo(nextStep) {
53310         context.map().on("move.intro drawn.intro", null);
53311         context.on("enter.intro", null);
53312         nextStep();
53313       }
53314     }
53315     function continuePlayground() {
53316       if (context.mode().id !== "draw-area") {
53317         return chapter.restart();
53318       }
53319       _areaID = null;
53320       revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 250 });
53321       timeout2(function() {
53322         context.map().on("move.intro drawn.intro", function() {
53323           revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 0 });
53324         });
53325       }, 250);
53326       context.on("enter.intro", function(mode) {
53327         if (mode.id === "draw-area") {
53328           var entity = context.hasEntity(context.selectedIDs()[0]);
53329           if (entity && entity.nodes.length >= 6) {
53330             return continueTo(finishPlayground);
53331           } else {
53332             return;
53333           }
53334         } else if (mode.id === "select") {
53335           _areaID = context.selectedIDs()[0];
53336           return continueTo(searchPresets);
53337         } else {
53338           return chapter.restart();
53339         }
53340       });
53341       function continueTo(nextStep) {
53342         context.map().on("move.intro drawn.intro", null);
53343         context.on("enter.intro", null);
53344         nextStep();
53345       }
53346     }
53347     function finishPlayground() {
53348       if (context.mode().id !== "draw-area") {
53349         return chapter.restart();
53350       }
53351       _areaID = null;
53352       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
53353       revealPlayground(playground, finishString, { duration: 250 });
53354       timeout2(function() {
53355         context.map().on("move.intro drawn.intro", function() {
53356           revealPlayground(playground, finishString, { duration: 0 });
53357         });
53358       }, 250);
53359       context.on("enter.intro", function(mode) {
53360         if (mode.id === "draw-area") {
53361           return;
53362         } else if (mode.id === "select") {
53363           _areaID = context.selectedIDs()[0];
53364           return continueTo(searchPresets);
53365         } else {
53366           return chapter.restart();
53367         }
53368       });
53369       function continueTo(nextStep) {
53370         context.map().on("move.intro drawn.intro", null);
53371         context.on("enter.intro", null);
53372         nextStep();
53373       }
53374     }
53375     function searchPresets() {
53376       if (!_areaID || !context.hasEntity(_areaID)) {
53377         return addArea();
53378       }
53379       var ids = context.selectedIDs();
53380       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53381         context.enter(modeSelect(context, [_areaID]));
53382       }
53383       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53384       timeout2(function() {
53385         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53386         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53387         reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
53388       }, 400);
53389       context.on("enter.intro", function(mode) {
53390         if (!_areaID || !context.hasEntity(_areaID)) {
53391           return continueTo(addArea);
53392         }
53393         var ids2 = context.selectedIDs();
53394         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
53395           context.enter(modeSelect(context, [_areaID]));
53396           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53397           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53398           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53399           reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
53400           context.history().on("change.intro", null);
53401         }
53402       });
53403       function checkPresetSearch() {
53404         var first = context.container().select(".preset-list-item:first-child");
53405         if (first.classed("preset-leisure-playground")) {
53406           reveal(first.select(".preset-list-button").node(), helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }), { duration: 300 });
53407           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
53408           context.history().on("change.intro", function() {
53409             continueTo(clickAddField);
53410           });
53411         }
53412       }
53413       function continueTo(nextStep) {
53414         context.container().select(".inspector-wrap").on("wheel.intro", null);
53415         context.on("enter.intro", null);
53416         context.history().on("change.intro", null);
53417         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53418         nextStep();
53419       }
53420     }
53421     function clickAddField() {
53422       if (!_areaID || !context.hasEntity(_areaID)) {
53423         return addArea();
53424       }
53425       var ids = context.selectedIDs();
53426       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53427         return searchPresets();
53428       }
53429       if (!context.container().select(".form-field-description").empty()) {
53430         return continueTo(describePlayground);
53431       }
53432       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53433       timeout2(function() {
53434         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53435         var entity = context.entity(_areaID);
53436         if (entity.tags.description) {
53437           return continueTo(play);
53438         }
53439         var box = context.container().select(".more-fields").node().getBoundingClientRect();
53440         if (box.top > 300) {
53441           var pane = context.container().select(".entity-editor-pane .inspector-body");
53442           var start2 = pane.node().scrollTop;
53443           var end = start2 + (box.top - 300);
53444           pane.transition().duration(250).tween("scroll.inspector", function() {
53445             var node = this;
53446             var i2 = number_default(start2, end);
53447             return function(t) {
53448               node.scrollTop = i2(t);
53449             };
53450           });
53451         }
53452         timeout2(function() {
53453           reveal(".more-fields .combobox-input", helpHtml("intro.areas.add_field", {
53454             name: { html: nameField.label() },
53455             description: { html: descriptionField.label() }
53456           }), { duration: 300 });
53457           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
53458             var watcher;
53459             watcher = window.setInterval(function() {
53460               if (!context.container().select("div.combobox").empty()) {
53461                 window.clearInterval(watcher);
53462                 continueTo(chooseDescriptionField);
53463               }
53464             }, 300);
53465           });
53466         }, 300);
53467       }, 400);
53468       context.on("exit.intro", function() {
53469         return continueTo(searchPresets);
53470       });
53471       function continueTo(nextStep) {
53472         context.container().select(".inspector-wrap").on("wheel.intro", null);
53473         context.container().select(".more-fields .combobox-input").on("click.intro", null);
53474         context.on("exit.intro", null);
53475         nextStep();
53476       }
53477     }
53478     function chooseDescriptionField() {
53479       if (!_areaID || !context.hasEntity(_areaID)) {
53480         return addArea();
53481       }
53482       var ids = context.selectedIDs();
53483       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53484         return searchPresets();
53485       }
53486       if (!context.container().select(".form-field-description").empty()) {
53487         return continueTo(describePlayground);
53488       }
53489       if (context.container().select("div.combobox").empty()) {
53490         return continueTo(clickAddField);
53491       }
53492       var watcher;
53493       watcher = window.setInterval(function() {
53494         if (context.container().select("div.combobox").empty()) {
53495           window.clearInterval(watcher);
53496           timeout2(function() {
53497             if (context.container().select(".form-field-description").empty()) {
53498               continueTo(retryChooseDescription);
53499             } else {
53500               continueTo(describePlayground);
53501             }
53502           }, 300);
53503         }
53504       }, 300);
53505       reveal("div.combobox", helpHtml("intro.areas.choose_field", { field: { html: descriptionField.label() } }), { duration: 300 });
53506       context.on("exit.intro", function() {
53507         return continueTo(searchPresets);
53508       });
53509       function continueTo(nextStep) {
53510         if (watcher)
53511           window.clearInterval(watcher);
53512         context.on("exit.intro", null);
53513         nextStep();
53514       }
53515     }
53516     function describePlayground() {
53517       if (!_areaID || !context.hasEntity(_areaID)) {
53518         return addArea();
53519       }
53520       var ids = context.selectedIDs();
53521       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53522         return searchPresets();
53523       }
53524       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53525       if (context.container().select(".form-field-description").empty()) {
53526         return continueTo(retryChooseDescription);
53527       }
53528       context.on("exit.intro", function() {
53529         continueTo(play);
53530       });
53531       reveal(".entity-editor-pane", helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }), { duration: 300 });
53532       function continueTo(nextStep) {
53533         context.on("exit.intro", null);
53534         nextStep();
53535       }
53536     }
53537     function retryChooseDescription() {
53538       if (!_areaID || !context.hasEntity(_areaID)) {
53539         return addArea();
53540       }
53541       var ids = context.selectedIDs();
53542       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53543         return searchPresets();
53544       }
53545       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53546       reveal(".entity-editor-pane", helpHtml("intro.areas.retry_add_field", { field: { html: descriptionField.label() } }), {
53547         buttonText: _t.html("intro.ok"),
53548         buttonCallback: function() {
53549           continueTo(clickAddField);
53550         }
53551       });
53552       context.on("exit.intro", function() {
53553         return continueTo(searchPresets);
53554       });
53555       function continueTo(nextStep) {
53556         context.on("exit.intro", null);
53557         nextStep();
53558       }
53559     }
53560     function play() {
53561       dispatch10.call("done");
53562       reveal(".ideditor", helpHtml("intro.areas.play", { next: _t("intro.lines.title") }), {
53563         tooltipBox: ".intro-nav-wrap .chapter-line",
53564         buttonText: _t.html("intro.ok"),
53565         buttonCallback: function() {
53566           reveal(".ideditor");
53567         }
53568       });
53569     }
53570     chapter.enter = function() {
53571       addArea();
53572     };
53573     chapter.exit = function() {
53574       timeouts.forEach(window.clearTimeout);
53575       context.on("enter.intro exit.intro", null);
53576       context.map().on("move.intro drawn.intro", null);
53577       context.history().on("change.intro", null);
53578       context.container().select(".inspector-wrap").on("wheel.intro", null);
53579       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53580       context.container().select(".more-fields .combobox-input").on("click.intro", null);
53581     };
53582     chapter.restart = function() {
53583       chapter.exit();
53584       chapter.enter();
53585     };
53586     return utilRebind(chapter, dispatch10, "on");
53587   }
53588
53589   // modules/ui/intro/line.js
53590   function uiIntroLine(context, reveal) {
53591     var dispatch10 = dispatch_default("done");
53592     var timeouts = [];
53593     var _tulipRoadID = null;
53594     var flowerRoadID = "w646";
53595     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
53596     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
53597     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
53598     var roadCategory = _mainPresetIndex.item("category-road_minor");
53599     var residentialPreset = _mainPresetIndex.item("highway/residential");
53600     var woodRoadID = "w525";
53601     var woodRoadEndID = "n2862";
53602     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
53603     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
53604     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
53605     var washingtonStreetID = "w522";
53606     var twelfthAvenueID = "w1";
53607     var eleventhAvenueEndID = "n3550";
53608     var twelfthAvenueEndID = "n5";
53609     var _washingtonSegmentID = null;
53610     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
53611     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
53612     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
53613     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
53614     var chapter = {
53615       title: "intro.lines.title"
53616     };
53617     function timeout2(f2, t) {
53618       timeouts.push(window.setTimeout(f2, t));
53619     }
53620     function eventCancel(d3_event) {
53621       d3_event.stopPropagation();
53622       d3_event.preventDefault();
53623     }
53624     function addLine() {
53625       context.enter(modeBrowse(context));
53626       context.history().reset("initial");
53627       var msec = transitionTime(tulipRoadStart, context.map().center());
53628       if (msec) {
53629         reveal(null, null, { duration: 0 });
53630       }
53631       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
53632       timeout2(function() {
53633         var tooltip = reveal("button.add-line", helpHtml("intro.lines.add_line"));
53634         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
53635         context.on("enter.intro", function(mode) {
53636           if (mode.id !== "add-line")
53637             return;
53638           continueTo(startLine);
53639         });
53640       }, msec + 100);
53641       function continueTo(nextStep) {
53642         context.on("enter.intro", null);
53643         nextStep();
53644       }
53645     }
53646     function startLine() {
53647       if (context.mode().id !== "add-line")
53648         return chapter.restart();
53649       _tulipRoadID = null;
53650       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
53651       var box = pad(tulipRoadStart, padding, context);
53652       box.height = box.height + 100;
53653       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
53654       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
53655       reveal(box, startLineString);
53656       context.map().on("move.intro drawn.intro", function() {
53657         padding = 70 * Math.pow(2, context.map().zoom() - 18);
53658         box = pad(tulipRoadStart, padding, context);
53659         box.height = box.height + 100;
53660         reveal(box, startLineString, { duration: 0 });
53661       });
53662       context.on("enter.intro", function(mode) {
53663         if (mode.id !== "draw-line")
53664           return chapter.restart();
53665         continueTo(drawLine);
53666       });
53667       function continueTo(nextStep) {
53668         context.map().on("move.intro drawn.intro", null);
53669         context.on("enter.intro", null);
53670         nextStep();
53671       }
53672     }
53673     function drawLine() {
53674       if (context.mode().id !== "draw-line")
53675         return chapter.restart();
53676       _tulipRoadID = context.mode().selectedIDs()[0];
53677       context.map().centerEase(tulipRoadMidpoint, 500);
53678       timeout2(function() {
53679         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
53680         var box = pad(tulipRoadMidpoint, padding, context);
53681         box.height = box.height * 2;
53682         reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }));
53683         context.map().on("move.intro drawn.intro", function() {
53684           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
53685           box = pad(tulipRoadMidpoint, padding, context);
53686           box.height = box.height * 2;
53687           reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }), { duration: 0 });
53688         });
53689       }, 550);
53690       context.history().on("change.intro", function() {
53691         if (isLineConnected()) {
53692           continueTo(continueLine);
53693         }
53694       });
53695       context.on("enter.intro", function(mode) {
53696         if (mode.id === "draw-line") {
53697           return;
53698         } else if (mode.id === "select") {
53699           continueTo(retryIntersect);
53700           return;
53701         } else {
53702           return chapter.restart();
53703         }
53704       });
53705       function continueTo(nextStep) {
53706         context.map().on("move.intro drawn.intro", null);
53707         context.history().on("change.intro", null);
53708         context.on("enter.intro", null);
53709         nextStep();
53710       }
53711     }
53712     function isLineConnected() {
53713       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
53714       if (!entity)
53715         return false;
53716       var drawNodes = context.graph().childNodes(entity);
53717       return drawNodes.some(function(node) {
53718         return context.graph().parentWays(node).some(function(parent) {
53719           return parent.id === flowerRoadID;
53720         });
53721       });
53722     }
53723     function retryIntersect() {
53724       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
53725       var box = pad(tulipRoadIntersection, 80, context);
53726       reveal(box, helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") }));
53727       timeout2(chapter.restart, 3e3);
53728     }
53729     function continueLine() {
53730       if (context.mode().id !== "draw-line")
53731         return chapter.restart();
53732       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
53733       if (!entity)
53734         return chapter.restart();
53735       context.map().centerEase(tulipRoadIntersection, 500);
53736       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
53737       reveal(".surface", continueLineText);
53738       context.on("enter.intro", function(mode) {
53739         if (mode.id === "draw-line") {
53740           return;
53741         } else if (mode.id === "select") {
53742           return continueTo(chooseCategoryRoad);
53743         } else {
53744           return chapter.restart();
53745         }
53746       });
53747       function continueTo(nextStep) {
53748         context.on("enter.intro", null);
53749         nextStep();
53750       }
53751     }
53752     function chooseCategoryRoad() {
53753       if (context.mode().id !== "select")
53754         return chapter.restart();
53755       context.on("exit.intro", function() {
53756         return chapter.restart();
53757       });
53758       var button = context.container().select(".preset-category-road_minor .preset-list-button");
53759       if (button.empty())
53760         return chapter.restart();
53761       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53762       timeout2(function() {
53763         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53764         reveal(button.node(), helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() }));
53765         button.on("click.intro", function() {
53766           continueTo(choosePresetResidential);
53767         });
53768       }, 400);
53769       function continueTo(nextStep) {
53770         context.container().select(".inspector-wrap").on("wheel.intro", null);
53771         context.container().select(".preset-list-button").on("click.intro", null);
53772         context.on("exit.intro", null);
53773         nextStep();
53774       }
53775     }
53776     function choosePresetResidential() {
53777       if (context.mode().id !== "select")
53778         return chapter.restart();
53779       context.on("exit.intro", function() {
53780         return chapter.restart();
53781       });
53782       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
53783       if (subgrid.empty())
53784         return chapter.restart();
53785       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
53786         continueTo(retryPresetResidential);
53787       });
53788       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
53789         continueTo(nameRoad);
53790       });
53791       timeout2(function() {
53792         reveal(subgrid.node(), helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }), { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 });
53793       }, 300);
53794       function continueTo(nextStep) {
53795         context.container().select(".preset-list-button").on("click.intro", null);
53796         context.on("exit.intro", null);
53797         nextStep();
53798       }
53799     }
53800     function retryPresetResidential() {
53801       if (context.mode().id !== "select")
53802         return chapter.restart();
53803       context.on("exit.intro", function() {
53804         return chapter.restart();
53805       });
53806       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53807       timeout2(function() {
53808         var button = context.container().select(".entity-editor-pane .preset-list-button");
53809         reveal(button.node(), helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() }));
53810         button.on("click.intro", function() {
53811           continueTo(chooseCategoryRoad);
53812         });
53813       }, 500);
53814       function continueTo(nextStep) {
53815         context.container().select(".inspector-wrap").on("wheel.intro", null);
53816         context.container().select(".preset-list-button").on("click.intro", null);
53817         context.on("exit.intro", null);
53818         nextStep();
53819       }
53820     }
53821     function nameRoad() {
53822       context.on("exit.intro", function() {
53823         continueTo(didNameRoad);
53824       });
53825       timeout2(function() {
53826         reveal(".entity-editor-pane", helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }), { tooltipClass: "intro-lines-name_road" });
53827       }, 500);
53828       function continueTo(nextStep) {
53829         context.on("exit.intro", null);
53830         nextStep();
53831       }
53832     }
53833     function didNameRoad() {
53834       context.history().checkpoint("doneAddLine");
53835       timeout2(function() {
53836         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
53837           buttonText: _t.html("intro.ok"),
53838           buttonCallback: function() {
53839             continueTo(updateLine);
53840           }
53841         });
53842       }, 500);
53843       function continueTo(nextStep) {
53844         nextStep();
53845       }
53846     }
53847     function updateLine() {
53848       context.history().reset("doneAddLine");
53849       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53850         return chapter.restart();
53851       }
53852       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
53853       if (msec) {
53854         reveal(null, null, { duration: 0 });
53855       }
53856       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
53857       timeout2(function() {
53858         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
53859         var box = pad(woodRoadDragMidpoint, padding, context);
53860         var advance = function() {
53861           continueTo(addNode);
53862         };
53863         reveal(box, helpHtml("intro.lines.update_line"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
53864         context.map().on("move.intro drawn.intro", function() {
53865           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
53866           var box2 = pad(woodRoadDragMidpoint, padding2, context);
53867           reveal(box2, helpHtml("intro.lines.update_line"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
53868         });
53869       }, msec + 100);
53870       function continueTo(nextStep) {
53871         context.map().on("move.intro drawn.intro", null);
53872         nextStep();
53873       }
53874     }
53875     function addNode() {
53876       context.history().reset("doneAddLine");
53877       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53878         return chapter.restart();
53879       }
53880       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
53881       var box = pad(woodRoadAddNode, padding, context);
53882       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
53883       reveal(box, addNodeString);
53884       context.map().on("move.intro drawn.intro", function() {
53885         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
53886         var box2 = pad(woodRoadAddNode, padding2, context);
53887         reveal(box2, addNodeString, { duration: 0 });
53888       });
53889       context.history().on("change.intro", function(changed) {
53890         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53891           return continueTo(updateLine);
53892         }
53893         if (changed.created().length === 1) {
53894           timeout2(function() {
53895             continueTo(startDragEndpoint);
53896           }, 500);
53897         }
53898       });
53899       context.on("enter.intro", function(mode) {
53900         if (mode.id !== "select") {
53901           continueTo(updateLine);
53902         }
53903       });
53904       function continueTo(nextStep) {
53905         context.map().on("move.intro drawn.intro", null);
53906         context.history().on("change.intro", null);
53907         context.on("enter.intro", null);
53908         nextStep();
53909       }
53910     }
53911     function startDragEndpoint() {
53912       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53913         return continueTo(updateLine);
53914       }
53915       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
53916       var box = pad(woodRoadDragEndpoint, padding, context);
53917       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
53918       reveal(box, startDragString);
53919       context.map().on("move.intro drawn.intro", function() {
53920         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53921           return continueTo(updateLine);
53922         }
53923         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
53924         var box2 = pad(woodRoadDragEndpoint, padding2, context);
53925         reveal(box2, startDragString, { duration: 0 });
53926         var entity = context.entity(woodRoadEndID);
53927         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
53928           continueTo(finishDragEndpoint);
53929         }
53930       });
53931       function continueTo(nextStep) {
53932         context.map().on("move.intro drawn.intro", null);
53933         nextStep();
53934       }
53935     }
53936     function finishDragEndpoint() {
53937       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53938         return continueTo(updateLine);
53939       }
53940       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
53941       var box = pad(woodRoadDragEndpoint, padding, context);
53942       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
53943       reveal(box, finishDragString);
53944       context.map().on("move.intro drawn.intro", function() {
53945         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53946           return continueTo(updateLine);
53947         }
53948         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
53949         var box2 = pad(woodRoadDragEndpoint, padding2, context);
53950         reveal(box2, finishDragString, { duration: 0 });
53951         var entity = context.entity(woodRoadEndID);
53952         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
53953           continueTo(startDragEndpoint);
53954         }
53955       });
53956       context.on("enter.intro", function() {
53957         continueTo(startDragMidpoint);
53958       });
53959       function continueTo(nextStep) {
53960         context.map().on("move.intro drawn.intro", null);
53961         context.on("enter.intro", null);
53962         nextStep();
53963       }
53964     }
53965     function startDragMidpoint() {
53966       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53967         return continueTo(updateLine);
53968       }
53969       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
53970         context.enter(modeSelect(context, [woodRoadID]));
53971       }
53972       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
53973       var box = pad(woodRoadDragMidpoint, padding, context);
53974       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
53975       context.map().on("move.intro drawn.intro", function() {
53976         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53977           return continueTo(updateLine);
53978         }
53979         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
53980         var box2 = pad(woodRoadDragMidpoint, padding2, context);
53981         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
53982       });
53983       context.history().on("change.intro", function(changed) {
53984         if (changed.created().length === 1) {
53985           continueTo(continueDragMidpoint);
53986         }
53987       });
53988       context.on("enter.intro", function(mode) {
53989         if (mode.id !== "select") {
53990           context.enter(modeSelect(context, [woodRoadID]));
53991         }
53992       });
53993       function continueTo(nextStep) {
53994         context.map().on("move.intro drawn.intro", null);
53995         context.history().on("change.intro", null);
53996         context.on("enter.intro", null);
53997         nextStep();
53998       }
53999     }
54000     function continueDragMidpoint() {
54001       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54002         return continueTo(updateLine);
54003       }
54004       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
54005       var box = pad(woodRoadDragEndpoint, padding, context);
54006       box.height += 400;
54007       var advance = function() {
54008         context.history().checkpoint("doneUpdateLine");
54009         continueTo(deleteLines);
54010       };
54011       reveal(box, helpHtml("intro.lines.continue_drag_midpoint"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
54012       context.map().on("move.intro drawn.intro", function() {
54013         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54014           return continueTo(updateLine);
54015         }
54016         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
54017         var box2 = pad(woodRoadDragEndpoint, padding2, context);
54018         box2.height += 400;
54019         reveal(box2, helpHtml("intro.lines.continue_drag_midpoint"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54020       });
54021       function continueTo(nextStep) {
54022         context.map().on("move.intro drawn.intro", null);
54023         nextStep();
54024       }
54025     }
54026     function deleteLines() {
54027       context.history().reset("doneUpdateLine");
54028       context.enter(modeBrowse(context));
54029       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54030         return chapter.restart();
54031       }
54032       var msec = transitionTime(deleteLinesLoc, context.map().center());
54033       if (msec) {
54034         reveal(null, null, { duration: 0 });
54035       }
54036       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
54037       timeout2(function() {
54038         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54039         var box = pad(deleteLinesLoc, padding, context);
54040         box.top -= 200;
54041         box.height += 400;
54042         var advance = function() {
54043           continueTo(rightClickIntersection);
54044         };
54045         reveal(box, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
54046         context.map().on("move.intro drawn.intro", function() {
54047           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54048           var box2 = pad(deleteLinesLoc, padding2, context);
54049           box2.top -= 200;
54050           box2.height += 400;
54051           reveal(box2, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54052         });
54053         context.history().on("change.intro", function() {
54054           timeout2(function() {
54055             continueTo(deleteLines);
54056           }, 500);
54057         });
54058       }, msec + 100);
54059       function continueTo(nextStep) {
54060         context.map().on("move.intro drawn.intro", null);
54061         context.history().on("change.intro", null);
54062         nextStep();
54063       }
54064     }
54065     function rightClickIntersection() {
54066       context.history().reset("doneUpdateLine");
54067       context.enter(modeBrowse(context));
54068       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54069       var rightClickString = helpHtml("intro.lines.split_street", {
54070         street1: _t("intro.graph.name.11th-avenue"),
54071         street2: _t("intro.graph.name.washington-street")
54072       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
54073       timeout2(function() {
54074         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54075         var box = pad(eleventhAvenueEnd, padding, context);
54076         reveal(box, rightClickString);
54077         context.map().on("move.intro drawn.intro", function() {
54078           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54079           var box2 = pad(eleventhAvenueEnd, padding2, context);
54080           reveal(box2, rightClickString, { duration: 0 });
54081         });
54082         context.on("enter.intro", function(mode) {
54083           if (mode.id !== "select")
54084             return;
54085           var ids = context.selectedIDs();
54086           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
54087             return;
54088           timeout2(function() {
54089             var node = selectMenuItem(context, "split").node();
54090             if (!node)
54091               return;
54092             continueTo(splitIntersection);
54093           }, 50);
54094         });
54095         context.history().on("change.intro", function() {
54096           timeout2(function() {
54097             continueTo(deleteLines);
54098           }, 300);
54099         });
54100       }, 600);
54101       function continueTo(nextStep) {
54102         context.map().on("move.intro drawn.intro", null);
54103         context.on("enter.intro", null);
54104         context.history().on("change.intro", null);
54105         nextStep();
54106       }
54107     }
54108     function splitIntersection() {
54109       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54110         return continueTo(deleteLines);
54111       }
54112       var node = selectMenuItem(context, "split").node();
54113       if (!node) {
54114         return continueTo(rightClickIntersection);
54115       }
54116       var wasChanged = false;
54117       _washingtonSegmentID = null;
54118       reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { padding: 50 });
54119       context.map().on("move.intro drawn.intro", function() {
54120         var node2 = selectMenuItem(context, "split").node();
54121         if (!wasChanged && !node2) {
54122           return continueTo(rightClickIntersection);
54123         }
54124         reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { duration: 0, padding: 50 });
54125       });
54126       context.history().on("change.intro", function(changed) {
54127         wasChanged = true;
54128         timeout2(function() {
54129           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
54130             _washingtonSegmentID = changed.created()[0].id;
54131             continueTo(didSplit);
54132           } else {
54133             _washingtonSegmentID = null;
54134             continueTo(retrySplit);
54135           }
54136         }, 300);
54137       });
54138       function continueTo(nextStep) {
54139         context.map().on("move.intro drawn.intro", null);
54140         context.history().on("change.intro", null);
54141         nextStep();
54142       }
54143     }
54144     function retrySplit() {
54145       context.enter(modeBrowse(context));
54146       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54147       var advance = function() {
54148         continueTo(rightClickIntersection);
54149       };
54150       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54151       var box = pad(eleventhAvenueEnd, padding, context);
54152       reveal(box, helpHtml("intro.lines.retry_split"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
54153       context.map().on("move.intro drawn.intro", function() {
54154         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54155         var box2 = pad(eleventhAvenueEnd, padding2, context);
54156         reveal(box2, helpHtml("intro.lines.retry_split"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54157       });
54158       function continueTo(nextStep) {
54159         context.map().on("move.intro drawn.intro", null);
54160         nextStep();
54161       }
54162     }
54163     function didSplit() {
54164       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54165         return continueTo(rightClickIntersection);
54166       }
54167       var ids = context.selectedIDs();
54168       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
54169       var street = _t("intro.graph.name.washington-street");
54170       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54171       var box = pad(twelfthAvenue, padding, context);
54172       box.width = box.width / 2;
54173       reveal(box, helpHtml(string, { street1: street, street2: street }), { duration: 500 });
54174       timeout2(function() {
54175         context.map().centerZoomEase(twelfthAvenue, 18, 500);
54176         context.map().on("move.intro drawn.intro", function() {
54177           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54178           var box2 = pad(twelfthAvenue, padding2, context);
54179           box2.width = box2.width / 2;
54180           reveal(box2, helpHtml(string, { street1: street, street2: street }), { duration: 0 });
54181         });
54182       }, 600);
54183       context.on("enter.intro", function() {
54184         var ids2 = context.selectedIDs();
54185         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
54186           continueTo(multiSelect);
54187         }
54188       });
54189       context.history().on("change.intro", function() {
54190         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54191           return continueTo(rightClickIntersection);
54192         }
54193       });
54194       function continueTo(nextStep) {
54195         context.map().on("move.intro drawn.intro", null);
54196         context.on("enter.intro", null);
54197         context.history().on("change.intro", null);
54198         nextStep();
54199       }
54200     }
54201     function multiSelect() {
54202       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54203         return continueTo(rightClickIntersection);
54204       }
54205       var ids = context.selectedIDs();
54206       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
54207       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
54208       if (hasWashington && hasTwelfth) {
54209         return continueTo(multiRightClick);
54210       } else if (!hasWashington && !hasTwelfth) {
54211         return continueTo(didSplit);
54212       }
54213       context.map().centerZoomEase(twelfthAvenue, 18, 500);
54214       timeout2(function() {
54215         var selected, other, padding, box;
54216         if (hasWashington) {
54217           selected = _t("intro.graph.name.washington-street");
54218           other = _t("intro.graph.name.12th-avenue");
54219           padding = 60 * Math.pow(2, context.map().zoom() - 18);
54220           box = pad(twelfthAvenueEnd, padding, context);
54221           box.width *= 3;
54222         } else {
54223           selected = _t("intro.graph.name.12th-avenue");
54224           other = _t("intro.graph.name.washington-street");
54225           padding = 200 * Math.pow(2, context.map().zoom() - 18);
54226           box = pad(twelfthAvenue, padding, context);
54227           box.width /= 2;
54228         }
54229         reveal(box, helpHtml("intro.lines.multi_select", { selected, other1: other }) + " " + helpHtml("intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"), { selected, other2: other }));
54230         context.map().on("move.intro drawn.intro", function() {
54231           if (hasWashington) {
54232             selected = _t("intro.graph.name.washington-street");
54233             other = _t("intro.graph.name.12th-avenue");
54234             padding = 60 * Math.pow(2, context.map().zoom() - 18);
54235             box = pad(twelfthAvenueEnd, padding, context);
54236             box.width *= 3;
54237           } else {
54238             selected = _t("intro.graph.name.12th-avenue");
54239             other = _t("intro.graph.name.washington-street");
54240             padding = 200 * Math.pow(2, context.map().zoom() - 18);
54241             box = pad(twelfthAvenue, padding, context);
54242             box.width /= 2;
54243           }
54244           reveal(box, helpHtml("intro.lines.multi_select", { selected, other1: other }) + " " + helpHtml("intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"), { selected, other2: other }), { duration: 0 });
54245         });
54246         context.on("enter.intro", function() {
54247           continueTo(multiSelect);
54248         });
54249         context.history().on("change.intro", function() {
54250           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54251             return continueTo(rightClickIntersection);
54252           }
54253         });
54254       }, 600);
54255       function continueTo(nextStep) {
54256         context.map().on("move.intro drawn.intro", null);
54257         context.on("enter.intro", null);
54258         context.history().on("change.intro", null);
54259         nextStep();
54260       }
54261     }
54262     function multiRightClick() {
54263       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54264         return continueTo(rightClickIntersection);
54265       }
54266       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54267       var box = pad(twelfthAvenue, padding, context);
54268       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
54269       reveal(box, rightClickString);
54270       context.map().on("move.intro drawn.intro", function() {
54271         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54272         var box2 = pad(twelfthAvenue, padding2, context);
54273         reveal(box2, rightClickString, { duration: 0 });
54274       });
54275       context.ui().editMenu().on("toggled.intro", function(open) {
54276         if (!open)
54277           return;
54278         timeout2(function() {
54279           var ids = context.selectedIDs();
54280           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
54281             var node = selectMenuItem(context, "delete").node();
54282             if (!node)
54283               return;
54284             continueTo(multiDelete);
54285           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
54286             return continueTo(multiSelect);
54287           } else {
54288             return continueTo(didSplit);
54289           }
54290         }, 300);
54291       });
54292       context.history().on("change.intro", function() {
54293         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54294           return continueTo(rightClickIntersection);
54295         }
54296       });
54297       function continueTo(nextStep) {
54298         context.map().on("move.intro drawn.intro", null);
54299         context.ui().editMenu().on("toggled.intro", null);
54300         context.history().on("change.intro", null);
54301         nextStep();
54302       }
54303     }
54304     function multiDelete() {
54305       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54306         return continueTo(rightClickIntersection);
54307       }
54308       var node = selectMenuItem(context, "delete").node();
54309       if (!node)
54310         return continueTo(multiRightClick);
54311       reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { padding: 50 });
54312       context.map().on("move.intro drawn.intro", function() {
54313         reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { duration: 0, padding: 50 });
54314       });
54315       context.on("exit.intro", function() {
54316         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
54317           return continueTo(multiSelect);
54318         }
54319       });
54320       context.history().on("change.intro", function() {
54321         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
54322           continueTo(retryDelete);
54323         } else {
54324           continueTo(play);
54325         }
54326       });
54327       function continueTo(nextStep) {
54328         context.map().on("move.intro drawn.intro", null);
54329         context.on("exit.intro", null);
54330         context.history().on("change.intro", null);
54331         nextStep();
54332       }
54333     }
54334     function retryDelete() {
54335       context.enter(modeBrowse(context));
54336       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54337       var box = pad(twelfthAvenue, padding, context);
54338       reveal(box, helpHtml("intro.lines.retry_delete"), {
54339         buttonText: _t.html("intro.ok"),
54340         buttonCallback: function() {
54341           continueTo(multiSelect);
54342         }
54343       });
54344       function continueTo(nextStep) {
54345         nextStep();
54346       }
54347     }
54348     function play() {
54349       dispatch10.call("done");
54350       reveal(".ideditor", helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }), {
54351         tooltipBox: ".intro-nav-wrap .chapter-building",
54352         buttonText: _t.html("intro.ok"),
54353         buttonCallback: function() {
54354           reveal(".ideditor");
54355         }
54356       });
54357     }
54358     chapter.enter = function() {
54359       addLine();
54360     };
54361     chapter.exit = function() {
54362       timeouts.forEach(window.clearTimeout);
54363       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
54364       context.on("enter.intro exit.intro", null);
54365       context.map().on("move.intro drawn.intro", null);
54366       context.history().on("change.intro", null);
54367       context.container().select(".inspector-wrap").on("wheel.intro", null);
54368       context.container().select(".preset-list-button").on("click.intro", null);
54369     };
54370     chapter.restart = function() {
54371       chapter.exit();
54372       chapter.enter();
54373     };
54374     return utilRebind(chapter, dispatch10, "on");
54375   }
54376
54377   // modules/ui/intro/building.js
54378   function uiIntroBuilding(context, reveal) {
54379     var dispatch10 = dispatch_default("done");
54380     var house = [-85.62815, 41.95638];
54381     var tank = [-85.62732, 41.95347];
54382     var buildingCatetory = _mainPresetIndex.item("category-building");
54383     var housePreset = _mainPresetIndex.item("building/house");
54384     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
54385     var timeouts = [];
54386     var _houseID = null;
54387     var _tankID = null;
54388     var chapter = {
54389       title: "intro.buildings.title"
54390     };
54391     function timeout2(f2, t) {
54392       timeouts.push(window.setTimeout(f2, t));
54393     }
54394     function eventCancel(d3_event) {
54395       d3_event.stopPropagation();
54396       d3_event.preventDefault();
54397     }
54398     function revealHouse(center, text2, options2) {
54399       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
54400       var box = pad(center, padding, context);
54401       reveal(box, text2, options2);
54402     }
54403     function revealTank(center, text2, options2) {
54404       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
54405       var box = pad(center, padding, context);
54406       reveal(box, text2, options2);
54407     }
54408     function addHouse() {
54409       context.enter(modeBrowse(context));
54410       context.history().reset("initial");
54411       _houseID = null;
54412       var msec = transitionTime(house, context.map().center());
54413       if (msec) {
54414         reveal(null, null, { duration: 0 });
54415       }
54416       context.map().centerZoomEase(house, 19, msec);
54417       timeout2(function() {
54418         var tooltip = reveal("button.add-area", helpHtml("intro.buildings.add_building"));
54419         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
54420         context.on("enter.intro", function(mode) {
54421           if (mode.id !== "add-area")
54422             return;
54423           continueTo(startHouse);
54424         });
54425       }, msec + 100);
54426       function continueTo(nextStep) {
54427         context.on("enter.intro", null);
54428         nextStep();
54429       }
54430     }
54431     function startHouse() {
54432       if (context.mode().id !== "add-area") {
54433         return continueTo(addHouse);
54434       }
54435       _houseID = null;
54436       context.map().zoomEase(20, 500);
54437       timeout2(function() {
54438         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
54439         revealHouse(house, startString);
54440         context.map().on("move.intro drawn.intro", function() {
54441           revealHouse(house, startString, { duration: 0 });
54442         });
54443         context.on("enter.intro", function(mode) {
54444           if (mode.id !== "draw-area")
54445             return chapter.restart();
54446           continueTo(continueHouse);
54447         });
54448       }, 550);
54449       function continueTo(nextStep) {
54450         context.map().on("move.intro drawn.intro", null);
54451         context.on("enter.intro", null);
54452         nextStep();
54453       }
54454     }
54455     function continueHouse() {
54456       if (context.mode().id !== "draw-area") {
54457         return continueTo(addHouse);
54458       }
54459       _houseID = null;
54460       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
54461       revealHouse(house, continueString);
54462       context.map().on("move.intro drawn.intro", function() {
54463         revealHouse(house, continueString, { duration: 0 });
54464       });
54465       context.on("enter.intro", function(mode) {
54466         if (mode.id === "draw-area") {
54467           return;
54468         } else if (mode.id === "select") {
54469           var graph = context.graph();
54470           var way = context.entity(context.selectedIDs()[0]);
54471           var nodes = graph.childNodes(way);
54472           var points = utilArrayUniq(nodes).map(function(n2) {
54473             return context.projection(n2.loc);
54474           });
54475           if (isMostlySquare(points)) {
54476             _houseID = way.id;
54477             return continueTo(chooseCategoryBuilding);
54478           } else {
54479             return continueTo(retryHouse);
54480           }
54481         } else {
54482           return chapter.restart();
54483         }
54484       });
54485       function continueTo(nextStep) {
54486         context.map().on("move.intro drawn.intro", null);
54487         context.on("enter.intro", null);
54488         nextStep();
54489       }
54490     }
54491     function retryHouse() {
54492       var onClick = function() {
54493         continueTo(addHouse);
54494       };
54495       revealHouse(house, helpHtml("intro.buildings.retry_building"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
54496       context.map().on("move.intro drawn.intro", function() {
54497         revealHouse(house, helpHtml("intro.buildings.retry_building"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
54498       });
54499       function continueTo(nextStep) {
54500         context.map().on("move.intro drawn.intro", null);
54501         nextStep();
54502       }
54503     }
54504     function chooseCategoryBuilding() {
54505       if (!_houseID || !context.hasEntity(_houseID)) {
54506         return addHouse();
54507       }
54508       var ids = context.selectedIDs();
54509       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54510         context.enter(modeSelect(context, [_houseID]));
54511       }
54512       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54513       timeout2(function() {
54514         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54515         var button = context.container().select(".preset-category-building .preset-list-button");
54516         reveal(button.node(), helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() }));
54517         button.on("click.intro", function() {
54518           button.on("click.intro", null);
54519           continueTo(choosePresetHouse);
54520         });
54521       }, 400);
54522       context.on("enter.intro", function(mode) {
54523         if (!_houseID || !context.hasEntity(_houseID)) {
54524           return continueTo(addHouse);
54525         }
54526         var ids2 = context.selectedIDs();
54527         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
54528           return continueTo(chooseCategoryBuilding);
54529         }
54530       });
54531       function continueTo(nextStep) {
54532         context.container().select(".inspector-wrap").on("wheel.intro", null);
54533         context.container().select(".preset-list-button").on("click.intro", null);
54534         context.on("enter.intro", null);
54535         nextStep();
54536       }
54537     }
54538     function choosePresetHouse() {
54539       if (!_houseID || !context.hasEntity(_houseID)) {
54540         return addHouse();
54541       }
54542       var ids = context.selectedIDs();
54543       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54544         context.enter(modeSelect(context, [_houseID]));
54545       }
54546       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54547       timeout2(function() {
54548         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54549         var button = context.container().select(".preset-building-house .preset-list-button");
54550         reveal(button.node(), helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }), { duration: 300 });
54551         button.on("click.intro", function() {
54552           button.on("click.intro", null);
54553           continueTo(closeEditorHouse);
54554         });
54555       }, 400);
54556       context.on("enter.intro", function(mode) {
54557         if (!_houseID || !context.hasEntity(_houseID)) {
54558           return continueTo(addHouse);
54559         }
54560         var ids2 = context.selectedIDs();
54561         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
54562           return continueTo(chooseCategoryBuilding);
54563         }
54564       });
54565       function continueTo(nextStep) {
54566         context.container().select(".inspector-wrap").on("wheel.intro", null);
54567         context.container().select(".preset-list-button").on("click.intro", null);
54568         context.on("enter.intro", null);
54569         nextStep();
54570       }
54571     }
54572     function closeEditorHouse() {
54573       if (!_houseID || !context.hasEntity(_houseID)) {
54574         return addHouse();
54575       }
54576       var ids = context.selectedIDs();
54577       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54578         context.enter(modeSelect(context, [_houseID]));
54579       }
54580       context.history().checkpoint("hasHouse");
54581       context.on("exit.intro", function() {
54582         continueTo(rightClickHouse);
54583       });
54584       timeout2(function() {
54585         reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
54586       }, 500);
54587       function continueTo(nextStep) {
54588         context.on("exit.intro", null);
54589         nextStep();
54590       }
54591     }
54592     function rightClickHouse() {
54593       if (!_houseID)
54594         return chapter.restart();
54595       context.enter(modeBrowse(context));
54596       context.history().reset("hasHouse");
54597       var zoom = context.map().zoom();
54598       if (zoom < 20) {
54599         zoom = 20;
54600       }
54601       context.map().centerZoomEase(house, zoom, 500);
54602       context.on("enter.intro", function(mode) {
54603         if (mode.id !== "select")
54604           return;
54605         var ids = context.selectedIDs();
54606         if (ids.length !== 1 || ids[0] !== _houseID)
54607           return;
54608         timeout2(function() {
54609           var node = selectMenuItem(context, "orthogonalize").node();
54610           if (!node)
54611             return;
54612           continueTo(clickSquare);
54613         }, 50);
54614       });
54615       context.map().on("move.intro drawn.intro", function() {
54616         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
54617         revealHouse(house, rightclickString, { duration: 0 });
54618       });
54619       context.history().on("change.intro", function() {
54620         continueTo(rightClickHouse);
54621       });
54622       function continueTo(nextStep) {
54623         context.on("enter.intro", null);
54624         context.map().on("move.intro drawn.intro", null);
54625         context.history().on("change.intro", null);
54626         nextStep();
54627       }
54628     }
54629     function clickSquare() {
54630       if (!_houseID)
54631         return chapter.restart();
54632       var entity = context.hasEntity(_houseID);
54633       if (!entity)
54634         return continueTo(rightClickHouse);
54635       var node = selectMenuItem(context, "orthogonalize").node();
54636       if (!node) {
54637         return continueTo(rightClickHouse);
54638       }
54639       var wasChanged = false;
54640       reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { padding: 50 });
54641       context.on("enter.intro", function(mode) {
54642         if (mode.id === "browse") {
54643           continueTo(rightClickHouse);
54644         } else if (mode.id === "move" || mode.id === "rotate") {
54645           continueTo(retryClickSquare);
54646         }
54647       });
54648       context.map().on("move.intro", function() {
54649         var node2 = selectMenuItem(context, "orthogonalize").node();
54650         if (!wasChanged && !node2) {
54651           return continueTo(rightClickHouse);
54652         }
54653         reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { duration: 0, padding: 50 });
54654       });
54655       context.history().on("change.intro", function() {
54656         wasChanged = true;
54657         context.history().on("change.intro", null);
54658         timeout2(function() {
54659           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
54660             continueTo(doneSquare);
54661           } else {
54662             continueTo(retryClickSquare);
54663           }
54664         }, 500);
54665       });
54666       function continueTo(nextStep) {
54667         context.on("enter.intro", null);
54668         context.map().on("move.intro", null);
54669         context.history().on("change.intro", null);
54670         nextStep();
54671       }
54672     }
54673     function retryClickSquare() {
54674       context.enter(modeBrowse(context));
54675       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
54676         buttonText: _t.html("intro.ok"),
54677         buttonCallback: function() {
54678           continueTo(rightClickHouse);
54679         }
54680       });
54681       function continueTo(nextStep) {
54682         nextStep();
54683       }
54684     }
54685     function doneSquare() {
54686       context.history().checkpoint("doneSquare");
54687       revealHouse(house, helpHtml("intro.buildings.done_square"), {
54688         buttonText: _t.html("intro.ok"),
54689         buttonCallback: function() {
54690           continueTo(addTank);
54691         }
54692       });
54693       function continueTo(nextStep) {
54694         nextStep();
54695       }
54696     }
54697     function addTank() {
54698       context.enter(modeBrowse(context));
54699       context.history().reset("doneSquare");
54700       _tankID = null;
54701       var msec = transitionTime(tank, context.map().center());
54702       if (msec) {
54703         reveal(null, null, { duration: 0 });
54704       }
54705       context.map().centerZoomEase(tank, 19.5, msec);
54706       timeout2(function() {
54707         reveal("button.add-area", helpHtml("intro.buildings.add_tank"));
54708         context.on("enter.intro", function(mode) {
54709           if (mode.id !== "add-area")
54710             return;
54711           continueTo(startTank);
54712         });
54713       }, msec + 100);
54714       function continueTo(nextStep) {
54715         context.on("enter.intro", null);
54716         nextStep();
54717       }
54718     }
54719     function startTank() {
54720       if (context.mode().id !== "add-area") {
54721         return continueTo(addTank);
54722       }
54723       _tankID = null;
54724       timeout2(function() {
54725         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
54726         revealTank(tank, startString);
54727         context.map().on("move.intro drawn.intro", function() {
54728           revealTank(tank, startString, { duration: 0 });
54729         });
54730         context.on("enter.intro", function(mode) {
54731           if (mode.id !== "draw-area")
54732             return chapter.restart();
54733           continueTo(continueTank);
54734         });
54735       }, 550);
54736       function continueTo(nextStep) {
54737         context.map().on("move.intro drawn.intro", null);
54738         context.on("enter.intro", null);
54739         nextStep();
54740       }
54741     }
54742     function continueTank() {
54743       if (context.mode().id !== "draw-area") {
54744         return continueTo(addTank);
54745       }
54746       _tankID = null;
54747       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
54748       revealTank(tank, continueString);
54749       context.map().on("move.intro drawn.intro", function() {
54750         revealTank(tank, continueString, { duration: 0 });
54751       });
54752       context.on("enter.intro", function(mode) {
54753         if (mode.id === "draw-area") {
54754           return;
54755         } else if (mode.id === "select") {
54756           _tankID = context.selectedIDs()[0];
54757           return continueTo(searchPresetTank);
54758         } else {
54759           return continueTo(addTank);
54760         }
54761       });
54762       function continueTo(nextStep) {
54763         context.map().on("move.intro drawn.intro", null);
54764         context.on("enter.intro", null);
54765         nextStep();
54766       }
54767     }
54768     function searchPresetTank() {
54769       if (!_tankID || !context.hasEntity(_tankID)) {
54770         return addTank();
54771       }
54772       var ids = context.selectedIDs();
54773       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
54774         context.enter(modeSelect(context, [_tankID]));
54775       }
54776       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54777       timeout2(function() {
54778         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54779         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54780         reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
54781       }, 400);
54782       context.on("enter.intro", function(mode) {
54783         if (!_tankID || !context.hasEntity(_tankID)) {
54784           return continueTo(addTank);
54785         }
54786         var ids2 = context.selectedIDs();
54787         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
54788           context.enter(modeSelect(context, [_tankID]));
54789           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54790           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54791           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54792           reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
54793           context.history().on("change.intro", null);
54794         }
54795       });
54796       function checkPresetSearch() {
54797         var first = context.container().select(".preset-list-item:first-child");
54798         if (first.classed("preset-man_made-storage_tank")) {
54799           reveal(first.select(".preset-list-button").node(), helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }), { duration: 300 });
54800           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
54801           context.history().on("change.intro", function() {
54802             continueTo(closeEditorTank);
54803           });
54804         }
54805       }
54806       function continueTo(nextStep) {
54807         context.container().select(".inspector-wrap").on("wheel.intro", null);
54808         context.on("enter.intro", null);
54809         context.history().on("change.intro", null);
54810         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54811         nextStep();
54812       }
54813     }
54814     function closeEditorTank() {
54815       if (!_tankID || !context.hasEntity(_tankID)) {
54816         return addTank();
54817       }
54818       var ids = context.selectedIDs();
54819       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
54820         context.enter(modeSelect(context, [_tankID]));
54821       }
54822       context.history().checkpoint("hasTank");
54823       context.on("exit.intro", function() {
54824         continueTo(rightClickTank);
54825       });
54826       timeout2(function() {
54827         reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
54828       }, 500);
54829       function continueTo(nextStep) {
54830         context.on("exit.intro", null);
54831         nextStep();
54832       }
54833     }
54834     function rightClickTank() {
54835       if (!_tankID)
54836         return continueTo(addTank);
54837       context.enter(modeBrowse(context));
54838       context.history().reset("hasTank");
54839       context.map().centerEase(tank, 500);
54840       timeout2(function() {
54841         context.on("enter.intro", function(mode) {
54842           if (mode.id !== "select")
54843             return;
54844           var ids = context.selectedIDs();
54845           if (ids.length !== 1 || ids[0] !== _tankID)
54846             return;
54847           timeout2(function() {
54848             var node = selectMenuItem(context, "circularize").node();
54849             if (!node)
54850               return;
54851             continueTo(clickCircle);
54852           }, 50);
54853         });
54854         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
54855         revealTank(tank, rightclickString);
54856         context.map().on("move.intro drawn.intro", function() {
54857           revealTank(tank, rightclickString, { duration: 0 });
54858         });
54859         context.history().on("change.intro", function() {
54860           continueTo(rightClickTank);
54861         });
54862       }, 600);
54863       function continueTo(nextStep) {
54864         context.on("enter.intro", null);
54865         context.map().on("move.intro drawn.intro", null);
54866         context.history().on("change.intro", null);
54867         nextStep();
54868       }
54869     }
54870     function clickCircle() {
54871       if (!_tankID)
54872         return chapter.restart();
54873       var entity = context.hasEntity(_tankID);
54874       if (!entity)
54875         return continueTo(rightClickTank);
54876       var node = selectMenuItem(context, "circularize").node();
54877       if (!node) {
54878         return continueTo(rightClickTank);
54879       }
54880       var wasChanged = false;
54881       reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { padding: 50 });
54882       context.on("enter.intro", function(mode) {
54883         if (mode.id === "browse") {
54884           continueTo(rightClickTank);
54885         } else if (mode.id === "move" || mode.id === "rotate") {
54886           continueTo(retryClickCircle);
54887         }
54888       });
54889       context.map().on("move.intro", function() {
54890         var node2 = selectMenuItem(context, "circularize").node();
54891         if (!wasChanged && !node2) {
54892           return continueTo(rightClickTank);
54893         }
54894         reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { duration: 0, padding: 50 });
54895       });
54896       context.history().on("change.intro", function() {
54897         wasChanged = true;
54898         context.history().on("change.intro", null);
54899         timeout2(function() {
54900           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
54901             continueTo(play);
54902           } else {
54903             continueTo(retryClickCircle);
54904           }
54905         }, 500);
54906       });
54907       function continueTo(nextStep) {
54908         context.on("enter.intro", null);
54909         context.map().on("move.intro", null);
54910         context.history().on("change.intro", null);
54911         nextStep();
54912       }
54913     }
54914     function retryClickCircle() {
54915       context.enter(modeBrowse(context));
54916       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
54917         buttonText: _t.html("intro.ok"),
54918         buttonCallback: function() {
54919           continueTo(rightClickTank);
54920         }
54921       });
54922       function continueTo(nextStep) {
54923         nextStep();
54924       }
54925     }
54926     function play() {
54927       dispatch10.call("done");
54928       reveal(".ideditor", helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }), {
54929         tooltipBox: ".intro-nav-wrap .chapter-startEditing",
54930         buttonText: _t.html("intro.ok"),
54931         buttonCallback: function() {
54932           reveal(".ideditor");
54933         }
54934       });
54935     }
54936     chapter.enter = function() {
54937       addHouse();
54938     };
54939     chapter.exit = function() {
54940       timeouts.forEach(window.clearTimeout);
54941       context.on("enter.intro exit.intro", null);
54942       context.map().on("move.intro drawn.intro", null);
54943       context.history().on("change.intro", null);
54944       context.container().select(".inspector-wrap").on("wheel.intro", null);
54945       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54946       context.container().select(".more-fields .combobox-input").on("click.intro", null);
54947     };
54948     chapter.restart = function() {
54949       chapter.exit();
54950       chapter.enter();
54951     };
54952     return utilRebind(chapter, dispatch10, "on");
54953   }
54954
54955   // modules/ui/intro/start_editing.js
54956   function uiIntroStartEditing(context, reveal) {
54957     var dispatch10 = dispatch_default("done", "startEditing");
54958     var modalSelection = select_default2(null);
54959     var chapter = {
54960       title: "intro.startediting.title"
54961     };
54962     function showHelp() {
54963       reveal(".map-control.help-control", helpHtml("intro.startediting.help"), {
54964         buttonText: _t.html("intro.ok"),
54965         buttonCallback: function() {
54966           shortcuts();
54967         }
54968       });
54969     }
54970     function shortcuts() {
54971       reveal(".map-control.help-control", helpHtml("intro.startediting.shortcuts"), {
54972         buttonText: _t.html("intro.ok"),
54973         buttonCallback: function() {
54974           showSave();
54975         }
54976       });
54977     }
54978     function showSave() {
54979       context.container().selectAll(".shaded").remove();
54980       reveal(".top-toolbar button.save", helpHtml("intro.startediting.save"), {
54981         buttonText: _t.html("intro.ok"),
54982         buttonCallback: function() {
54983           showStart();
54984         }
54985       });
54986     }
54987     function showStart() {
54988       context.container().selectAll(".shaded").remove();
54989       modalSelection = uiModal(context.container());
54990       modalSelection.select(".modal").attr("class", "modal-splash modal");
54991       modalSelection.selectAll(".close").remove();
54992       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
54993         modalSelection.remove();
54994       });
54995       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
54996       startbutton.append("h2").call(_t.append("intro.startediting.start"));
54997       dispatch10.call("startEditing");
54998     }
54999     chapter.enter = function() {
55000       showHelp();
55001     };
55002     chapter.exit = function() {
55003       modalSelection.remove();
55004       context.container().selectAll(".shaded").remove();
55005     };
55006     return utilRebind(chapter, dispatch10, "on");
55007   }
55008
55009   // modules/ui/intro/intro.js
55010   var chapterUi = {
55011     welcome: uiIntroWelcome,
55012     navigation: uiIntroNavigation,
55013     point: uiIntroPoint,
55014     area: uiIntroArea,
55015     line: uiIntroLine,
55016     building: uiIntroBuilding,
55017     startEditing: uiIntroStartEditing
55018   };
55019   var chapterFlow = [
55020     "welcome",
55021     "navigation",
55022     "point",
55023     "area",
55024     "line",
55025     "building",
55026     "startEditing"
55027   ];
55028   function uiIntro(context) {
55029     const INTRO_IMAGERY = "EsriWorldImageryClarity";
55030     let _introGraph = {};
55031     let _currChapter;
55032     function intro(selection2) {
55033       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
55034         for (let id2 in dataIntroGraph) {
55035           if (!_introGraph[id2]) {
55036             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
55037           }
55038         }
55039         selection2.call(startIntro);
55040       }).catch(function() {
55041       });
55042     }
55043     function startIntro(selection2) {
55044       context.enter(modeBrowse(context));
55045       let osm = context.connection();
55046       let history = context.history().toJSON();
55047       let hash = window.location.hash;
55048       let center = context.map().center();
55049       let zoom = context.map().zoom();
55050       let background = context.background().baseLayerSource();
55051       let overlays = context.background().overlayLayerSources();
55052       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
55053       let caches = osm && osm.caches();
55054       let baseEntities = context.history().graph().base().entities;
55055       context.ui().sidebar.expand();
55056       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
55057       context.inIntro(true);
55058       if (osm) {
55059         osm.toggle(false).reset();
55060       }
55061       context.history().reset();
55062       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
55063       context.history().checkpoint("initial");
55064       let imagery = context.background().findSource(INTRO_IMAGERY);
55065       if (imagery) {
55066         context.background().baseLayerSource(imagery);
55067       } else {
55068         context.background().bing();
55069       }
55070       overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55071       let layers = context.layers();
55072       layers.all().forEach((item) => {
55073         if (typeof item.layer.enabled === "function") {
55074           item.layer.enabled(item.id === "osm");
55075         }
55076       });
55077       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
55078       let curtain = uiCurtain(context.container().node());
55079       selection2.call(curtain);
55080       corePreferences("walkthrough_started", "yes");
55081       let storedProgress = corePreferences("walkthrough_progress") || "";
55082       let progress = storedProgress.split(";").filter(Boolean);
55083       let chapters = chapterFlow.map((chapter, i2) => {
55084         let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
55085           buttons.filter((d) => d.title === s.title).classed("finished", true);
55086           if (i2 < chapterFlow.length - 1) {
55087             const next = chapterFlow[i2 + 1];
55088             context.container().select(`button.chapter-${next}`).classed("next", true);
55089           }
55090           progress.push(chapter);
55091           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55092         });
55093         return s;
55094       });
55095       chapters[chapters.length - 1].on("startEditing", () => {
55096         progress.push("startEditing");
55097         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55098         let incomplete = utilArrayDifference(chapterFlow, progress);
55099         if (!incomplete.length) {
55100           corePreferences("walkthrough_completed", "yes");
55101         }
55102         curtain.remove();
55103         navwrap.remove();
55104         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
55105         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
55106         if (osm) {
55107           osm.toggle(true).reset().caches(caches);
55108         }
55109         context.history().reset().merge(Object.values(baseEntities));
55110         context.background().baseLayerSource(background);
55111         overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55112         if (history) {
55113           context.history().fromJSON(history, false);
55114         }
55115         context.map().centerZoom(center, zoom);
55116         window.location.replace(hash);
55117         context.inIntro(false);
55118       });
55119       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
55120       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
55121       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
55122       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
55123       buttons.append("span").html((d) => _t.html(d.title));
55124       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
55125       enterChapter(null, chapters[0]);
55126       function enterChapter(d3_event, newChapter) {
55127         if (_currChapter) {
55128           _currChapter.exit();
55129         }
55130         context.enter(modeBrowse(context));
55131         _currChapter = newChapter;
55132         _currChapter.enter();
55133         buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
55134       }
55135     }
55136     return intro;
55137   }
55138
55139   // modules/ui/issues_info.js
55140   function uiIssuesInfo(context) {
55141     var warningsItem = {
55142       id: "warnings",
55143       count: 0,
55144       iconID: "iD-icon-alert",
55145       descriptionID: "issues.warnings_and_errors"
55146     };
55147     var resolvedItem = {
55148       id: "resolved",
55149       count: 0,
55150       iconID: "iD-icon-apply",
55151       descriptionID: "issues.user_resolved_issues"
55152     };
55153     function update(selection2) {
55154       var shownItems = [];
55155       var liveIssues = context.validator().getIssues({
55156         what: corePreferences("validate-what") || "edited",
55157         where: corePreferences("validate-where") || "all"
55158       });
55159       if (liveIssues.length) {
55160         warningsItem.count = liveIssues.length;
55161         shownItems.push(warningsItem);
55162       }
55163       if (corePreferences("validate-what") === "all") {
55164         var resolvedIssues = context.validator().getResolvedIssues();
55165         if (resolvedIssues.length) {
55166           resolvedItem.count = resolvedIssues.length;
55167           shownItems.push(resolvedItem);
55168         }
55169       }
55170       var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
55171         return d.id;
55172       });
55173       chips.exit().remove();
55174       var enter = chips.enter().append("a").attr("class", function(d) {
55175         return "chip " + d.id + "-count";
55176       }).attr("href", "#").each(function(d) {
55177         var chipSelection = select_default2(this);
55178         var tooltipBehavior = uiTooltip().placement("top").title(_t.html(d.descriptionID));
55179         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
55180           d3_event.preventDefault();
55181           tooltipBehavior.hide(select_default2(this));
55182           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
55183         });
55184         chipSelection.call(svgIcon("#" + d.iconID));
55185       });
55186       enter.append("span").attr("class", "count");
55187       enter.merge(chips).selectAll("span.count").text(function(d) {
55188         return d.count.toString();
55189       });
55190     }
55191     return function(selection2) {
55192       update(selection2);
55193       context.validator().on("validated.infobox", function() {
55194         update(selection2);
55195       });
55196     };
55197   }
55198
55199   // modules/ui/map_in_map.js
55200   function uiMapInMap(context) {
55201     function mapInMap(selection2) {
55202       var backgroundLayer = rendererTileLayer(context);
55203       var overlayLayers = {};
55204       var projection2 = geoRawMercator();
55205       var dataLayer = svgData(projection2, context).showLabels(false);
55206       var debugLayer = svgDebug(projection2, context);
55207       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
55208       var wrap2 = select_default2(null);
55209       var tiles = select_default2(null);
55210       var viewport = select_default2(null);
55211       var _isTransformed = false;
55212       var _isHidden = true;
55213       var _skipEvents = false;
55214       var _gesture = null;
55215       var _zDiff = 6;
55216       var _dMini;
55217       var _cMini;
55218       var _tStart;
55219       var _tCurr;
55220       var _timeoutID;
55221       function zoomStarted() {
55222         if (_skipEvents)
55223           return;
55224         _tStart = _tCurr = projection2.transform();
55225         _gesture = null;
55226       }
55227       function zoomed(d3_event) {
55228         if (_skipEvents)
55229           return;
55230         var x = d3_event.transform.x;
55231         var y = d3_event.transform.y;
55232         var k = d3_event.transform.k;
55233         var isZooming = k !== _tStart.k;
55234         var isPanning = x !== _tStart.x || y !== _tStart.y;
55235         if (!isZooming && !isPanning) {
55236           return;
55237         }
55238         if (!_gesture) {
55239           _gesture = isZooming ? "zoom" : "pan";
55240         }
55241         var tMini = projection2.transform();
55242         var tX, tY, scale;
55243         if (_gesture === "zoom") {
55244           scale = k / tMini.k;
55245           tX = (_cMini[0] / scale - _cMini[0]) * scale;
55246           tY = (_cMini[1] / scale - _cMini[1]) * scale;
55247         } else {
55248           k = tMini.k;
55249           scale = 1;
55250           tX = x - tMini.x;
55251           tY = y - tMini.y;
55252         }
55253         utilSetTransform(tiles, tX, tY, scale);
55254         utilSetTransform(viewport, 0, 0, scale);
55255         _isTransformed = true;
55256         _tCurr = identity2.translate(x, y).scale(k);
55257         var zMain = geoScaleToZoom(context.projection.scale());
55258         var zMini = geoScaleToZoom(k);
55259         _zDiff = zMain - zMini;
55260         queueRedraw();
55261       }
55262       function zoomEnded() {
55263         if (_skipEvents)
55264           return;
55265         if (_gesture !== "pan")
55266           return;
55267         updateProjection();
55268         _gesture = null;
55269         context.map().center(projection2.invert(_cMini));
55270       }
55271       function updateProjection() {
55272         var loc = context.map().center();
55273         var tMain = context.projection.transform();
55274         var zMain = geoScaleToZoom(tMain.k);
55275         var zMini = Math.max(zMain - _zDiff, 0.5);
55276         var kMini = geoZoomToScale(zMini);
55277         projection2.translate([tMain.x, tMain.y]).scale(kMini);
55278         var point = projection2(loc);
55279         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
55280         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
55281         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
55282         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
55283         _tCurr = projection2.transform();
55284         if (_isTransformed) {
55285           utilSetTransform(tiles, 0, 0);
55286           utilSetTransform(viewport, 0, 0);
55287           _isTransformed = false;
55288         }
55289         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
55290         _skipEvents = true;
55291         wrap2.call(zoom.transform, _tCurr);
55292         _skipEvents = false;
55293       }
55294       function redraw() {
55295         clearTimeout(_timeoutID);
55296         if (_isHidden)
55297           return;
55298         updateProjection();
55299         var zMini = geoScaleToZoom(projection2.scale());
55300         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
55301         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
55302         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
55303         var background = tiles.selectAll(".map-in-map-background").data([0]);
55304         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
55305         var overlaySources = context.background().overlayLayerSources();
55306         var activeOverlayLayers = [];
55307         for (var i2 = 0; i2 < overlaySources.length; i2++) {
55308           if (overlaySources[i2].validZoom(zMini)) {
55309             if (!overlayLayers[i2])
55310               overlayLayers[i2] = rendererTileLayer(context);
55311             activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
55312           }
55313         }
55314         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
55315         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
55316         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
55317           return d.source().name();
55318         });
55319         overlays.exit().remove();
55320         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
55321           select_default2(this).call(layer);
55322         });
55323         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
55324         dataLayers.exit().remove();
55325         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
55326         if (_gesture !== "pan") {
55327           var getPath = path_default(projection2);
55328           var bbox = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
55329           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
55330           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
55331           var path = viewport.selectAll(".map-in-map-bbox").data([bbox]);
55332           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
55333             return getPath.area(d) < 30;
55334           });
55335         }
55336       }
55337       function queueRedraw() {
55338         clearTimeout(_timeoutID);
55339         _timeoutID = setTimeout(function() {
55340           redraw();
55341         }, 750);
55342       }
55343       function toggle(d3_event) {
55344         if (d3_event)
55345           d3_event.preventDefault();
55346         _isHidden = !_isHidden;
55347         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
55348         if (_isHidden) {
55349           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
55350             selection2.selectAll(".map-in-map").style("display", "none");
55351           });
55352         } else {
55353           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
55354             redraw();
55355           });
55356         }
55357       }
55358       uiMapInMap.toggle = toggle;
55359       wrap2 = selection2.selectAll(".map-in-map").data([0]);
55360       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
55361       _dMini = [200, 150];
55362       _cMini = geoVecScale(_dMini, 0.5);
55363       context.map().on("drawn.map-in-map", function(drawn) {
55364         if (drawn.full === true) {
55365           redraw();
55366         }
55367       });
55368       redraw();
55369       context.keybinding().on(_t("background.minimap.key"), toggle);
55370     }
55371     return mapInMap;
55372   }
55373
55374   // modules/ui/notice.js
55375   function uiNotice(context) {
55376     return function(selection2) {
55377       var div = selection2.append("div").attr("class", "notice");
55378       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
55379         context.map().zoomEase(context.minEditableZoom());
55380       }).on("wheel", function(d3_event) {
55381         var e22 = new WheelEvent(d3_event.type, d3_event);
55382         context.surface().node().dispatchEvent(e22);
55383       });
55384       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
55385       function disableTooHigh() {
55386         var canEdit = context.map().zoom() >= context.minEditableZoom();
55387         div.style("display", canEdit ? "none" : "block");
55388       }
55389       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
55390       disableTooHigh();
55391     };
55392   }
55393
55394   // modules/ui/photoviewer.js
55395   function uiPhotoviewer(context) {
55396     var dispatch10 = dispatch_default("resize");
55397     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
55398     function photoviewer(selection2) {
55399       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
55400         if (services.streetside) {
55401           services.streetside.hideViewer(context);
55402         }
55403         if (services.mapillary) {
55404           services.mapillary.hideViewer(context);
55405         }
55406         if (services.kartaview) {
55407           services.kartaview.hideViewer(context);
55408         }
55409       }).append("div").call(svgIcon("#iD-icon-close"));
55410       function preventDefault(d3_event) {
55411         d3_event.preventDefault();
55412       }
55413       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true }));
55414       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true }));
55415       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true }));
55416       function buildResizeListener(target, eventName, dispatch11, options2) {
55417         var resizeOnX = !!options2.resizeOnX;
55418         var resizeOnY = !!options2.resizeOnY;
55419         var minHeight = options2.minHeight || 240;
55420         var minWidth = options2.minWidth || 320;
55421         var pointerId;
55422         var startX;
55423         var startY;
55424         var startWidth;
55425         var startHeight;
55426         function startResize(d3_event) {
55427           if (pointerId !== (d3_event.pointerId || "mouse"))
55428             return;
55429           d3_event.preventDefault();
55430           d3_event.stopPropagation();
55431           var mapSize = context.map().dimensions();
55432           if (resizeOnX) {
55433             var maxWidth = mapSize[0];
55434             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
55435             target.style("width", newWidth + "px");
55436           }
55437           if (resizeOnY) {
55438             var maxHeight = mapSize[1] - 90;
55439             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
55440             target.style("height", newHeight + "px");
55441           }
55442           dispatch11.call(eventName, target, utilGetDimensions(target, true));
55443         }
55444         function clamp3(num, min3, max3) {
55445           return Math.max(min3, Math.min(num, max3));
55446         }
55447         function stopResize(d3_event) {
55448           if (pointerId !== (d3_event.pointerId || "mouse"))
55449             return;
55450           d3_event.preventDefault();
55451           d3_event.stopPropagation();
55452           select_default2(window).on("." + eventName, null);
55453         }
55454         return function initResize(d3_event) {
55455           d3_event.preventDefault();
55456           d3_event.stopPropagation();
55457           pointerId = d3_event.pointerId || "mouse";
55458           startX = d3_event.clientX;
55459           startY = d3_event.clientY;
55460           var targetRect = target.node().getBoundingClientRect();
55461           startWidth = targetRect.width;
55462           startHeight = targetRect.height;
55463           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
55464           if (_pointerPrefix === "pointer") {
55465             select_default2(window).on("pointercancel." + eventName, stopResize, false);
55466           }
55467         };
55468       }
55469     }
55470     photoviewer.onMapResize = function() {
55471       var photoviewer2 = context.container().select(".photoviewer");
55472       var content = context.container().select(".main-content");
55473       var mapDimensions = utilGetDimensions(content, true);
55474       var photoDimensions = utilGetDimensions(photoviewer2, true);
55475       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
55476         var setPhotoDimensions = [
55477           Math.min(photoDimensions[0], mapDimensions[0]),
55478           Math.min(photoDimensions[1], mapDimensions[1] - 90)
55479         ];
55480         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
55481         dispatch10.call("resize", photoviewer2, setPhotoDimensions);
55482       }
55483     };
55484     return utilRebind(photoviewer, dispatch10, "on");
55485   }
55486
55487   // modules/ui/restore.js
55488   function uiRestore(context) {
55489     return function(selection2) {
55490       if (!context.history().hasRestorableChanges())
55491         return;
55492       let modalSelection = uiModal(selection2, true);
55493       modalSelection.select(".modal").attr("class", "modal fillL");
55494       let introModal = modalSelection.select(".content");
55495       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
55496       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
55497       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
55498       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
55499         context.history().restore();
55500         modalSelection.remove();
55501       });
55502       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
55503       restore.append("div").call(_t.append("restore.restore"));
55504       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
55505         context.history().clearSaved();
55506         modalSelection.remove();
55507       });
55508       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
55509       reset.append("div").call(_t.append("restore.reset"));
55510       restore.node().focus();
55511     };
55512   }
55513
55514   // modules/ui/scale.js
55515   function uiScale(context) {
55516     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
55517     function scaleDefs(loc1, loc2) {
55518       var lat = (loc2[1] + loc1[1]) / 2, conversion = isImperial ? 3.28084 : 1, dist = geoLonToMeters(loc2[0] - loc1[0], lat) * conversion, scale = { dist: 0, px: 0, text: "" }, buckets, i2, val, dLon;
55519       if (isImperial) {
55520         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
55521       } else {
55522         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
55523       }
55524       for (i2 = 0; i2 < buckets.length; i2++) {
55525         val = buckets[i2];
55526         if (dist >= val) {
55527           scale.dist = Math.floor(dist / val) * val;
55528           break;
55529         } else {
55530           scale.dist = +dist.toFixed(2);
55531         }
55532       }
55533       dLon = geoMetersToLon(scale.dist / conversion, lat);
55534       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
55535       scale.text = displayLength(scale.dist / conversion, isImperial);
55536       return scale;
55537     }
55538     function update(selection2) {
55539       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
55540       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
55541       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
55542     }
55543     return function(selection2) {
55544       function switchUnits() {
55545         isImperial = !isImperial;
55546         selection2.call(update);
55547       }
55548       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
55549       scalegroup.append("path").attr("class", "scale-path");
55550       selection2.append("div").attr("class", "scale-text");
55551       selection2.call(update);
55552       context.map().on("move.scale", function() {
55553         update(selection2);
55554       });
55555     };
55556   }
55557
55558   // modules/ui/shortcuts.js
55559   function uiShortcuts(context) {
55560     var detected = utilDetect();
55561     var _activeTab = 0;
55562     var _modalSelection;
55563     var _selection = select_default2(null);
55564     var _dataShortcuts;
55565     function shortcutsModal(_modalSelection2) {
55566       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
55567       var content = _modalSelection2.select(".content");
55568       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
55569       _mainFileFetcher.get("shortcuts").then(function(data) {
55570         _dataShortcuts = data;
55571         content.call(render);
55572       }).catch(function() {
55573       });
55574     }
55575     function render(selection2) {
55576       if (!_dataShortcuts)
55577         return;
55578       var wrapper = selection2.selectAll(".wrapper").data([0]);
55579       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
55580       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
55581       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
55582       wrapper = wrapper.merge(wrapperEnter);
55583       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
55584       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
55585         d3_event.preventDefault();
55586         var i2 = _dataShortcuts.indexOf(d);
55587         _activeTab = i2;
55588         render(selection2);
55589       });
55590       tabsEnter.append("span").html(function(d) {
55591         return _t.html(d.text);
55592       });
55593       wrapper.selectAll(".tab").classed("active", function(d, i2) {
55594         return i2 === _activeTab;
55595       });
55596       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
55597       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
55598         return "shortcut-tab shortcut-tab-" + d.tab;
55599       });
55600       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
55601         return d.columns;
55602       }).enter().append("table").attr("class", "shortcut-column");
55603       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
55604         return d.rows;
55605       }).enter().append("tr").attr("class", "shortcut-row");
55606       var sectionRows = rowsEnter.filter(function(d) {
55607         return !d.shortcuts;
55608       });
55609       sectionRows.append("td");
55610       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
55611         return _t.html(d.text);
55612       });
55613       var shortcutRows = rowsEnter.filter(function(d) {
55614         return d.shortcuts;
55615       });
55616       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
55617       var modifierKeys = shortcutKeys.filter(function(d) {
55618         return d.modifiers;
55619       });
55620       modifierKeys.selectAll("kbd.modifier").data(function(d) {
55621         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
55622           return ["\u2318"];
55623         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
55624           return [];
55625         } else {
55626           return d.modifiers;
55627         }
55628       }).enter().each(function() {
55629         var selection3 = select_default2(this);
55630         selection3.append("kbd").attr("class", "modifier").text(function(d) {
55631           return uiCmd.display(d);
55632         });
55633         selection3.append("span").text("+");
55634       });
55635       shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
55636         var arr = d.shortcuts;
55637         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
55638           arr = ["Y"];
55639         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
55640           arr = ["F11"];
55641         }
55642         arr = arr.map(function(s) {
55643           return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
55644         });
55645         return utilArrayUniq(arr).map(function(s) {
55646           return {
55647             shortcut: s,
55648             separator: d.separator,
55649             suffix: d.suffix
55650           };
55651         });
55652       }).enter().each(function(d, i2, nodes) {
55653         var selection3 = select_default2(this);
55654         var click = d.shortcut.toLowerCase().match(/(.*).click/);
55655         if (click && click[1]) {
55656           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
55657         } else if (d.shortcut.toLowerCase() === "long-press") {
55658           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
55659         } else if (d.shortcut.toLowerCase() === "tap") {
55660           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
55661         } else {
55662           selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
55663             return d2.shortcut;
55664           });
55665         }
55666         if (i2 < nodes.length - 1) {
55667           selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
55668         } else if (i2 === nodes.length - 1 && d.suffix) {
55669           selection3.append("span").text(d.suffix);
55670         }
55671       });
55672       shortcutKeys.filter(function(d) {
55673         return d.gesture;
55674       }).each(function() {
55675         var selection3 = select_default2(this);
55676         selection3.append("span").text("+");
55677         selection3.append("span").attr("class", "gesture").html(function(d) {
55678           return _t.html(d.gesture);
55679         });
55680       });
55681       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
55682         return d.text ? _t.html(d.text) : "\xA0";
55683       });
55684       wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
55685         return i2 === _activeTab ? "flex" : "none";
55686       });
55687     }
55688     return function(selection2, show) {
55689       _selection = selection2;
55690       if (show) {
55691         _modalSelection = uiModal(selection2);
55692         _modalSelection.call(shortcutsModal);
55693       } else {
55694         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
55695           if (context.container().selectAll(".modal-shortcuts").size()) {
55696             if (_modalSelection) {
55697               _modalSelection.close();
55698               _modalSelection = null;
55699             }
55700           } else {
55701             _modalSelection = uiModal(_selection);
55702             _modalSelection.call(shortcutsModal);
55703           }
55704         });
55705       }
55706     };
55707   }
55708
55709   // modules/ui/data_header.js
55710   function uiDataHeader() {
55711     var _datum;
55712     function dataHeader(selection2) {
55713       var header = selection2.selectAll(".data-header").data(_datum ? [_datum] : [], function(d) {
55714         return d.__featurehash__;
55715       });
55716       header.exit().remove();
55717       var headerEnter = header.enter().append("div").attr("class", "data-header");
55718       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
55719       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
55720       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
55721     }
55722     dataHeader.datum = function(val) {
55723       if (!arguments.length)
55724         return _datum;
55725       _datum = val;
55726       return this;
55727     };
55728     return dataHeader;
55729   }
55730
55731   // modules/ui/combobox.js
55732   var _comboHideTimerID;
55733   function uiCombobox(context, klass) {
55734     var dispatch10 = dispatch_default("accept", "cancel");
55735     var container = context.container();
55736     var _suggestions = [];
55737     var _data = [];
55738     var _fetched = {};
55739     var _selected = null;
55740     var _canAutocomplete = true;
55741     var _caseSensitive = false;
55742     var _cancelFetch = false;
55743     var _minItems = 2;
55744     var _tDown = 0;
55745     var _mouseEnterHandler, _mouseLeaveHandler;
55746     var _fetcher = function(val, cb) {
55747       cb(_data.filter(function(d) {
55748         var terms = d.terms || [];
55749         terms.push(d.value);
55750         return terms.some(function(term) {
55751           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
55752         });
55753       }));
55754     };
55755     var combobox = function(input, attachTo) {
55756       if (!input || input.empty())
55757         return;
55758       input.classed("combobox-input", true).on("focus.combo-input", focus).on("blur.combo-input", blur).on("keydown.combo-input", keydown).on("keyup.combo-input", keyup).on("input.combo-input", change).on("mousedown.combo-input", mousedown).each(function() {
55759         var parent = this.parentNode;
55760         var sibling = this.nextSibling;
55761         select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
55762           return d === input.node();
55763         }).data([input.node()]).enter().insert("div", function() {
55764           return sibling;
55765         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
55766           d3_event.preventDefault();
55767           input.node().focus();
55768           mousedown(d3_event);
55769         }).on("mouseup.combo-caret", function(d3_event) {
55770           d3_event.preventDefault();
55771           mouseup(d3_event);
55772         });
55773       });
55774       function mousedown(d3_event) {
55775         if (d3_event.button !== 0)
55776           return;
55777         if (input.classed("disabled"))
55778           return;
55779         _tDown = +new Date();
55780         var start2 = input.property("selectionStart");
55781         var end = input.property("selectionEnd");
55782         if (start2 !== end) {
55783           var val = utilGetSetValue(input);
55784           input.node().setSelectionRange(val.length, val.length);
55785           return;
55786         }
55787         input.on("mouseup.combo-input", mouseup);
55788       }
55789       function mouseup(d3_event) {
55790         input.on("mouseup.combo-input", null);
55791         if (d3_event.button !== 0)
55792           return;
55793         if (input.classed("disabled"))
55794           return;
55795         if (input.node() !== document.activeElement)
55796           return;
55797         var start2 = input.property("selectionStart");
55798         var end = input.property("selectionEnd");
55799         if (start2 !== end)
55800           return;
55801         var combo = container.selectAll(".combobox");
55802         if (combo.empty() || combo.datum() !== input.node()) {
55803           var tOrig = _tDown;
55804           window.setTimeout(function() {
55805             if (tOrig !== _tDown)
55806               return;
55807             fetchComboData("", function() {
55808               show();
55809               render();
55810             });
55811           }, 250);
55812         } else {
55813           hide();
55814         }
55815       }
55816       function focus() {
55817         fetchComboData("");
55818       }
55819       function blur() {
55820         _comboHideTimerID = window.setTimeout(hide, 75);
55821       }
55822       function show() {
55823         hide();
55824         container.insert("div", ":first-child").datum(input.node()).attr("class", "combobox" + (klass ? " combobox-" + klass : "")).style("position", "absolute").style("display", "block").style("left", "0px").on("mousedown.combo-container", function(d3_event) {
55825           d3_event.preventDefault();
55826         });
55827         container.on("scroll.combo-scroll", render, true);
55828       }
55829       function hide() {
55830         if (_comboHideTimerID) {
55831           window.clearTimeout(_comboHideTimerID);
55832           _comboHideTimerID = void 0;
55833         }
55834         container.selectAll(".combobox").remove();
55835         container.on("scroll.combo-scroll", null);
55836       }
55837       function keydown(d3_event) {
55838         var shown = !container.selectAll(".combobox").empty();
55839         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
55840         switch (d3_event.keyCode) {
55841           case 8:
55842           case 46:
55843             d3_event.stopPropagation();
55844             _selected = null;
55845             render();
55846             input.on("input.combo-input", function() {
55847               var start2 = input.property("selectionStart");
55848               input.node().setSelectionRange(start2, start2);
55849               input.on("input.combo-input", change);
55850             });
55851             break;
55852           case 9:
55853             accept(d3_event);
55854             break;
55855           case 13:
55856             d3_event.preventDefault();
55857             d3_event.stopPropagation();
55858             break;
55859           case 38:
55860             if (tagName === "textarea" && !shown)
55861               return;
55862             d3_event.preventDefault();
55863             if (tagName === "input" && !shown) {
55864               show();
55865             }
55866             nav(-1);
55867             break;
55868           case 40:
55869             if (tagName === "textarea" && !shown)
55870               return;
55871             d3_event.preventDefault();
55872             if (tagName === "input" && !shown) {
55873               show();
55874             }
55875             nav(1);
55876             break;
55877         }
55878       }
55879       function keyup(d3_event) {
55880         switch (d3_event.keyCode) {
55881           case 27:
55882             cancel();
55883             break;
55884           case 13:
55885             accept(d3_event);
55886             break;
55887         }
55888       }
55889       function change() {
55890         fetchComboData(value(), function() {
55891           _selected = null;
55892           var val = input.property("value");
55893           if (_suggestions.length) {
55894             if (input.property("selectionEnd") === val.length) {
55895               _selected = tryAutocomplete();
55896             }
55897             if (!_selected) {
55898               _selected = val;
55899             }
55900           }
55901           if (val.length) {
55902             var combo = container.selectAll(".combobox");
55903             if (combo.empty()) {
55904               show();
55905             }
55906           } else {
55907             hide();
55908           }
55909           render();
55910         });
55911       }
55912       function nav(dir) {
55913         if (_suggestions.length) {
55914           var index = -1;
55915           for (var i2 = 0; i2 < _suggestions.length; i2++) {
55916             if (_selected && _suggestions[i2].value === _selected) {
55917               index = i2;
55918               break;
55919             }
55920           }
55921           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
55922           _selected = _suggestions[index].value;
55923           input.property("value", _selected);
55924         }
55925         render();
55926         ensureVisible();
55927       }
55928       function ensureVisible() {
55929         var combo = container.selectAll(".combobox");
55930         if (combo.empty())
55931           return;
55932         var containerRect = container.node().getBoundingClientRect();
55933         var comboRect = combo.node().getBoundingClientRect();
55934         if (comboRect.bottom > containerRect.bottom) {
55935           var node = attachTo ? attachTo.node() : input.node();
55936           node.scrollIntoView({ behavior: "instant", block: "center" });
55937           render();
55938         }
55939         var selected = combo.selectAll(".combobox-option.selected").node();
55940         if (selected) {
55941           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
55942         }
55943       }
55944       function value() {
55945         var value2 = input.property("value");
55946         var start2 = input.property("selectionStart");
55947         var end = input.property("selectionEnd");
55948         if (start2 && end) {
55949           value2 = value2.substring(0, start2);
55950         }
55951         return value2;
55952       }
55953       function fetchComboData(v, cb) {
55954         _cancelFetch = false;
55955         _fetcher.call(input, v, function(results) {
55956           if (_cancelFetch)
55957             return;
55958           _suggestions = results;
55959           results.forEach(function(d) {
55960             _fetched[d.value] = d;
55961           });
55962           if (cb) {
55963             cb();
55964           }
55965         });
55966       }
55967       function tryAutocomplete() {
55968         if (!_canAutocomplete)
55969           return;
55970         var val = _caseSensitive ? value() : value().toLowerCase();
55971         if (!val)
55972           return;
55973         if (!isNaN(parseFloat(val)) && isFinite(val))
55974           return;
55975         var bestIndex = -1;
55976         for (var i2 = 0; i2 < _suggestions.length; i2++) {
55977           var suggestion = _suggestions[i2].value;
55978           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
55979           if (compare === val) {
55980             bestIndex = i2;
55981             break;
55982           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
55983             bestIndex = i2;
55984           }
55985         }
55986         if (bestIndex !== -1) {
55987           var bestVal = _suggestions[bestIndex].value;
55988           input.property("value", bestVal);
55989           input.node().setSelectionRange(val.length, bestVal.length);
55990           return bestVal;
55991         }
55992       }
55993       function render() {
55994         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
55995           hide();
55996           return;
55997         }
55998         var shown = !container.selectAll(".combobox").empty();
55999         if (!shown)
56000           return;
56001         var combo = container.selectAll(".combobox");
56002         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
56003           return d.value;
56004         });
56005         options2.exit().remove();
56006         options2.enter().append("a").attr("class", function(d) {
56007           return "combobox-option " + (d.klass || "");
56008         }).attr("title", function(d) {
56009           return d.title;
56010         }).html(function(d) {
56011           return d.display || d.value;
56012         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
56013           return d.value === _selected;
56014         }).on("click.combo-option", accept).order();
56015         var node = attachTo ? attachTo.node() : input.node();
56016         var containerRect = container.node().getBoundingClientRect();
56017         var rect = node.getBoundingClientRect();
56018         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
56019       }
56020       function accept(d3_event, d) {
56021         _cancelFetch = true;
56022         var thiz = input.node();
56023         if (d) {
56024           utilGetSetValue(input, d.value);
56025           utilTriggerEvent(input, "change");
56026         }
56027         var val = utilGetSetValue(input);
56028         thiz.setSelectionRange(val.length, val.length);
56029         d = _fetched[val];
56030         dispatch10.call("accept", thiz, d, val);
56031         hide();
56032       }
56033       function cancel() {
56034         _cancelFetch = true;
56035         var thiz = input.node();
56036         var val = utilGetSetValue(input);
56037         var start2 = input.property("selectionStart");
56038         var end = input.property("selectionEnd");
56039         val = val.slice(0, start2) + val.slice(end);
56040         utilGetSetValue(input, val);
56041         thiz.setSelectionRange(val.length, val.length);
56042         dispatch10.call("cancel", thiz);
56043         hide();
56044       }
56045     };
56046     combobox.canAutocomplete = function(val) {
56047       if (!arguments.length)
56048         return _canAutocomplete;
56049       _canAutocomplete = val;
56050       return combobox;
56051     };
56052     combobox.caseSensitive = function(val) {
56053       if (!arguments.length)
56054         return _caseSensitive;
56055       _caseSensitive = val;
56056       return combobox;
56057     };
56058     combobox.data = function(val) {
56059       if (!arguments.length)
56060         return _data;
56061       _data = val;
56062       return combobox;
56063     };
56064     combobox.fetcher = function(val) {
56065       if (!arguments.length)
56066         return _fetcher;
56067       _fetcher = val;
56068       return combobox;
56069     };
56070     combobox.minItems = function(val) {
56071       if (!arguments.length)
56072         return _minItems;
56073       _minItems = val;
56074       return combobox;
56075     };
56076     combobox.itemsMouseEnter = function(val) {
56077       if (!arguments.length)
56078         return _mouseEnterHandler;
56079       _mouseEnterHandler = val;
56080       return combobox;
56081     };
56082     combobox.itemsMouseLeave = function(val) {
56083       if (!arguments.length)
56084         return _mouseLeaveHandler;
56085       _mouseLeaveHandler = val;
56086       return combobox;
56087     };
56088     return utilRebind(combobox, dispatch10, "on");
56089   }
56090   uiCombobox.off = function(input, context) {
56091     input.on("focus.combo-input", null).on("blur.combo-input", null).on("keydown.combo-input", null).on("keyup.combo-input", null).on("input.combo-input", null).on("mousedown.combo-input", null).on("mouseup.combo-input", null);
56092     context.container().on("scroll.combo-scroll", null);
56093   };
56094
56095   // modules/ui/disclosure.js
56096   function uiDisclosure(context, key, expandedDefault) {
56097     var dispatch10 = dispatch_default("toggled");
56098     var _expanded;
56099     var _label = utilFunctor("");
56100     var _updatePreference = true;
56101     var _content = function() {
56102     };
56103     var disclosure = function(selection2) {
56104       if (_expanded === void 0 || _expanded === null) {
56105         var preference = corePreferences("disclosure." + key + ".expanded");
56106         _expanded = preference === null ? !!expandedDefault : preference === "true";
56107       }
56108       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
56109       var hideToggleEnter = hideToggle.enter().append("h3").append("a").attr("role", "button").attr("href", "#").attr("class", "hide-toggle hide-toggle-" + key).call(svgIcon("", "pre-text", "hide-toggle-icon"));
56110       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
56111       hideToggle = hideToggleEnter.merge(hideToggle);
56112       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
56113       hideToggle.selectAll(".hide-toggle-text").html(_label());
56114       hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
56115       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
56116       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
56117       if (_expanded) {
56118         wrap2.call(_content);
56119       }
56120       function toggle(d3_event) {
56121         d3_event.preventDefault();
56122         _expanded = !_expanded;
56123         if (_updatePreference) {
56124           corePreferences("disclosure." + key + ".expanded", _expanded);
56125         }
56126         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
56127         hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
56128         wrap2.call(uiToggle(_expanded));
56129         if (_expanded) {
56130           wrap2.call(_content);
56131         }
56132         dispatch10.call("toggled", this, _expanded);
56133       }
56134     };
56135     disclosure.label = function(val) {
56136       if (!arguments.length)
56137         return _label;
56138       _label = utilFunctor(val);
56139       return disclosure;
56140     };
56141     disclosure.expanded = function(val) {
56142       if (!arguments.length)
56143         return _expanded;
56144       _expanded = val;
56145       return disclosure;
56146     };
56147     disclosure.updatePreference = function(val) {
56148       if (!arguments.length)
56149         return _updatePreference;
56150       _updatePreference = val;
56151       return disclosure;
56152     };
56153     disclosure.content = function(val) {
56154       if (!arguments.length)
56155         return _content;
56156       _content = val;
56157       return disclosure;
56158     };
56159     return utilRebind(disclosure, dispatch10, "on");
56160   }
56161
56162   // modules/ui/section.js
56163   function uiSection(id2, context) {
56164     var _classes = utilFunctor("");
56165     var _shouldDisplay;
56166     var _content;
56167     var _disclosure;
56168     var _label;
56169     var _expandedByDefault = utilFunctor(true);
56170     var _disclosureContent;
56171     var _disclosureExpanded;
56172     var _containerSelection = select_default2(null);
56173     var section = {
56174       id: id2
56175     };
56176     section.classes = function(val) {
56177       if (!arguments.length)
56178         return _classes;
56179       _classes = utilFunctor(val);
56180       return section;
56181     };
56182     section.label = function(val) {
56183       if (!arguments.length)
56184         return _label;
56185       _label = utilFunctor(val);
56186       return section;
56187     };
56188     section.expandedByDefault = function(val) {
56189       if (!arguments.length)
56190         return _expandedByDefault;
56191       _expandedByDefault = utilFunctor(val);
56192       return section;
56193     };
56194     section.shouldDisplay = function(val) {
56195       if (!arguments.length)
56196         return _shouldDisplay;
56197       _shouldDisplay = utilFunctor(val);
56198       return section;
56199     };
56200     section.content = function(val) {
56201       if (!arguments.length)
56202         return _content;
56203       _content = val;
56204       return section;
56205     };
56206     section.disclosureContent = function(val) {
56207       if (!arguments.length)
56208         return _disclosureContent;
56209       _disclosureContent = val;
56210       return section;
56211     };
56212     section.disclosureExpanded = function(val) {
56213       if (!arguments.length)
56214         return _disclosureExpanded;
56215       _disclosureExpanded = val;
56216       return section;
56217     };
56218     section.render = function(selection2) {
56219       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
56220       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
56221       _containerSelection = sectionEnter.merge(_containerSelection);
56222       _containerSelection.call(renderContent);
56223     };
56224     section.reRender = function() {
56225       _containerSelection.call(renderContent);
56226     };
56227     section.selection = function() {
56228       return _containerSelection;
56229     };
56230     section.disclosure = function() {
56231       return _disclosure;
56232     };
56233     function renderContent(selection2) {
56234       if (_shouldDisplay) {
56235         var shouldDisplay = _shouldDisplay();
56236         selection2.classed("hide", !shouldDisplay);
56237         if (!shouldDisplay) {
56238           selection2.html("");
56239           return;
56240         }
56241       }
56242       if (_disclosureContent) {
56243         if (!_disclosure) {
56244           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
56245         }
56246         if (_disclosureExpanded !== void 0) {
56247           _disclosure.expanded(_disclosureExpanded);
56248           _disclosureExpanded = void 0;
56249         }
56250         selection2.call(_disclosure);
56251         return;
56252       }
56253       if (_content) {
56254         selection2.call(_content);
56255       }
56256     }
56257     return section;
56258   }
56259
56260   // modules/ui/tag_reference.js
56261   function uiTagReference(what) {
56262     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
56263     var tagReference = {};
56264     var _button = select_default2(null);
56265     var _body = select_default2(null);
56266     var _loaded;
56267     var _showing;
56268     function load() {
56269       if (!wikibase)
56270         return;
56271       _button.classed("tag-reference-loading", true);
56272       wikibase.getDocs(what, gotDocs);
56273     }
56274     function gotDocs(err, docs) {
56275       _body.html("");
56276       if (!docs || !docs.title) {
56277         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
56278         done();
56279         return;
56280       }
56281       if (docs.imageURL) {
56282         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
56283           done();
56284         }).on("error", function() {
56285           select_default2(this).remove();
56286           done();
56287         });
56288       } else {
56289         done();
56290       }
56291       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
56292       if (docs.description) {
56293         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
56294       } else {
56295         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
56296       }
56297       tagReferenceDescription.append("a").attr("class", "tag-reference-edit").attr("target", "_blank").attr("title", _t("inspector.edit_reference")).attr("href", docs.editURL).call(svgIcon("#iD-icon-edit", "inline"));
56298       if (docs.wiki) {
56299         _body.append("a").attr("class", "tag-reference-link").attr("target", "_blank").attr("href", docs.wiki.url).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append(docs.wiki.text));
56300       }
56301       if (what.key === "comment") {
56302         _body.append("a").attr("class", "tag-reference-comment-link").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", _t("commit.about_changeset_comments_link")).append("span").call(_t.append("commit.about_changeset_comments"));
56303       }
56304     }
56305     function done() {
56306       _loaded = true;
56307       _button.classed("tag-reference-loading", false);
56308       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
56309       _showing = true;
56310       _button.selectAll("svg.icon use").each(function() {
56311         var iconUse = select_default2(this);
56312         if (iconUse.attr("href") === "#iD-icon-info") {
56313           iconUse.attr("href", "#iD-icon-info-filled");
56314         }
56315       });
56316     }
56317     function hide() {
56318       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
56319         _body.classed("expanded", false);
56320       });
56321       _showing = false;
56322       _button.selectAll("svg.icon use").each(function() {
56323         var iconUse = select_default2(this);
56324         if (iconUse.attr("href") === "#iD-icon-info-filled") {
56325           iconUse.attr("href", "#iD-icon-info");
56326         }
56327       });
56328     }
56329     tagReference.button = function(selection2, klass, iconName) {
56330       _button = selection2.selectAll(".tag-reference-button").data([0]);
56331       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
56332       _button.on("click", function(d3_event) {
56333         d3_event.stopPropagation();
56334         d3_event.preventDefault();
56335         this.blur();
56336         if (_showing) {
56337           hide();
56338         } else if (_loaded) {
56339           done();
56340         } else {
56341           load();
56342         }
56343       });
56344     };
56345     tagReference.body = function(selection2) {
56346       var itemID = what.qid || what.key + "-" + (what.value || "");
56347       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
56348         return d;
56349       });
56350       _body.exit().remove();
56351       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
56352       if (_showing === false) {
56353         hide();
56354       }
56355     };
56356     tagReference.showing = function(val) {
56357       if (!arguments.length)
56358         return _showing;
56359       _showing = val;
56360       return tagReference;
56361     };
56362     return tagReference;
56363   }
56364
56365   // modules/ui/field_help.js
56366   function uiFieldHelp(context, fieldName) {
56367     var fieldHelp = {};
56368     var _inspector = select_default2(null);
56369     var _wrap = select_default2(null);
56370     var _body = select_default2(null);
56371     var fieldHelpKeys = {
56372       restrictions: [
56373         ["about", [
56374           "about",
56375           "from_via_to",
56376           "maxdist",
56377           "maxvia"
56378         ]],
56379         ["inspecting", [
56380           "about",
56381           "from_shadow",
56382           "allow_shadow",
56383           "restrict_shadow",
56384           "only_shadow",
56385           "restricted",
56386           "only"
56387         ]],
56388         ["modifying", [
56389           "about",
56390           "indicators",
56391           "allow_turn",
56392           "restrict_turn",
56393           "only_turn"
56394         ]],
56395         ["tips", [
56396           "simple",
56397           "simple_example",
56398           "indirect",
56399           "indirect_example",
56400           "indirect_noedit"
56401         ]]
56402       ]
56403     };
56404     var fieldHelpHeadings = {};
56405     var replacements = {
56406       distField: { html: _t.html("restriction.controls.distance") },
56407       viaField: { html: _t.html("restriction.controls.via") },
56408       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
56409       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
56410       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
56411       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
56412       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
56413       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
56414       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
56415     };
56416     var docs = fieldHelpKeys[fieldName].map(function(key) {
56417       var helpkey = "help.field." + fieldName + "." + key[0];
56418       var text2 = key[1].reduce(function(all, part) {
56419         var subkey = helpkey + "." + part;
56420         var depth = fieldHelpHeadings[subkey];
56421         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
56422         return all + hhh + _t.html(subkey, replacements) + "\n\n";
56423       }, "");
56424       return {
56425         key: helpkey,
56426         title: _t.html(helpkey + ".title"),
56427         html: marked(text2.trim())
56428       };
56429     });
56430     function show() {
56431       updatePosition();
56432       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
56433     }
56434     function hide() {
56435       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
56436         _body.classed("hide", true);
56437       });
56438     }
56439     function clickHelp(index) {
56440       var d = docs[index];
56441       var tkeys = fieldHelpKeys[fieldName][index][1];
56442       _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
56443         return i2 === index;
56444       });
56445       var content = _body.selectAll(".field-help-content").html(d.html);
56446       content.selectAll("p").attr("class", function(d2, i2) {
56447         return tkeys[i2];
56448       });
56449       if (d.key === "help.field.restrictions.inspecting") {
56450         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
56451       } else if (d.key === "help.field.restrictions.modifying") {
56452         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
56453       }
56454     }
56455     fieldHelp.button = function(selection2) {
56456       if (_body.empty())
56457         return;
56458       var button = selection2.selectAll(".field-help-button").data([0]);
56459       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
56460         d3_event.stopPropagation();
56461         d3_event.preventDefault();
56462         if (_body.classed("hide")) {
56463           show();
56464         } else {
56465           hide();
56466         }
56467       });
56468     };
56469     function updatePosition() {
56470       var wrap2 = _wrap.node();
56471       var inspector = _inspector.node();
56472       var wRect = wrap2.getBoundingClientRect();
56473       var iRect = inspector.getBoundingClientRect();
56474       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
56475     }
56476     fieldHelp.body = function(selection2) {
56477       _wrap = selection2.selectAll(".form-field-input-wrap");
56478       if (_wrap.empty())
56479         return;
56480       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
56481       if (_inspector.empty())
56482         return;
56483       _body = _inspector.selectAll(".field-help-body").data([0]);
56484       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
56485       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
56486       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
56487       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
56488         d3_event.stopPropagation();
56489         d3_event.preventDefault();
56490         hide();
56491       }).call(svgIcon("#iD-icon-close"));
56492       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
56493       var titles = docs.map(function(d) {
56494         return d.title;
56495       });
56496       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
56497         return d;
56498       }).on("click", function(d3_event, d) {
56499         d3_event.stopPropagation();
56500         d3_event.preventDefault();
56501         clickHelp(titles.indexOf(d));
56502       });
56503       enter.append("div").attr("class", "field-help-content");
56504       _body = _body.merge(enter);
56505       clickHelp(0);
56506     };
56507     return fieldHelp;
56508   }
56509
56510   // modules/ui/fields/check.js
56511   function uiFieldCheck(field, context) {
56512     var dispatch10 = dispatch_default("change");
56513     var options2 = field.options;
56514     var values = [];
56515     var texts = [];
56516     var _tags;
56517     var input = select_default2(null);
56518     var text2 = select_default2(null);
56519     var label = select_default2(null);
56520     var reverser = select_default2(null);
56521     var _impliedYes;
56522     var _entityIDs = [];
56523     var _value;
56524     if (options2) {
56525       for (var i2 in options2) {
56526         var v = options2[i2];
56527         values.push(v === "undefined" ? void 0 : v);
56528         texts.push(field.t.html("options." + v, { "default": v }));
56529       }
56530     } else {
56531       values = [void 0, "yes"];
56532       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
56533       if (field.type !== "defaultCheck") {
56534         values.push("no");
56535         texts.push(_t.html("inspector.check.no"));
56536       }
56537     }
56538     function checkImpliedYes() {
56539       _impliedYes = field.id === "oneway_yes";
56540       if (field.id === "oneway") {
56541         var entity = context.entity(_entityIDs[0]);
56542         for (var key in entity.tags) {
56543           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
56544             _impliedYes = true;
56545             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
56546             break;
56547           }
56548         }
56549       }
56550     }
56551     function reverserHidden() {
56552       if (!context.container().select("div.inspector-hover").empty())
56553         return true;
56554       return !(_value === "yes" || _impliedYes && !_value);
56555     }
56556     function reverserSetText(selection2) {
56557       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
56558       if (reverserHidden() || !entity)
56559         return selection2;
56560       var first = entity.first();
56561       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
56562       var pseudoDirection = first < last;
56563       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
56564       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
56565       return selection2;
56566     }
56567     var check = function(selection2) {
56568       checkImpliedYes();
56569       label = selection2.selectAll(".form-field-input-wrap").data([0]);
56570       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
56571       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
56572       enter.append("span").html(texts[0]).attr("class", "value");
56573       if (field.type === "onewayCheck") {
56574         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
56575       }
56576       label = label.merge(enter);
56577       input = label.selectAll("input");
56578       text2 = label.selectAll("span.value");
56579       input.on("click", function(d3_event) {
56580         d3_event.stopPropagation();
56581         var t = {};
56582         if (Array.isArray(_tags[field.key])) {
56583           if (values.indexOf("yes") !== -1) {
56584             t[field.key] = "yes";
56585           } else {
56586             t[field.key] = values[0];
56587           }
56588         } else {
56589           t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
56590         }
56591         if (t[field.key] === "reversible" || t[field.key] === "alternating") {
56592           t[field.key] = values[0];
56593         }
56594         dispatch10.call("change", this, t);
56595       });
56596       if (field.type === "onewayCheck") {
56597         reverser = label.selectAll(".reverser");
56598         reverser.call(reverserSetText).on("click", function(d3_event) {
56599           d3_event.preventDefault();
56600           d3_event.stopPropagation();
56601           context.perform(function(graph) {
56602             for (var i3 in _entityIDs) {
56603               graph = actionReverse(_entityIDs[i3])(graph);
56604             }
56605             return graph;
56606           }, _t("operations.reverse.annotation.line", { n: 1 }));
56607           context.validator().validate();
56608           select_default2(this).call(reverserSetText);
56609         });
56610       }
56611     };
56612     check.entityIDs = function(val) {
56613       if (!arguments.length)
56614         return _entityIDs;
56615       _entityIDs = val;
56616       return check;
56617     };
56618     check.tags = function(tags) {
56619       _tags = tags;
56620       function isChecked(val) {
56621         return val !== "no" && val !== "" && val !== void 0 && val !== null;
56622       }
56623       function textFor(val) {
56624         if (val === "")
56625           val = void 0;
56626         var index = values.indexOf(val);
56627         return index !== -1 ? texts[index] : '"' + val + '"';
56628       }
56629       checkImpliedYes();
56630       var isMixed = Array.isArray(tags[field.key]);
56631       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
56632       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
56633         _value = "yes";
56634       }
56635       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
56636       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
56637       label.classed("set", !!_value);
56638       if (field.type === "onewayCheck") {
56639         reverser.classed("hide", reverserHidden()).call(reverserSetText);
56640       }
56641     };
56642     check.focus = function() {
56643       input.node().focus();
56644     };
56645     return utilRebind(check, dispatch10, "on");
56646   }
56647
56648   // modules/ui/fields/combo.js
56649   function uiFieldCombo(field, context) {
56650     var dispatch10 = dispatch_default("change");
56651     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
56652     var _isNetwork = field.type === "networkCombo";
56653     var _isSemi = field.type === "semiCombo";
56654     var _optarray = field.options;
56655     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
56656     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
56657     var _snake_case = field.snake_case || field.snake_case === void 0;
56658     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(_isMulti || _isSemi ? 1 : 2);
56659     var _container = select_default2(null);
56660     var _inputWrap = select_default2(null);
56661     var _input = select_default2(null);
56662     var _comboData = [];
56663     var _multiData = [];
56664     var _entityIDs = [];
56665     var _tags;
56666     var _countryCode;
56667     var _staticPlaceholder;
56668     var _dataDeprecated = [];
56669     _mainFileFetcher.get("deprecated").then(function(d) {
56670       _dataDeprecated = d;
56671     }).catch(function() {
56672     });
56673     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
56674       field.key += ":";
56675     }
56676     function snake(s) {
56677       return s.replace(/\s+/g, "_").toLowerCase();
56678     }
56679     function clean2(s) {
56680       return s.split(";").map(function(s2) {
56681         return s2.trim();
56682       }).join(";");
56683     }
56684     function tagValue(dval) {
56685       dval = clean2(dval || "");
56686       var found = _comboData.find(function(o) {
56687         return o.key && clean2(o.value) === dval;
56688       });
56689       if (found)
56690         return found.key;
56691       if (field.type === "typeCombo" && !dval) {
56692         return "yes";
56693       }
56694       return (_snake_case ? snake(dval) : dval) || void 0;
56695     }
56696     function displayValue(tval) {
56697       tval = tval || "";
56698       if (field.hasTextForStringId("options." + tval)) {
56699         return field.t("options." + tval, { default: tval });
56700       }
56701       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
56702         return "";
56703       }
56704       return tval;
56705     }
56706     function objectDifference(a, b) {
56707       return a.filter(function(d1) {
56708         return !b.some(function(d2) {
56709           return !d2.isMixed && d1.value === d2.value;
56710         });
56711       });
56712     }
56713     function initCombo(selection2, attachTo) {
56714       if (!_allowCustomValues) {
56715         selection2.attr("readonly", "readonly");
56716       }
56717       if (_showTagInfoSuggestions && services.taginfo) {
56718         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
56719         setTaginfoValues("", setPlaceholder);
56720       } else {
56721         selection2.call(_combobox, attachTo);
56722         setStaticValues(setPlaceholder);
56723       }
56724     }
56725     function setStaticValues(callback) {
56726       if (!_optarray)
56727         return;
56728       _comboData = _optarray.map(function(v) {
56729         return {
56730           key: v,
56731           value: field.t("options." + v, { default: v }),
56732           title: v,
56733           display: field.t.html("options." + v, { default: v }),
56734           klass: field.hasTextForStringId("options." + v) ? "" : "raw-option"
56735         };
56736       });
56737       _combobox.data(objectDifference(_comboData, _multiData));
56738       if (callback)
56739         callback(_comboData);
56740     }
56741     function setTaginfoValues(q, callback) {
56742       var fn = _isMulti ? "multikeys" : "values";
56743       var query = (_isMulti ? field.key : "") + q;
56744       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
56745       if (hasCountryPrefix) {
56746         query = _countryCode + ":";
56747       }
56748       var params = {
56749         debounce: q !== "",
56750         key: field.key,
56751         query
56752       };
56753       if (_entityIDs.length) {
56754         params.geometry = context.graph().geometry(_entityIDs[0]);
56755       }
56756       services.taginfo[fn](params, function(err, data) {
56757         if (err)
56758           return;
56759         data = data.filter(function(d) {
56760           if (field.type === "typeCombo" && d.value === "yes") {
56761             return false;
56762           }
56763           return !d.count || d.count > 10;
56764         });
56765         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
56766         if (deprecatedValues) {
56767           data = data.filter(function(d) {
56768             return deprecatedValues.indexOf(d.value) === -1;
56769           });
56770         }
56771         if (hasCountryPrefix) {
56772           data = data.filter(function(d) {
56773             return d.value.toLowerCase().indexOf(_countryCode + ":") === 0;
56774           });
56775         }
56776         _container.classed("empty-combobox", data.length === 0);
56777         _comboData = data.map(function(d) {
56778           var k = d.value;
56779           if (_isMulti)
56780             k = k.replace(field.key, "");
56781           var label = field.t("options." + k, { default: k });
56782           return {
56783             key: k,
56784             value: label,
56785             display: field.t.html("options." + k, { default: k }),
56786             title: d.title || label,
56787             klass: field.hasTextForStringId("options." + k) ? "" : "raw-option"
56788           };
56789         });
56790         _comboData = objectDifference(_comboData, _multiData);
56791         if (callback)
56792           callback(_comboData);
56793       });
56794     }
56795     function setPlaceholder(values) {
56796       if (_isMulti || _isSemi) {
56797         _staticPlaceholder = field.placeholder() || _t("inspector.add");
56798       } else {
56799         var vals = values.map(function(d) {
56800           return d.value;
56801         }).filter(function(s) {
56802           return s.length < 20;
56803         });
56804         var placeholders = vals.length > 1 ? vals : values.map(function(d) {
56805           return d.key;
56806         });
56807         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
56808       }
56809       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
56810         _staticPlaceholder += "\u2026";
56811       }
56812       var ph;
56813       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
56814         ph = _t("inspector.multiple_values");
56815       } else {
56816         ph = _staticPlaceholder;
56817       }
56818       _container.selectAll("input").attr("placeholder", ph);
56819     }
56820     function change() {
56821       var t = {};
56822       var val;
56823       if (_isMulti || _isSemi) {
56824         val = tagValue(utilGetSetValue(_input).replace(/,/g, ";")) || "";
56825         _container.classed("active", false);
56826         utilGetSetValue(_input, "");
56827         var vals = val.split(";").filter(Boolean);
56828         if (!vals.length)
56829           return;
56830         if (_isMulti) {
56831           utilArrayUniq(vals).forEach(function(v) {
56832             var key = (field.key || "") + v;
56833             if (_tags) {
56834               var old = _tags[key];
56835               if (typeof old === "string" && old.toLowerCase() !== "no")
56836                 return;
56837             }
56838             key = context.cleanTagKey(key);
56839             field.keys.push(key);
56840             t[key] = "yes";
56841           });
56842         } else if (_isSemi) {
56843           var arr = _multiData.map(function(d) {
56844             return d.key;
56845           });
56846           arr = arr.concat(vals);
56847           t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
56848         }
56849         window.setTimeout(function() {
56850           _input.node().focus();
56851         }, 10);
56852       } else {
56853         var rawValue = utilGetSetValue(_input);
56854         if (!rawValue && Array.isArray(_tags[field.key]))
56855           return;
56856         val = context.cleanTagValue(tagValue(rawValue));
56857         t[field.key] = val || void 0;
56858       }
56859       dispatch10.call("change", this, t);
56860     }
56861     function removeMultikey(d3_event, d) {
56862       d3_event.preventDefault();
56863       d3_event.stopPropagation();
56864       var t = {};
56865       if (_isMulti) {
56866         t[d.key] = void 0;
56867       } else if (_isSemi) {
56868         var arr = _multiData.map(function(md) {
56869           return md.key === d.key ? null : md.key;
56870         }).filter(Boolean);
56871         arr = utilArrayUniq(arr);
56872         t[field.key] = arr.length ? arr.join(";") : void 0;
56873       }
56874       dispatch10.call("change", this, t);
56875     }
56876     function combo(selection2) {
56877       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
56878       var type3 = _isMulti || _isSemi ? "multicombo" : "combo";
56879       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type3).merge(_container);
56880       if (_isMulti || _isSemi) {
56881         _container = _container.selectAll(".chiplist").data([0]);
56882         var listClass = "chiplist";
56883         if (field.key === "destination" || field.key === "via") {
56884           listClass += " full-line-chips";
56885         }
56886         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
56887           window.setTimeout(function() {
56888             _input.node().focus();
56889           }, 10);
56890         }).merge(_container);
56891         _inputWrap = _container.selectAll(".input-wrap").data([0]);
56892         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
56893         _input = _inputWrap.selectAll("input").data([0]);
56894       } else {
56895         _input = _container.selectAll("input").data([0]);
56896       }
56897       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
56898       if (_isNetwork) {
56899         var extent = combinedEntityExtent();
56900         var countryCode = extent && iso1A2Code(extent.center());
56901         _countryCode = countryCode && countryCode.toLowerCase();
56902       }
56903       _input.on("change", change).on("blur", change);
56904       _input.on("keydown.field", function(d3_event) {
56905         switch (d3_event.keyCode) {
56906           case 13:
56907             _input.node().blur();
56908             d3_event.stopPropagation();
56909             break;
56910         }
56911       });
56912       if (_isMulti || _isSemi) {
56913         _combobox.on("accept", function() {
56914           _input.node().blur();
56915           _input.node().focus();
56916         });
56917         _input.on("focus", function() {
56918           _container.classed("active", true);
56919         });
56920       }
56921     }
56922     combo.tags = function(tags) {
56923       _tags = tags;
56924       if (_isMulti || _isSemi) {
56925         _multiData = [];
56926         var maxLength;
56927         if (_isMulti) {
56928           for (var k in tags) {
56929             if (field.key && k.indexOf(field.key) !== 0)
56930               continue;
56931             if (!field.key && field.keys.indexOf(k) === -1)
56932               continue;
56933             var v = tags[k];
56934             if (!v || typeof v === "string" && v.toLowerCase() === "no")
56935               continue;
56936             var suffix = field.key ? k.substr(field.key.length) : k;
56937             _multiData.push({
56938               key: k,
56939               value: displayValue(suffix),
56940               isMixed: Array.isArray(v)
56941             });
56942           }
56943           if (field.key) {
56944             field.keys = _multiData.map(function(d) {
56945               return d.key;
56946             });
56947             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
56948           } else {
56949             maxLength = context.maxCharsForTagKey();
56950           }
56951         } else if (_isSemi) {
56952           var allValues = [];
56953           var commonValues;
56954           if (Array.isArray(tags[field.key])) {
56955             tags[field.key].forEach(function(tagVal) {
56956               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
56957               allValues = allValues.concat(thisVals);
56958               if (!commonValues) {
56959                 commonValues = thisVals;
56960               } else {
56961                 commonValues = commonValues.filter((value) => thisVals.includes(value));
56962               }
56963             });
56964             allValues = utilArrayUniq(allValues).filter(Boolean);
56965           } else {
56966             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
56967             commonValues = allValues;
56968           }
56969           _multiData = allValues.map(function(v2) {
56970             return {
56971               key: v2,
56972               value: displayValue(v2),
56973               isMixed: !commonValues.includes(v2)
56974             };
56975           });
56976           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
56977           maxLength = context.maxCharsForTagValue() - currLength;
56978           if (currLength > 0) {
56979             maxLength -= 1;
56980           }
56981         }
56982         maxLength = Math.max(0, maxLength);
56983         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
56984         var available = objectDifference(_comboData, _multiData);
56985         _combobox.data(available);
56986         var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0;
56987         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
56988         var chips = _container.selectAll(".chip").data(_multiData);
56989         chips.exit().remove();
56990         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
56991         enter.append("span");
56992         enter.append("a");
56993         chips = chips.merge(enter).order().classed("raw-value", function(d) {
56994           var k2 = d.key;
56995           if (_isMulti)
56996             k2 = k2.replace(field.key, "");
56997           return !field.hasTextForStringId("options." + k2);
56998         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
56999           return d.isMixed;
57000         }).attr("title", function(d) {
57001           return d.isMixed ? _t("inspector.unshared_value_tooltip") : null;
57002         });
57003         if (allowDragAndDrop) {
57004           registerDragAndDrop(chips);
57005         }
57006         chips.select("span").text(function(d) {
57007           return d.value;
57008         });
57009         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
57010       } else {
57011         var isMixed = Array.isArray(tags[field.key]);
57012         var mixedValues = isMixed && tags[field.key].map(function(val) {
57013           return displayValue(val);
57014         }).filter(Boolean);
57015         var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes");
57016         var isRawValue = showsValue && !field.hasTextForStringId("options." + tags[field.key]);
57017         var isKnownValue = showsValue && !isRawValue;
57018         var isReadOnly = !_allowCustomValues || isKnownValue;
57019         utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
57020           if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
57021             d3_event.preventDefault();
57022             d3_event.stopPropagation();
57023             var t = {};
57024             t[field.key] = void 0;
57025             dispatch10.call("change", this, t);
57026           }
57027         });
57028       }
57029     };
57030     function registerDragAndDrop(selection2) {
57031       var dragOrigin, targetIndex;
57032       selection2.call(drag_default().on("start", function(d3_event) {
57033         dragOrigin = {
57034           x: d3_event.x,
57035           y: d3_event.y
57036         };
57037         targetIndex = null;
57038       }).on("drag", function(d3_event) {
57039         var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
57040         if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
57041           return;
57042         var index = selection2.nodes().indexOf(this);
57043         select_default2(this).classed("dragging", true);
57044         targetIndex = null;
57045         var targetIndexOffsetTop = null;
57046         var draggedTagWidth = select_default2(this).node().offsetWidth;
57047         if (field.key === "destination" || field.key === "via") {
57048           _container.selectAll(".chip").style("transform", function(d2, index2) {
57049             var node = select_default2(this).node();
57050             if (index === index2) {
57051               return "translate(" + x + "px, " + y + "px)";
57052             } else if (index2 > index && d3_event.y > node.offsetTop) {
57053               if (targetIndex === null || index2 > targetIndex) {
57054                 targetIndex = index2;
57055               }
57056               return "translateY(-100%)";
57057             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
57058               if (targetIndex === null || index2 < targetIndex) {
57059                 targetIndex = index2;
57060               }
57061               return "translateY(100%)";
57062             }
57063             return null;
57064           });
57065         } else {
57066           _container.selectAll(".chip").each(function(d2, index2) {
57067             var node = select_default2(this).node();
57068             if (index !== index2 && d3_event.x < node.offsetLeft + node.offsetWidth + 5 && d3_event.x > node.offsetLeft && d3_event.y < node.offsetTop + node.offsetHeight && d3_event.y > node.offsetTop) {
57069               targetIndex = index2;
57070               targetIndexOffsetTop = node.offsetTop;
57071             }
57072           }).style("transform", function(d2, index2) {
57073             var node = select_default2(this).node();
57074             if (index === index2) {
57075               return "translate(" + x + "px, " + y + "px)";
57076             }
57077             if (node.offsetTop === targetIndexOffsetTop) {
57078               if (index2 < index && index2 >= targetIndex) {
57079                 return "translateX(" + draggedTagWidth + "px)";
57080               } else if (index2 > index && index2 <= targetIndex) {
57081                 return "translateX(-" + draggedTagWidth + "px)";
57082               }
57083             }
57084             return null;
57085           });
57086         }
57087       }).on("end", function() {
57088         if (!select_default2(this).classed("dragging")) {
57089           return;
57090         }
57091         var index = selection2.nodes().indexOf(this);
57092         select_default2(this).classed("dragging", false);
57093         _container.selectAll(".chip").style("transform", null);
57094         if (typeof targetIndex === "number") {
57095           var element = _multiData[index];
57096           _multiData.splice(index, 1);
57097           _multiData.splice(targetIndex, 0, element);
57098           var t = {};
57099           if (_multiData.length) {
57100             t[field.key] = _multiData.map(function(element2) {
57101               return element2.key;
57102             }).join(";");
57103           } else {
57104             t[field.key] = void 0;
57105           }
57106           dispatch10.call("change", this, t);
57107         }
57108         dragOrigin = void 0;
57109         targetIndex = void 0;
57110       }));
57111     }
57112     combo.focus = function() {
57113       _input.node().focus();
57114     };
57115     combo.entityIDs = function(val) {
57116       if (!arguments.length)
57117         return _entityIDs;
57118       _entityIDs = val;
57119       return combo;
57120     };
57121     function combinedEntityExtent() {
57122       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57123     }
57124     return utilRebind(combo, dispatch10, "on");
57125   }
57126
57127   // modules/ui/fields/input.js
57128   function uiFieldText(field, context) {
57129     var dispatch10 = dispatch_default("change");
57130     var input = select_default2(null);
57131     var outlinkButton = select_default2(null);
57132     var wrap2 = select_default2(null);
57133     var _entityIDs = [];
57134     var _tags;
57135     var _phoneFormats = {};
57136     if (field.type === "tel") {
57137       _mainFileFetcher.get("phone_formats").then(function(d) {
57138         _phoneFormats = d;
57139         updatePhonePlaceholder();
57140       }).catch(function() {
57141       });
57142     }
57143     function calcLocked() {
57144       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
57145         var entity = context.graph().hasEntity(entityID);
57146         if (!entity)
57147           return false;
57148         if (entity.tags.wikidata)
57149           return true;
57150         var preset = _mainPresetIndex.match(entity, context.graph());
57151         var isSuggestion = preset && preset.suggestion;
57152         var which = field.id;
57153         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
57154       });
57155       field.locked(isLocked);
57156     }
57157     function i2(selection2) {
57158       calcLocked();
57159       var isLocked = field.locked();
57160       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57161       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57162       input = wrap2.selectAll("input").data([0]);
57163       input = input.enter().append("input").attr("type", field.type === "identifier" ? "text" : field.type).attr("id", field.domId).classed(field.type, true).call(utilNoAuto).merge(input);
57164       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
57165       if (field.type === "tel") {
57166         updatePhonePlaceholder();
57167       } else if (field.type === "number") {
57168         var rtl = _mainLocalizer.textDirection() === "rtl";
57169         input.attr("type", "text");
57170         var inc = field.increment;
57171         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
57172         buttons.enter().append("button").attr("class", function(d) {
57173           var which = d > 0 ? "increment" : "decrement";
57174           return "form-field-button " + which;
57175         }).attr("title", function(d) {
57176           var which = d > 0 ? "increment" : "decrement";
57177           return _t(`inspector.${which}`);
57178         }).merge(buttons).on("click", function(d3_event, d) {
57179           d3_event.preventDefault();
57180           var raw_vals = input.node().value || "0";
57181           var vals = raw_vals.split(";");
57182           vals = vals.map(function(v) {
57183             var num = parseFloat(v.trim(), 10);
57184             return isFinite(num) ? clamped(num + d) : v.trim();
57185           });
57186           input.node().value = vals.join(";");
57187           change()();
57188         });
57189       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
57190         input.attr("type", "text");
57191         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
57192         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
57193           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
57194           if (domainResults.length >= 2 && domainResults[1]) {
57195             var domain2 = domainResults[1];
57196             return _t("icons.view_on", { domain: domain2 });
57197           }
57198           return "";
57199         }).on("click", function(d3_event) {
57200           d3_event.preventDefault();
57201           var value = validIdentifierValueForLink();
57202           if (value) {
57203             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
57204             window.open(url, "_blank");
57205           }
57206         }).merge(outlinkButton);
57207       } else if (field.type === "url") {
57208         input.attr("type", "text");
57209         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
57210         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).on("click", function(d3_event) {
57211           d3_event.preventDefault();
57212           const value = validIdentifierValueForLink();
57213           if (value)
57214             window.open(value, "_blank");
57215         }).merge(outlinkButton);
57216       } else if (field.key.split(":").includes("colour")) {
57217         input.attr("type", "text");
57218         updateColourPreview();
57219       }
57220     }
57221     function isColourValid(colour) {
57222       if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
57223         return false;
57224       } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) {
57225         return false;
57226       }
57227       return true;
57228     }
57229     function updateColourPreview() {
57230       wrap2.selectAll(".colour-preview").remove();
57231       const colour = utilGetSetValue(input);
57232       if (!isColourValid(colour) && colour !== "")
57233         return;
57234       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
57235       outlinkButton = wrap2.selectAll(".colour-preview").data([colour]);
57236       colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) {
57237         d3_event.preventDefault();
57238         var colour2 = this.value;
57239         if (!isColourValid(colour2))
57240           return;
57241         utilGetSetValue(input, this.value);
57242         change()();
57243         updateColourPreview();
57244       }, 100));
57245       outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
57246       if (colour === "") {
57247         outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit"));
57248       }
57249       outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton);
57250     }
57251     function updatePhonePlaceholder() {
57252       if (input.empty() || !Object.keys(_phoneFormats).length)
57253         return;
57254       var extent = combinedEntityExtent();
57255       var countryCode = extent && iso1A2Code(extent.center());
57256       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
57257       if (format2)
57258         input.attr("placeholder", format2);
57259     }
57260     function validIdentifierValueForLink() {
57261       const value = utilGetSetValue(input).trim();
57262       if (field.type === "url" && value) {
57263         try {
57264           return new URL(value).href;
57265         } catch (e) {
57266           return null;
57267         }
57268       }
57269       if (field.type === "identifier" && field.pattern) {
57270         return value && value.match(new RegExp(field.pattern))[0];
57271       }
57272       return null;
57273     }
57274     function clamped(num) {
57275       if (field.minValue !== void 0) {
57276         num = Math.max(num, field.minValue);
57277       }
57278       if (field.maxValue !== void 0) {
57279         num = Math.min(num, field.maxValue);
57280       }
57281       return num;
57282     }
57283     function change(onInput) {
57284       return function() {
57285         var t = {};
57286         var val = utilGetSetValue(input);
57287         if (!onInput)
57288           val = context.cleanTagValue(val);
57289         if (!val && Array.isArray(_tags[field.key]))
57290           return;
57291         if (!onInput) {
57292           if (field.type === "number" && val) {
57293             var vals = val.split(";");
57294             vals = vals.map(function(v) {
57295               var num = parseFloat(v.trim(), 10);
57296               return isFinite(num) ? clamped(num) : v.trim();
57297             });
57298             val = vals.join(";");
57299           }
57300           utilGetSetValue(input, val);
57301         }
57302         t[field.key] = val || void 0;
57303         dispatch10.call("change", this, t, onInput);
57304       };
57305     }
57306     i2.entityIDs = function(val) {
57307       if (!arguments.length)
57308         return _entityIDs;
57309       _entityIDs = val;
57310       return i2;
57311     };
57312     i2.tags = function(tags) {
57313       _tags = tags;
57314       var isMixed = Array.isArray(tags[field.key]);
57315       utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
57316       if (field.key.split(":").includes("colour"))
57317         updateColourPreview();
57318       if (outlinkButton && !outlinkButton.empty()) {
57319         var disabled = !validIdentifierValueForLink();
57320         outlinkButton.classed("disabled", disabled);
57321       }
57322     };
57323     i2.focus = function() {
57324       var node = input.node();
57325       if (node)
57326         node.focus();
57327     };
57328     function combinedEntityExtent() {
57329       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57330     }
57331     return utilRebind(i2, dispatch10, "on");
57332   }
57333
57334   // modules/ui/fields/access.js
57335   function uiFieldAccess(field, context) {
57336     var dispatch10 = dispatch_default("change");
57337     var items = select_default2(null);
57338     var _tags;
57339     function access(selection2) {
57340       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57341       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57342       var list = wrap2.selectAll("ul").data([0]);
57343       list = list.enter().append("ul").attr("class", "rows").merge(list);
57344       items = list.selectAll("li").data(field.keys);
57345       var enter = items.enter().append("li").attr("class", function(d) {
57346         return "labeled-input preset-access-" + d;
57347       });
57348       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
57349         return "preset-input-access-" + d;
57350       }).html(function(d) {
57351         return field.t.html("types." + d);
57352       });
57353       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
57354         return "preset-input-access preset-input-access-" + d;
57355       }).call(utilNoAuto).each(function(d) {
57356         select_default2(this).call(uiCombobox(context, "access-" + d).data(access.options(d)));
57357       });
57358       items = items.merge(enter);
57359       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
57360     }
57361     function change(d3_event, d) {
57362       var tag = {};
57363       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
57364       if (!value && typeof _tags[d] !== "string")
57365         return;
57366       tag[d] = value || void 0;
57367       dispatch10.call("change", this, tag);
57368     }
57369     access.options = function(type3) {
57370       var options2 = [
57371         "yes",
57372         "no",
57373         "designated",
57374         "permissive",
57375         "destination",
57376         "customers",
57377         "private",
57378         "permit",
57379         "unknown"
57380       ];
57381       if (type3 === "access") {
57382         options2 = options2.filter((v) => v !== "yes" && v !== "designated");
57383       }
57384       if (type3 === "bicycle") {
57385         options2.splice(options2.length - 4, 0, "dismount");
57386       }
57387       return options2.map(function(option) {
57388         return {
57389           title: field.t("options." + option + ".description"),
57390           value: option
57391         };
57392       });
57393     };
57394     var placeholdersByHighway = {
57395       footway: {
57396         foot: "designated",
57397         motor_vehicle: "no"
57398       },
57399       steps: {
57400         foot: "yes",
57401         motor_vehicle: "no",
57402         bicycle: "no",
57403         horse: "no"
57404       },
57405       pedestrian: {
57406         foot: "yes",
57407         motor_vehicle: "no"
57408       },
57409       cycleway: {
57410         motor_vehicle: "no",
57411         bicycle: "designated"
57412       },
57413       bridleway: {
57414         motor_vehicle: "no",
57415         horse: "designated"
57416       },
57417       path: {
57418         foot: "yes",
57419         motor_vehicle: "no",
57420         bicycle: "yes",
57421         horse: "yes"
57422       },
57423       motorway: {
57424         foot: "no",
57425         motor_vehicle: "yes",
57426         bicycle: "no",
57427         horse: "no"
57428       },
57429       trunk: {
57430         motor_vehicle: "yes"
57431       },
57432       primary: {
57433         foot: "yes",
57434         motor_vehicle: "yes",
57435         bicycle: "yes",
57436         horse: "yes"
57437       },
57438       secondary: {
57439         foot: "yes",
57440         motor_vehicle: "yes",
57441         bicycle: "yes",
57442         horse: "yes"
57443       },
57444       tertiary: {
57445         foot: "yes",
57446         motor_vehicle: "yes",
57447         bicycle: "yes",
57448         horse: "yes"
57449       },
57450       residential: {
57451         foot: "yes",
57452         motor_vehicle: "yes",
57453         bicycle: "yes",
57454         horse: "yes"
57455       },
57456       unclassified: {
57457         foot: "yes",
57458         motor_vehicle: "yes",
57459         bicycle: "yes",
57460         horse: "yes"
57461       },
57462       service: {
57463         foot: "yes",
57464         motor_vehicle: "yes",
57465         bicycle: "yes",
57466         horse: "yes"
57467       },
57468       motorway_link: {
57469         foot: "no",
57470         motor_vehicle: "yes",
57471         bicycle: "no",
57472         horse: "no"
57473       },
57474       trunk_link: {
57475         motor_vehicle: "yes"
57476       },
57477       primary_link: {
57478         foot: "yes",
57479         motor_vehicle: "yes",
57480         bicycle: "yes",
57481         horse: "yes"
57482       },
57483       secondary_link: {
57484         foot: "yes",
57485         motor_vehicle: "yes",
57486         bicycle: "yes",
57487         horse: "yes"
57488       },
57489       tertiary_link: {
57490         foot: "yes",
57491         motor_vehicle: "yes",
57492         bicycle: "yes",
57493         horse: "yes"
57494       },
57495       construction: {
57496         access: "no"
57497       }
57498     };
57499     access.tags = function(tags) {
57500       _tags = tags;
57501       utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
57502         return typeof tags[d] === "string" ? tags[d] : "";
57503       }).classed("mixed", function(d) {
57504         return tags[d] && Array.isArray(tags[d]);
57505       }).attr("title", function(d) {
57506         return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
57507       }).attr("placeholder", function(d) {
57508         if (tags[d] && Array.isArray(tags[d])) {
57509           return _t("inspector.multiple_values");
57510         }
57511         if (d === "bicycle" || d === "motor_vehicle") {
57512           if (tags.vehicle && typeof tags.vehicle === "string") {
57513             return tags.vehicle;
57514           }
57515         }
57516         if (tags.access && typeof tags.access === "string") {
57517           return tags.access;
57518         }
57519         if (tags.highway) {
57520           if (typeof tags.highway === "string") {
57521             if (placeholdersByHighway[tags.highway] && placeholdersByHighway[tags.highway][d]) {
57522               return placeholdersByHighway[tags.highway][d];
57523             }
57524           } else {
57525             var impliedAccesses = tags.highway.filter(Boolean).map(function(highwayVal) {
57526               return placeholdersByHighway[highwayVal] && placeholdersByHighway[highwayVal][d];
57527             }).filter(Boolean);
57528             if (impliedAccesses.length === tags.highway.length && new Set(impliedAccesses).size === 1) {
57529               return impliedAccesses[0];
57530             }
57531           }
57532         }
57533         if (d === "access") {
57534           return "yes";
57535         }
57536         return field.placeholder();
57537       });
57538     };
57539     access.focus = function() {
57540       items.selectAll(".preset-input-access").node().focus();
57541     };
57542     return utilRebind(access, dispatch10, "on");
57543   }
57544
57545   // modules/ui/fields/address.js
57546   function uiFieldAddress(field, context) {
57547     var dispatch10 = dispatch_default("change");
57548     var _selection = select_default2(null);
57549     var _wrap = select_default2(null);
57550     var addrField = _mainPresetIndex.field("address");
57551     var _entityIDs = [];
57552     var _tags;
57553     var _countryCode;
57554     var _addressFormats = [{
57555       format: [
57556         ["housenumber", "street"],
57557         ["city", "postcode"]
57558       ]
57559     }];
57560     _mainFileFetcher.get("address_formats").then(function(d) {
57561       _addressFormats = d;
57562       if (!_selection.empty()) {
57563         _selection.call(address);
57564       }
57565     }).catch(function() {
57566     });
57567     function getNearStreets() {
57568       var extent = combinedEntityExtent();
57569       var l = extent.center();
57570       var box = geoExtent(l).padByMeters(200);
57571       var streets = context.history().intersects(box).filter(isAddressable).map(function(d) {
57572         var loc = context.projection([
57573           (extent[0][0] + extent[1][0]) / 2,
57574           (extent[0][1] + extent[1][1]) / 2
57575         ]);
57576         var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
57577         return {
57578           title: d.tags.name,
57579           value: d.tags.name,
57580           dist: choice.distance
57581         };
57582       }).sort(function(a, b) {
57583         return a.dist - b.dist;
57584       });
57585       return utilArrayUniqBy(streets, "value");
57586       function isAddressable(d) {
57587         return d.tags.highway && d.tags.name && d.type === "way";
57588       }
57589     }
57590     function getNearCities() {
57591       var extent = combinedEntityExtent();
57592       var l = extent.center();
57593       var box = geoExtent(l).padByMeters(200);
57594       var cities = context.history().intersects(box).filter(isAddressable).map(function(d) {
57595         return {
57596           title: d.tags["addr:city"] || d.tags.name,
57597           value: d.tags["addr:city"] || d.tags.name,
57598           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
57599         };
57600       }).sort(function(a, b) {
57601         return a.dist - b.dist;
57602       });
57603       return utilArrayUniqBy(cities, "value");
57604       function isAddressable(d) {
57605         if (d.tags.name) {
57606           if (d.tags.admin_level === "8" && d.tags.boundary === "administrative")
57607             return true;
57608           if (d.tags.border_type === "city")
57609             return true;
57610           if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
57611             return true;
57612         }
57613         if (d.tags["addr:city"])
57614           return true;
57615         return false;
57616       }
57617     }
57618     function getNearValues(key) {
57619       var extent = combinedEntityExtent();
57620       var l = extent.center();
57621       var box = geoExtent(l).padByMeters(200);
57622       var results = context.history().intersects(box).filter(function hasTag(d) {
57623         return _entityIDs.indexOf(d.id) === -1 && d.tags[key];
57624       }).map(function(d) {
57625         return {
57626           title: d.tags[key],
57627           value: d.tags[key],
57628           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
57629         };
57630       }).sort(function(a, b) {
57631         return a.dist - b.dist;
57632       });
57633       return utilArrayUniqBy(results, "value");
57634     }
57635     function updateForCountryCode() {
57636       if (!_countryCode)
57637         return;
57638       var addressFormat;
57639       for (var i2 = 0; i2 < _addressFormats.length; i2++) {
57640         var format2 = _addressFormats[i2];
57641         if (!format2.countryCodes) {
57642           addressFormat = format2;
57643         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
57644           addressFormat = format2;
57645           break;
57646         }
57647       }
57648       var dropdowns = addressFormat.dropdowns || [
57649         "city",
57650         "county",
57651         "country",
57652         "district",
57653         "hamlet",
57654         "neighbourhood",
57655         "place",
57656         "postcode",
57657         "province",
57658         "quarter",
57659         "state",
57660         "street",
57661         "subdistrict",
57662         "suburb"
57663       ];
57664       var widths = addressFormat.widths || {
57665         housenumber: 1 / 3,
57666         street: 2 / 3,
57667         city: 2 / 3,
57668         state: 1 / 4,
57669         postcode: 1 / 3
57670       };
57671       function row(r) {
57672         var total = r.reduce(function(sum, key) {
57673           return sum + (widths[key] || 0.5);
57674         }, 0);
57675         return r.map(function(key) {
57676           return {
57677             id: key,
57678             width: (widths[key] || 0.5) / total
57679           };
57680         });
57681       }
57682       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
57683         return d.toString();
57684       });
57685       rows.exit().remove();
57686       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
57687         return "addr-" + d.id;
57688       }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
57689         return d.width * 100 + "%";
57690       });
57691       function addDropdown(d) {
57692         if (dropdowns.indexOf(d.id) === -1)
57693           return;
57694         var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues;
57695         select_default2(this).call(uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) {
57696           callback(nearValues("addr:" + d.id));
57697         }));
57698       }
57699       _wrap.selectAll("input").on("blur", change()).on("change", change());
57700       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
57701       if (_tags)
57702         updateTags(_tags);
57703     }
57704     function address(selection2) {
57705       _selection = selection2;
57706       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
57707       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
57708       var extent = combinedEntityExtent();
57709       if (extent) {
57710         var countryCode;
57711         if (context.inIntro()) {
57712           countryCode = _t("intro.graph.countrycode");
57713         } else {
57714           var center = extent.center();
57715           countryCode = iso1A2Code(center);
57716         }
57717         if (countryCode) {
57718           _countryCode = countryCode.toLowerCase();
57719           updateForCountryCode();
57720         }
57721       }
57722     }
57723     function change(onInput) {
57724       return function() {
57725         var tags = {};
57726         _wrap.selectAll("input").each(function(subfield) {
57727           var key = field.key + ":" + subfield.id;
57728           var value = this.value;
57729           if (!onInput)
57730             value = context.cleanTagValue(value);
57731           if (Array.isArray(_tags[key]) && !value)
57732             return;
57733           tags[key] = value || void 0;
57734         });
57735         dispatch10.call("change", this, tags, onInput);
57736       };
57737     }
57738     function updatePlaceholder(inputSelection) {
57739       return inputSelection.attr("placeholder", function(subfield) {
57740         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
57741           return _t("inspector.multiple_values");
57742         }
57743         if (_countryCode) {
57744           var localkey = subfield.id + "!" + _countryCode;
57745           var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id;
57746           return addrField.t("placeholders." + tkey);
57747         }
57748       });
57749     }
57750     function updateTags(tags) {
57751       utilGetSetValue(_wrap.selectAll("input"), function(subfield) {
57752         var val = tags[field.key + ":" + subfield.id];
57753         return typeof val === "string" ? val : "";
57754       }).attr("title", function(subfield) {
57755         var val = tags[field.key + ":" + subfield.id];
57756         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
57757       }).classed("mixed", function(subfield) {
57758         return Array.isArray(tags[field.key + ":" + subfield.id]);
57759       }).call(updatePlaceholder);
57760     }
57761     function combinedEntityExtent() {
57762       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57763     }
57764     address.entityIDs = function(val) {
57765       if (!arguments.length)
57766         return _entityIDs;
57767       _entityIDs = val;
57768       return address;
57769     };
57770     address.tags = function(tags) {
57771       _tags = tags;
57772       updateTags(tags);
57773     };
57774     address.focus = function() {
57775       var node = _wrap.selectAll("input").node();
57776       if (node)
57777         node.focus();
57778     };
57779     return utilRebind(address, dispatch10, "on");
57780   }
57781
57782   // modules/ui/fields/cycleway.js
57783   function uiFieldCycleway(field, context) {
57784     var dispatch10 = dispatch_default("change");
57785     var items = select_default2(null);
57786     var wrap2 = select_default2(null);
57787     var _tags;
57788     function cycleway(selection2) {
57789       function stripcolon(s) {
57790         return s.replace(":", "");
57791       }
57792       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57793       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57794       var div = wrap2.selectAll("ul").data([0]);
57795       div = div.enter().append("ul").attr("class", "rows").merge(div);
57796       var keys = ["cycleway:left", "cycleway:right"];
57797       items = div.selectAll("li").data(keys);
57798       var enter = items.enter().append("li").attr("class", function(d) {
57799         return "labeled-input preset-cycleway-" + stripcolon(d);
57800       });
57801       enter.append("span").attr("class", "label preset-label-cycleway").attr("for", function(d) {
57802         return "preset-input-cycleway-" + stripcolon(d);
57803       }).html(function(d) {
57804         return field.t.html("types." + d);
57805       });
57806       enter.append("div").attr("class", "preset-input-cycleway-wrap").append("input").attr("type", "text").attr("class", function(d) {
57807         return "preset-input-cycleway preset-input-" + stripcolon(d);
57808       }).call(utilNoAuto).each(function(d) {
57809         select_default2(this).call(uiCombobox(context, "cycleway-" + stripcolon(d)).data(cycleway.options(d)));
57810       });
57811       items = items.merge(enter);
57812       wrap2.selectAll(".preset-input-cycleway").on("change", change).on("blur", change);
57813     }
57814     function change(d3_event, key) {
57815       var newValue = context.cleanTagValue(utilGetSetValue(select_default2(this)));
57816       if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key])))
57817         return;
57818       if (newValue === "none" || newValue === "") {
57819         newValue = void 0;
57820       }
57821       var otherKey = key === "cycleway:left" ? "cycleway:right" : "cycleway:left";
57822       var otherValue = typeof _tags.cycleway === "string" ? _tags.cycleway : _tags[otherKey];
57823       if (otherValue && Array.isArray(otherValue)) {
57824         otherValue = otherValue[0];
57825       }
57826       if (otherValue === "none" || otherValue === "") {
57827         otherValue = void 0;
57828       }
57829       var tag = {};
57830       if (newValue === otherValue) {
57831         tag = {
57832           cycleway: newValue,
57833           "cycleway:left": void 0,
57834           "cycleway:right": void 0
57835         };
57836       } else {
57837         tag = {
57838           cycleway: void 0
57839         };
57840         tag[key] = newValue;
57841         tag[otherKey] = otherValue;
57842       }
57843       dispatch10.call("change", this, tag);
57844     }
57845     cycleway.options = function() {
57846       return field.options.map(function(option) {
57847         return {
57848           title: field.t("options." + option + ".description"),
57849           value: option
57850         };
57851       });
57852     };
57853     cycleway.tags = function(tags) {
57854       _tags = tags;
57855       var commonValue = typeof tags.cycleway === "string" && tags.cycleway;
57856       utilGetSetValue(items.selectAll(".preset-input-cycleway"), function(d) {
57857         if (commonValue)
57858           return commonValue;
57859         return !tags.cycleway && typeof tags[d] === "string" ? tags[d] : "";
57860       }).attr("title", function(d) {
57861         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
57862           var vals = [];
57863           if (Array.isArray(tags.cycleway)) {
57864             vals = vals.concat(tags.cycleway);
57865           }
57866           if (Array.isArray(tags[d])) {
57867             vals = vals.concat(tags[d]);
57868           }
57869           return vals.filter(Boolean).join("\n");
57870         }
57871         return null;
57872       }).attr("placeholder", function(d) {
57873         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
57874           return _t("inspector.multiple_values");
57875         }
57876         return field.placeholder();
57877       }).classed("mixed", function(d) {
57878         return Array.isArray(tags.cycleway) || Array.isArray(tags[d]);
57879       });
57880     };
57881     cycleway.focus = function() {
57882       var node = wrap2.selectAll("input").node();
57883       if (node)
57884         node.focus();
57885     };
57886     return utilRebind(cycleway, dispatch10, "on");
57887   }
57888
57889   // modules/ui/fields/lanes.js
57890   function uiFieldLanes(field, context) {
57891     var dispatch10 = dispatch_default("change");
57892     var LANE_WIDTH = 40;
57893     var LANE_HEIGHT = 200;
57894     var _entityIDs = [];
57895     function lanes(selection2) {
57896       var lanesData = context.entity(_entityIDs[0]).lanes();
57897       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
57898         selection2.call(lanes.off);
57899         return;
57900       }
57901       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57902       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57903       var surface = wrap2.selectAll(".surface").data([0]);
57904       var d = utilGetDimensions(wrap2);
57905       var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
57906       surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
57907       var lanesSelection = surface.selectAll(".lanes").data([0]);
57908       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
57909       lanesSelection.attr("transform", function() {
57910         return "translate(" + freeSpace / 2 + ", 0)";
57911       });
57912       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
57913       lane.exit().remove();
57914       var enter = lane.enter().append("g").attr("class", "lane");
57915       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
57916       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
57917       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
57918       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
57919       lane = lane.merge(enter);
57920       lane.attr("transform", function(d2) {
57921         return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
57922       });
57923       lane.select(".forward").style("visibility", function(d2) {
57924         return d2.direction === "forward" ? "visible" : "hidden";
57925       });
57926       lane.select(".bothways").style("visibility", function(d2) {
57927         return d2.direction === "bothways" ? "visible" : "hidden";
57928       });
57929       lane.select(".backward").style("visibility", function(d2) {
57930         return d2.direction === "backward" ? "visible" : "hidden";
57931       });
57932     }
57933     lanes.entityIDs = function(val) {
57934       _entityIDs = val;
57935     };
57936     lanes.tags = function() {
57937     };
57938     lanes.focus = function() {
57939     };
57940     lanes.off = function() {
57941     };
57942     return utilRebind(lanes, dispatch10, "on");
57943   }
57944   uiFieldLanes.supportsMultiselection = false;
57945
57946   // modules/ui/fields/localized.js
57947   var _languagesArray = [];
57948   function uiFieldLocalized(field, context) {
57949     var dispatch10 = dispatch_default("change", "input");
57950     var wikipedia = services.wikipedia;
57951     var input = select_default2(null);
57952     var localizedInputs = select_default2(null);
57953     var _countryCode;
57954     var _tags;
57955     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
57956     });
57957     var _territoryLanguages = {};
57958     _mainFileFetcher.get("territory_languages").then(function(d) {
57959       _territoryLanguages = d;
57960     }).catch(function() {
57961     });
57962     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
57963     var _selection = select_default2(null);
57964     var _multilingual = [];
57965     var _buttonTip = uiTooltip().title(_t.html("translate.translate")).placement("left");
57966     var _wikiTitles;
57967     var _entityIDs = [];
57968     function loadLanguagesArray(dataLanguages) {
57969       if (_languagesArray.length !== 0)
57970         return;
57971       var replacements = {
57972         sr: "sr-Cyrl",
57973         "sr-Cyrl": false
57974       };
57975       for (var code in dataLanguages) {
57976         if (replacements[code] === false)
57977           continue;
57978         var metaCode = code;
57979         if (replacements[code])
57980           metaCode = replacements[code];
57981         _languagesArray.push({
57982           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
57983           nativeName: dataLanguages[metaCode].nativeName,
57984           code,
57985           label: _mainLocalizer.languageName(metaCode)
57986         });
57987       }
57988     }
57989     function calcLocked() {
57990       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
57991         var entity = context.graph().hasEntity(entityID);
57992         if (!entity)
57993           return false;
57994         if (entity.tags.wikidata)
57995           return true;
57996         if (entity.tags["name:etymology:wikidata"])
57997           return true;
57998         var preset = _mainPresetIndex.match(entity, context.graph());
57999         if (preset) {
58000           var isSuggestion = preset.suggestion;
58001           var fields = preset.fields();
58002           var showsBrandField = fields.some(function(d) {
58003             return d.id === "brand";
58004           });
58005           var showsOperatorField = fields.some(function(d) {
58006             return d.id === "operator";
58007           });
58008           var setsName = preset.addTags.name;
58009           var setsBrandWikidata = preset.addTags["brand:wikidata"];
58010           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
58011           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
58012         }
58013         return false;
58014       });
58015       field.locked(isLocked);
58016     }
58017     function calcMultilingual(tags) {
58018       var existingLangsOrdered = _multilingual.map(function(item2) {
58019         return item2.lang;
58020       });
58021       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
58022       for (var k in tags) {
58023         var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
58024         if (m && m[1] === field.key && m[2]) {
58025           var item = { lang: m[2], value: tags[k] };
58026           if (existingLangs.has(item.lang)) {
58027             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
58028             existingLangs.delete(item.lang);
58029           } else {
58030             _multilingual.push(item);
58031           }
58032         }
58033       }
58034       _multilingual.forEach(function(item2) {
58035         if (item2.lang && existingLangs.has(item2.lang)) {
58036           item2.value = "";
58037         }
58038       });
58039     }
58040     function localized(selection2) {
58041       _selection = selection2;
58042       calcLocked();
58043       var isLocked = field.locked();
58044       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58045       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58046       input = wrap2.selectAll(".localized-main").data([0]);
58047       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
58048       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
58049       var translateButton = wrap2.selectAll(".localized-add").data([0]);
58050       translateButton = translateButton.enter().append("button").attr("class", "localized-add form-field-button").attr("aria-label", _t("icons.plus")).call(svgIcon("#iD-icon-plus")).merge(translateButton);
58051       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
58052       if (_tags && !_multilingual.length) {
58053         calcMultilingual(_tags);
58054       }
58055       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
58056       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
58057       localizedInputs.call(renderMultilingual);
58058       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
58059       selection2.selectAll(".combobox-caret").classed("nope", true);
58060       function addNew(d3_event) {
58061         d3_event.preventDefault();
58062         if (field.locked())
58063           return;
58064         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
58065         var langExists = _multilingual.find(function(datum2) {
58066           return datum2.lang === defaultLang;
58067         });
58068         var isLangEn = defaultLang.indexOf("en") > -1;
58069         if (isLangEn || langExists) {
58070           defaultLang = "";
58071           langExists = _multilingual.find(function(datum2) {
58072             return datum2.lang === defaultLang;
58073           });
58074         }
58075         if (!langExists) {
58076           _multilingual.unshift({ lang: defaultLang, value: "" });
58077           localizedInputs.call(renderMultilingual);
58078         }
58079       }
58080       function change(onInput) {
58081         return function(d3_event) {
58082           if (field.locked()) {
58083             d3_event.preventDefault();
58084             return;
58085           }
58086           var val = utilGetSetValue(select_default2(this));
58087           if (!onInput)
58088             val = context.cleanTagValue(val);
58089           if (!val && Array.isArray(_tags[field.key]))
58090             return;
58091           var t = {};
58092           t[field.key] = val || void 0;
58093           dispatch10.call("change", this, t, onInput);
58094         };
58095       }
58096     }
58097     function key(lang) {
58098       return field.key + ":" + lang;
58099     }
58100     function changeLang(d3_event, d) {
58101       var tags = {};
58102       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
58103       var language = _languagesArray.find(function(d2) {
58104         return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
58105       });
58106       if (language)
58107         lang = language.code;
58108       if (d.lang && d.lang !== lang) {
58109         tags[key(d.lang)] = void 0;
58110       }
58111       var newKey = lang && context.cleanTagKey(key(lang));
58112       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
58113       if (newKey && value) {
58114         tags[newKey] = value;
58115       } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
58116         tags[newKey] = _wikiTitles[d.lang];
58117       }
58118       d.lang = lang;
58119       dispatch10.call("change", this, tags);
58120     }
58121     function changeValue(d3_event, d) {
58122       if (!d.lang)
58123         return;
58124       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
58125       if (!value && Array.isArray(d.value))
58126         return;
58127       var t = {};
58128       t[key(d.lang)] = value;
58129       d.value = value;
58130       dispatch10.call("change", this, t);
58131     }
58132     function fetchLanguages(value, cb) {
58133       var v = value.toLowerCase();
58134       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
58135       if (_countryCode && _territoryLanguages[_countryCode]) {
58136         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
58137       }
58138       var langItems = [];
58139       langCodes.forEach(function(code) {
58140         var langItem = _languagesArray.find(function(item) {
58141           return item.code === code;
58142         });
58143         if (langItem)
58144           langItems.push(langItem);
58145       });
58146       langItems = utilArrayUniq(langItems.concat(_languagesArray));
58147       cb(langItems.filter(function(d) {
58148         return d.label.toLowerCase().indexOf(v) >= 0 || d.localName && d.localName.toLowerCase().indexOf(v) >= 0 || d.nativeName && d.nativeName.toLowerCase().indexOf(v) >= 0 || d.code.toLowerCase().indexOf(v) >= 0;
58149       }).map(function(d) {
58150         return { value: d.label };
58151       }));
58152     }
58153     function renderMultilingual(selection2) {
58154       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
58155         return d.lang;
58156       });
58157       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
58158       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
58159         var wrap2 = select_default2(this);
58160         var domId = utilUniqueDomId(index);
58161         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
58162         var text2 = label.append("span").attr("class", "label-text");
58163         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
58164         text2.append("span").attr("class", "label-textannotation");
58165         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
58166           if (field.locked())
58167             return;
58168           d3_event.preventDefault();
58169           _multilingual.splice(_multilingual.indexOf(d), 1);
58170           var langKey = d.lang && key(d.lang);
58171           if (langKey && langKey in _tags) {
58172             delete _tags[langKey];
58173             var t = {};
58174             t[langKey] = void 0;
58175             dispatch10.call("change", this, t);
58176             return;
58177           }
58178           renderMultilingual(selection2);
58179         }).call(svgIcon("#iD-operation-delete"));
58180         wrap2.append("input").attr("class", "localized-lang").attr("id", domId).attr("type", "text").attr("placeholder", _t("translate.localized_translation_language")).on("blur", changeLang).on("change", changeLang).call(langCombo);
58181         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
58182       });
58183       entriesEnter.style("margin-top", "0px").style("max-height", "0px").style("opacity", "0").transition().duration(200).style("margin-top", "10px").style("max-height", "240px").style("opacity", "1").on("end", function() {
58184         select_default2(this).style("max-height", "").style("overflow", "visible");
58185       });
58186       entries = entries.merge(entriesEnter);
58187       entries.order();
58188       entries.classed("present", true);
58189       utilGetSetValue(entries.select(".localized-lang"), function(d) {
58190         var langItem = _languagesArray.find(function(item) {
58191           return item.code === d.lang;
58192         });
58193         if (langItem)
58194           return langItem.label;
58195         return d.lang;
58196       });
58197       utilGetSetValue(entries.select(".localized-value"), function(d) {
58198         return typeof d.value === "string" ? d.value : "";
58199       }).attr("title", function(d) {
58200         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
58201       }).attr("placeholder", function(d) {
58202         return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
58203       }).classed("mixed", function(d) {
58204         return Array.isArray(d.value);
58205       });
58206     }
58207     localized.tags = function(tags) {
58208       _tags = tags;
58209       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
58210         _wikiTitles = {};
58211         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
58212         if (wm && wm[0] && wm[1]) {
58213           wikipedia.translations(wm[1], wm[2], function(err, d) {
58214             if (err || !d)
58215               return;
58216             _wikiTitles = d;
58217           });
58218         }
58219       }
58220       var isMixed = Array.isArray(tags[field.key]);
58221       utilGetSetValue(input, typeof tags[field.key] === "string" ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
58222       calcMultilingual(tags);
58223       _selection.call(localized);
58224     };
58225     localized.focus = function() {
58226       input.node().focus();
58227     };
58228     localized.entityIDs = function(val) {
58229       if (!arguments.length)
58230         return _entityIDs;
58231       _entityIDs = val;
58232       _multilingual = [];
58233       loadCountryCode();
58234       return localized;
58235     };
58236     function loadCountryCode() {
58237       var extent = combinedEntityExtent();
58238       var countryCode = extent && iso1A2Code(extent.center());
58239       _countryCode = countryCode && countryCode.toLowerCase();
58240     }
58241     function combinedEntityExtent() {
58242       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58243     }
58244     return utilRebind(localized, dispatch10, "on");
58245   }
58246
58247   // modules/ui/fields/roadheight.js
58248   function uiFieldRoadheight(field, context) {
58249     var dispatch10 = dispatch_default("change");
58250     var primaryUnitInput = select_default2(null);
58251     var primaryInput = select_default2(null);
58252     var secondaryInput = select_default2(null);
58253     var secondaryUnitInput = select_default2(null);
58254     var _entityIDs = [];
58255     var _tags;
58256     var _isImperial;
58257     var primaryUnits = [
58258       {
58259         value: "m",
58260         title: _t("inspector.roadheight.meter")
58261       },
58262       {
58263         value: "ft",
58264         title: _t("inspector.roadheight.foot")
58265       }
58266     ];
58267     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
58268     function roadheight(selection2) {
58269       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58270       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58271       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
58272       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
58273       primaryInput.on("change", change).on("blur", change);
58274       var loc = combinedEntityExtent().center();
58275       _isImperial = roadHeightUnit(loc) === "ft";
58276       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
58277       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
58278       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
58279       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
58280       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
58281       secondaryInput.on("change", change).on("blur", change);
58282       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
58283       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
58284       function changeUnits() {
58285         _isImperial = utilGetSetValue(primaryUnitInput) === "ft";
58286         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
58287         setUnitSuggestions();
58288         change();
58289       }
58290     }
58291     function setUnitSuggestions() {
58292       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
58293     }
58294     function change() {
58295       var tag = {};
58296       var primaryValue = utilGetSetValue(primaryInput).trim();
58297       var secondaryValue = utilGetSetValue(secondaryInput).trim();
58298       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
58299         return;
58300       if (!primaryValue && !secondaryValue) {
58301         tag[field.key] = void 0;
58302       } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) {
58303         tag[field.key] = context.cleanTagValue(primaryValue);
58304       } else {
58305         if (primaryValue !== "") {
58306           primaryValue = context.cleanTagValue(primaryValue + "'");
58307         }
58308         if (secondaryValue !== "") {
58309           secondaryValue = context.cleanTagValue(secondaryValue + '"');
58310         }
58311         tag[field.key] = primaryValue + secondaryValue;
58312       }
58313       dispatch10.call("change", this, tag);
58314     }
58315     roadheight.tags = function(tags) {
58316       _tags = tags;
58317       var primaryValue = tags[field.key];
58318       var secondaryValue;
58319       var isMixed = Array.isArray(primaryValue);
58320       if (!isMixed) {
58321         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
58322           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
58323           if (secondaryValue !== null) {
58324             secondaryValue = secondaryValue[1];
58325           }
58326           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
58327           if (primaryValue !== null) {
58328             primaryValue = primaryValue[1];
58329           }
58330           _isImperial = true;
58331         } else if (primaryValue) {
58332           _isImperial = false;
58333         }
58334       }
58335       setUnitSuggestions();
58336       utilGetSetValue(primaryInput, typeof primaryValue === "string" ? primaryValue : "").attr("title", isMixed ? primaryValue.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _t("inspector.unknown")).classed("mixed", isMixed);
58337       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? "0" : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
58338       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
58339     };
58340     roadheight.focus = function() {
58341       primaryInput.node().focus();
58342     };
58343     roadheight.entityIDs = function(val) {
58344       _entityIDs = val;
58345     };
58346     function combinedEntityExtent() {
58347       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58348     }
58349     return utilRebind(roadheight, dispatch10, "on");
58350   }
58351
58352   // modules/ui/fields/roadspeed.js
58353   function uiFieldRoadspeed(field, context) {
58354     var dispatch10 = dispatch_default("change");
58355     var unitInput = select_default2(null);
58356     var input = select_default2(null);
58357     var _entityIDs = [];
58358     var _tags;
58359     var _isImperial;
58360     var speedCombo = uiCombobox(context, "roadspeed");
58361     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
58362     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
58363     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
58364     function roadspeed(selection2) {
58365       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58366       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58367       input = wrap2.selectAll("input.roadspeed-number").data([0]);
58368       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
58369       input.on("change", change).on("blur", change);
58370       var loc = combinedEntityExtent().center();
58371       _isImperial = roadSpeedUnit(loc) === "mph";
58372       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
58373       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
58374       unitInput.on("blur", changeUnits).on("change", changeUnits);
58375       function changeUnits() {
58376         _isImperial = utilGetSetValue(unitInput) === "mph";
58377         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
58378         setUnitSuggestions();
58379         change();
58380       }
58381     }
58382     function setUnitSuggestions() {
58383       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
58384       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
58385     }
58386     function comboValues(d) {
58387       return {
58388         value: d.toString(),
58389         title: d.toString()
58390       };
58391     }
58392     function change() {
58393       var tag = {};
58394       var value = utilGetSetValue(input).trim();
58395       if (!value && Array.isArray(_tags[field.key]))
58396         return;
58397       if (!value) {
58398         tag[field.key] = void 0;
58399       } else if (isNaN(value) || !_isImperial) {
58400         tag[field.key] = context.cleanTagValue(value);
58401       } else {
58402         tag[field.key] = context.cleanTagValue(value + " mph");
58403       }
58404       dispatch10.call("change", this, tag);
58405     }
58406     roadspeed.tags = function(tags) {
58407       _tags = tags;
58408       var value = tags[field.key];
58409       var isMixed = Array.isArray(value);
58410       if (!isMixed) {
58411         if (value && value.indexOf("mph") >= 0) {
58412           value = parseInt(value, 10).toString();
58413           _isImperial = true;
58414         } else if (value) {
58415           _isImperial = false;
58416         }
58417       }
58418       setUnitSuggestions();
58419       utilGetSetValue(input, typeof value === "string" ? value : "").attr("title", isMixed ? value.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
58420     };
58421     roadspeed.focus = function() {
58422       input.node().focus();
58423     };
58424     roadspeed.entityIDs = function(val) {
58425       _entityIDs = val;
58426     };
58427     function combinedEntityExtent() {
58428       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58429     }
58430     return utilRebind(roadspeed, dispatch10, "on");
58431   }
58432
58433   // modules/ui/fields/radio.js
58434   function uiFieldRadio(field, context) {
58435     var dispatch10 = dispatch_default("change");
58436     var placeholder = select_default2(null);
58437     var wrap2 = select_default2(null);
58438     var labels = select_default2(null);
58439     var radios = select_default2(null);
58440     var radioData = (field.options || field.keys).slice();
58441     var typeField;
58442     var layerField;
58443     var _oldType = {};
58444     var _entityIDs = [];
58445     function selectedKey() {
58446       var node = wrap2.selectAll(".form-field-input-radio label.active input");
58447       return !node.empty() && node.datum();
58448     }
58449     function radio(selection2) {
58450       selection2.classed("preset-radio", true);
58451       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58452       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
58453       enter.append("span").attr("class", "placeholder");
58454       wrap2 = wrap2.merge(enter);
58455       placeholder = wrap2.selectAll(".placeholder");
58456       labels = wrap2.selectAll("label").data(radioData);
58457       enter = labels.enter().append("label");
58458       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
58459         return field.t("options." + d, { "default": d });
58460       }).attr("checked", false);
58461       enter.append("span").html(function(d) {
58462         return field.t.html("options." + d, { "default": d });
58463       });
58464       labels = labels.merge(enter);
58465       radios = labels.selectAll("input").on("change", changeRadio);
58466     }
58467     function structureExtras(selection2, tags) {
58468       var selected = selectedKey() || tags.layer !== void 0;
58469       var type3 = _mainPresetIndex.field(selected);
58470       var layer = _mainPresetIndex.field("layer");
58471       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
58472       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
58473       extrasWrap.exit().remove();
58474       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
58475       var list = extrasWrap.selectAll("ul").data([0]);
58476       list = list.enter().append("ul").attr("class", "rows").merge(list);
58477       if (type3) {
58478         if (!typeField || typeField.id !== selected) {
58479           typeField = uiField(context, type3, _entityIDs, { wrap: false }).on("change", changeType);
58480         }
58481         typeField.tags(tags);
58482       } else {
58483         typeField = null;
58484       }
58485       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
58486         return d.id;
58487       });
58488       typeItem.exit().remove();
58489       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
58490       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
58491       typeEnter.append("div").attr("class", "structure-input-type-wrap");
58492       typeItem = typeItem.merge(typeEnter);
58493       if (typeField) {
58494         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
58495       }
58496       if (layer && showLayer) {
58497         if (!layerField) {
58498           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
58499         }
58500         layerField.tags(tags);
58501         field.keys = utilArrayUnion(field.keys, ["layer"]);
58502       } else {
58503         layerField = null;
58504         field.keys = field.keys.filter(function(k) {
58505           return k !== "layer";
58506         });
58507       }
58508       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
58509       layerItem.exit().remove();
58510       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
58511       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
58512       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
58513       layerItem = layerItem.merge(layerEnter);
58514       if (layerField) {
58515         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
58516       }
58517     }
58518     function changeType(t, onInput) {
58519       var key = selectedKey();
58520       if (!key)
58521         return;
58522       var val = t[key];
58523       if (val !== "no") {
58524         _oldType[key] = val;
58525       }
58526       if (field.type === "structureRadio") {
58527         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
58528           t.layer = void 0;
58529         }
58530         if (t.layer === void 0) {
58531           if (key === "bridge" && val !== "no") {
58532             t.layer = "1";
58533           }
58534           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
58535             t.layer = "-1";
58536           }
58537         }
58538       }
58539       dispatch10.call("change", this, t, onInput);
58540     }
58541     function changeLayer(t, onInput) {
58542       if (t.layer === "0") {
58543         t.layer = void 0;
58544       }
58545       dispatch10.call("change", this, t, onInput);
58546     }
58547     function changeRadio() {
58548       var t = {};
58549       var activeKey;
58550       if (field.key) {
58551         t[field.key] = void 0;
58552       }
58553       radios.each(function(d) {
58554         var active = select_default2(this).property("checked");
58555         if (active)
58556           activeKey = d;
58557         if (field.key) {
58558           if (active)
58559             t[field.key] = d;
58560         } else {
58561           var val = _oldType[activeKey] || "yes";
58562           t[d] = active ? val : void 0;
58563         }
58564       });
58565       if (field.type === "structureRadio") {
58566         if (activeKey === "bridge") {
58567           t.layer = "1";
58568         } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
58569           t.layer = "-1";
58570         } else {
58571           t.layer = void 0;
58572         }
58573       }
58574       dispatch10.call("change", this, t);
58575     }
58576     radio.tags = function(tags) {
58577       function isOptionChecked(d) {
58578         if (field.key) {
58579           return tags[field.key] === d;
58580         }
58581         return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
58582       }
58583       function isMixed(d) {
58584         if (field.key) {
58585           return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
58586         }
58587         return Array.isArray(tags[d]);
58588       }
58589       radios.property("checked", function(d) {
58590         return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
58591       });
58592       labels.classed("active", function(d) {
58593         if (field.key) {
58594           return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
58595         }
58596         return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
58597       }).classed("mixed", isMixed).attr("title", function(d) {
58598         return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
58599       });
58600       var selection2 = radios.filter(function() {
58601         return this.checked;
58602       });
58603       if (selection2.empty()) {
58604         placeholder.text("");
58605         placeholder.call(_t.append("inspector.none"));
58606       } else {
58607         placeholder.text(selection2.attr("value"));
58608         _oldType[selection2.datum()] = tags[selection2.datum()];
58609       }
58610       if (field.type === "structureRadio") {
58611         if (!!tags.waterway && !_oldType.tunnel) {
58612           _oldType.tunnel = "culvert";
58613         }
58614         wrap2.call(structureExtras, tags);
58615       }
58616     };
58617     radio.focus = function() {
58618       radios.node().focus();
58619     };
58620     radio.entityIDs = function(val) {
58621       if (!arguments.length)
58622         return _entityIDs;
58623       _entityIDs = val;
58624       _oldType = {};
58625       return radio;
58626     };
58627     radio.isAllowed = function() {
58628       return _entityIDs.length === 1;
58629     };
58630     return utilRebind(radio, dispatch10, "on");
58631   }
58632
58633   // modules/ui/fields/restrictions.js
58634   function uiFieldRestrictions(field, context) {
58635     var dispatch10 = dispatch_default("change");
58636     var breathe = behaviorBreathe(context);
58637     corePreferences("turn-restriction-via-way", null);
58638     var storedViaWay = corePreferences("turn-restriction-via-way0");
58639     var storedDistance = corePreferences("turn-restriction-distance");
58640     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
58641     var _maxDistance = storedDistance ? +storedDistance : 30;
58642     var _initialized2 = false;
58643     var _parent = select_default2(null);
58644     var _container = select_default2(null);
58645     var _oldTurns;
58646     var _graph;
58647     var _vertexID;
58648     var _intersection;
58649     var _fromWayID;
58650     var _lastXPos;
58651     function restrictions(selection2) {
58652       _parent = selection2;
58653       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
58654         _graph = context.graph();
58655         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
58656       }
58657       var isOK = _intersection && _intersection.vertices.length && _intersection.vertices.filter(function(vertex) {
58658         return vertex.id === _vertexID;
58659       }).length && _intersection.ways.length > 2 && _intersection.ways.filter(function(way) {
58660         return way.__to;
58661       }).length > 1;
58662       select_default2(selection2.node().parentNode).classed("hide", !isOK);
58663       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
58664         selection2.call(restrictions.off);
58665         return;
58666       }
58667       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58668       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58669       var container = wrap2.selectAll(".restriction-container").data([0]);
58670       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
58671       containerEnter.append("div").attr("class", "restriction-help");
58672       _container = containerEnter.merge(container).call(renderViewer);
58673       var controls = wrap2.selectAll(".restriction-controls").data([0]);
58674       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
58675     }
58676     function renderControls(selection2) {
58677       var distControl = selection2.selectAll(".restriction-distance").data([0]);
58678       distControl.exit().remove();
58679       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
58680       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
58681       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
58682       distControlEnter.append("span").attr("class", "restriction-distance-text");
58683       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
58684         var val = select_default2(this).property("value");
58685         _maxDistance = +val;
58686         _intersection = null;
58687         _container.selectAll(".layer-osm .layer-turns *").remove();
58688         corePreferences("turn-restriction-distance", _maxDistance);
58689         _parent.call(restrictions);
58690       });
58691       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
58692       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
58693       viaControl.exit().remove();
58694       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
58695       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
58696       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
58697       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
58698       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
58699         var val = select_default2(this).property("value");
58700         _maxViaWay = +val;
58701         _container.selectAll(".layer-osm .layer-turns *").remove();
58702         corePreferences("turn-restriction-via-way0", _maxViaWay);
58703         _parent.call(restrictions);
58704       });
58705       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
58706     }
58707     function renderViewer(selection2) {
58708       if (!_intersection)
58709         return;
58710       var vgraph = _intersection.graph;
58711       var filter2 = utilFunctor(true);
58712       var projection2 = geoRawMercator();
58713       var sdims = utilGetDimensions(context.container().select(".sidebar"));
58714       var d = [sdims[0] - 50, 370];
58715       var c = geoVecScale(d, 0.5);
58716       var z = 22;
58717       projection2.scale(geoZoomToScale(z));
58718       var extent = geoExtent();
58719       for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
58720         extent._extend(_intersection.vertices[i2].extent());
58721       }
58722       var padTop = 35;
58723       if (_intersection.vertices.length > 1) {
58724         var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
58725         var vPadding = 160;
58726         var tl = projection2([extent[0][0], extent[1][1]]);
58727         var br = projection2([extent[1][0], extent[0][1]]);
58728         var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
58729         var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
58730         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
58731         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
58732         z = z - Math.max(hZoomDiff, vZoomDiff);
58733         projection2.scale(geoZoomToScale(z));
58734       }
58735       var extentCenter = projection2(extent.center());
58736       extentCenter[1] = extentCenter[1] - padTop / 2;
58737       projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
58738       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
58739       var drawVertices = svgVertices(projection2, context);
58740       var drawLines = svgLines(projection2, context);
58741       var drawTurns = svgTurns(projection2, context);
58742       var firstTime = selection2.selectAll(".surface").empty();
58743       selection2.call(drawLayers);
58744       var surface = selection2.selectAll(".surface").classed("tr", true);
58745       if (firstTime) {
58746         _initialized2 = true;
58747         surface.call(breathe);
58748       }
58749       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
58750         _fromWayID = null;
58751         _oldTurns = null;
58752       }
58753       surface.call(utilSetDimensions, d).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
58754       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
58755       surface.selectAll(".selected").classed("selected", false);
58756       surface.selectAll(".related").classed("related", false);
58757       var way;
58758       if (_fromWayID) {
58759         way = vgraph.entity(_fromWayID);
58760         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
58761       }
58762       document.addEventListener("resizeWindow", function() {
58763         utilSetDimensions(_container, null);
58764         redraw(1);
58765       }, false);
58766       updateHints(null);
58767       function click(d3_event) {
58768         surface.call(breathe.off).call(breathe);
58769         var datum2 = d3_event.target.__data__;
58770         var entity = datum2 && datum2.properties && datum2.properties.entity;
58771         if (entity) {
58772           datum2 = entity;
58773         }
58774         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
58775           _fromWayID = datum2.id;
58776           _oldTurns = null;
58777           redraw();
58778         } else if (datum2 instanceof osmTurn) {
58779           var actions, extraActions, turns, i3;
58780           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
58781           if (datum2.restrictionID && !datum2.direct) {
58782             return;
58783           } else if (datum2.restrictionID && !datum2.only) {
58784             var seen = {};
58785             var datumOnly = JSON.parse(JSON.stringify(datum2));
58786             datumOnly.only = true;
58787             restrictionType = restrictionType.replace(/^no/, "only");
58788             turns = _intersection.turns(_fromWayID, 2);
58789             extraActions = [];
58790             _oldTurns = [];
58791             for (i3 = 0; i3 < turns.length; i3++) {
58792               var turn = turns[i3];
58793               if (seen[turn.restrictionID])
58794                 continue;
58795               if (turn.direct && turn.path[1] === datum2.path[1]) {
58796                 seen[turns[i3].restrictionID] = true;
58797                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
58798                 _oldTurns.push(turn);
58799                 extraActions.push(actionUnrestrictTurn(turn));
58800               }
58801             }
58802             actions = _intersection.actions.concat(extraActions, [
58803               actionRestrictTurn(datumOnly, restrictionType),
58804               _t("operations.restriction.annotation.create")
58805             ]);
58806           } else if (datum2.restrictionID) {
58807             turns = _oldTurns || [];
58808             extraActions = [];
58809             for (i3 = 0; i3 < turns.length; i3++) {
58810               if (turns[i3].key !== datum2.key) {
58811                 extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
58812               }
58813             }
58814             _oldTurns = null;
58815             actions = _intersection.actions.concat(extraActions, [
58816               actionUnrestrictTurn(datum2),
58817               _t("operations.restriction.annotation.delete")
58818             ]);
58819           } else {
58820             actions = _intersection.actions.concat([
58821               actionRestrictTurn(datum2, restrictionType),
58822               _t("operations.restriction.annotation.create")
58823             ]);
58824           }
58825           context.perform.apply(context, actions);
58826           var s = surface.selectAll("." + datum2.key);
58827           datum2 = s.empty() ? null : s.datum();
58828           updateHints(datum2);
58829         } else {
58830           _fromWayID = null;
58831           _oldTurns = null;
58832           redraw();
58833         }
58834       }
58835       function mouseover(d3_event) {
58836         var datum2 = d3_event.target.__data__;
58837         updateHints(datum2);
58838       }
58839       _lastXPos = _lastXPos || sdims[0];
58840       function redraw(minChange) {
58841         var xPos = -1;
58842         if (minChange) {
58843           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
58844         }
58845         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
58846           if (context.hasEntity(_vertexID)) {
58847             _lastXPos = xPos;
58848             _container.call(renderViewer);
58849           }
58850         }
58851       }
58852       function highlightPathsFrom(wayID) {
58853         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
58854         surface.selectAll("." + wayID).classed("related", true);
58855         if (wayID) {
58856           var turns = _intersection.turns(wayID, _maxViaWay);
58857           for (var i3 = 0; i3 < turns.length; i3++) {
58858             var turn = turns[i3];
58859             var ids = [turn.to.way];
58860             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
58861             if (turn.only || turns.length === 1) {
58862               if (turn.via.ways) {
58863                 ids = ids.concat(turn.via.ways);
58864               }
58865             } else if (turn.to.way === wayID) {
58866               continue;
58867             }
58868             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
58869           }
58870         }
58871       }
58872       function updateHints(datum2) {
58873         var help = _container.selectAll(".restriction-help").html("");
58874         var placeholders = {};
58875         ["from", "via", "to"].forEach(function(k) {
58876           placeholders[k] = { html: '<span class="qualifier">' + _t("restriction.help." + k) + "</span>" };
58877         });
58878         var entity = datum2 && datum2.properties && datum2.properties.entity;
58879         if (entity) {
58880           datum2 = entity;
58881         }
58882         if (_fromWayID) {
58883           way = vgraph.entity(_fromWayID);
58884           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
58885         }
58886         if (datum2 instanceof osmWay && datum2.__from) {
58887           way = datum2;
58888           highlightPathsFrom(_fromWayID ? null : way.id);
58889           surface.selectAll("." + way.id).classed("related", true);
58890           var clickSelect = !_fromWayID || _fromWayID !== way.id;
58891           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
58892             from: placeholders.from,
58893             fromName: displayName(way.id, vgraph)
58894           }));
58895         } else if (datum2 instanceof osmTurn) {
58896           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
58897           var turnType = restrictionType.replace(/^(only|no)\_/, "");
58898           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
58899           var klass, turnText, nextText;
58900           if (datum2.no) {
58901             klass = "restrict";
58902             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
58903             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
58904           } else if (datum2.only) {
58905             klass = "only";
58906             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
58907             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
58908           } else {
58909             klass = "allow";
58910             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
58911             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
58912           }
58913           help.append("div").attr("class", "qualifier " + klass).html(turnText);
58914           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
58915             from: placeholders.from,
58916             fromName: displayName(datum2.from.way, vgraph),
58917             to: placeholders.to,
58918             toName: displayName(datum2.to.way, vgraph)
58919           }));
58920           if (datum2.via.ways && datum2.via.ways.length) {
58921             var names = [];
58922             for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
58923               var prev = names[names.length - 1];
58924               var curr = displayName(datum2.via.ways[i3], vgraph);
58925               if (!prev || curr !== prev) {
58926                 names.push(curr);
58927               }
58928             }
58929             help.append("div").html(_t.html("restriction.help.via_names", {
58930               via: placeholders.via,
58931               viaNames: names.join(", ")
58932             }));
58933           }
58934           if (!indirect) {
58935             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
58936           }
58937           highlightPathsFrom(null);
58938           var alongIDs = datum2.path.slice();
58939           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
58940         } else {
58941           highlightPathsFrom(null);
58942           if (_fromWayID) {
58943             help.append("div").html(_t.html("restriction.help.from_name", {
58944               from: placeholders.from,
58945               fromName: displayName(_fromWayID, vgraph)
58946             }));
58947           } else {
58948             help.append("div").html(_t.html("restriction.help.select_from", {
58949               from: placeholders.from
58950             }));
58951           }
58952         }
58953       }
58954     }
58955     function displayMaxDistance(maxDist) {
58956       return (selection2) => {
58957         var isImperial = !_mainLocalizer.usesMetric();
58958         var opts;
58959         if (isImperial) {
58960           var distToFeet = {
58961             20: 70,
58962             25: 85,
58963             30: 100,
58964             35: 115,
58965             40: 130,
58966             45: 145,
58967             50: 160
58968           }[maxDist];
58969           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
58970         } else {
58971           opts = { distance: _t("units.meters", { quantity: maxDist }) };
58972         }
58973         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
58974       };
58975     }
58976     function displayMaxVia(maxVia) {
58977       return (selection2) => {
58978         selection2 = selection2.html("");
58979         return maxVia === 0 ? selection2.call(_t.append("restriction.controls.via_node_only")) : maxVia === 1 ? selection2.call(_t.append("restriction.controls.via_up_to_one")) : selection2.call(_t.append("restriction.controls.via_up_to_two"));
58980       };
58981     }
58982     function displayName(entityID, graph) {
58983       var entity = graph.entity(entityID);
58984       var name2 = utilDisplayName(entity) || "";
58985       var matched = _mainPresetIndex.match(entity, graph);
58986       var type3 = matched && matched.name() || utilDisplayType(entity.id);
58987       return name2 || type3;
58988     }
58989     restrictions.entityIDs = function(val) {
58990       _intersection = null;
58991       _fromWayID = null;
58992       _oldTurns = null;
58993       _vertexID = val[0];
58994     };
58995     restrictions.tags = function() {
58996     };
58997     restrictions.focus = function() {
58998     };
58999     restrictions.off = function(selection2) {
59000       if (!_initialized2)
59001         return;
59002       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
59003       select_default2(window).on("resize.restrictions", null);
59004     };
59005     return utilRebind(restrictions, dispatch10, "on");
59006   }
59007   uiFieldRestrictions.supportsMultiselection = false;
59008
59009   // modules/ui/fields/textarea.js
59010   function uiFieldTextarea(field, context) {
59011     var dispatch10 = dispatch_default("change");
59012     var input = select_default2(null);
59013     var _tags;
59014     function textarea(selection2) {
59015       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59016       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59017       input = wrap2.selectAll("textarea").data([0]);
59018       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
59019     }
59020     function change(onInput) {
59021       return function() {
59022         var val = utilGetSetValue(input);
59023         if (!onInput)
59024           val = context.cleanTagValue(val);
59025         if (!val && Array.isArray(_tags[field.key]))
59026           return;
59027         var t = {};
59028         t[field.key] = val || void 0;
59029         dispatch10.call("change", this, t, onInput);
59030       };
59031     }
59032     textarea.tags = function(tags) {
59033       _tags = tags;
59034       var isMixed = Array.isArray(tags[field.key]);
59035       utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
59036     };
59037     textarea.focus = function() {
59038       input.node().focus();
59039     };
59040     return utilRebind(textarea, dispatch10, "on");
59041   }
59042
59043   // modules/ui/fields/wikidata.js
59044   function uiFieldWikidata(field, context) {
59045     var wikidata = services.wikidata;
59046     var dispatch10 = dispatch_default("change");
59047     var _selection = select_default2(null);
59048     var _searchInput = select_default2(null);
59049     var _qid = null;
59050     var _wikidataEntity = null;
59051     var _wikiURL = "";
59052     var _entityIDs = [];
59053     var _wikipediaKey = field.keys && field.keys.find(function(key) {
59054       return key.includes("wikipedia");
59055     }), _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
59056     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
59057     function wiki(selection2) {
59058       _selection = selection2;
59059       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59060       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59061       var list = wrap2.selectAll("ul").data([0]);
59062       list = list.enter().append("ul").attr("class", "rows").merge(list);
59063       var searchRow = list.selectAll("li.wikidata-search").data([0]);
59064       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
59065       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
59066         var node = select_default2(this).node();
59067         node.setSelectionRange(0, node.value.length);
59068       }).on("blur", function() {
59069         setLabelForEntity();
59070       }).call(combobox.fetcher(fetchWikidataItems));
59071       combobox.on("accept", function(d) {
59072         if (d) {
59073           _qid = d.id;
59074           change();
59075         }
59076       }).on("cancel", function() {
59077         setLabelForEntity();
59078       });
59079       searchRowEnter.append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikidata.org" })).call(svgIcon("#iD-icon-out-link")).on("click", function(d3_event) {
59080         d3_event.preventDefault();
59081         if (_wikiURL)
59082           window.open(_wikiURL, "_blank");
59083       });
59084       searchRow = searchRow.merge(searchRowEnter);
59085       _searchInput = searchRow.select("input");
59086       var wikidataProperties = ["description", "identifier"];
59087       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
59088       var enter = items.enter().append("li").attr("class", function(d) {
59089         return "labeled-input preset-wikidata-" + d;
59090       });
59091       enter.append("span").attr("class", "label").html(function(d) {
59092         return _t.html("wikidata." + d);
59093       });
59094       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
59095       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
59096         d3_event.preventDefault();
59097         select_default2(this.parentNode).select("input").node().select();
59098         document.execCommand("copy");
59099       });
59100     }
59101     function fetchWikidataItems(q, callback) {
59102       if (!q && _hintKey) {
59103         for (var i2 in _entityIDs) {
59104           var entity = context.hasEntity(_entityIDs[i2]);
59105           if (entity.tags[_hintKey]) {
59106             q = entity.tags[_hintKey];
59107             break;
59108           }
59109         }
59110       }
59111       wikidata.itemsForSearchQuery(q, function(err, data) {
59112         if (err)
59113           return;
59114         for (var i3 in data) {
59115           data[i3].value = data[i3].label + " (" + data[i3].id + ")";
59116           data[i3].title = data[i3].description;
59117         }
59118         if (callback)
59119           callback(data);
59120       });
59121     }
59122     function change() {
59123       var syncTags = {};
59124       syncTags[field.key] = _qid;
59125       dispatch10.call("change", this, syncTags);
59126       var initGraph = context.graph();
59127       var initEntityIDs = _entityIDs;
59128       wikidata.entityByQID(_qid, function(err, entity) {
59129         if (err)
59130           return;
59131         if (context.graph() !== initGraph)
59132           return;
59133         if (!entity.sitelinks)
59134           return;
59135         var langs = wikidata.languagesToQuery();
59136         ["labels", "descriptions"].forEach(function(key) {
59137           if (!entity[key])
59138             return;
59139           var valueLangs = Object.keys(entity[key]);
59140           if (valueLangs.length === 0)
59141             return;
59142           var valueLang = valueLangs[0];
59143           if (langs.indexOf(valueLang) === -1) {
59144             langs.push(valueLang);
59145           }
59146         });
59147         var newWikipediaValue;
59148         if (_wikipediaKey) {
59149           var foundPreferred;
59150           for (var i2 in langs) {
59151             var lang = langs[i2];
59152             var siteID = lang.replace("-", "_") + "wiki";
59153             if (entity.sitelinks[siteID]) {
59154               foundPreferred = true;
59155               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
59156               break;
59157             }
59158           }
59159           if (!foundPreferred) {
59160             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
59161               return site.endsWith("wiki");
59162             });
59163             if (wikiSiteKeys.length === 0) {
59164               newWikipediaValue = null;
59165             } else {
59166               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
59167               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
59168               newWikipediaValue = wikiLang + ":" + wikiTitle;
59169             }
59170           }
59171         }
59172         if (newWikipediaValue) {
59173           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
59174         }
59175         if (typeof newWikipediaValue === "undefined")
59176           return;
59177         var actions = initEntityIDs.map(function(entityID) {
59178           var entity2 = context.hasEntity(entityID);
59179           if (!entity2)
59180             return null;
59181           var currTags = Object.assign({}, entity2.tags);
59182           if (newWikipediaValue === null) {
59183             if (!currTags[_wikipediaKey])
59184               return null;
59185             delete currTags[_wikipediaKey];
59186           } else {
59187             currTags[_wikipediaKey] = newWikipediaValue;
59188           }
59189           return actionChangeTags(entityID, currTags);
59190         }).filter(Boolean);
59191         if (!actions.length)
59192           return;
59193         context.overwrite(function actionUpdateWikipediaTags(graph) {
59194           actions.forEach(function(action) {
59195             graph = action(graph);
59196           });
59197           return graph;
59198         }, context.history().undoAnnotation());
59199       });
59200     }
59201     function setLabelForEntity() {
59202       var label = "";
59203       if (_wikidataEntity) {
59204         label = entityPropertyForDisplay(_wikidataEntity, "labels");
59205         if (label.length === 0) {
59206           label = _wikidataEntity.id.toString();
59207         }
59208       }
59209       utilGetSetValue(_searchInput, label);
59210     }
59211     wiki.tags = function(tags) {
59212       var isMixed = Array.isArray(tags[field.key]);
59213       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
59214       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
59215       if (!/^Q[0-9]*$/.test(_qid)) {
59216         unrecognized();
59217         return;
59218       }
59219       _wikiURL = "https://wikidata.org/wiki/" + _qid;
59220       wikidata.entityByQID(_qid, function(err, entity) {
59221         if (err) {
59222           unrecognized();
59223           return;
59224         }
59225         _wikidataEntity = entity;
59226         setLabelForEntity();
59227         var description2 = entityPropertyForDisplay(entity, "descriptions");
59228         _selection.select("button.wiki-link").classed("disabled", false);
59229         _selection.select(".preset-wikidata-description").style("display", function() {
59230           return description2.length > 0 ? "flex" : "none";
59231         }).select("input").attr("value", description2);
59232         _selection.select(".preset-wikidata-identifier").style("display", function() {
59233           return entity.id ? "flex" : "none";
59234         }).select("input").attr("value", entity.id);
59235       });
59236       function unrecognized() {
59237         _wikidataEntity = null;
59238         setLabelForEntity();
59239         _selection.select(".preset-wikidata-description").style("display", "none");
59240         _selection.select(".preset-wikidata-identifier").style("display", "none");
59241         _selection.select("button.wiki-link").classed("disabled", true);
59242         if (_qid && _qid !== "") {
59243           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
59244         } else {
59245           _wikiURL = "";
59246         }
59247       }
59248     };
59249     function entityPropertyForDisplay(wikidataEntity, propKey) {
59250       if (!wikidataEntity[propKey])
59251         return "";
59252       var propObj = wikidataEntity[propKey];
59253       var langKeys = Object.keys(propObj);
59254       if (langKeys.length === 0)
59255         return "";
59256       var langs = wikidata.languagesToQuery();
59257       for (var i2 in langs) {
59258         var lang = langs[i2];
59259         var valueObj = propObj[lang];
59260         if (valueObj && valueObj.value && valueObj.value.length > 0)
59261           return valueObj.value;
59262       }
59263       return propObj[langKeys[0]].value;
59264     }
59265     wiki.entityIDs = function(val) {
59266       if (!arguments.length)
59267         return _entityIDs;
59268       _entityIDs = val;
59269       return wiki;
59270     };
59271     wiki.focus = function() {
59272       _searchInput.node().focus();
59273     };
59274     return utilRebind(wiki, dispatch10, "on");
59275   }
59276
59277   // modules/ui/fields/wikipedia.js
59278   function uiFieldWikipedia(field, context) {
59279     const dispatch10 = dispatch_default("change");
59280     const wikipedia = services.wikipedia;
59281     const wikidata = services.wikidata;
59282     let _langInput = select_default2(null);
59283     let _titleInput = select_default2(null);
59284     let _wikiURL = "";
59285     let _entityIDs;
59286     let _tags;
59287     let _dataWikipedia = [];
59288     _mainFileFetcher.get("wmf_sitematrix").then((d) => {
59289       _dataWikipedia = d;
59290       if (_tags)
59291         updateForTags(_tags);
59292     }).catch(() => {
59293     });
59294     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
59295       const v = value.toLowerCase();
59296       callback(_dataWikipedia.filter((d) => {
59297         return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
59298       }).map((d) => ({ value: d[1] })));
59299     });
59300     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
59301       if (!value) {
59302         value = "";
59303         for (let i2 in _entityIDs) {
59304           let entity = context.hasEntity(_entityIDs[i2]);
59305           if (entity.tags.name) {
59306             value = entity.tags.name;
59307             break;
59308           }
59309         }
59310       }
59311       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
59312       searchfn(language()[2], value, (query, data) => {
59313         callback(data.map((d) => ({ value: d })));
59314       });
59315     });
59316     function wiki(selection2) {
59317       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59318       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
59319       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
59320       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
59321       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
59322       _langInput = _langInput.enter().append("input").attr("type", "text").attr("class", "wiki-lang").attr("placeholder", _t("translate.localized_translation_language")).call(utilNoAuto).call(langCombo).merge(_langInput);
59323       _langInput.on("blur", changeLang).on("change", changeLang);
59324       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
59325       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
59326       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
59327       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
59328       _titleInput.on("blur", function() {
59329         change(true);
59330       }).on("change", function() {
59331         change(false);
59332       });
59333       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
59334       link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikipedia.org" })).call(svgIcon("#iD-icon-out-link")).merge(link2);
59335       link2.on("click", (d3_event) => {
59336         d3_event.preventDefault();
59337         if (_wikiURL)
59338           window.open(_wikiURL, "_blank");
59339       });
59340     }
59341     function defaultLanguageInfo(skipEnglishFallback) {
59342       const langCode = _mainLocalizer.languageCode().toLowerCase();
59343       for (let i2 in _dataWikipedia) {
59344         let d = _dataWikipedia[i2];
59345         if (d[2] === langCode)
59346           return d;
59347       }
59348       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
59349     }
59350     function language(skipEnglishFallback) {
59351       const value = utilGetSetValue(_langInput).toLowerCase();
59352       for (let i2 in _dataWikipedia) {
59353         let d = _dataWikipedia[i2];
59354         if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
59355           return d;
59356       }
59357       return defaultLanguageInfo(skipEnglishFallback);
59358     }
59359     function changeLang() {
59360       utilGetSetValue(_langInput, language()[1]);
59361       change(true);
59362     }
59363     function change(skipWikidata) {
59364       let value = utilGetSetValue(_titleInput);
59365       const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
59366       const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
59367       let syncTags = {};
59368       if (langInfo) {
59369         const nativeLangName = langInfo[1];
59370         value = decodeURIComponent(m[2]).replace(/_/g, " ");
59371         if (m[3]) {
59372           let anchor;
59373           anchor = decodeURIComponent(m[3]);
59374           value += "#" + anchor.replace(/_/g, " ");
59375         }
59376         value = value.slice(0, 1).toUpperCase() + value.slice(1);
59377         utilGetSetValue(_langInput, nativeLangName);
59378         utilGetSetValue(_titleInput, value);
59379       }
59380       if (value) {
59381         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
59382       } else {
59383         syncTags.wikipedia = void 0;
59384       }
59385       dispatch10.call("change", this, syncTags);
59386       if (skipWikidata || !value || !language()[2])
59387         return;
59388       const initGraph = context.graph();
59389       const initEntityIDs = _entityIDs;
59390       wikidata.itemsByTitle(language()[2], value, (err, data) => {
59391         if (err || !data || !Object.keys(data).length)
59392           return;
59393         if (context.graph() !== initGraph)
59394           return;
59395         const qids = Object.keys(data);
59396         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
59397         let actions = initEntityIDs.map((entityID) => {
59398           let entity = context.entity(entityID).tags;
59399           let currTags = Object.assign({}, entity);
59400           if (currTags.wikidata !== value2) {
59401             currTags.wikidata = value2;
59402             return actionChangeTags(entityID, currTags);
59403           }
59404           return null;
59405         }).filter(Boolean);
59406         if (!actions.length)
59407           return;
59408         context.overwrite(function actionUpdateWikidataTags(graph) {
59409           actions.forEach(function(action) {
59410             graph = action(graph);
59411           });
59412           return graph;
59413         }, context.history().undoAnnotation());
59414       });
59415     }
59416     wiki.tags = (tags) => {
59417       _tags = tags;
59418       updateForTags(tags);
59419     };
59420     function updateForTags(tags) {
59421       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
59422       const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
59423       const tagLang = m && m[1];
59424       const tagArticleTitle = m && m[2];
59425       let anchor = m && m[3];
59426       const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
59427       if (tagLangInfo) {
59428         const nativeLangName = tagLangInfo[1];
59429         utilGetSetValue(_langInput, nativeLangName);
59430         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
59431         if (anchor) {
59432           try {
59433             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
59434           } catch (e) {
59435             anchor = anchor.replace(/ /g, "_");
59436           }
59437         }
59438         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
59439       } else {
59440         utilGetSetValue(_titleInput, value);
59441         if (value && value !== "") {
59442           utilGetSetValue(_langInput, "");
59443           const defaultLangInfo = defaultLanguageInfo();
59444           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
59445         } else {
59446           const shownOrDefaultLangInfo = language(true);
59447           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
59448           _wikiURL = "";
59449         }
59450       }
59451     }
59452     wiki.entityIDs = (val) => {
59453       if (!arguments.length)
59454         return _entityIDs;
59455       _entityIDs = val;
59456       return wiki;
59457     };
59458     wiki.focus = () => {
59459       _titleInput.node().focus();
59460     };
59461     return utilRebind(wiki, dispatch10, "on");
59462   }
59463   uiFieldWikipedia.supportsMultiselection = false;
59464
59465   // modules/ui/fields/index.js
59466   var uiFields = {
59467     access: uiFieldAccess,
59468     address: uiFieldAddress,
59469     check: uiFieldCheck,
59470     combo: uiFieldCombo,
59471     cycleway: uiFieldCycleway,
59472     defaultCheck: uiFieldCheck,
59473     email: uiFieldText,
59474     identifier: uiFieldText,
59475     lanes: uiFieldLanes,
59476     localized: uiFieldLocalized,
59477     roadheight: uiFieldRoadheight,
59478     roadspeed: uiFieldRoadspeed,
59479     manyCombo: uiFieldCombo,
59480     multiCombo: uiFieldCombo,
59481     networkCombo: uiFieldCombo,
59482     number: uiFieldText,
59483     onewayCheck: uiFieldCheck,
59484     radio: uiFieldRadio,
59485     restrictions: uiFieldRestrictions,
59486     semiCombo: uiFieldCombo,
59487     structureRadio: uiFieldRadio,
59488     tel: uiFieldText,
59489     text: uiFieldText,
59490     textarea: uiFieldTextarea,
59491     typeCombo: uiFieldCombo,
59492     url: uiFieldText,
59493     wikidata: uiFieldWikidata,
59494     wikipedia: uiFieldWikipedia
59495   };
59496
59497   // modules/ui/field.js
59498   function uiField(context, presetField2, entityIDs, options2) {
59499     options2 = Object.assign({
59500       show: true,
59501       wrap: true,
59502       remove: true,
59503       revert: true,
59504       info: true
59505     }, options2);
59506     var dispatch10 = dispatch_default("change", "revert");
59507     var field = Object.assign({}, presetField2);
59508     field.domId = utilUniqueDomId("form-field-" + field.safeid);
59509     var _show = options2.show;
59510     var _state = "";
59511     var _tags = {};
59512     var _entityExtent;
59513     if (entityIDs && entityIDs.length) {
59514       _entityExtent = entityIDs.reduce(function(extent, entityID) {
59515         var entity = context.graph().entity(entityID);
59516         return extent.extend(entity.extent(context.graph()));
59517       }, geoExtent());
59518     }
59519     var _locked = false;
59520     var _lockedTip = uiTooltip().title(_t.html("inspector.lock.suggestion", { label: field.label })).placement("bottom");
59521     field.keys = field.keys || [field.key];
59522     if (_show && !field.impl) {
59523       createField();
59524     }
59525     function createField() {
59526       field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
59527         dispatch10.call("change", field, t, onInput);
59528       });
59529       if (entityIDs) {
59530         field.entityIDs = entityIDs;
59531         if (field.impl.entityIDs) {
59532           field.impl.entityIDs(entityIDs);
59533         }
59534       }
59535     }
59536     function isModified() {
59537       if (!entityIDs || !entityIDs.length)
59538         return false;
59539       return entityIDs.some(function(entityID) {
59540         var original = context.graph().base().entities[entityID];
59541         var latest = context.graph().entity(entityID);
59542         return field.keys.some(function(key) {
59543           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
59544         });
59545       });
59546     }
59547     function tagsContainFieldKey() {
59548       return field.keys.some(function(key) {
59549         if (field.type === "multiCombo") {
59550           for (var tagKey in _tags) {
59551             if (tagKey.indexOf(key) === 0) {
59552               return true;
59553             }
59554           }
59555           return false;
59556         }
59557         return _tags[key] !== void 0;
59558       });
59559     }
59560     function revert(d3_event, d) {
59561       d3_event.stopPropagation();
59562       d3_event.preventDefault();
59563       if (!entityIDs || _locked)
59564         return;
59565       dispatch10.call("revert", d, d.keys);
59566     }
59567     function remove2(d3_event, d) {
59568       d3_event.stopPropagation();
59569       d3_event.preventDefault();
59570       if (_locked)
59571         return;
59572       var t = {};
59573       d.keys.forEach(function(key) {
59574         t[key] = void 0;
59575       });
59576       dispatch10.call("change", d, t);
59577     }
59578     field.render = function(selection2) {
59579       var container = selection2.selectAll(".form-field").data([field]);
59580       var enter = container.enter().append("div").attr("class", function(d) {
59581         return "form-field form-field-" + d.safeid;
59582       }).classed("nowrap", !options2.wrap);
59583       if (options2.wrap) {
59584         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
59585           return d.domId;
59586         });
59587         var textEnter = labelEnter.append("span").attr("class", "label-text");
59588         textEnter.append("span").attr("class", "label-textvalue").html(function(d) {
59589           return d.label();
59590         });
59591         textEnter.append("span").attr("class", "label-textannotation");
59592         if (options2.remove) {
59593           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
59594         }
59595         if (options2.revert) {
59596           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
59597         }
59598       }
59599       container = container.merge(enter);
59600       container.select(".field-label > .remove-icon").on("click", remove2);
59601       container.select(".field-label > .modified-icon").on("click", revert);
59602       container.each(function(d) {
59603         var selection3 = select_default2(this);
59604         if (!d.impl) {
59605           createField();
59606         }
59607         var reference, help;
59608         if (options2.wrap && field.type === "restrictions") {
59609           help = uiFieldHelp(context, "restrictions");
59610         }
59611         if (options2.wrap && options2.info) {
59612           var referenceKey = d.key || "";
59613           if (d.type === "multiCombo") {
59614             referenceKey = referenceKey.replace(/:$/, "");
59615           }
59616           reference = uiTagReference(d.reference || { key: referenceKey }, context);
59617           if (_state === "hover") {
59618             reference.showing(false);
59619           }
59620         }
59621         selection3.call(d.impl);
59622         if (help) {
59623           selection3.call(help.body).select(".field-label").call(help.button);
59624         }
59625         if (reference) {
59626           selection3.call(reference.body).select(".field-label").call(reference.button);
59627         }
59628         d.impl.tags(_tags);
59629       });
59630       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
59631       var annotation = container.selectAll(".field-label .label-textannotation");
59632       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
59633       icon2.exit().remove();
59634       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
59635       container.call(_locked ? _lockedTip : _lockedTip.destroy);
59636     };
59637     field.state = function(val) {
59638       if (!arguments.length)
59639         return _state;
59640       _state = val;
59641       return field;
59642     };
59643     field.tags = function(val) {
59644       if (!arguments.length)
59645         return _tags;
59646       _tags = val;
59647       if (tagsContainFieldKey() && !_show) {
59648         _show = true;
59649         if (!field.impl) {
59650           createField();
59651         }
59652       }
59653       return field;
59654     };
59655     field.locked = function(val) {
59656       if (!arguments.length)
59657         return _locked;
59658       _locked = val;
59659       return field;
59660     };
59661     field.show = function() {
59662       _show = true;
59663       if (!field.impl) {
59664         createField();
59665       }
59666       if (field.default && field.key && _tags[field.key] !== field.default) {
59667         var t = {};
59668         t[field.key] = field.default;
59669         dispatch10.call("change", this, t);
59670       }
59671     };
59672     field.isShown = function() {
59673       return _show;
59674     };
59675     field.isAllowed = function() {
59676       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
59677         return false;
59678       if (field.geometry && !entityIDs.every(function(entityID) {
59679         return field.matchGeometry(context.graph().geometry(entityID));
59680       }))
59681         return false;
59682       if (entityIDs && _entityExtent && field.locationSetID) {
59683         var validLocations = _mainLocations.locationsAt(_entityExtent.center());
59684         if (!validLocations[field.locationSetID])
59685           return false;
59686       }
59687       var prerequisiteTag = field.prerequisiteTag;
59688       if (entityIDs && !tagsContainFieldKey() && prerequisiteTag) {
59689         if (!entityIDs.every(function(entityID) {
59690           var entity = context.graph().entity(entityID);
59691           if (prerequisiteTag.key) {
59692             var value = entity.tags[prerequisiteTag.key];
59693             if (!value)
59694               return false;
59695             if (prerequisiteTag.valueNot) {
59696               return prerequisiteTag.valueNot !== value;
59697             }
59698             if (prerequisiteTag.value) {
59699               return prerequisiteTag.value === value;
59700             }
59701           } else if (prerequisiteTag.keyNot) {
59702             if (entity.tags[prerequisiteTag.keyNot])
59703               return false;
59704           }
59705           return true;
59706         }))
59707           return false;
59708       }
59709       return true;
59710     };
59711     field.focus = function() {
59712       if (field.impl) {
59713         field.impl.focus();
59714       }
59715     };
59716     return utilRebind(field, dispatch10, "on");
59717   }
59718
59719   // modules/ui/form_fields.js
59720   function uiFormFields(context) {
59721     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
59722     var _fieldsArr = [];
59723     var _lastPlaceholder = "";
59724     var _state = "";
59725     var _klass = "";
59726     function formFields(selection2) {
59727       var allowedFields = _fieldsArr.filter(function(field) {
59728         return field.isAllowed();
59729       });
59730       var shown = allowedFields.filter(function(field) {
59731         return field.isShown();
59732       });
59733       var notShown = allowedFields.filter(function(field) {
59734         return !field.isShown();
59735       });
59736       var container = selection2.selectAll(".form-fields-container").data([0]);
59737       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
59738       var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
59739         return d.id + (d.entityIDs ? d.entityIDs.join() : "");
59740       });
59741       fields.exit().remove();
59742       var enter = fields.enter().append("div").attr("class", function(d) {
59743         return "wrap-form-field wrap-form-field-" + d.safeid;
59744       });
59745       fields = fields.merge(enter);
59746       fields.order().each(function(d) {
59747         select_default2(this).call(d.render);
59748       });
59749       var titles = [];
59750       var moreFields = notShown.map(function(field) {
59751         var title = field.title();
59752         titles.push(title);
59753         var terms = field.terms();
59754         if (field.key)
59755           terms.push(field.key);
59756         if (field.keys)
59757           terms = terms.concat(field.keys);
59758         return {
59759           display: field.label(),
59760           value: title,
59761           title,
59762           field,
59763           terms
59764         };
59765       });
59766       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
59767       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
59768       more.exit().remove();
59769       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
59770       moreEnter.append("span").call(_t.append("inspector.add_fields"));
59771       more = moreEnter.merge(more);
59772       var input = more.selectAll(".value").data([0]);
59773       input.exit().remove();
59774       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
59775       input.call(utilGetSetValue, "").call(moreCombo.data(moreFields).on("accept", function(d) {
59776         if (!d)
59777           return;
59778         var field = d.field;
59779         field.show();
59780         selection2.call(formFields);
59781         field.focus();
59782       }));
59783       if (_lastPlaceholder !== placeholder) {
59784         input.attr("placeholder", placeholder);
59785         _lastPlaceholder = placeholder;
59786       }
59787     }
59788     formFields.fieldsArr = function(val) {
59789       if (!arguments.length)
59790         return _fieldsArr;
59791       _fieldsArr = val || [];
59792       return formFields;
59793     };
59794     formFields.state = function(val) {
59795       if (!arguments.length)
59796         return _state;
59797       _state = val;
59798       return formFields;
59799     };
59800     formFields.klass = function(val) {
59801       if (!arguments.length)
59802         return _klass;
59803       _klass = val;
59804       return formFields;
59805     };
59806     return formFields;
59807   }
59808
59809   // modules/ui/changeset_editor.js
59810   function uiChangesetEditor(context) {
59811     var dispatch10 = dispatch_default("change");
59812     var formFields = uiFormFields(context);
59813     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
59814     var _fieldsArr;
59815     var _tags;
59816     var _changesetID;
59817     function changesetEditor(selection2) {
59818       render(selection2);
59819     }
59820     function render(selection2) {
59821       var initial = false;
59822       if (!_fieldsArr) {
59823         initial = true;
59824         var presets = _mainPresetIndex;
59825         _fieldsArr = [
59826           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
59827           uiField(context, presets.field("source"), null, { show: false, revert: false }),
59828           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
59829         ];
59830         _fieldsArr.forEach(function(field) {
59831           field.on("change", function(t, onInput) {
59832             dispatch10.call("change", field, void 0, t, onInput);
59833           });
59834         });
59835       }
59836       _fieldsArr.forEach(function(field) {
59837         field.tags(_tags);
59838       });
59839       selection2.call(formFields.fieldsArr(_fieldsArr));
59840       if (initial) {
59841         var commentField = selection2.select(".form-field-comment textarea");
59842         var commentNode = commentField.node();
59843         if (commentNode) {
59844           commentNode.focus();
59845           commentNode.select();
59846         }
59847         utilTriggerEvent(commentField, "blur");
59848         var osm = context.connection();
59849         if (osm) {
59850           osm.userChangesets(function(err, changesets) {
59851             if (err)
59852               return;
59853             var comments = changesets.map(function(changeset) {
59854               var comment = changeset.tags.comment;
59855               return comment ? { title: comment, value: comment } : null;
59856             }).filter(Boolean);
59857             commentField.call(commentCombo.data(utilArrayUniqBy(comments, "title")));
59858           });
59859         }
59860       }
59861       var hasGoogle = _tags.comment.match(/google/i);
59862       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(hasGoogle ? [0] : []);
59863       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
59864       var commentEnter = commentWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning comment-warning").style("opacity", 0);
59865       commentEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-alert", "inline")).attr("href", _t("commit.google_warning_link")).append("span").call(_t.append("commit.google_warning"));
59866       commentEnter.transition().duration(200).style("opacity", 1);
59867     }
59868     changesetEditor.tags = function(_) {
59869       if (!arguments.length)
59870         return _tags;
59871       _tags = _;
59872       return changesetEditor;
59873     };
59874     changesetEditor.changesetID = function(_) {
59875       if (!arguments.length)
59876         return _changesetID;
59877       if (_changesetID === _)
59878         return changesetEditor;
59879       _changesetID = _;
59880       _fieldsArr = null;
59881       return changesetEditor;
59882     };
59883     return utilRebind(changesetEditor, dispatch10, "on");
59884   }
59885
59886   // modules/ui/commit.js
59887   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
59888
59889   // modules/util/jxon.js
59890   var JXON = new function() {
59891     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
59892     function parseText(sValue) {
59893       if (rIsNull.test(sValue)) {
59894         return null;
59895       }
59896       if (rIsBool.test(sValue)) {
59897         return sValue.toLowerCase() === "true";
59898       }
59899       if (isFinite(sValue)) {
59900         return parseFloat(sValue);
59901       }
59902       if (isFinite(Date.parse(sValue))) {
59903         return new Date(sValue);
59904       }
59905       return sValue;
59906     }
59907     function EmptyTree() {
59908     }
59909     EmptyTree.prototype.toString = function() {
59910       return "null";
59911     };
59912     EmptyTree.prototype.valueOf = function() {
59913       return null;
59914     };
59915     function objectify(vValue) {
59916       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
59917     }
59918     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
59919       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
59920       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : true;
59921       if (bChildren) {
59922         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
59923           oNode = oParentNode.childNodes.item(nItem);
59924           if (oNode.nodeType === 4) {
59925             sCollectedTxt += oNode.nodeValue;
59926           } else if (oNode.nodeType === 3) {
59927             sCollectedTxt += oNode.nodeValue.trim();
59928           } else if (oNode.nodeType === 1 && !oNode.prefix) {
59929             aCache.push(oNode);
59930           }
59931         }
59932       }
59933       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
59934       if (!bHighVerb && (bChildren || bAttributes)) {
59935         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
59936       }
59937       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
59938         sProp = aCache[nElId].nodeName.toLowerCase();
59939         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
59940         if (vResult.hasOwnProperty(sProp)) {
59941           if (vResult[sProp].constructor !== Array) {
59942             vResult[sProp] = [vResult[sProp]];
59943           }
59944           vResult[sProp].push(vContent);
59945         } else {
59946           vResult[sProp] = vContent;
59947           nLength++;
59948         }
59949       }
59950       if (bAttributes) {
59951         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
59952         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
59953           oAttrib = oParentNode.attributes.item(nAttrib);
59954           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
59955         }
59956         if (bNesteAttr) {
59957           if (bFreeze) {
59958             Object.freeze(oAttrParent);
59959           }
59960           vResult[sAttributesProp] = oAttrParent;
59961           nLength -= nAttrLen - 1;
59962         }
59963       }
59964       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
59965         vResult[sValueProp] = vBuiltVal;
59966       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
59967         vResult = vBuiltVal;
59968       }
59969       if (bFreeze && (bHighVerb || nLength > 0)) {
59970         Object.freeze(vResult);
59971       }
59972       aCache.length = nLevelStart;
59973       return vResult;
59974     }
59975     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
59976       var vValue, oChild;
59977       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
59978         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
59979       } else if (oParentObj.constructor === Date) {
59980         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
59981       }
59982       for (var sName in oParentObj) {
59983         vValue = oParentObj[sName];
59984         if (isFinite(sName) || vValue instanceof Function) {
59985           continue;
59986         }
59987         if (sName === sValueProp) {
59988           if (vValue !== null && vValue !== true) {
59989             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
59990           }
59991         } else if (sName === sAttributesProp) {
59992           for (var sAttrib in vValue) {
59993             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
59994           }
59995         } else if (sName.charAt(0) === sAttrPref) {
59996           oParentEl.setAttribute(sName.slice(1), vValue);
59997         } else if (vValue.constructor === Array) {
59998           for (var nItem = 0; nItem < vValue.length; nItem++) {
59999             oChild = oXMLDoc.createElement(sName);
60000             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
60001             oParentEl.appendChild(oChild);
60002           }
60003         } else {
60004           oChild = oXMLDoc.createElement(sName);
60005           if (vValue instanceof Object) {
60006             loadObjTree(oXMLDoc, oChild, vValue);
60007           } else if (vValue !== null && vValue !== true) {
60008             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
60009           }
60010           oParentEl.appendChild(oChild);
60011         }
60012       }
60013     }
60014     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
60015       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : 1;
60016       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
60017     };
60018     this.unbuild = function(oObjTree) {
60019       var oNewDoc = document.implementation.createDocument("", "", null);
60020       loadObjTree(oNewDoc, oNewDoc, oObjTree);
60021       return oNewDoc;
60022     };
60023     this.stringify = function(oObjTree) {
60024       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
60025     };
60026   }();
60027
60028   // modules/ui/sections/changes.js
60029   function uiSectionChanges(context) {
60030     var _discardTags = {};
60031     _mainFileFetcher.get("discarded").then(function(d) {
60032       _discardTags = d;
60033     }).catch(function() {
60034     });
60035     var section = uiSection("changes-list", context).label(function() {
60036       var history = context.history();
60037       var summary = history.difference().summary();
60038       return _t.html("inspector.title_count", { title: { html: _t.html("commit.changes") }, count: summary.length });
60039     }).disclosureContent(renderDisclosureContent);
60040     function renderDisclosureContent(selection2) {
60041       var history = context.history();
60042       var summary = history.difference().summary();
60043       var container = selection2.selectAll(".commit-section").data([0]);
60044       var containerEnter = container.enter().append("div").attr("class", "commit-section");
60045       containerEnter.append("ul").attr("class", "changeset-list");
60046       container = containerEnter.merge(container);
60047       var items = container.select("ul").selectAll("li").data(summary);
60048       var itemsEnter = items.enter().append("li").attr("class", "change-item");
60049       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
60050       buttons.each(function(d) {
60051         select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
60052       });
60053       buttons.append("span").attr("class", "change-type").html(function(d) {
60054         return _t.html("commit." + d.changeType) + " ";
60055       });
60056       buttons.append("strong").attr("class", "entity-type").text(function(d) {
60057         var matched = _mainPresetIndex.match(d.entity, d.graph);
60058         return matched && matched.name() || utilDisplayType(d.entity.id);
60059       });
60060       buttons.append("span").attr("class", "entity-name").text(function(d) {
60061         var name2 = utilDisplayName(d.entity) || "", string = "";
60062         if (name2 !== "") {
60063           string += ":";
60064         }
60065         return string += " " + name2;
60066       });
60067       items = itemsEnter.merge(items);
60068       var changeset = new osmChangeset().update({ id: void 0 });
60069       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
60070       delete changeset.id;
60071       var data = JXON.stringify(changeset.osmChangeJXON(changes));
60072       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
60073       var fileName = "changes.osc";
60074       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
60075       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
60076       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
60077       function mouseover(d) {
60078         if (d.entity) {
60079           context.surface().selectAll(utilEntityOrMemberSelector([d.entity.id], context.graph())).classed("hover", true);
60080         }
60081       }
60082       function mouseout() {
60083         context.surface().selectAll(".hover").classed("hover", false);
60084       }
60085       function click(d3_event, change) {
60086         if (change.changeType !== "deleted") {
60087           var entity = change.entity;
60088           context.map().zoomToEase(entity);
60089           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
60090         }
60091       }
60092     }
60093     return section;
60094   }
60095
60096   // modules/ui/commit_warnings.js
60097   function uiCommitWarnings(context) {
60098     function commitWarnings(selection2) {
60099       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
60100       for (var severity in issuesBySeverity) {
60101         var issues = issuesBySeverity[severity];
60102         if (severity !== "error") {
60103           issues = issues.filter(function(issue) {
60104             return issue.type !== "help_request";
60105           });
60106         }
60107         var section = severity + "-section";
60108         var issueItem = severity + "-item";
60109         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
60110         container.exit().remove();
60111         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
60112         containerEnter.append("h3").html(severity === "warning" ? _t.html("commit.warnings") : _t.html("commit.errors"));
60113         containerEnter.append("ul").attr("class", "changeset-list");
60114         container = containerEnter.merge(container);
60115         var items = container.select("ul").selectAll("li").data(issues, function(d) {
60116           return d.key;
60117         });
60118         items.exit().remove();
60119         var itemsEnter = items.enter().append("li").attr("class", issueItem);
60120         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
60121           if (d.entityIds) {
60122             context.surface().selectAll(utilEntityOrMemberSelector(d.entityIds, context.graph())).classed("hover", true);
60123           }
60124         }).on("mouseout", function() {
60125           context.surface().selectAll(".hover").classed("hover", false);
60126         }).on("click", function(d3_event, d) {
60127           context.validator().focusIssue(d);
60128         });
60129         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
60130         buttons.append("strong").attr("class", "issue-message");
60131         buttons.filter(function(d) {
60132           return d.tooltip;
60133         }).call(uiTooltip().title(function(d) {
60134           return d.tooltip;
60135         }).placement("top"));
60136         items = itemsEnter.merge(items);
60137         items.selectAll(".issue-message").html(function(d) {
60138           return d.message(context);
60139         });
60140       }
60141     }
60142     return commitWarnings;
60143   }
60144
60145   // modules/ui/commit.js
60146   var readOnlyTags = [
60147     /^changesets_count$/,
60148     /^created_by$/,
60149     /^ideditor:/,
60150     /^imagery_used$/,
60151     /^host$/,
60152     /^locale$/,
60153     /^warnings:/,
60154     /^resolved:/,
60155     /^closed:note$/,
60156     /^closed:keepright$/,
60157     /^closed:improveosm:/,
60158     /^closed:osmose:/
60159   ];
60160   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
60161   function uiCommit(context) {
60162     var dispatch10 = dispatch_default("cancel");
60163     var _userDetails2;
60164     var _selection;
60165     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
60166     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
60167     var commitChanges = uiSectionChanges(context);
60168     var commitWarnings = uiCommitWarnings(context);
60169     function commit(selection2) {
60170       _selection = selection2;
60171       if (!context.changeset)
60172         initChangeset();
60173       loadDerivedChangesetTags();
60174       selection2.call(render);
60175     }
60176     function initChangeset() {
60177       var commentDate = +corePreferences("commentDate") || 0;
60178       var currDate = Date.now();
60179       var cutoff = 2 * 86400 * 1e3;
60180       if (commentDate > currDate || currDate - commentDate > cutoff) {
60181         corePreferences("comment", null);
60182         corePreferences("hashtags", null);
60183         corePreferences("source", null);
60184       }
60185       if (context.defaultChangesetComment()) {
60186         corePreferences("comment", context.defaultChangesetComment());
60187         corePreferences("commentDate", Date.now());
60188       }
60189       if (context.defaultChangesetSource()) {
60190         corePreferences("source", context.defaultChangesetSource());
60191         corePreferences("commentDate", Date.now());
60192       }
60193       if (context.defaultChangesetHashtags()) {
60194         corePreferences("hashtags", context.defaultChangesetHashtags());
60195         corePreferences("commentDate", Date.now());
60196       }
60197       var detected = utilDetect();
60198       var tags = {
60199         comment: corePreferences("comment") || "",
60200         created_by: context.cleanTagValue("iD " + context.version),
60201         host: context.cleanTagValue(detected.host),
60202         locale: context.cleanTagValue(_mainLocalizer.localeCode())
60203       };
60204       findHashtags(tags, true);
60205       var hashtags = corePreferences("hashtags");
60206       if (hashtags) {
60207         tags.hashtags = hashtags;
60208       }
60209       var source = corePreferences("source");
60210       if (source) {
60211         tags.source = source;
60212       }
60213       var photoOverlaysUsed = context.history().photoOverlaysUsed();
60214       if (photoOverlaysUsed.length) {
60215         var sources = (tags.source || "").split(";");
60216         if (sources.indexOf("streetlevel imagery") === -1) {
60217           sources.push("streetlevel imagery");
60218         }
60219         photoOverlaysUsed.forEach(function(photoOverlay) {
60220           if (sources.indexOf(photoOverlay) === -1) {
60221             sources.push(photoOverlay);
60222           }
60223         });
60224         tags.source = context.cleanTagValue(sources.join(";"));
60225       }
60226       context.changeset = new osmChangeset({ tags });
60227     }
60228     function loadDerivedChangesetTags() {
60229       var osm = context.connection();
60230       if (!osm)
60231         return;
60232       var tags = Object.assign({}, context.changeset.tags);
60233       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
60234       tags.imagery_used = imageryUsed || "None";
60235       var osmClosed = osm.getClosedIDs();
60236       var itemType;
60237       if (osmClosed.length) {
60238         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
60239       }
60240       if (services.keepRight) {
60241         var krClosed = services.keepRight.getClosedIDs();
60242         if (krClosed.length) {
60243           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
60244         }
60245       }
60246       if (services.improveOSM) {
60247         var iOsmClosed = services.improveOSM.getClosedCounts();
60248         for (itemType in iOsmClosed) {
60249           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
60250         }
60251       }
60252       if (services.osmose) {
60253         var osmoseClosed = services.osmose.getClosedCounts();
60254         for (itemType in osmoseClosed) {
60255           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
60256         }
60257       }
60258       for (var key in tags) {
60259         if (key.match(/(^warnings:)|(^resolved:)/)) {
60260           delete tags[key];
60261         }
60262       }
60263       function addIssueCounts(issues, prefix) {
60264         var issuesByType = utilArrayGroupBy(issues, "type");
60265         for (var issueType in issuesByType) {
60266           var issuesOfType = issuesByType[issueType];
60267           if (issuesOfType[0].subtype) {
60268             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
60269             for (var issueSubtype in issuesBySubtype) {
60270               var issuesOfSubtype = issuesBySubtype[issueSubtype];
60271               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
60272             }
60273           } else {
60274             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
60275           }
60276         }
60277       }
60278       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
60279         return issue.type !== "help_request";
60280       });
60281       addIssueCounts(warnings, "warnings");
60282       var resolvedIssues = context.validator().getResolvedIssues();
60283       addIssueCounts(resolvedIssues, "resolved");
60284       context.changeset = context.changeset.update({ tags });
60285     }
60286     function render(selection2) {
60287       var osm = context.connection();
60288       if (!osm)
60289         return;
60290       var header = selection2.selectAll(".header").data([0]);
60291       var headerTitle = header.enter().append("div").attr("class", "header fillL");
60292       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
60293       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
60294         dispatch10.call("cancel", this);
60295       }).call(svgIcon("#iD-icon-close"));
60296       var body = selection2.selectAll(".body").data([0]);
60297       body = body.enter().append("div").attr("class", "body").merge(body);
60298       var changesetSection = body.selectAll(".changeset-editor").data([0]);
60299       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
60300       changesetSection.call(changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags));
60301       body.call(commitWarnings);
60302       var saveSection = body.selectAll(".save-section").data([0]);
60303       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
60304       var prose = saveSection.selectAll(".commit-info").data([0]);
60305       if (prose.enter().size()) {
60306         _userDetails2 = null;
60307       }
60308       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
60309       osm.userDetails(function(err, user) {
60310         if (err)
60311           return;
60312         if (_userDetails2 === user)
60313           return;
60314         _userDetails2 = user;
60315         var userLink = select_default2(document.createElement("div"));
60316         if (user.image_url) {
60317           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
60318         }
60319         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
60320         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
60321       });
60322       var requestReview = saveSection.selectAll(".request-review").data([0]);
60323       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
60324       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
60325       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
60326       if (!labelEnter.empty()) {
60327         labelEnter.call(uiTooltip().title(_t.html("commit.request_review_info")).placement("top"));
60328       }
60329       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
60330       labelEnter.append("span").call(_t.append("commit.request_review"));
60331       requestReview = requestReview.merge(requestReviewEnter);
60332       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
60333       var buttonSection = saveSection.selectAll(".buttons").data([0]);
60334       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
60335       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
60336       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
60337       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
60338       var uploadBlockerTooltipText = getUploadBlockerMessage();
60339       buttonSection = buttonSection.merge(buttonEnter);
60340       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
60341         dispatch10.call("cancel", this);
60342       });
60343       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
60344         if (!select_default2(this).classed("disabled")) {
60345           this.blur();
60346           for (var key in context.changeset.tags) {
60347             if (!key)
60348               delete context.changeset.tags[key];
60349           }
60350           context.uploader().save(context.changeset);
60351         }
60352       });
60353       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
60354       if (uploadBlockerTooltipText) {
60355         buttonSection.selectAll(".save-button").call(uiTooltip().title(uploadBlockerTooltipText).placement("top"));
60356       }
60357       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
60358       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
60359       tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
60360       var changesSection = body.selectAll(".commit-changes-section").data([0]);
60361       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
60362       changesSection.call(commitChanges.render);
60363       function toggleRequestReview() {
60364         var rr = requestReviewInput.property("checked");
60365         updateChangeset({ review_requested: rr ? "yes" : void 0 });
60366         tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
60367       }
60368     }
60369     function getUploadBlockerMessage() {
60370       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
60371       if (errors.length) {
60372         return _t("commit.outstanding_errors_message", { count: errors.length });
60373       } else {
60374         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
60375         if (!hasChangesetComment) {
60376           return _t("commit.comment_needed_message");
60377         }
60378       }
60379       return null;
60380     }
60381     function changeTags(_, changed, onInput) {
60382       if (changed.hasOwnProperty("comment")) {
60383         if (changed.comment === void 0) {
60384           changed.comment = "";
60385         }
60386         if (!onInput) {
60387           corePreferences("comment", changed.comment);
60388           corePreferences("commentDate", Date.now());
60389         }
60390       }
60391       if (changed.hasOwnProperty("source")) {
60392         if (changed.source === void 0) {
60393           corePreferences("source", null);
60394         } else if (!onInput) {
60395           corePreferences("source", changed.source);
60396           corePreferences("commentDate", Date.now());
60397         }
60398       }
60399       updateChangeset(changed, onInput);
60400       if (_selection) {
60401         _selection.call(render);
60402       }
60403     }
60404     function findHashtags(tags, commentOnly) {
60405       var detectedHashtags = commentHashtags();
60406       if (detectedHashtags.length) {
60407         corePreferences("hashtags", null);
60408       }
60409       if (!detectedHashtags.length || !commentOnly) {
60410         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
60411       }
60412       var allLowerCase = /* @__PURE__ */ new Set();
60413       return detectedHashtags.filter(function(hashtag) {
60414         var lowerCase = hashtag.toLowerCase();
60415         if (!allLowerCase.has(lowerCase)) {
60416           allLowerCase.add(lowerCase);
60417           return true;
60418         }
60419         return false;
60420       });
60421       function commentHashtags() {
60422         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
60423         return matches || [];
60424       }
60425       function hashtagHashtags() {
60426         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
60427           if (s[0] !== "#") {
60428             s = "#" + s;
60429           }
60430           var matched = s.match(hashtagRegex);
60431           return matched && matched[0];
60432         }).filter(Boolean);
60433         return matches || [];
60434       }
60435     }
60436     function isReviewRequested(tags) {
60437       var rr = tags.review_requested;
60438       if (rr === void 0)
60439         return false;
60440       rr = rr.trim().toLowerCase();
60441       return !(rr === "" || rr === "no");
60442     }
60443     function updateChangeset(changed, onInput) {
60444       var tags = Object.assign({}, context.changeset.tags);
60445       Object.keys(changed).forEach(function(k) {
60446         var v = changed[k];
60447         k = context.cleanTagKey(k);
60448         if (readOnlyTags.indexOf(k) !== -1)
60449           return;
60450         if (v === void 0) {
60451           delete tags[k];
60452         } else if (onInput) {
60453           tags[k] = v;
60454         } else {
60455           tags[k] = context.cleanTagValue(v);
60456         }
60457       });
60458       if (!onInput) {
60459         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
60460         var arr = findHashtags(tags, commentOnly);
60461         if (arr.length) {
60462           tags.hashtags = context.cleanTagValue(arr.join(";"));
60463           corePreferences("hashtags", tags.hashtags);
60464         } else {
60465           delete tags.hashtags;
60466           corePreferences("hashtags", null);
60467         }
60468       }
60469       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
60470         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
60471         tags.changesets_count = String(changesetsCount);
60472         if (changesetsCount <= 100) {
60473           var s;
60474           s = corePreferences("walkthrough_completed");
60475           if (s) {
60476             tags["ideditor:walkthrough_completed"] = s;
60477           }
60478           s = corePreferences("walkthrough_progress");
60479           if (s) {
60480             tags["ideditor:walkthrough_progress"] = s;
60481           }
60482           s = corePreferences("walkthrough_started");
60483           if (s) {
60484             tags["ideditor:walkthrough_started"] = s;
60485           }
60486         }
60487       } else {
60488         delete tags.changesets_count;
60489       }
60490       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
60491         context.changeset = context.changeset.update({ tags });
60492       }
60493     }
60494     commit.reset = function() {
60495       context.changeset = null;
60496     };
60497     return utilRebind(commit, dispatch10, "on");
60498   }
60499
60500   // modules/ui/confirm.js
60501   function uiConfirm(selection2) {
60502     var modalSelection = uiModal(selection2);
60503     modalSelection.select(".modal").classed("modal-alert", true);
60504     var section = modalSelection.select(".content");
60505     section.append("div").attr("class", "modal-section header");
60506     section.append("div").attr("class", "modal-section message-text");
60507     var buttons = section.append("div").attr("class", "modal-section buttons cf");
60508     modalSelection.okButton = function() {
60509       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
60510         modalSelection.remove();
60511       }).call(_t.append("confirm.okay")).node().focus();
60512       return modalSelection;
60513     };
60514     return modalSelection;
60515   }
60516
60517   // modules/ui/conflicts.js
60518   function uiConflicts(context) {
60519     var dispatch10 = dispatch_default("cancel", "save");
60520     var keybinding = utilKeybinding("conflicts");
60521     var _origChanges;
60522     var _conflictList;
60523     var _shownConflictIndex;
60524     function keybindingOn() {
60525       select_default2(document).call(keybinding.on("\u238B", cancel, true));
60526     }
60527     function keybindingOff() {
60528       select_default2(document).call(keybinding.unbind);
60529     }
60530     function tryAgain() {
60531       keybindingOff();
60532       dispatch10.call("save");
60533     }
60534     function cancel() {
60535       keybindingOff();
60536       dispatch10.call("cancel");
60537     }
60538     function conflicts(selection2) {
60539       keybindingOn();
60540       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
60541       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
60542       headerEnter.append("h2").call(_t.append("save.conflict.header"));
60543       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
60544       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
60545       var changeset = new osmChangeset();
60546       delete changeset.id;
60547       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
60548       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
60549       var fileName = "changes.osc";
60550       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
60551       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
60552       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
60553       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
60554       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
60555       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
60556       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
60557       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
60558     }
60559     function showConflict(selection2, index) {
60560       index = utilWrap(index, _conflictList.length);
60561       _shownConflictIndex = index;
60562       var parent = select_default2(selection2.node().parentNode);
60563       if (index === _conflictList.length - 1) {
60564         window.setTimeout(function() {
60565           parent.select(".conflicts-button").attr("disabled", null);
60566           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
60567         }, 250);
60568       }
60569       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
60570       conflict.exit().remove();
60571       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
60572       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
60573       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
60574         return d.name;
60575       }).on("click", function(d3_event, d) {
60576         d3_event.preventDefault();
60577         zoomToEntity(d.id);
60578       });
60579       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
60580       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
60581         return d.details || [];
60582       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
60583         return d;
60584       });
60585       details.append("div").attr("class", "conflict-choices").call(addChoices);
60586       details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").html(function(d) {
60587         return _t.html("save.conflict." + d);
60588       }).attr("class", "conflict-nav-button action col6").attr("disabled", function(d, i2) {
60589         return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
60590       }).on("click", function(d3_event, d) {
60591         d3_event.preventDefault();
60592         var container = parent.selectAll(".conflict-container");
60593         var sign2 = d === "previous" ? -1 : 1;
60594         container.selectAll(".conflict").remove();
60595         container.call(showConflict, index + sign2);
60596       });
60597     }
60598     function addChoices(selection2) {
60599       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
60600         return d.choices || [];
60601       });
60602       var choicesEnter = choices.enter().append("li").attr("class", "layer");
60603       var labelEnter = choicesEnter.append("label");
60604       labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
60605         return d.id;
60606       }).on("change", function(d3_event, d) {
60607         var ul = this.parentNode.parentNode.parentNode;
60608         ul.__data__.chosen = d.id;
60609         choose(d3_event, ul, d);
60610       });
60611       labelEnter.append("span").text(function(d) {
60612         return d.text;
60613       });
60614       choicesEnter.merge(choices).each(function(d) {
60615         var ul = this.parentNode;
60616         if (ul.__data__.chosen === d.id) {
60617           choose(null, ul, d);
60618         }
60619       });
60620     }
60621     function choose(d3_event, ul, datum2) {
60622       if (d3_event)
60623         d3_event.preventDefault();
60624       select_default2(ul).selectAll("li").classed("active", function(d) {
60625         return d === datum2;
60626       }).selectAll("input").property("checked", function(d) {
60627         return d === datum2;
60628       });
60629       var extent = geoExtent();
60630       var entity;
60631       entity = context.graph().hasEntity(datum2.id);
60632       if (entity)
60633         extent._extend(entity.extent(context.graph()));
60634       datum2.action();
60635       entity = context.graph().hasEntity(datum2.id);
60636       if (entity)
60637         extent._extend(entity.extent(context.graph()));
60638       zoomToEntity(datum2.id, extent);
60639     }
60640     function zoomToEntity(id2, extent) {
60641       context.surface().selectAll(".hover").classed("hover", false);
60642       var entity = context.graph().hasEntity(id2);
60643       if (entity) {
60644         if (extent) {
60645           context.map().trimmedExtent(extent);
60646         } else {
60647           context.map().zoomToEase(entity);
60648         }
60649         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
60650       }
60651     }
60652     conflicts.conflictList = function(_) {
60653       if (!arguments.length)
60654         return _conflictList;
60655       _conflictList = _;
60656       return conflicts;
60657     };
60658     conflicts.origChanges = function(_) {
60659       if (!arguments.length)
60660         return _origChanges;
60661       _origChanges = _;
60662       return conflicts;
60663     };
60664     conflicts.shownEntityIds = function() {
60665       if (_conflictList && typeof _shownConflictIndex === "number") {
60666         return [_conflictList[_shownConflictIndex].id];
60667       }
60668       return [];
60669     };
60670     return utilRebind(conflicts, dispatch10, "on");
60671   }
60672
60673   // modules/ui/entity_editor.js
60674   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
60675
60676   // modules/ui/sections/entity_issues.js
60677   function uiSectionEntityIssues(context) {
60678     var preference = corePreferences("entity-issues.reference.expanded");
60679     var _expanded = preference === null ? true : preference === "true";
60680     var _entityIDs = [];
60681     var _issues = [];
60682     var _activeIssueID;
60683     var section = uiSection("entity-issues", context).shouldDisplay(function() {
60684       return _issues.length > 0;
60685     }).label(function() {
60686       return _t.html("inspector.title_count", { title: { html: _t.html("issues.list_title") }, count: _issues.length });
60687     }).disclosureContent(renderDisclosureContent);
60688     context.validator().on("validated.entity_issues", function() {
60689       reloadIssues();
60690       section.reRender();
60691     }).on("focusedIssue.entity_issues", function(issue) {
60692       makeActiveIssue(issue.id);
60693     });
60694     function reloadIssues() {
60695       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
60696     }
60697     function makeActiveIssue(issueID) {
60698       _activeIssueID = issueID;
60699       section.selection().selectAll(".issue-container").classed("active", function(d) {
60700         return d.id === _activeIssueID;
60701       });
60702     }
60703     function renderDisclosureContent(selection2) {
60704       selection2.classed("grouped-items-area", true);
60705       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
60706       var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
60707         return d.key;
60708       });
60709       containers.exit().remove();
60710       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
60711       var itemsEnter = containersEnter.append("div").attr("class", function(d) {
60712         return "issue severity-" + d.severity;
60713       }).on("mouseover.highlight", function(d3_event, d) {
60714         var ids = d.entityIds.filter(function(e) {
60715           return _entityIDs.indexOf(e) === -1;
60716         });
60717         utilHighlightEntities(ids, true, context);
60718       }).on("mouseout.highlight", function(d3_event, d) {
60719         var ids = d.entityIds.filter(function(e) {
60720           return _entityIDs.indexOf(e) === -1;
60721         });
60722         utilHighlightEntities(ids, false, context);
60723       });
60724       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
60725       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
60726         makeActiveIssue(d.id);
60727         var extent = d.extent(context.graph());
60728         if (extent) {
60729           var setZoom = Math.max(context.map().zoom(), 19);
60730           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
60731         }
60732       });
60733       textEnter.each(function(d) {
60734         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
60735         select_default2(this).call(svgIcon(iconName, "issue-icon"));
60736       });
60737       textEnter.append("span").attr("class", "issue-message");
60738       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
60739       infoButton.on("click", function(d3_event) {
60740         d3_event.stopPropagation();
60741         d3_event.preventDefault();
60742         this.blur();
60743         var container = select_default2(this.parentNode.parentNode.parentNode);
60744         var info = container.selectAll(".issue-info");
60745         var isExpanded = info.classed("expanded");
60746         _expanded = !isExpanded;
60747         corePreferences("entity-issues.reference.expanded", _expanded);
60748         if (isExpanded) {
60749           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
60750             info.classed("expanded", false);
60751           });
60752         } else {
60753           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
60754             info.style("max-height", null);
60755           });
60756         }
60757       });
60758       itemsEnter.append("ul").attr("class", "issue-fix-list");
60759       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
60760         if (typeof d.reference === "function") {
60761           select_default2(this).call(d.reference);
60762         } else {
60763           select_default2(this).call(_t.append("inspector.no_documentation_key"));
60764         }
60765       });
60766       containers = containers.merge(containersEnter).classed("active", function(d) {
60767         return d.id === _activeIssueID;
60768       });
60769       containers.selectAll(".issue-message").html(function(d) {
60770         return d.message(context);
60771       });
60772       var fixLists = containers.selectAll(".issue-fix-list");
60773       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
60774         return d.fixes ? d.fixes(context) : [];
60775       }, function(fix) {
60776         return fix.id;
60777       });
60778       fixes.exit().remove();
60779       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
60780       var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
60781         if (select_default2(this).attr("disabled") || !d.onClick)
60782           return;
60783         if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3)
60784           return;
60785         d.issue.dateLastRanFix = new Date();
60786         utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
60787         new Promise(function(resolve, reject) {
60788           d.onClick(context, resolve, reject);
60789           if (d.onClick.length <= 1) {
60790             resolve();
60791           }
60792         }).then(function() {
60793           context.validator().validate();
60794         });
60795       }).on("mouseover.highlight", function(d3_event, d) {
60796         utilHighlightEntities(d.entityIds, true, context);
60797       }).on("mouseout.highlight", function(d3_event, d) {
60798         utilHighlightEntities(d.entityIds, false, context);
60799       });
60800       buttons.each(function(d) {
60801         var iconName = d.icon || "iD-icon-wrench";
60802         if (iconName.startsWith("maki")) {
60803           iconName += "-15";
60804         }
60805         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
60806       });
60807       buttons.append("span").attr("class", "fix-message").html(function(d) {
60808         return d.title;
60809       });
60810       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
60811         return d.onClick;
60812       }).attr("disabled", function(d) {
60813         return d.onClick ? null : "true";
60814       }).attr("title", function(d) {
60815         if (d.disabledReason) {
60816           return d.disabledReason;
60817         }
60818         return null;
60819       });
60820     }
60821     section.entityIDs = function(val) {
60822       if (!arguments.length)
60823         return _entityIDs;
60824       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
60825         _entityIDs = val;
60826         _activeIssueID = null;
60827         reloadIssues();
60828       }
60829       return section;
60830     };
60831     return section;
60832   }
60833
60834   // modules/ui/preset_icon.js
60835   function uiPresetIcon() {
60836     let _preset;
60837     let _geometry;
60838     function presetIcon(selection2) {
60839       selection2.each(render);
60840     }
60841     function getIcon(p, geom) {
60842       if (p.icon)
60843         return p.icon;
60844       if (geom === "line")
60845         return "iD-other-line";
60846       if (geom === "vertex")
60847         return p.isFallback() ? "" : "temaki-vertex";
60848       return "maki-marker-stroked";
60849     }
60850     function renderPointBorder(container, drawPoint) {
60851       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
60852       pointBorder.exit().remove();
60853       let pointBorderEnter = pointBorder.enter();
60854       const w = 40;
60855       const h = 40;
60856       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
60857       pointBorder = pointBorderEnter.merge(pointBorder);
60858     }
60859     function renderCategoryBorder(container, category) {
60860       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
60861       categoryBorder.exit().remove();
60862       let categoryBorderEnter = categoryBorder.enter();
60863       const d = 60;
60864       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d).attr("height", d).attr("viewBox", `0 0 ${d} ${d}`);
60865       svgEnter.append("path").attr("class", "area").attr("d", "M9.5,7.5 L25.5,7.5 L28.5,12.5 L49.5,12.5 C51.709139,12.5 53.5,14.290861 53.5,16.5 L53.5,43.5 C53.5,45.709139 51.709139,47.5 49.5,47.5 L10.5,47.5 C8.290861,47.5 6.5,45.709139 6.5,43.5 L6.5,12.5 L9.5,7.5 Z");
60866       categoryBorder = categoryBorderEnter.merge(categoryBorder);
60867       if (category) {
60868         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
60869       }
60870     }
60871     function renderCircleFill(container, drawVertex) {
60872       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
60873       vertexFill.exit().remove();
60874       let vertexFillEnter = vertexFill.enter();
60875       const w = 60;
60876       const h = 60;
60877       const d = 40;
60878       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).append("circle").attr("cx", w / 2).attr("cy", h / 2).attr("r", d / 2);
60879       vertexFill = vertexFillEnter.merge(vertexFill);
60880     }
60881     function renderSquareFill(container, drawArea, tagClasses) {
60882       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
60883       fill.exit().remove();
60884       let fillEnter = fill.enter();
60885       const d = 60;
60886       const w = d;
60887       const h = d;
60888       const l = d * 2 / 3;
60889       const c1 = (w - l) / 2;
60890       const c2 = c1 + l;
60891       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
60892       ["fill", "stroke"].forEach((klass) => {
60893         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
60894       });
60895       const rVertex = 2.5;
60896       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
60897         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
60898       });
60899       const rMidpoint = 1.25;
60900       [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point) => {
60901         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
60902       });
60903       fill = fillEnter.merge(fill);
60904       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
60905       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
60906     }
60907     function renderLine(container, drawLine, tagClasses) {
60908       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
60909       line.exit().remove();
60910       let lineEnter = line.enter();
60911       const d = 60;
60912       const w = d;
60913       const h = d;
60914       const y = Math.round(d * 0.72);
60915       const l = Math.round(d * 0.6);
60916       const r = 2.5;
60917       const x12 = (w - l) / 2;
60918       const x2 = x12 + l;
60919       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
60920       ["casing", "stroke"].forEach((klass) => {
60921         lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
60922       });
60923       [[x12 - 1, y], [x2 + 1, y]].forEach((point) => {
60924         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
60925       });
60926       line = lineEnter.merge(line);
60927       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
60928       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
60929     }
60930     function renderRoute(container, drawRoute, p) {
60931       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
60932       route.exit().remove();
60933       let routeEnter = route.enter();
60934       const d = 60;
60935       const w = d;
60936       const h = d;
60937       const y12 = Math.round(d * 0.8);
60938       const y2 = Math.round(d * 0.68);
60939       const l = Math.round(d * 0.6);
60940       const r = 2;
60941       const x12 = (w - l) / 2;
60942       const x2 = x12 + l / 3;
60943       const x3 = x2 + l / 3;
60944       const x4 = x3 + l / 3;
60945       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
60946       ["casing", "stroke"].forEach((klass) => {
60947         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
60948         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
60949         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
60950       });
60951       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
60952         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
60953       });
60954       route = routeEnter.merge(route);
60955       if (drawRoute) {
60956         let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
60957         const segmentPresetIDs = routeSegments[routeType];
60958         for (let i2 in segmentPresetIDs) {
60959           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
60960           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
60961           route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
60962           route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
60963         }
60964       }
60965     }
60966     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
60967       const isMaki = picon && /^maki-/.test(picon);
60968       const isTemaki = picon && /^temaki-/.test(picon);
60969       const isFa = picon && /^fa[srb]-/.test(picon);
60970       const isiDIcon = picon && !(isMaki || isTemaki || isFa);
60971       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
60972       icon2.exit().remove();
60973       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
60974       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
60975       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
60976       icon2.selectAll("use").attr("href", "#" + picon);
60977     }
60978     function renderImageIcon(container, imageURL) {
60979       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
60980       imageIcon.exit().remove();
60981       imageIcon = imageIcon.enter().append("img").attr("class", "image-icon").on("load", () => container.classed("showing-img", true)).on("error", () => container.classed("showing-img", false)).merge(imageIcon);
60982       imageIcon.attr("src", imageURL);
60983     }
60984     const routeSegments = {
60985       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
60986       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
60987       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
60988       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
60989       ferry: ["route/ferry", "route/ferry", "route/ferry"],
60990       foot: ["highway/footway", "highway/footway", "highway/footway"],
60991       hiking: ["highway/path", "highway/path", "highway/path"],
60992       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
60993       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
60994       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
60995       mtb: ["highway/path", "highway/track", "highway/bridleway"],
60996       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
60997       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
60998       power: ["power/line", "power/line", "power/line"],
60999       road: ["highway/secondary", "highway/primary", "highway/trunk"],
61000       subway: ["railway/subway", "railway/subway", "railway/subway"],
61001       train: ["railway/rail", "railway/rail", "railway/rail"],
61002       tram: ["railway/tram", "railway/tram", "railway/tram"],
61003       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
61004     };
61005     function render() {
61006       let p = _preset.apply(this, arguments);
61007       let geom = _geometry ? _geometry.apply(this, arguments) : null;
61008       if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
61009         geom = "route";
61010       }
61011       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
61012       const isFallback = p.isFallback && p.isFallback();
61013       const imageURL = showThirdPartyIcons === "true" && p.imageURL;
61014       const picon = getIcon(p, geom);
61015       const isCategory = !p.setTags;
61016       const drawPoint = false;
61017       const drawVertex = picon !== null && geom === "vertex" && !isFallback;
61018       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
61019       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
61020       const drawRoute = picon && geom === "route";
61021       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
61022       let tags = !isCategory ? p.setTags({}, geom) : {};
61023       for (let k in tags) {
61024         if (tags[k] === "*") {
61025           tags[k] = "yes";
61026         }
61027       }
61028       let tagClasses = svgTagClasses().getClassesString(tags, "");
61029       let selection2 = select_default2(this);
61030       let container = selection2.selectAll(".preset-icon-container").data([0]);
61031       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
61032       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
61033       renderCategoryBorder(container, isCategory && p);
61034       renderPointBorder(container, drawPoint);
61035       renderCircleFill(container, drawVertex);
61036       renderSquareFill(container, drawArea, tagClasses);
61037       renderLine(container, drawLine, tagClasses);
61038       renderRoute(container, drawRoute, p);
61039       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
61040       renderImageIcon(container, imageURL);
61041     }
61042     presetIcon.preset = function(val) {
61043       if (!arguments.length)
61044         return _preset;
61045       _preset = utilFunctor(val);
61046       return presetIcon;
61047     };
61048     presetIcon.geometry = function(val) {
61049       if (!arguments.length)
61050         return _geometry;
61051       _geometry = utilFunctor(val);
61052       return presetIcon;
61053     };
61054     return presetIcon;
61055   }
61056
61057   // modules/ui/sections/feature_type.js
61058   function uiSectionFeatureType(context) {
61059     var dispatch10 = dispatch_default("choose");
61060     var _entityIDs = [];
61061     var _presets = [];
61062     var _tagReference;
61063     var section = uiSection("feature-type", context).label(_t.html("inspector.feature_type")).disclosureContent(renderDisclosureContent);
61064     function renderDisclosureContent(selection2) {
61065       selection2.classed("preset-list-item", true);
61066       selection2.classed("mixed-types", _presets.length > 1);
61067       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
61068       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(uiTooltip().title(_t.html("inspector.back_tooltip")).placement("bottom"));
61069       presetButton.append("div").attr("class", "preset-icon-container");
61070       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
61071       presetButtonWrap.append("div").attr("class", "accessory-buttons");
61072       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
61073       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
61074       if (_tagReference) {
61075         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
61076         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
61077       }
61078       selection2.selectAll(".preset-reset").on("click", function() {
61079         dispatch10.call("choose", this, _presets);
61080       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
61081         d3_event.preventDefault();
61082         d3_event.stopPropagation();
61083       });
61084       var geometries = entityGeometries();
61085       selection2.select(".preset-list-item button").call(uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point")));
61086       var names = _presets.length === 1 ? [
61087         _presets[0].nameLabel(),
61088         _presets[0].subtitleLabel()
61089       ].filter(Boolean) : [_t("inspector.multiple_types")];
61090       var label = selection2.select(".label-inner");
61091       var nameparts = label.selectAll(".namepart").data(names, function(d) {
61092         return d;
61093       });
61094       nameparts.exit().remove();
61095       nameparts.enter().append("div").attr("class", "namepart").html(function(d) {
61096         return d;
61097       });
61098     }
61099     section.entityIDs = function(val) {
61100       if (!arguments.length)
61101         return _entityIDs;
61102       _entityIDs = val;
61103       return section;
61104     };
61105     section.presets = function(val) {
61106       if (!arguments.length)
61107         return _presets;
61108       if (!utilArrayIdentical(val, _presets)) {
61109         _presets = val;
61110         if (_presets.length === 1) {
61111           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
61112         }
61113       }
61114       return section;
61115     };
61116     function entityGeometries() {
61117       var counts = {};
61118       for (var i2 in _entityIDs) {
61119         var geometry = context.graph().geometry(_entityIDs[i2]);
61120         if (!counts[geometry])
61121           counts[geometry] = 0;
61122         counts[geometry] += 1;
61123       }
61124       return Object.keys(counts).sort(function(geom1, geom2) {
61125         return counts[geom2] - counts[geom1];
61126       });
61127     }
61128     return utilRebind(section, dispatch10, "on");
61129   }
61130
61131   // modules/ui/sections/preset_fields.js
61132   function uiSectionPresetFields(context) {
61133     var section = uiSection("preset-fields", context).label(_t.html("inspector.fields")).disclosureContent(renderDisclosureContent);
61134     var dispatch10 = dispatch_default("change", "revert");
61135     var formFields = uiFormFields(context);
61136     var _state;
61137     var _fieldsArr;
61138     var _presets = [];
61139     var _tags;
61140     var _entityIDs;
61141     function renderDisclosureContent(selection2) {
61142       if (!_fieldsArr) {
61143         var graph = context.graph();
61144         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
61145           geoms[graph.entity(entityID).geometry(graph)] = true;
61146           return geoms;
61147         }, {}));
61148         var presetsManager = _mainPresetIndex;
61149         var allFields = [];
61150         var allMoreFields = [];
61151         var sharedTotalFields;
61152         _presets.forEach(function(preset) {
61153           var fields = preset.fields();
61154           var moreFields = preset.moreFields();
61155           allFields = utilArrayUnion(allFields, fields);
61156           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
61157           if (!sharedTotalFields) {
61158             sharedTotalFields = utilArrayUnion(fields, moreFields);
61159           } else {
61160             sharedTotalFields = sharedTotalFields.filter(function(field) {
61161               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
61162             });
61163           }
61164         });
61165         var sharedFields = allFields.filter(function(field) {
61166           return sharedTotalFields.indexOf(field) !== -1;
61167         });
61168         var sharedMoreFields = allMoreFields.filter(function(field) {
61169           return sharedTotalFields.indexOf(field) !== -1;
61170         });
61171         _fieldsArr = [];
61172         sharedFields.forEach(function(field) {
61173           if (field.matchAllGeometry(geometries)) {
61174             _fieldsArr.push(uiField(context, field, _entityIDs));
61175           }
61176         });
61177         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
61178         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
61179           _fieldsArr.push(uiField(context, presetsManager.field("restrictions"), _entityIDs));
61180         }
61181         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
61182         additionalFields.sort(function(field1, field2) {
61183           return field1.label().localeCompare(field2.label(), _mainLocalizer.localeCode());
61184         });
61185         additionalFields.forEach(function(field) {
61186           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
61187             _fieldsArr.push(uiField(context, field, _entityIDs, { show: false }));
61188           }
61189         });
61190         _fieldsArr.forEach(function(field) {
61191           field.on("change", function(t, onInput) {
61192             dispatch10.call("change", field, _entityIDs, t, onInput);
61193           }).on("revert", function(keys) {
61194             dispatch10.call("revert", field, keys);
61195           });
61196         });
61197       }
61198       _fieldsArr.forEach(function(field) {
61199         field.state(_state).tags(_tags);
61200       });
61201       selection2.call(formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area"));
61202       selection2.selectAll(".wrap-form-field input").on("keydown", function(d3_event) {
61203         if (d3_event.keyCode === 13 && context.container().select(".combobox").empty()) {
61204           context.enter(modeBrowse(context));
61205         }
61206       });
61207     }
61208     section.presets = function(val) {
61209       if (!arguments.length)
61210         return _presets;
61211       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
61212         _presets = val;
61213         _fieldsArr = null;
61214       }
61215       return section;
61216     };
61217     section.state = function(val) {
61218       if (!arguments.length)
61219         return _state;
61220       _state = val;
61221       return section;
61222     };
61223     section.tags = function(val) {
61224       if (!arguments.length)
61225         return _tags;
61226       _tags = val;
61227       return section;
61228     };
61229     section.entityIDs = function(val) {
61230       if (!arguments.length)
61231         return _entityIDs;
61232       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
61233         _entityIDs = val;
61234         _fieldsArr = null;
61235       }
61236       return section;
61237     };
61238     return utilRebind(section, dispatch10, "on");
61239   }
61240
61241   // modules/ui/sections/raw_member_editor.js
61242   function uiSectionRawMemberEditor(context) {
61243     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
61244       if (!_entityIDs || _entityIDs.length !== 1)
61245         return false;
61246       var entity = context.hasEntity(_entityIDs[0]);
61247       return entity && entity.type === "relation";
61248     }).label(function() {
61249       var entity = context.hasEntity(_entityIDs[0]);
61250       if (!entity)
61251         return "";
61252       var gt = entity.members.length > _maxMembers ? ">" : "";
61253       var count = gt + entity.members.slice(0, _maxMembers).length;
61254       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.members") }, count });
61255     }).disclosureContent(renderDisclosureContent);
61256     var taginfo = services.taginfo;
61257     var _entityIDs;
61258     var _maxMembers = 1e3;
61259     function downloadMember(d3_event, d) {
61260       d3_event.preventDefault();
61261       select_default2(this.parentNode).classed("tag-reference-loading", true);
61262       context.loadEntity(d.id, function() {
61263         section.reRender();
61264       });
61265     }
61266     function zoomToMember(d3_event, d) {
61267       d3_event.preventDefault();
61268       var entity = context.entity(d.id);
61269       context.map().zoomToEase(entity);
61270       utilHighlightEntities([d.id], true, context);
61271     }
61272     function selectMember(d3_event, d) {
61273       d3_event.preventDefault();
61274       utilHighlightEntities([d.id], false, context);
61275       var entity = context.entity(d.id);
61276       var mapExtent = context.map().extent();
61277       if (!entity.intersects(mapExtent, context.graph())) {
61278         context.map().zoomToEase(entity);
61279       }
61280       context.enter(modeSelect(context, [d.id]));
61281     }
61282     function changeRole(d3_event, d) {
61283       var oldRole = d.role;
61284       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
61285       if (oldRole !== newRole) {
61286         var member = { id: d.id, type: d.type, role: newRole };
61287         context.perform(actionChangeMember(d.relation.id, member, d.index), _t("operations.change_role.annotation", {
61288           n: 1
61289         }));
61290         context.validator().validate();
61291       }
61292     }
61293     function deleteMember(d3_event, d) {
61294       utilHighlightEntities([d.id], false, context);
61295       context.perform(actionDeleteMember(d.relation.id, d.index), _t("operations.delete_member.annotation", {
61296         n: 1
61297       }));
61298       if (!context.hasEntity(d.relation.id)) {
61299         context.enter(modeBrowse(context));
61300       } else {
61301         context.validator().validate();
61302       }
61303     }
61304     function renderDisclosureContent(selection2) {
61305       var entityID = _entityIDs[0];
61306       var memberships = [];
61307       var entity = context.entity(entityID);
61308       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
61309         memberships.push({
61310           index,
61311           id: member.id,
61312           type: member.type,
61313           role: member.role,
61314           relation: entity,
61315           member: context.hasEntity(member.id),
61316           domId: utilUniqueDomId(entityID + "-member-" + index)
61317         });
61318       });
61319       var list = selection2.selectAll(".member-list").data([0]);
61320       list = list.enter().append("ul").attr("class", "member-list").merge(list);
61321       var items = list.selectAll("li").data(memberships, function(d) {
61322         return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
61323       });
61324       items.exit().each(unbind).remove();
61325       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
61326         return !d.member;
61327       });
61328       itemsEnter.each(function(d) {
61329         var item = select_default2(this);
61330         var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
61331         if (d.member) {
61332           item.on("mouseover", function() {
61333             utilHighlightEntities([d.id], true, context);
61334           }).on("mouseout", function() {
61335             utilHighlightEntities([d.id], false, context);
61336           });
61337           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
61338           labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
61339             var matched = _mainPresetIndex.match(d2.member, context.graph());
61340             return matched && matched.name() || utilDisplayType(d2.member.id);
61341           });
61342           labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
61343             return utilDisplayName(d2.member);
61344           });
61345           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
61346           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
61347         } else {
61348           var labelText = label.append("span").attr("class", "label-text");
61349           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
61350           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
61351           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
61352         }
61353       });
61354       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61355       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
61356         return d.domId;
61357       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
61358       if (taginfo) {
61359         wrapEnter.each(bindTypeahead);
61360       }
61361       items = items.merge(itemsEnter).order();
61362       items.select("input.member-role").property("value", function(d) {
61363         return d.role;
61364       }).on("blur", changeRole).on("change", changeRole);
61365       items.select("button.member-delete").on("click", deleteMember);
61366       var dragOrigin, targetIndex;
61367       items.call(drag_default().on("start", function(d3_event) {
61368         dragOrigin = {
61369           x: d3_event.x,
61370           y: d3_event.y
61371         };
61372         targetIndex = null;
61373       }).on("drag", function(d3_event) {
61374         var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
61375         if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
61376           return;
61377         var index = items.nodes().indexOf(this);
61378         select_default2(this).classed("dragging", true);
61379         targetIndex = null;
61380         selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
61381           var node = select_default2(this).node();
61382           if (index === index2) {
61383             return "translate(" + x + "px, " + y + "px)";
61384           } else if (index2 > index && d3_event.y > node.offsetTop) {
61385             if (targetIndex === null || index2 > targetIndex) {
61386               targetIndex = index2;
61387             }
61388             return "translateY(-100%)";
61389           } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
61390             if (targetIndex === null || index2 < targetIndex) {
61391               targetIndex = index2;
61392             }
61393             return "translateY(100%)";
61394           }
61395           return null;
61396         });
61397       }).on("end", function(d3_event, d) {
61398         if (!select_default2(this).classed("dragging"))
61399           return;
61400         var index = items.nodes().indexOf(this);
61401         select_default2(this).classed("dragging", false);
61402         selection2.selectAll("li.member-row").style("transform", null);
61403         if (targetIndex !== null) {
61404           context.perform(actionMoveMember(d.relation.id, index, targetIndex), _t("operations.reorder_members.annotation"));
61405           context.validator().validate();
61406         }
61407       }));
61408       function bindTypeahead(d) {
61409         var row = select_default2(this);
61410         var role = row.selectAll("input.member-role");
61411         var origValue = role.property("value");
61412         function sort(value, data) {
61413           var sameletter = [];
61414           var other = [];
61415           for (var i2 = 0; i2 < data.length; i2++) {
61416             if (data[i2].value.substring(0, value.length) === value) {
61417               sameletter.push(data[i2]);
61418             } else {
61419               other.push(data[i2]);
61420             }
61421           }
61422           return sameletter.concat(other);
61423         }
61424         role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
61425           var geometry;
61426           if (d.member) {
61427             geometry = context.graph().geometry(d.member.id);
61428           } else if (d.type === "relation") {
61429             geometry = "relation";
61430           } else if (d.type === "way") {
61431             geometry = "line";
61432           } else {
61433             geometry = "point";
61434           }
61435           var rtype = entity.tags.type;
61436           taginfo.roles({
61437             debounce: true,
61438             rtype: rtype || "",
61439             geometry,
61440             query: role2
61441           }, function(err, data) {
61442             if (!err)
61443               callback(sort(role2, data));
61444           });
61445         }).on("cancel", function() {
61446           role.property("value", origValue);
61447         }));
61448       }
61449       function unbind() {
61450         var row = select_default2(this);
61451         row.selectAll("input.member-role").call(uiCombobox.off, context);
61452       }
61453     }
61454     section.entityIDs = function(val) {
61455       if (!arguments.length)
61456         return _entityIDs;
61457       _entityIDs = val;
61458       return section;
61459     };
61460     return section;
61461   }
61462
61463   // modules/actions/delete_members.js
61464   function actionDeleteMembers(relationId, memberIndexes) {
61465     return function(graph) {
61466       memberIndexes.sort((a, b) => b - a);
61467       for (var i2 in memberIndexes) {
61468         graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
61469       }
61470       return graph;
61471     };
61472   }
61473
61474   // modules/ui/sections/raw_membership_editor.js
61475   function uiSectionRawMembershipEditor(context) {
61476     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
61477       return _entityIDs && _entityIDs.length;
61478     }).label(function() {
61479       var parents = getSharedParentRelations();
61480       var gt = parents.length > _maxMemberships ? ">" : "";
61481       var count = gt + parents.slice(0, _maxMemberships).length;
61482       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.relations") }, count });
61483     }).disclosureContent(renderDisclosureContent);
61484     var taginfo = services.taginfo;
61485     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
61486       if (d.relation)
61487         utilHighlightEntities([d.relation.id], true, context);
61488     }).itemsMouseLeave(function(d3_event, d) {
61489       if (d.relation)
61490         utilHighlightEntities([d.relation.id], false, context);
61491     });
61492     var _inChange = false;
61493     var _entityIDs = [];
61494     var _showBlank;
61495     var _maxMemberships = 1e3;
61496     function getSharedParentRelations() {
61497       var parents = [];
61498       for (var i2 = 0; i2 < _entityIDs.length; i2++) {
61499         var entity = context.graph().hasEntity(_entityIDs[i2]);
61500         if (!entity)
61501           continue;
61502         if (i2 === 0) {
61503           parents = context.graph().parentRelations(entity);
61504         } else {
61505           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
61506         }
61507         if (!parents.length)
61508           break;
61509       }
61510       return parents;
61511     }
61512     function getMemberships() {
61513       var memberships = [];
61514       var relations = getSharedParentRelations().slice(0, _maxMemberships);
61515       var isMultiselect = _entityIDs.length > 1;
61516       var i2, relation, membership, index, member, indexedMember;
61517       for (i2 = 0; i2 < relations.length; i2++) {
61518         relation = relations[i2];
61519         membership = {
61520           relation,
61521           members: [],
61522           hash: osmEntity.key(relation)
61523         };
61524         for (index = 0; index < relation.members.length; index++) {
61525           member = relation.members[index];
61526           if (_entityIDs.indexOf(member.id) !== -1) {
61527             indexedMember = Object.assign({}, member, { index });
61528             membership.members.push(indexedMember);
61529             membership.hash += "," + index.toString();
61530             if (!isMultiselect) {
61531               memberships.push(membership);
61532               membership = {
61533                 relation,
61534                 members: [],
61535                 hash: osmEntity.key(relation)
61536               };
61537             }
61538           }
61539         }
61540         if (membership.members.length)
61541           memberships.push(membership);
61542       }
61543       memberships.forEach(function(membership2) {
61544         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
61545         var roles = [];
61546         membership2.members.forEach(function(member2) {
61547           if (roles.indexOf(member2.role) === -1)
61548             roles.push(member2.role);
61549         });
61550         membership2.role = roles.length === 1 ? roles[0] : roles;
61551       });
61552       return memberships;
61553     }
61554     function selectRelation(d3_event, d) {
61555       d3_event.preventDefault();
61556       utilHighlightEntities([d.relation.id], false, context);
61557       context.enter(modeSelect(context, [d.relation.id]));
61558     }
61559     function zoomToRelation(d3_event, d) {
61560       d3_event.preventDefault();
61561       var entity = context.entity(d.relation.id);
61562       context.map().zoomToEase(entity);
61563       utilHighlightEntities([d.relation.id], true, context);
61564     }
61565     function changeRole(d3_event, d) {
61566       if (d === 0)
61567         return;
61568       if (_inChange)
61569         return;
61570       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
61571       if (!newRole.trim() && typeof d.role !== "string")
61572         return;
61573       var membersToUpdate = d.members.filter(function(member) {
61574         return member.role !== newRole;
61575       });
61576       if (membersToUpdate.length) {
61577         _inChange = true;
61578         context.perform(function actionChangeMemberRoles(graph) {
61579           membersToUpdate.forEach(function(member) {
61580             var newMember = Object.assign({}, member, { role: newRole });
61581             delete newMember.index;
61582             graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
61583           });
61584           return graph;
61585         }, _t("operations.change_role.annotation", {
61586           n: membersToUpdate.length
61587         }));
61588         context.validator().validate();
61589       }
61590       _inChange = false;
61591     }
61592     function addMembership(d, role) {
61593       this.blur();
61594       _showBlank = false;
61595       function actionAddMembers(relationId, ids, role2) {
61596         return function(graph) {
61597           for (var i2 in ids) {
61598             var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
61599             graph = actionAddMember(relationId, member)(graph);
61600           }
61601           return graph;
61602         };
61603       }
61604       if (d.relation) {
61605         context.perform(actionAddMembers(d.relation.id, _entityIDs, role), _t("operations.add_member.annotation", {
61606           n: _entityIDs.length
61607         }));
61608         context.validator().validate();
61609       } else {
61610         var relation = osmRelation();
61611         context.perform(actionAddEntity(relation), actionAddMembers(relation.id, _entityIDs, role), _t("operations.add.annotation.relation"));
61612         context.enter(modeSelect(context, [relation.id]).newFeature(true));
61613       }
61614     }
61615     function deleteMembership(d3_event, d) {
61616       this.blur();
61617       if (d === 0)
61618         return;
61619       utilHighlightEntities([d.relation.id], false, context);
61620       var indexes = d.members.map(function(member) {
61621         return member.index;
61622       });
61623       context.perform(actionDeleteMembers(d.relation.id, indexes), _t("operations.delete_member.annotation", {
61624         n: _entityIDs.length
61625       }));
61626       context.validator().validate();
61627     }
61628     function fetchNearbyRelations(q, callback) {
61629       var newRelation = {
61630         relation: null,
61631         value: _t("inspector.new_relation"),
61632         display: _t.html("inspector.new_relation")
61633       };
61634       var entityID = _entityIDs[0];
61635       var result = [];
61636       var graph = context.graph();
61637       function baseDisplayLabel(entity) {
61638         var matched = _mainPresetIndex.match(entity, graph);
61639         var presetName = matched && matched.name() || _t("inspector.relation");
61640         var entityName = utilDisplayName(entity) || "";
61641         return presetName + " " + entityName;
61642       }
61643       var explicitRelation = q && context.hasEntity(q.toLowerCase());
61644       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
61645         result.push({
61646           relation: explicitRelation,
61647           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
61648         });
61649       } else {
61650         context.history().intersects(context.map().extent()).forEach(function(entity) {
61651           if (entity.type !== "relation" || entity.id === entityID)
61652             return;
61653           var value = baseDisplayLabel(entity);
61654           if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
61655             return;
61656           result.push({ relation: entity, value });
61657         });
61658         result.sort(function(a, b) {
61659           return osmRelation.creationOrder(a.relation, b.relation);
61660         });
61661         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
61662           return v.length > 1;
61663         });
61664         dupeGroups.forEach(function(group) {
61665           group.forEach(function(obj) {
61666             obj.value += " " + obj.relation.id;
61667           });
61668         });
61669       }
61670       result.forEach(function(obj) {
61671         obj.title = obj.value;
61672       });
61673       result.unshift(newRelation);
61674       callback(result);
61675     }
61676     function renderDisclosureContent(selection2) {
61677       var memberships = getMemberships();
61678       var list = selection2.selectAll(".member-list").data([0]);
61679       list = list.enter().append("ul").attr("class", "member-list").merge(list);
61680       var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
61681         return d.hash;
61682       });
61683       items.exit().each(unbind).remove();
61684       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
61685       itemsEnter.on("mouseover", function(d3_event, d) {
61686         utilHighlightEntities([d.relation.id], true, context);
61687       }).on("mouseout", function(d3_event, d) {
61688         utilHighlightEntities([d.relation.id], false, context);
61689       });
61690       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
61691         return d.domId;
61692       });
61693       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
61694       labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
61695         var matched = _mainPresetIndex.match(d.relation, context.graph());
61696         return matched && matched.name() || _t.html("inspector.relation");
61697       });
61698       labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
61699         return utilDisplayName(d.relation);
61700       });
61701       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
61702       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
61703       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61704       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
61705         return d.domId;
61706       }).property("type", "text").property("value", function(d) {
61707         return typeof d.role === "string" ? d.role : "";
61708       }).attr("title", function(d) {
61709         return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
61710       }).attr("placeholder", function(d) {
61711         return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
61712       }).classed("mixed", function(d) {
61713         return Array.isArray(d.role);
61714       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
61715       if (taginfo) {
61716         wrapEnter.each(bindTypeahead);
61717       }
61718       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
61719       newMembership.exit().remove();
61720       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
61721       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
61722       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
61723       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
61724         list.selectAll(".member-row-new").remove();
61725       });
61726       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61727       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
61728       newMembership = newMembership.merge(newMembershipEnter);
61729       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity));
61730       var addRow = selection2.selectAll(".add-row").data([0]);
61731       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
61732       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
61733       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
61734       addRelationButton.call(uiTooltip().title(_t.html("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
61735       addRowEnter.append("div").attr("class", "space-value");
61736       addRowEnter.append("div").attr("class", "space-buttons");
61737       addRow = addRow.merge(addRowEnter);
61738       addRow.select(".add-relation").on("click", function() {
61739         _showBlank = true;
61740         section.reRender();
61741         list.selectAll(".member-entity-input").node().focus();
61742       });
61743       function acceptEntity(d) {
61744         if (!d) {
61745           cancelEntity();
61746           return;
61747         }
61748         if (d.relation)
61749           utilHighlightEntities([d.relation.id], false, context);
61750         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
61751         addMembership(d, role);
61752       }
61753       function cancelEntity() {
61754         var input = newMembership.selectAll(".member-entity-input");
61755         input.property("value", "");
61756         context.surface().selectAll(".highlighted").classed("highlighted", false);
61757       }
61758       function bindTypeahead(d) {
61759         var row = select_default2(this);
61760         var role = row.selectAll("input.member-role");
61761         var origValue = role.property("value");
61762         function sort(value, data) {
61763           var sameletter = [];
61764           var other = [];
61765           for (var i2 = 0; i2 < data.length; i2++) {
61766             if (data[i2].value.substring(0, value.length) === value) {
61767               sameletter.push(data[i2]);
61768             } else {
61769               other.push(data[i2]);
61770             }
61771           }
61772           return sameletter.concat(other);
61773         }
61774         role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
61775           var rtype = d.relation.tags.type;
61776           taginfo.roles({
61777             debounce: true,
61778             rtype: rtype || "",
61779             geometry: context.graph().geometry(_entityIDs[0]),
61780             query: role2
61781           }, function(err, data) {
61782             if (!err)
61783               callback(sort(role2, data));
61784           });
61785         }).on("cancel", function() {
61786           role.property("value", origValue);
61787         }));
61788       }
61789       function unbind() {
61790         var row = select_default2(this);
61791         row.selectAll("input.member-role").call(uiCombobox.off, context);
61792       }
61793     }
61794     section.entityIDs = function(val) {
61795       if (!arguments.length)
61796         return _entityIDs;
61797       _entityIDs = val;
61798       _showBlank = false;
61799       return section;
61800     };
61801     return section;
61802   }
61803
61804   // modules/ui/sections/selection_list.js
61805   function uiSectionSelectionList(context) {
61806     var _selectedIDs = [];
61807     var section = uiSection("selected-features", context).shouldDisplay(function() {
61808       return _selectedIDs.length > 1;
61809     }).label(function() {
61810       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.features") }, count: _selectedIDs.length });
61811     }).disclosureContent(renderDisclosureContent);
61812     context.history().on("change.selectionList", function(difference) {
61813       if (difference) {
61814         section.reRender();
61815       }
61816     });
61817     section.entityIDs = function(val) {
61818       if (!arguments.length)
61819         return _selectedIDs;
61820       _selectedIDs = val;
61821       return section;
61822     };
61823     function selectEntity(d3_event, entity) {
61824       context.enter(modeSelect(context, [entity.id]));
61825     }
61826     function deselectEntity(d3_event, entity) {
61827       var selectedIDs = _selectedIDs.slice();
61828       var index = selectedIDs.indexOf(entity.id);
61829       if (index > -1) {
61830         selectedIDs.splice(index, 1);
61831         context.enter(modeSelect(context, selectedIDs));
61832       }
61833     }
61834     function renderDisclosureContent(selection2) {
61835       var list = selection2.selectAll(".feature-list").data([0]);
61836       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
61837       var entities = _selectedIDs.map(function(id2) {
61838         return context.hasEntity(id2);
61839       }).filter(Boolean);
61840       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
61841       items.exit().remove();
61842       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
61843         select_default2(this).on("mouseover", function() {
61844           utilHighlightEntities([d.id], true, context);
61845         }).on("mouseout", function() {
61846           utilHighlightEntities([d.id], false, context);
61847         });
61848       });
61849       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
61850       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
61851       label.append("span").attr("class", "entity-type");
61852       label.append("span").attr("class", "entity-name");
61853       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
61854       items = items.merge(enter);
61855       items.selectAll(".entity-geom-icon use").attr("href", function() {
61856         var entity = this.parentNode.parentNode.__data__;
61857         return "#iD-icon-" + entity.geometry(context.graph());
61858       });
61859       items.selectAll(".entity-type").text(function(entity) {
61860         return _mainPresetIndex.match(entity, context.graph()).name();
61861       });
61862       items.selectAll(".entity-name").text(function(d) {
61863         var entity = context.entity(d.id);
61864         return utilDisplayName(entity);
61865       });
61866     }
61867     return section;
61868   }
61869
61870   // modules/ui/entity_editor.js
61871   function uiEntityEditor(context) {
61872     var dispatch10 = dispatch_default("choose");
61873     var _state = "select";
61874     var _coalesceChanges = false;
61875     var _modified = false;
61876     var _base;
61877     var _entityIDs;
61878     var _activePresets = [];
61879     var _newFeature;
61880     var _sections;
61881     function entityEditor(selection2) {
61882       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
61883       var header = selection2.selectAll(".header").data([0]);
61884       var headerEnter = header.enter().append("div").attr("class", "header fillL");
61885       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
61886       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t(`icons.${direction}`)).call(svgIcon(`#iD-icon-${direction}`));
61887       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
61888         context.enter(modeBrowse(context));
61889       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
61890       headerEnter.append("h2");
61891       header = header.merge(headerEnter);
61892       header.selectAll("h2").html(_entityIDs.length === 1 ? _t.html("inspector.edit") : _t.html("inspector.edit_features"));
61893       header.selectAll(".preset-reset").on("click", function() {
61894         dispatch10.call("choose", this, _activePresets);
61895       });
61896       var body = selection2.selectAll(".inspector-body").data([0]);
61897       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
61898       body = body.merge(bodyEnter);
61899       if (!_sections) {
61900         _sections = [
61901           uiSectionSelectionList(context),
61902           uiSectionFeatureType(context).on("choose", function(presets) {
61903             dispatch10.call("choose", this, presets);
61904           }),
61905           uiSectionEntityIssues(context),
61906           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
61907           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
61908           uiSectionRawMemberEditor(context),
61909           uiSectionRawMembershipEditor(context)
61910         ];
61911       }
61912       _sections.forEach(function(section) {
61913         if (section.entityIDs) {
61914           section.entityIDs(_entityIDs);
61915         }
61916         if (section.presets) {
61917           section.presets(_activePresets);
61918         }
61919         if (section.tags) {
61920           section.tags(combinedTags);
61921         }
61922         if (section.state) {
61923           section.state(_state);
61924         }
61925         body.call(section.render);
61926       });
61927       context.history().on("change.entity-editor", historyChanged);
61928       function historyChanged(difference) {
61929         if (selection2.selectAll(".entity-editor").empty())
61930           return;
61931         if (_state === "hide")
61932           return;
61933         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
61934         if (!significant)
61935           return;
61936         _entityIDs = _entityIDs.filter(context.hasEntity);
61937         if (!_entityIDs.length)
61938           return;
61939         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
61940         loadActivePresets();
61941         var graph = context.graph();
61942         entityEditor.modified(_base !== graph);
61943         entityEditor(selection2);
61944         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
61945           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
61946         }
61947       }
61948     }
61949     function changeTags(entityIDs, changed, onInput) {
61950       var actions = [];
61951       for (var i2 in entityIDs) {
61952         var entityID = entityIDs[i2];
61953         var entity = context.entity(entityID);
61954         var tags = Object.assign({}, entity.tags);
61955         for (var k in changed) {
61956           if (!k)
61957             continue;
61958           var v = changed[k];
61959           if (typeof v === "object") {
61960             tags[k] = tags[v.oldKey];
61961           } else if (v !== void 0 || tags.hasOwnProperty(k)) {
61962             tags[k] = v;
61963           }
61964         }
61965         if (!onInput) {
61966           tags = utilCleanTags(tags);
61967         }
61968         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
61969           actions.push(actionChangeTags(entityID, tags));
61970         }
61971       }
61972       if (actions.length) {
61973         var combinedAction = function(graph) {
61974           actions.forEach(function(action) {
61975             graph = action(graph);
61976           });
61977           return graph;
61978         };
61979         var annotation = _t("operations.change_tags.annotation");
61980         if (_coalesceChanges) {
61981           context.overwrite(combinedAction, annotation);
61982         } else {
61983           context.perform(combinedAction, annotation);
61984           _coalesceChanges = !!onInput;
61985         }
61986       }
61987       if (!onInput) {
61988         context.validator().validate();
61989       }
61990     }
61991     function revertTags(keys) {
61992       var actions = [];
61993       for (var i2 in _entityIDs) {
61994         var entityID = _entityIDs[i2];
61995         var original = context.graph().base().entities[entityID];
61996         var changed = {};
61997         for (var j2 in keys) {
61998           var key = keys[j2];
61999           changed[key] = original ? original.tags[key] : void 0;
62000         }
62001         var entity = context.entity(entityID);
62002         var tags = Object.assign({}, entity.tags);
62003         for (var k in changed) {
62004           if (!k)
62005             continue;
62006           var v = changed[k];
62007           if (v !== void 0 || tags.hasOwnProperty(k)) {
62008             tags[k] = v;
62009           }
62010         }
62011         tags = utilCleanTags(tags);
62012         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
62013           actions.push(actionChangeTags(entityID, tags));
62014         }
62015       }
62016       if (actions.length) {
62017         var combinedAction = function(graph) {
62018           actions.forEach(function(action) {
62019             graph = action(graph);
62020           });
62021           return graph;
62022         };
62023         var annotation = _t("operations.change_tags.annotation");
62024         if (_coalesceChanges) {
62025           context.overwrite(combinedAction, annotation);
62026         } else {
62027           context.perform(combinedAction, annotation);
62028           _coalesceChanges = false;
62029         }
62030       }
62031       context.validator().validate();
62032     }
62033     entityEditor.modified = function(val) {
62034       if (!arguments.length)
62035         return _modified;
62036       _modified = val;
62037       return entityEditor;
62038     };
62039     entityEditor.state = function(val) {
62040       if (!arguments.length)
62041         return _state;
62042       _state = val;
62043       return entityEditor;
62044     };
62045     entityEditor.entityIDs = function(val) {
62046       if (!arguments.length)
62047         return _entityIDs;
62048       _base = context.graph();
62049       _coalesceChanges = false;
62050       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
62051         return entityEditor;
62052       _entityIDs = val;
62053       loadActivePresets(true);
62054       return entityEditor.modified(false);
62055     };
62056     entityEditor.newFeature = function(val) {
62057       if (!arguments.length)
62058         return _newFeature;
62059       _newFeature = val;
62060       return entityEditor;
62061     };
62062     function loadActivePresets(isForNewSelection) {
62063       var graph = context.graph();
62064       var counts = {};
62065       for (var i2 in _entityIDs) {
62066         var entity = graph.hasEntity(_entityIDs[i2]);
62067         if (!entity)
62068           return;
62069         var match = _mainPresetIndex.match(entity, graph);
62070         if (!counts[match.id])
62071           counts[match.id] = 0;
62072         counts[match.id] += 1;
62073       }
62074       var matches = Object.keys(counts).sort(function(p1, p2) {
62075         return counts[p2] - counts[p1];
62076       }).map(function(pID) {
62077         return _mainPresetIndex.item(pID);
62078       });
62079       if (!isForNewSelection) {
62080         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
62081         if (weakPreset && matches.length === 1 && matches[0].isFallback())
62082           return;
62083       }
62084       entityEditor.presets(matches);
62085     }
62086     entityEditor.presets = function(val) {
62087       if (!arguments.length)
62088         return _activePresets;
62089       if (!utilArrayIdentical(val, _activePresets)) {
62090         _activePresets = val;
62091       }
62092       return entityEditor;
62093     };
62094     return utilRebind(entityEditor, dispatch10, "on");
62095   }
62096
62097   // modules/ui/feature_list.js
62098   var sexagesimal = __toESM(require_sexagesimal());
62099   function uiFeatureList(context) {
62100     var _geocodeResults;
62101     function featureList(selection2) {
62102       var header = selection2.append("div").attr("class", "header fillL");
62103       header.append("h2").call(_t.append("inspector.feature_list"));
62104       var searchWrap = selection2.append("div").attr("class", "search-header");
62105       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
62106       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
62107       var listWrap = selection2.append("div").attr("class", "inspector-body");
62108       var list = listWrap.append("div").attr("class", "feature-list");
62109       context.on("exit.feature-list", clearSearch);
62110       context.map().on("drawn.feature-list", mapDrawn);
62111       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
62112       function focusSearch(d3_event) {
62113         var mode = context.mode() && context.mode().id;
62114         if (mode !== "browse")
62115           return;
62116         d3_event.preventDefault();
62117         search.node().focus();
62118       }
62119       function keydown(d3_event) {
62120         if (d3_event.keyCode === 27) {
62121           search.node().blur();
62122         }
62123       }
62124       function keypress(d3_event) {
62125         var q = search.property("value"), items = list.selectAll(".feature-list-item");
62126         if (d3_event.keyCode === 13 && q.length && items.size()) {
62127           click(d3_event, items.datum());
62128         }
62129       }
62130       function inputevent() {
62131         _geocodeResults = void 0;
62132         drawList();
62133       }
62134       function clearSearch() {
62135         search.property("value", "");
62136         drawList();
62137       }
62138       function mapDrawn(e) {
62139         if (e.full) {
62140           drawList();
62141         }
62142       }
62143       function features2() {
62144         var result = [];
62145         var graph = context.graph();
62146         var visibleCenter = context.map().extent().center();
62147         var q = search.property("value").toLowerCase();
62148         if (!q)
62149           return result;
62150         var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
62151         if (locationMatch) {
62152           var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
62153           result.push({
62154             id: -1,
62155             geometry: "point",
62156             type: _t("inspector.location"),
62157             name: dmsCoordinatePair([loc[1], loc[0]]),
62158             location: loc
62159           });
62160         }
62161         var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
62162         if (idMatch) {
62163           var elemType = idMatch[1].charAt(0);
62164           var elemId = idMatch[2];
62165           result.push({
62166             id: elemType + elemId,
62167             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
62168             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
62169             name: elemId
62170           });
62171         }
62172         var allEntities = graph.entities;
62173         var localResults = [];
62174         for (var id2 in allEntities) {
62175           var entity = allEntities[id2];
62176           if (!entity)
62177             continue;
62178           var name2 = utilDisplayName(entity) || "";
62179           if (name2.toLowerCase().indexOf(q) < 0)
62180             continue;
62181           var matched = _mainPresetIndex.match(entity, graph);
62182           var type3 = matched && matched.name() || utilDisplayType(entity.id);
62183           var extent = entity.extent(graph);
62184           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
62185           localResults.push({
62186             id: entity.id,
62187             entity,
62188             geometry: entity.geometry(graph),
62189             type: type3,
62190             name: name2,
62191             distance
62192           });
62193           if (localResults.length > 100)
62194             break;
62195         }
62196         localResults = localResults.sort(function byDistance(a, b) {
62197           return a.distance - b.distance;
62198         });
62199         result = result.concat(localResults);
62200         (_geocodeResults || []).forEach(function(d) {
62201           if (d.osm_type && d.osm_id) {
62202             var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
62203             var tags = {};
62204             tags[d.class] = d.type;
62205             var attrs = { id: id3, type: d.osm_type, tags };
62206             if (d.osm_type === "way") {
62207               attrs.nodes = ["a", "a"];
62208             }
62209             var tempEntity = osmEntity(attrs);
62210             var tempGraph = coreGraph([tempEntity]);
62211             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
62212             var type4 = matched2 && matched2.name() || utilDisplayType(id3);
62213             result.push({
62214               id: tempEntity.id,
62215               geometry: tempEntity.geometry(tempGraph),
62216               type: type4,
62217               name: d.display_name,
62218               extent: new geoExtent([parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])], [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])])
62219             });
62220           }
62221         });
62222         if (q.match(/^[0-9]+$/)) {
62223           result.push({
62224             id: "n" + q,
62225             geometry: "point",
62226             type: _t("inspector.node"),
62227             name: q
62228           });
62229           result.push({
62230             id: "w" + q,
62231             geometry: "line",
62232             type: _t("inspector.way"),
62233             name: q
62234           });
62235           result.push({
62236             id: "r" + q,
62237             geometry: "relation",
62238             type: _t("inspector.relation"),
62239             name: q
62240           });
62241         }
62242         return result;
62243       }
62244       function drawList() {
62245         var value = search.property("value");
62246         var results = features2();
62247         list.classed("filtered", value.length);
62248         var resultsIndicator = list.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
62249         resultsIndicator.append("span").attr("class", "entity-name");
62250         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
62251         if (services.geocoder) {
62252           list.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
62253         }
62254         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
62255         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
62256         list.selectAll(".feature-list-item").data([-1]).remove();
62257         var items = list.selectAll(".feature-list-item").data(results, function(d) {
62258           return d.id;
62259         });
62260         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
62261         var label = enter.append("div").attr("class", "label");
62262         label.each(function(d) {
62263           select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
62264         });
62265         label.append("span").attr("class", "entity-type").text(function(d) {
62266           return d.type;
62267         });
62268         label.append("span").attr("class", "entity-name").text(function(d) {
62269           return d.name;
62270         });
62271         enter.style("opacity", 0).transition().style("opacity", 1);
62272         items.order();
62273         items.exit().remove();
62274       }
62275       function mouseover(d3_event, d) {
62276         if (d.id === -1)
62277           return;
62278         utilHighlightEntities([d.id], true, context);
62279       }
62280       function mouseout(d3_event, d) {
62281         if (d.id === -1)
62282           return;
62283         utilHighlightEntities([d.id], false, context);
62284       }
62285       function click(d3_event, d) {
62286         d3_event.preventDefault();
62287         if (d.location) {
62288           context.map().centerZoomEase([d.location[1], d.location[0]], 19);
62289         } else if (d.entity) {
62290           utilHighlightEntities([d.id], false, context);
62291           context.enter(modeSelect(context, [d.entity.id]));
62292           context.map().zoomToEase(d.entity);
62293         } else {
62294           context.zoomToEntity(d.id);
62295         }
62296       }
62297       function geocoderSearch() {
62298         services.geocoder.search(search.property("value"), function(err, resp) {
62299           _geocodeResults = resp || [];
62300           drawList();
62301         });
62302       }
62303     }
62304     return featureList;
62305   }
62306
62307   // modules/ui/improveOSM_comments.js
62308   function uiImproveOsmComments() {
62309     let _qaItem;
62310     function issueComments(selection2) {
62311       let comments = selection2.selectAll(".comments-container").data([0]);
62312       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
62313       services.improveOSM.getComments(_qaItem).then((d) => {
62314         if (!d.comments)
62315           return;
62316         const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
62317         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
62318         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
62319         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
62320         metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
62321           const osm = services.osm;
62322           let selection3 = select_default2(this);
62323           if (osm && d2.username) {
62324             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
62325           }
62326           selection3.text((d4) => d4.username);
62327         });
62328         metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
62329         mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
62330       }).catch((err) => {
62331         console.log(err);
62332       });
62333     }
62334     function localeDateString2(s) {
62335       if (!s)
62336         return null;
62337       const options2 = { day: "numeric", month: "short", year: "numeric" };
62338       const d = new Date(s * 1e3);
62339       if (isNaN(d.getTime()))
62340         return null;
62341       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
62342     }
62343     issueComments.issue = function(val) {
62344       if (!arguments.length)
62345         return _qaItem;
62346       _qaItem = val;
62347       return issueComments;
62348     };
62349     return issueComments;
62350   }
62351
62352   // modules/ui/improveOSM_details.js
62353   function uiImproveOsmDetails(context) {
62354     let _qaItem;
62355     function issueDetail(d) {
62356       if (d.desc)
62357         return d.desc;
62358       const issueKey = d.issueKey;
62359       d.replacements = d.replacements || {};
62360       d.replacements.default = { html: _t.html("inspector.unknown") };
62361       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
62362     }
62363     function improveOsmDetails(selection2) {
62364       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62365       details.exit().remove();
62366       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
62367       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
62368       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
62369       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
62370       let relatedEntities = [];
62371       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
62372         const link2 = select_default2(this);
62373         const isObjectLink = link2.classed("error_object_link");
62374         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
62375         const entity = context.hasEntity(entityID);
62376         relatedEntities.push(entityID);
62377         link2.on("mouseenter", () => {
62378           utilHighlightEntities([entityID], true, context);
62379         }).on("mouseleave", () => {
62380           utilHighlightEntities([entityID], false, context);
62381         }).on("click", (d3_event) => {
62382           d3_event.preventDefault();
62383           utilHighlightEntities([entityID], false, context);
62384           const osmlayer = context.layers().layer("osm");
62385           if (!osmlayer.enabled()) {
62386             osmlayer.enabled(true);
62387           }
62388           context.map().centerZoom(_qaItem.loc, 20);
62389           if (entity) {
62390             context.enter(modeSelect(context, [entityID]));
62391           } else {
62392             context.loadEntity(entityID, (err, result) => {
62393               if (err)
62394                 return;
62395               const entity2 = result.data.find((e) => e.id === entityID);
62396               if (entity2)
62397                 context.enter(modeSelect(context, [entityID]));
62398             });
62399           }
62400         });
62401         if (entity) {
62402           let name2 = utilDisplayName(entity);
62403           if (!name2 && !isObjectLink) {
62404             const preset = _mainPresetIndex.match(entity, context.graph());
62405             name2 = preset && !preset.isFallback() && preset.name();
62406           }
62407           if (name2) {
62408             this.innerText = name2;
62409           }
62410         }
62411       });
62412       context.features().forceVisible(relatedEntities);
62413       context.map().pan([0, 0]);
62414     }
62415     improveOsmDetails.issue = function(val) {
62416       if (!arguments.length)
62417         return _qaItem;
62418       _qaItem = val;
62419       return improveOsmDetails;
62420     };
62421     return improveOsmDetails;
62422   }
62423
62424   // modules/ui/improveOSM_header.js
62425   function uiImproveOsmHeader() {
62426     let _qaItem;
62427     function issueTitle(d) {
62428       const issueKey = d.issueKey;
62429       d.replacements = d.replacements || {};
62430       d.replacements.default = { html: _t.html("inspector.unknown") };
62431       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
62432     }
62433     function improveOsmHeader(selection2) {
62434       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62435       header.exit().remove();
62436       const headerEnter = header.enter().append("div").attr("class", "qa-header");
62437       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
62438       svgEnter.append("polygon").attr("fill", "currentColor").attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
62439       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
62440       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
62441     }
62442     improveOsmHeader.issue = function(val) {
62443       if (!arguments.length)
62444         return _qaItem;
62445       _qaItem = val;
62446       return improveOsmHeader;
62447     };
62448     return improveOsmHeader;
62449   }
62450
62451   // modules/ui/improveOSM_editor.js
62452   function uiImproveOsmEditor(context) {
62453     const dispatch10 = dispatch_default("change");
62454     const qaDetails = uiImproveOsmDetails(context);
62455     const qaComments = uiImproveOsmComments(context);
62456     const qaHeader = uiImproveOsmHeader(context);
62457     let _qaItem;
62458     function improveOsmEditor(selection2) {
62459       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
62460       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
62461       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
62462       let body = selection2.selectAll(".body").data([0]);
62463       body = body.enter().append("div").attr("class", "body").merge(body);
62464       const editor = body.selectAll(".qa-editor").data([0]);
62465       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(qaComments.issue(_qaItem)).call(improveOsmSaveSection);
62466     }
62467     function improveOsmSaveSection(selection2) {
62468       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
62469       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
62470       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62471       saveSection.exit().remove();
62472       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
62473       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
62474       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
62475       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
62476       function changeInput() {
62477         const input = select_default2(this);
62478         let val = input.property("value").trim();
62479         if (val === "") {
62480           val = void 0;
62481         }
62482         _qaItem = _qaItem.update({ newComment: val });
62483         const qaService = services.improveOSM;
62484         if (qaService) {
62485           qaService.replaceItem(_qaItem);
62486         }
62487         saveSection.call(qaSaveButtons);
62488       }
62489     }
62490     function qaSaveButtons(selection2) {
62491       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
62492       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
62493       buttonSection.exit().remove();
62494       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
62495       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
62496       buttonEnter.append("button").attr("class", "button close-button action");
62497       buttonEnter.append("button").attr("class", "button ignore-button action");
62498       buttonSection = buttonSection.merge(buttonEnter);
62499       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
62500         this.blur();
62501         const qaService = services.improveOSM;
62502         if (qaService) {
62503           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62504         }
62505       });
62506       buttonSection.select(".close-button").html((d) => {
62507         const andComment = d.newComment ? "_comment" : "";
62508         return _t.html(`QA.keepRight.close${andComment}`);
62509       }).on("click.close", function(d3_event, d) {
62510         this.blur();
62511         const qaService = services.improveOSM;
62512         if (qaService) {
62513           d.newStatus = "SOLVED";
62514           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62515         }
62516       });
62517       buttonSection.select(".ignore-button").html((d) => {
62518         const andComment = d.newComment ? "_comment" : "";
62519         return _t.html(`QA.keepRight.ignore${andComment}`);
62520       }).on("click.ignore", function(d3_event, d) {
62521         this.blur();
62522         const qaService = services.improveOSM;
62523         if (qaService) {
62524           d.newStatus = "INVALID";
62525           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62526         }
62527       });
62528     }
62529     improveOsmEditor.error = function(val) {
62530       if (!arguments.length)
62531         return _qaItem;
62532       _qaItem = val;
62533       return improveOsmEditor;
62534     };
62535     return utilRebind(improveOsmEditor, dispatch10, "on");
62536   }
62537
62538   // modules/ui/preset_list.js
62539   function uiPresetList(context) {
62540     var dispatch10 = dispatch_default("cancel", "choose");
62541     var _entityIDs;
62542     var _currLoc;
62543     var _currentPresets;
62544     var _autofocus = false;
62545     function presetList(selection2) {
62546       if (!_entityIDs)
62547         return;
62548       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
62549       selection2.html("");
62550       var messagewrap = selection2.append("div").attr("class", "header fillL");
62551       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
62552       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
62553       messagewrap.append("button").attr("class", "preset-choose").attr("title", direction).on("click", function() {
62554         dispatch10.call("cancel", this);
62555       }).call(svgIcon(`#iD-icon-${direction}`));
62556       function initialKeydown(d3_event) {
62557         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
62558           d3_event.preventDefault();
62559           d3_event.stopPropagation();
62560           operationDelete(context, _entityIDs)();
62561         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
62562           d3_event.preventDefault();
62563           d3_event.stopPropagation();
62564           context.undo();
62565         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
62566           select_default2(this).on("keydown", keydown);
62567           keydown.call(this, d3_event);
62568         }
62569       }
62570       function keydown(d3_event) {
62571         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && search.node().selectionStart === search.property("value").length) {
62572           d3_event.preventDefault();
62573           d3_event.stopPropagation();
62574           var buttons = list.selectAll(".preset-list-button");
62575           if (!buttons.empty())
62576             buttons.nodes()[0].focus();
62577         }
62578       }
62579       function keypress(d3_event) {
62580         var value = search.property("value");
62581         if (d3_event.keyCode === 13 && value.length) {
62582           list.selectAll(".preset-list-item:first-child").each(function(d) {
62583             d.choose.call(this);
62584           });
62585         }
62586       }
62587       function inputevent() {
62588         var value = search.property("value");
62589         list.classed("filtered", value.length);
62590         var results, messageText;
62591         if (value.length) {
62592           results = presets.search(value, entityGeometries()[0], _currLoc);
62593           messageText = _t.html("inspector.results", {
62594             n: results.collection.length,
62595             search: value
62596           });
62597         } else {
62598           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc);
62599           messageText = _t.html("inspector.choose");
62600         }
62601         list.call(drawList, results);
62602         message.html(messageText);
62603       }
62604       var searchWrap = selection2.append("div").attr("class", "search-header");
62605       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
62606       var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
62607       if (_autofocus) {
62608         search.node().focus();
62609         setTimeout(function() {
62610           search.node().focus();
62611         }, 0);
62612       }
62613       var listWrap = selection2.append("div").attr("class", "inspector-body");
62614       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc));
62615       context.features().on("change.preset-list", updateForFeatureHiddenState);
62616     }
62617     function drawList(list, presets) {
62618       presets = presets.matchAllGeometry(entityGeometries());
62619       var collection = presets.collection.reduce(function(collection2, preset) {
62620         if (!preset)
62621           return collection2;
62622         if (preset.members) {
62623           if (preset.members.collection.filter(function(preset2) {
62624             return preset2.addable();
62625           }).length > 1) {
62626             collection2.push(CategoryItem(preset));
62627           }
62628         } else if (preset.addable()) {
62629           collection2.push(PresetItem(preset));
62630         }
62631         return collection2;
62632       }, []);
62633       var items = list.selectAll(".preset-list-item").data(collection, function(d) {
62634         return d.preset.id;
62635       });
62636       items.order();
62637       items.exit().remove();
62638       items.enter().append("div").attr("class", function(item) {
62639         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
62640       }).classed("current", function(item) {
62641         return _currentPresets.indexOf(item.preset) !== -1;
62642       }).each(function(item) {
62643         select_default2(this).call(item);
62644       }).style("opacity", 0).transition().style("opacity", 1);
62645       updateForFeatureHiddenState();
62646     }
62647     function itemKeydown(d3_event) {
62648       var item = select_default2(this.closest(".preset-list-item"));
62649       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
62650       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
62651         d3_event.preventDefault();
62652         d3_event.stopPropagation();
62653         var nextItem = select_default2(item.node().nextElementSibling);
62654         if (nextItem.empty()) {
62655           if (!parentItem.empty()) {
62656             nextItem = select_default2(parentItem.node().nextElementSibling);
62657           }
62658         } else if (select_default2(this).classed("expanded")) {
62659           nextItem = item.select(".subgrid .preset-list-item:first-child");
62660         }
62661         if (!nextItem.empty()) {
62662           nextItem.select(".preset-list-button").node().focus();
62663         }
62664       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
62665         d3_event.preventDefault();
62666         d3_event.stopPropagation();
62667         var previousItem = select_default2(item.node().previousElementSibling);
62668         if (previousItem.empty()) {
62669           if (!parentItem.empty()) {
62670             previousItem = parentItem;
62671           }
62672         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
62673           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
62674         }
62675         if (!previousItem.empty()) {
62676           previousItem.select(".preset-list-button").node().focus();
62677         } else {
62678           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
62679           search.node().focus();
62680         }
62681       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
62682         d3_event.preventDefault();
62683         d3_event.stopPropagation();
62684         if (!parentItem.empty()) {
62685           parentItem.select(".preset-list-button").node().focus();
62686         }
62687       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
62688         d3_event.preventDefault();
62689         d3_event.stopPropagation();
62690         item.datum().choose.call(select_default2(this).node());
62691       }
62692     }
62693     function CategoryItem(preset) {
62694       var box, sublist, shown = false;
62695       function item(selection2) {
62696         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
62697         function click() {
62698           var isExpanded = select_default2(this).classed("expanded");
62699           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
62700           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
62701           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
62702           item.choose();
62703         }
62704         var geometries = entityGeometries();
62705         var button = wrap2.append("button").attr("class", "preset-list-button").attr("title", _t("icons.expand")).classed("expanded", false).call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", click).on("keydown", function(d3_event) {
62706           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
62707             d3_event.preventDefault();
62708             d3_event.stopPropagation();
62709             if (!select_default2(this).classed("expanded")) {
62710               click.call(this, d3_event);
62711             }
62712           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
62713             d3_event.preventDefault();
62714             d3_event.stopPropagation();
62715             if (select_default2(this).classed("expanded")) {
62716               click.call(this, d3_event);
62717             }
62718           } else {
62719             itemKeydown.call(this, d3_event);
62720           }
62721         });
62722         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62723         label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").html(function() {
62724           return preset.nameLabel() + "&hellip;";
62725         });
62726         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
62727         box.append("div").attr("class", "arrow");
62728         sublist = box.append("div").attr("class", "preset-list fillL3");
62729       }
62730       item.choose = function() {
62731         if (!box || !sublist)
62732           return;
62733         if (shown) {
62734           shown = false;
62735           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
62736         } else {
62737           shown = true;
62738           var members = preset.members.matchAllGeometry(entityGeometries());
62739           sublist.call(drawList, members);
62740           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
62741         }
62742       };
62743       item.preset = preset;
62744       return item;
62745     }
62746     function PresetItem(preset) {
62747       function item(selection2) {
62748         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
62749         var geometries = entityGeometries();
62750         var button = wrap2.append("button").attr("class", "preset-list-button").call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", item.choose).on("keydown", itemKeydown);
62751         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62752         var nameparts = [
62753           preset.nameLabel(),
62754           preset.subtitleLabel()
62755         ].filter(Boolean);
62756         label.selectAll(".namepart").data(nameparts).enter().append("div").attr("class", "namepart").html(function(d) {
62757           return d;
62758         });
62759         wrap2.call(item.reference.button);
62760         selection2.call(item.reference.body);
62761       }
62762       item.choose = function() {
62763         if (select_default2(this).classed("disabled"))
62764           return;
62765         if (!context.inIntro()) {
62766           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
62767         }
62768         context.perform(function(graph) {
62769           for (var i2 in _entityIDs) {
62770             var entityID = _entityIDs[i2];
62771             var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
62772             graph = actionChangePreset(entityID, oldPreset, preset)(graph);
62773           }
62774           return graph;
62775         }, _t("operations.change_tags.annotation"));
62776         context.validator().validate();
62777         dispatch10.call("choose", this, preset);
62778       };
62779       item.help = function(d3_event) {
62780         d3_event.stopPropagation();
62781         item.reference.toggle();
62782       };
62783       item.preset = preset;
62784       item.reference = uiTagReference(preset.reference(), context);
62785       return item;
62786     }
62787     function updateForFeatureHiddenState() {
62788       if (!_entityIDs.every(context.hasEntity))
62789         return;
62790       var geometries = entityGeometries();
62791       var button = context.container().selectAll(".preset-list .preset-list-button");
62792       button.call(uiTooltip().destroyAny);
62793       button.each(function(item, index) {
62794         var hiddenPresetFeaturesId;
62795         for (var i2 in geometries) {
62796           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
62797           if (hiddenPresetFeaturesId)
62798             break;
62799         }
62800         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
62801         select_default2(this).classed("disabled", isHiddenPreset);
62802         if (isHiddenPreset) {
62803           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
62804           select_default2(this).call(uiTooltip().title(_t.html("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
62805             features: { html: _t.html("feature." + hiddenPresetFeaturesId + ".description") }
62806           })).placement(index < 2 ? "bottom" : "top"));
62807         }
62808       });
62809     }
62810     presetList.autofocus = function(val) {
62811       if (!arguments.length)
62812         return _autofocus;
62813       _autofocus = val;
62814       return presetList;
62815     };
62816     presetList.entityIDs = function(val) {
62817       if (!arguments.length)
62818         return _entityIDs;
62819       _entityIDs = val;
62820       _currLoc = null;
62821       if (_entityIDs && _entityIDs.length) {
62822         const extent = _entityIDs.reduce(function(extent2, entityID) {
62823           var entity = context.graph().entity(entityID);
62824           return extent2.extend(entity.extent(context.graph()));
62825         }, geoExtent());
62826         _currLoc = extent.center();
62827         var presets = _entityIDs.map(function(entityID) {
62828           return _mainPresetIndex.match(context.entity(entityID), context.graph());
62829         });
62830         presetList.presets(presets);
62831       }
62832       return presetList;
62833     };
62834     presetList.presets = function(val) {
62835       if (!arguments.length)
62836         return _currentPresets;
62837       _currentPresets = val;
62838       return presetList;
62839     };
62840     function entityGeometries() {
62841       var counts = {};
62842       for (var i2 in _entityIDs) {
62843         var entityID = _entityIDs[i2];
62844         var entity = context.entity(entityID);
62845         var geometry = entity.geometry(context.graph());
62846         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
62847           geometry = "point";
62848         }
62849         if (!counts[geometry])
62850           counts[geometry] = 0;
62851         counts[geometry] += 1;
62852       }
62853       return Object.keys(counts).sort(function(geom1, geom2) {
62854         return counts[geom2] - counts[geom1];
62855       });
62856     }
62857     return utilRebind(presetList, dispatch10, "on");
62858   }
62859
62860   // modules/ui/view_on_osm.js
62861   function uiViewOnOSM(context) {
62862     var _what;
62863     function viewOnOSM(selection2) {
62864       var url;
62865       if (_what instanceof osmEntity) {
62866         url = context.connection().entityURL(_what);
62867       } else if (_what instanceof osmNote) {
62868         url = context.connection().noteURL(_what);
62869       }
62870       var data = !_what || _what.isNew() ? [] : [_what];
62871       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
62872         return d.id;
62873       });
62874       link2.exit().remove();
62875       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
62876       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
62877     }
62878     viewOnOSM.what = function(_) {
62879       if (!arguments.length)
62880         return _what;
62881       _what = _;
62882       return viewOnOSM;
62883     };
62884     return viewOnOSM;
62885   }
62886
62887   // modules/ui/inspector.js
62888   function uiInspector(context) {
62889     var presetList = uiPresetList(context);
62890     var entityEditor = uiEntityEditor(context);
62891     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
62892     var _state = "select";
62893     var _entityIDs;
62894     var _newFeature = false;
62895     function inspector(selection2) {
62896       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
62897         inspector.setPreset();
62898       });
62899       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
62900       wrap2 = selection2.selectAll(".panewrap").data([0]);
62901       var enter = wrap2.enter().append("div").attr("class", "panewrap");
62902       enter.append("div").attr("class", "preset-list-pane pane");
62903       enter.append("div").attr("class", "entity-editor-pane pane");
62904       wrap2 = wrap2.merge(enter);
62905       presetPane = wrap2.selectAll(".preset-list-pane");
62906       editorPane = wrap2.selectAll(".entity-editor-pane");
62907       function shouldDefaultToPresetList() {
62908         if (_state !== "select")
62909           return false;
62910         if (_entityIDs.length !== 1)
62911           return false;
62912         var entityID = _entityIDs[0];
62913         var entity = context.hasEntity(entityID);
62914         if (!entity)
62915           return false;
62916         if (entity.hasNonGeometryTags())
62917           return false;
62918         if (_newFeature)
62919           return true;
62920         if (entity.geometry(context.graph()) !== "vertex")
62921           return false;
62922         if (context.graph().parentRelations(entity).length)
62923           return false;
62924         if (context.validator().getEntityIssues(entityID).length)
62925           return false;
62926         if (entity.isHighwayIntersection(context.graph()))
62927           return false;
62928         return true;
62929       }
62930       if (shouldDefaultToPresetList()) {
62931         wrap2.style("right", "-100%");
62932         editorPane.classed("hide", true);
62933         presetPane.classed("hide", false).call(presetList);
62934       } else {
62935         wrap2.style("right", "0%");
62936         presetPane.classed("hide", true);
62937         editorPane.classed("hide", false).call(entityEditor);
62938       }
62939       var footer = selection2.selectAll(".footer").data([0]);
62940       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
62941       footer.call(uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0])));
62942     }
62943     inspector.showList = function(presets) {
62944       presetPane.classed("hide", false);
62945       wrap2.transition().styleTween("right", function() {
62946         return value_default("0%", "-100%");
62947       }).on("end", function() {
62948         editorPane.classed("hide", true);
62949       });
62950       if (presets) {
62951         presetList.presets(presets);
62952       }
62953       presetPane.call(presetList.autofocus(true));
62954     };
62955     inspector.setPreset = function(preset) {
62956       if (preset && preset.id === "type/multipolygon") {
62957         presetPane.call(presetList.autofocus(true));
62958       } else {
62959         editorPane.classed("hide", false);
62960         wrap2.transition().styleTween("right", function() {
62961           return value_default("-100%", "0%");
62962         }).on("end", function() {
62963           presetPane.classed("hide", true);
62964         });
62965         if (preset) {
62966           entityEditor.presets([preset]);
62967         }
62968         editorPane.call(entityEditor);
62969       }
62970     };
62971     inspector.state = function(val) {
62972       if (!arguments.length)
62973         return _state;
62974       _state = val;
62975       entityEditor.state(_state);
62976       context.container().selectAll(".field-help-body").remove();
62977       return inspector;
62978     };
62979     inspector.entityIDs = function(val) {
62980       if (!arguments.length)
62981         return _entityIDs;
62982       _entityIDs = val;
62983       return inspector;
62984     };
62985     inspector.newFeature = function(val) {
62986       if (!arguments.length)
62987         return _newFeature;
62988       _newFeature = val;
62989       return inspector;
62990     };
62991     return inspector;
62992   }
62993
62994   // modules/ui/keepRight_details.js
62995   function uiKeepRightDetails(context) {
62996     let _qaItem;
62997     function issueDetail(d) {
62998       const { itemType, parentIssueType } = d;
62999       const unknown = { html: _t.html("inspector.unknown") };
63000       let replacements = d.replacements || {};
63001       replacements.default = unknown;
63002       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
63003         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
63004       } else {
63005         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
63006       }
63007     }
63008     function keepRightDetails(selection2) {
63009       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
63010       details.exit().remove();
63011       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
63012       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
63013       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
63014       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
63015       let relatedEntities = [];
63016       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
63017         const link2 = select_default2(this);
63018         const isObjectLink = link2.classed("error_object_link");
63019         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
63020         const entity = context.hasEntity(entityID);
63021         relatedEntities.push(entityID);
63022         link2.on("mouseenter", () => {
63023           utilHighlightEntities([entityID], true, context);
63024         }).on("mouseleave", () => {
63025           utilHighlightEntities([entityID], false, context);
63026         }).on("click", (d3_event) => {
63027           d3_event.preventDefault();
63028           utilHighlightEntities([entityID], false, context);
63029           const osmlayer = context.layers().layer("osm");
63030           if (!osmlayer.enabled()) {
63031             osmlayer.enabled(true);
63032           }
63033           context.map().centerZoomEase(_qaItem.loc, 20);
63034           if (entity) {
63035             context.enter(modeSelect(context, [entityID]));
63036           } else {
63037             context.loadEntity(entityID, (err, result) => {
63038               if (err)
63039                 return;
63040               const entity2 = result.data.find((e) => e.id === entityID);
63041               if (entity2)
63042                 context.enter(modeSelect(context, [entityID]));
63043             });
63044           }
63045         });
63046         if (entity) {
63047           let name2 = utilDisplayName(entity);
63048           if (!name2 && !isObjectLink) {
63049             const preset = _mainPresetIndex.match(entity, context.graph());
63050             name2 = preset && !preset.isFallback() && preset.name();
63051           }
63052           if (name2) {
63053             this.innerText = name2;
63054           }
63055         }
63056       });
63057       context.features().forceVisible(relatedEntities);
63058       context.map().pan([0, 0]);
63059     }
63060     keepRightDetails.issue = function(val) {
63061       if (!arguments.length)
63062         return _qaItem;
63063       _qaItem = val;
63064       return keepRightDetails;
63065     };
63066     return keepRightDetails;
63067   }
63068
63069   // modules/ui/keepRight_header.js
63070   function uiKeepRightHeader() {
63071     let _qaItem;
63072     function issueTitle(d) {
63073       const { itemType, parentIssueType } = d;
63074       const unknown = _t.html("inspector.unknown");
63075       let replacements = d.replacements || {};
63076       replacements.default = { html: unknown };
63077       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
63078         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
63079       } else {
63080         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
63081       }
63082     }
63083     function keepRightHeader(selection2) {
63084       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
63085       header.exit().remove();
63086       const headerEnter = header.enter().append("div").attr("class", "qa-header");
63087       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
63088       iconEnter.append("div").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
63089       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
63090     }
63091     keepRightHeader.issue = function(val) {
63092       if (!arguments.length)
63093         return _qaItem;
63094       _qaItem = val;
63095       return keepRightHeader;
63096     };
63097     return keepRightHeader;
63098   }
63099
63100   // modules/ui/view_on_keepRight.js
63101   function uiViewOnKeepRight() {
63102     let _qaItem;
63103     function viewOnKeepRight(selection2) {
63104       let url;
63105       if (services.keepRight && _qaItem instanceof QAItem) {
63106         url = services.keepRight.issueURL(_qaItem);
63107       }
63108       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
63109       link2.exit().remove();
63110       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
63111       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
63112     }
63113     viewOnKeepRight.what = function(val) {
63114       if (!arguments.length)
63115         return _qaItem;
63116       _qaItem = val;
63117       return viewOnKeepRight;
63118     };
63119     return viewOnKeepRight;
63120   }
63121
63122   // modules/ui/keepRight_editor.js
63123   function uiKeepRightEditor(context) {
63124     const dispatch10 = dispatch_default("change");
63125     const qaDetails = uiKeepRightDetails(context);
63126     const qaHeader = uiKeepRightHeader(context);
63127     let _qaItem;
63128     function keepRightEditor(selection2) {
63129       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
63130       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
63131       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
63132       let body = selection2.selectAll(".body").data([0]);
63133       body = body.enter().append("div").attr("class", "body").merge(body);
63134       const editor = body.selectAll(".qa-editor").data([0]);
63135       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
63136       const footer = selection2.selectAll(".footer").data([0]);
63137       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
63138     }
63139     function keepRightSaveSection(selection2) {
63140       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63141       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
63142       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
63143       saveSection.exit().remove();
63144       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
63145       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
63146       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment || d.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
63147       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
63148       function changeInput() {
63149         const input = select_default2(this);
63150         let val = input.property("value").trim();
63151         if (val === _qaItem.comment) {
63152           val = void 0;
63153         }
63154         _qaItem = _qaItem.update({ newComment: val });
63155         const qaService = services.keepRight;
63156         if (qaService) {
63157           qaService.replaceItem(_qaItem);
63158         }
63159         saveSection.call(qaSaveButtons);
63160       }
63161     }
63162     function qaSaveButtons(selection2) {
63163       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63164       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
63165       buttonSection.exit().remove();
63166       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
63167       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
63168       buttonEnter.append("button").attr("class", "button close-button action");
63169       buttonEnter.append("button").attr("class", "button ignore-button action");
63170       buttonSection = buttonSection.merge(buttonEnter);
63171       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
63172         this.blur();
63173         const qaService = services.keepRight;
63174         if (qaService) {
63175           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63176         }
63177       });
63178       buttonSection.select(".close-button").html((d) => {
63179         const andComment = d.newComment ? "_comment" : "";
63180         return _t.html(`QA.keepRight.close${andComment}`);
63181       }).on("click.close", function(d3_event, d) {
63182         this.blur();
63183         const qaService = services.keepRight;
63184         if (qaService) {
63185           d.newStatus = "ignore_t";
63186           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63187         }
63188       });
63189       buttonSection.select(".ignore-button").html((d) => {
63190         const andComment = d.newComment ? "_comment" : "";
63191         return _t.html(`QA.keepRight.ignore${andComment}`);
63192       }).on("click.ignore", function(d3_event, d) {
63193         this.blur();
63194         const qaService = services.keepRight;
63195         if (qaService) {
63196           d.newStatus = "ignore";
63197           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63198         }
63199       });
63200     }
63201     keepRightEditor.error = function(val) {
63202       if (!arguments.length)
63203         return _qaItem;
63204       _qaItem = val;
63205       return keepRightEditor;
63206     };
63207     return utilRebind(keepRightEditor, dispatch10, "on");
63208   }
63209
63210   // modules/ui/lasso.js
63211   function uiLasso(context) {
63212     var group, polygon2;
63213     lasso.coordinates = [];
63214     function lasso(selection2) {
63215       context.container().classed("lasso", true);
63216       group = selection2.append("g").attr("class", "lasso hide");
63217       polygon2 = group.append("path").attr("class", "lasso-path");
63218       group.call(uiToggle(true));
63219     }
63220     function draw() {
63221       if (polygon2) {
63222         polygon2.data([lasso.coordinates]).attr("d", function(d) {
63223           return "M" + d.join(" L") + " Z";
63224         });
63225       }
63226     }
63227     lasso.extent = function() {
63228       return lasso.coordinates.reduce(function(extent, point) {
63229         return extent.extend(geoExtent(point));
63230       }, geoExtent());
63231     };
63232     lasso.p = function(_) {
63233       if (!arguments.length)
63234         return lasso;
63235       lasso.coordinates.push(_);
63236       draw();
63237       return lasso;
63238     };
63239     lasso.close = function() {
63240       if (group) {
63241         group.call(uiToggle(false, function() {
63242           select_default2(this).remove();
63243         }));
63244       }
63245       context.container().classed("lasso", false);
63246     };
63247     return lasso;
63248   }
63249
63250   // modules/ui/note_comments.js
63251   function uiNoteComments() {
63252     var _note;
63253     function noteComments(selection2) {
63254       if (_note.isNew())
63255         return;
63256       var comments = selection2.selectAll(".comments-container").data([0]);
63257       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
63258       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
63259       commentEnter.append("div").attr("class", function(d) {
63260         return "comment-avatar user-" + d.uid;
63261       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
63262       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
63263       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
63264       metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
63265         var selection3 = select_default2(this);
63266         var osm = services.osm;
63267         if (osm && d.user) {
63268           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
63269         }
63270         if (d.user) {
63271           selection3.text(d.user);
63272         } else {
63273           selection3.call(_t.append("note.anonymous"));
63274         }
63275       });
63276       metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
63277         return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
63278       });
63279       mainEnter.append("div").attr("class", "comment-text").html(function(d) {
63280         return d.html;
63281       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
63282       comments.call(replaceAvatars);
63283     }
63284     function replaceAvatars(selection2) {
63285       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
63286       var osm = services.osm;
63287       if (showThirdPartyIcons !== "true" || !osm)
63288         return;
63289       var uids = {};
63290       _note.comments.forEach(function(d) {
63291         if (d.uid)
63292           uids[d.uid] = true;
63293       });
63294       Object.keys(uids).forEach(function(uid) {
63295         osm.loadUser(uid, function(err, user) {
63296           if (!user || !user.image_url)
63297             return;
63298           selection2.selectAll(".comment-avatar.user-" + uid).html("").append("img").attr("class", "icon comment-avatar-icon").attr("src", user.image_url).attr("alt", user.display_name);
63299         });
63300       });
63301     }
63302     function localeDateString2(s) {
63303       if (!s)
63304         return null;
63305       var options2 = { day: "numeric", month: "short", year: "numeric" };
63306       s = s.replace(/-/g, "/");
63307       var d = new Date(s);
63308       if (isNaN(d.getTime()))
63309         return null;
63310       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
63311     }
63312     noteComments.note = function(val) {
63313       if (!arguments.length)
63314         return _note;
63315       _note = val;
63316       return noteComments;
63317     };
63318     return noteComments;
63319   }
63320
63321   // modules/ui/note_header.js
63322   function uiNoteHeader() {
63323     var _note;
63324     function noteHeader(selection2) {
63325       var header = selection2.selectAll(".note-header").data(_note ? [_note] : [], function(d) {
63326         return d.status + d.id;
63327       });
63328       header.exit().remove();
63329       var headerEnter = header.enter().append("div").attr("class", "note-header");
63330       var iconEnter = headerEnter.append("div").attr("class", function(d) {
63331         return "note-header-icon " + d.status;
63332       }).classed("new", function(d) {
63333         return d.id < 0;
63334       });
63335       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
63336       iconEnter.each(function(d) {
63337         var statusIcon;
63338         if (d.id < 0) {
63339           statusIcon = "#iD-icon-plus";
63340         } else if (d.status === "open") {
63341           statusIcon = "#iD-icon-close";
63342         } else {
63343           statusIcon = "#iD-icon-apply";
63344         }
63345         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
63346       });
63347       headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
63348         if (_note.isNew()) {
63349           return _t.html("note.new");
63350         }
63351         return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
63352       });
63353     }
63354     noteHeader.note = function(val) {
63355       if (!arguments.length)
63356         return _note;
63357       _note = val;
63358       return noteHeader;
63359     };
63360     return noteHeader;
63361   }
63362
63363   // modules/ui/note_report.js
63364   function uiNoteReport() {
63365     var _note;
63366     function noteReport(selection2) {
63367       var url;
63368       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
63369         url = services.osm.noteReportURL(_note);
63370       }
63371       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
63372       link2.exit().remove();
63373       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
63374         return d;
63375       }).call(svgIcon("#iD-icon-out-link", "inline"));
63376       linkEnter.append("span").call(_t.append("note.report"));
63377     }
63378     noteReport.note = function(val) {
63379       if (!arguments.length)
63380         return _note;
63381       _note = val;
63382       return noteReport;
63383     };
63384     return noteReport;
63385   }
63386
63387   // modules/ui/note_editor.js
63388   function uiNoteEditor(context) {
63389     var dispatch10 = dispatch_default("change");
63390     var noteComments = uiNoteComments(context);
63391     var noteHeader = uiNoteHeader();
63392     var _note;
63393     var _newNote;
63394     function noteEditor(selection2) {
63395       var header = selection2.selectAll(".header").data([0]);
63396       var headerEnter = header.enter().append("div").attr("class", "header fillL");
63397       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
63398         context.enter(modeBrowse(context));
63399       }).call(svgIcon("#iD-icon-close"));
63400       headerEnter.append("h2").call(_t.append("note.title"));
63401       var body = selection2.selectAll(".body").data([0]);
63402       body = body.enter().append("div").attr("class", "body").merge(body);
63403       var editor = body.selectAll(".note-editor").data([0]);
63404       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
63405       var footer = selection2.selectAll(".footer").data([0]);
63406       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
63407       var osm = services.osm;
63408       if (osm) {
63409         osm.on("change.note-save", function() {
63410           selection2.call(noteEditor);
63411         });
63412       }
63413     }
63414     function noteSaveSection(selection2) {
63415       var isSelected = _note && _note.id === context.selectedNoteID();
63416       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
63417         return d.status + d.id;
63418       });
63419       noteSave.exit().remove();
63420       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
63421       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
63422         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
63423       });
63424       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
63425         return d.newComment;
63426       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
63427       if (!commentTextarea.empty() && _newNote) {
63428         commentTextarea.node().focus();
63429       }
63430       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
63431       function keydown(d3_event) {
63432         if (!(d3_event.keyCode === 13 && d3_event.metaKey))
63433           return;
63434         var osm = services.osm;
63435         if (!osm)
63436           return;
63437         var hasAuth = osm.authenticated();
63438         if (!hasAuth)
63439           return;
63440         if (!_note.newComment)
63441           return;
63442         d3_event.preventDefault();
63443         select_default2(this).on("keydown.note-input", null);
63444         window.setTimeout(function() {
63445           if (_note.isNew()) {
63446             noteSave.selectAll(".save-button").node().focus();
63447             clickSave(_note);
63448           } else {
63449             noteSave.selectAll(".comment-button").node().focus();
63450             clickComment(_note);
63451           }
63452         }, 10);
63453       }
63454       function changeInput() {
63455         var input = select_default2(this);
63456         var val = input.property("value").trim() || void 0;
63457         _note = _note.update({ newComment: val });
63458         var osm = services.osm;
63459         if (osm) {
63460           osm.replaceNote(_note);
63461         }
63462         noteSave.call(noteSaveButtons);
63463       }
63464     }
63465     function userDetails(selection2) {
63466       var detailSection = selection2.selectAll(".detail-section").data([0]);
63467       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
63468       var osm = services.osm;
63469       if (!osm)
63470         return;
63471       var hasAuth = osm.authenticated();
63472       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
63473       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
63474       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
63475       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
63476       authEnter.append("span").call(_t.append("note.login"));
63477       authEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.note-login", function(d3_event) {
63478         d3_event.preventDefault();
63479         osm.authenticate();
63480       });
63481       authEnter.transition().duration(200).style("opacity", 1);
63482       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
63483       prose.exit().remove();
63484       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
63485       osm.userDetails(function(err, user) {
63486         if (err)
63487           return;
63488         var userLink = select_default2(document.createElement("div"));
63489         if (user.image_url) {
63490           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
63491         }
63492         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
63493         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
63494       });
63495     }
63496     function noteSaveButtons(selection2) {
63497       var osm = services.osm;
63498       var hasAuth = osm && osm.authenticated();
63499       var isSelected = _note && _note.id === context.selectedNoteID();
63500       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
63501         return d.status + d.id;
63502       });
63503       buttonSection.exit().remove();
63504       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
63505       if (_note.isNew()) {
63506         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
63507         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
63508       } else {
63509         buttonEnter.append("button").attr("class", "button status-button action");
63510         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
63511       }
63512       buttonSection = buttonSection.merge(buttonEnter);
63513       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
63514       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
63515       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
63516         var action = d.status === "open" ? "close" : "open";
63517         var andComment = d.newComment ? "_comment" : "";
63518         return _t.html("note." + action + andComment);
63519       }).on("click.status", clickStatus);
63520       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
63521       function isSaveDisabled(d) {
63522         return hasAuth && d.status === "open" && d.newComment ? null : true;
63523       }
63524     }
63525     function clickCancel(d3_event, d) {
63526       this.blur();
63527       var osm = services.osm;
63528       if (osm) {
63529         osm.removeNote(d);
63530       }
63531       context.enter(modeBrowse(context));
63532       dispatch10.call("change");
63533     }
63534     function clickSave(d3_event, d) {
63535       this.blur();
63536       var osm = services.osm;
63537       if (osm) {
63538         osm.postNoteCreate(d, function(err, note) {
63539           dispatch10.call("change", note);
63540         });
63541       }
63542     }
63543     function clickStatus(d3_event, d) {
63544       this.blur();
63545       var osm = services.osm;
63546       if (osm) {
63547         var setStatus = d.status === "open" ? "closed" : "open";
63548         osm.postNoteUpdate(d, setStatus, function(err, note) {
63549           dispatch10.call("change", note);
63550         });
63551       }
63552     }
63553     function clickComment(d3_event, d) {
63554       this.blur();
63555       var osm = services.osm;
63556       if (osm) {
63557         osm.postNoteUpdate(d, d.status, function(err, note) {
63558           dispatch10.call("change", note);
63559         });
63560       }
63561     }
63562     noteEditor.note = function(val) {
63563       if (!arguments.length)
63564         return _note;
63565       _note = val;
63566       return noteEditor;
63567     };
63568     noteEditor.newNote = function(val) {
63569       if (!arguments.length)
63570         return _newNote;
63571       _newNote = val;
63572       return noteEditor;
63573     };
63574     return utilRebind(noteEditor, dispatch10, "on");
63575   }
63576
63577   // modules/ui/source_switch.js
63578   function uiSourceSwitch(context) {
63579     var keys;
63580     function click(d3_event) {
63581       d3_event.preventDefault();
63582       var osm = context.connection();
63583       if (!osm)
63584         return;
63585       if (context.inIntro())
63586         return;
63587       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
63588         return;
63589       var isLive = select_default2(this).classed("live");
63590       isLive = !isLive;
63591       context.enter(modeBrowse(context));
63592       context.history().clearSaved();
63593       context.flush();
63594       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
63595       osm.switch(isLive ? keys[0] : keys[1]);
63596     }
63597     var sourceSwitch = function(selection2) {
63598       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
63599     };
63600     sourceSwitch.keys = function(_) {
63601       if (!arguments.length)
63602         return keys;
63603       keys = _;
63604       return sourceSwitch;
63605     };
63606     return sourceSwitch;
63607   }
63608
63609   // modules/ui/spinner.js
63610   function uiSpinner(context) {
63611     var osm = context.connection();
63612     return function(selection2) {
63613       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
63614       if (osm) {
63615         osm.on("loading.spinner", function() {
63616           img.transition().style("opacity", 1);
63617         }).on("loaded.spinner", function() {
63618           img.transition().style("opacity", 0);
63619         });
63620       }
63621     };
63622   }
63623
63624   // modules/ui/sections/privacy.js
63625   function uiSectionPrivacy(context) {
63626     let section = uiSection("preferences-third-party", context).label(_t.html("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
63627     function renderDisclosureContent(selection2) {
63628       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
63629       let thirdPartyIconsEnter = selection2.select(".privacy-options-list").selectAll(".privacy-third-party-icons-item").data([corePreferences("preferences.privacy.thirdpartyicons") || "true"]).enter().append("li").attr("class", "privacy-third-party-icons-item").append("label").call(uiTooltip().title(_t.html("preferences.privacy.third_party_icons.tooltip")).placement("bottom"));
63630       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
63631         d3_event.preventDefault();
63632         corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
63633       });
63634       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
63635       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
63636       selection2.selectAll(".privacy-link").data([0]).enter().append("div").attr("class", "privacy-link").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/release/PRIVACY.md").append("span").call(_t.append("preferences.privacy.privacy_link"));
63637     }
63638     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
63639     return section;
63640   }
63641
63642   // modules/ui/splash.js
63643   function uiSplash(context) {
63644     return (selection2) => {
63645       if (context.history().hasRestorableChanges())
63646         return;
63647       let updateMessage = "";
63648       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
63649       let showSplash = !corePreferences("sawSplash");
63650       if (sawPrivacyVersion !== context.privacyVersion) {
63651         updateMessage = _t("splash.privacy_update");
63652         showSplash = true;
63653       }
63654       if (!showSplash)
63655         return;
63656       corePreferences("sawSplash", true);
63657       corePreferences("sawPrivacyVersion", context.privacyVersion);
63658       _mainFileFetcher.get("intro_graph");
63659       let modalSelection = uiModal(selection2);
63660       modalSelection.select(".modal").attr("class", "modal-splash modal");
63661       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
63662       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
63663       let modalSection = introModal.append("div").attr("class", "modal-section");
63664       modalSection.append("p").html(_t.html("splash.text", {
63665         version: context.version,
63666         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
63667         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
63668       }));
63669       modalSection.append("p").html(_t.html("splash.privacy", {
63670         updateMessage,
63671         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
63672       }));
63673       uiSectionPrivacy(context).label(_t.html("splash.privacy_settings")).render(modalSection);
63674       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
63675       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
63676         context.container().call(uiIntro(context));
63677         modalSelection.close();
63678       });
63679       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63680       walkthrough.append("div").call(_t.append("splash.walkthrough"));
63681       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
63682       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
63683       startEditing.append("div").call(_t.append("splash.start"));
63684       modalSelection.select("button.close").attr("class", "hide");
63685     };
63686   }
63687
63688   // modules/ui/status.js
63689   function uiStatus(context) {
63690     var osm = context.connection();
63691     return function(selection2) {
63692       if (!osm)
63693         return;
63694       function update(err, apiStatus) {
63695         selection2.html("");
63696         if (err) {
63697           if (apiStatus === "connectionSwitched") {
63698             return;
63699           } else if (apiStatus === "rateLimited") {
63700             selection2.call(_t.append("osm_api_status.message.rateLimit")).append("a").attr("href", "#").attr("class", "api-status-login").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.login", function(d3_event) {
63701               d3_event.preventDefault();
63702               osm.authenticate();
63703             });
63704           } else {
63705             var throttledRetry = throttle_default(function() {
63706               context.loadTiles(context.projection);
63707               osm.reloadApiStatus();
63708             }, 2e3);
63709             selection2.call(_t.append("osm_api_status.message.error", { suffix: " " })).append("a").attr("href", "#").call(_t.append("osm_api_status.retry")).on("click.retry", function(d3_event) {
63710               d3_event.preventDefault();
63711               throttledRetry();
63712             });
63713           }
63714         } else if (apiStatus === "readonly") {
63715           selection2.call(_t.append("osm_api_status.message.readonly"));
63716         } else if (apiStatus === "offline") {
63717           selection2.call(_t.append("osm_api_status.message.offline"));
63718         }
63719         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
63720       }
63721       osm.on("apiStatusChange.uiStatus", update);
63722       context.history().on("storage_error", () => {
63723         selection2.selectAll("span.local-storage-full").remove();
63724         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
63725         selection2.classed("error", true);
63726       });
63727       window.setInterval(function() {
63728         osm.reloadApiStatus();
63729       }, 9e4);
63730       osm.reloadApiStatus();
63731     };
63732   }
63733
63734   // node_modules/osm-community-index/lib/simplify.js
63735   var import_diacritics3 = __toESM(require_diacritics(), 1);
63736   function simplify2(str2) {
63737     if (typeof str2 !== "string")
63738       return "";
63739     return import_diacritics3.default.remove(str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u200b-\u200f\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase());
63740   }
63741
63742   // node_modules/osm-community-index/lib/resolve_strings.js
63743   function resolveStrings(item, defaults2, localizerFn) {
63744     let itemStrings = Object.assign({}, item.strings);
63745     let defaultStrings = Object.assign({}, defaults2[item.type]);
63746     const anyToken = new RegExp(/(\{\w+\})/, "gi");
63747     if (localizerFn) {
63748       if (itemStrings.community) {
63749         const communityID = simplify2(itemStrings.community);
63750         itemStrings.community = localizerFn(`_communities.${communityID}`);
63751       }
63752       ["name", "description", "extendedDescription"].forEach((prop) => {
63753         if (defaultStrings[prop])
63754           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
63755         if (itemStrings[prop])
63756           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
63757       });
63758     }
63759     let replacements = {
63760       account: item.account,
63761       community: itemStrings.community,
63762       signupUrl: itemStrings.signupUrl,
63763       url: itemStrings.url
63764     };
63765     if (!replacements.signupUrl) {
63766       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
63767     }
63768     if (!replacements.url) {
63769       replacements.url = resolve(itemStrings.url || defaultStrings.url);
63770     }
63771     let resolved = {
63772       name: resolve(itemStrings.name || defaultStrings.name),
63773       url: resolve(itemStrings.url || defaultStrings.url),
63774       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
63775       description: resolve(itemStrings.description || defaultStrings.description),
63776       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
63777     };
63778     resolved.nameHTML = linkify(resolved.url, resolved.name);
63779     resolved.urlHTML = linkify(resolved.url);
63780     resolved.signupUrlHTML = linkify(resolved.signupUrl);
63781     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
63782     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
63783     return resolved;
63784     function resolve(s, addLinks) {
63785       if (!s)
63786         return void 0;
63787       let result = s;
63788       for (let key in replacements) {
63789         const token = `{${key}}`;
63790         const regex = new RegExp(token, "g");
63791         if (regex.test(result)) {
63792           let replacement = replacements[key];
63793           if (!replacement) {
63794             throw new Error(`Cannot resolve token: ${token}`);
63795           } else {
63796             if (addLinks && (key === "signupUrl" || key === "url")) {
63797               replacement = linkify(replacement);
63798             }
63799             result = result.replace(regex, replacement);
63800           }
63801         }
63802       }
63803       const leftovers = result.match(anyToken);
63804       if (leftovers) {
63805         throw new Error(`Cannot resolve tokens: ${leftovers}`);
63806       }
63807       if (addLinks && item.type === "reddit") {
63808         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
63809       }
63810       return result;
63811     }
63812     function linkify(url, text2) {
63813       if (!url)
63814         return void 0;
63815       text2 = text2 || url;
63816       return `<a target="_blank" href="${url}">${text2}</a>`;
63817     }
63818   }
63819
63820   // modules/ui/success.js
63821   var _oci = null;
63822   function uiSuccess(context) {
63823     const MAXEVENTS = 2;
63824     const dispatch10 = dispatch_default("cancel");
63825     let _changeset2;
63826     let _location;
63827     ensureOSMCommunityIndex();
63828     function ensureOSMCommunityIndex() {
63829       const data = _mainFileFetcher;
63830       return Promise.all([
63831         data.get("oci_features"),
63832         data.get("oci_resources"),
63833         data.get("oci_defaults")
63834       ]).then((vals) => {
63835         if (_oci)
63836           return _oci;
63837         if (vals[0] && Array.isArray(vals[0].features)) {
63838           _mainLocations.mergeCustomGeoJSON(vals[0]);
63839         }
63840         let ociResources = Object.values(vals[1].resources);
63841         if (ociResources.length) {
63842           return _mainLocations.mergeLocationSets(ociResources).then(() => {
63843             _oci = {
63844               resources: ociResources,
63845               defaults: vals[2].defaults
63846             };
63847             return _oci;
63848           });
63849         } else {
63850           _oci = {
63851             resources: [],
63852             defaults: vals[2].defaults
63853           };
63854           return _oci;
63855         }
63856       });
63857     }
63858     function parseEventDate(when) {
63859       if (!when)
63860         return;
63861       let raw = when.trim();
63862       if (!raw)
63863         return;
63864       if (!/Z$/.test(raw)) {
63865         raw += "Z";
63866       }
63867       const parsed = new Date(raw);
63868       return new Date(parsed.toUTCString().substr(0, 25));
63869     }
63870     function success(selection2) {
63871       let header = selection2.append("div").attr("class", "header fillL");
63872       header.append("h2").call(_t.append("success.just_edited"));
63873       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
63874       let body = selection2.append("div").attr("class", "body save-success fillL");
63875       let summary = body.append("div").attr("class", "save-summary");
63876       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
63877       summary.append("p").call(_t.append("success.help_html")).append("a").attr("class", "link-out").attr("target", "_blank").attr("href", _t("success.help_link_url")).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("success.help_link_text"));
63878       let osm = context.connection();
63879       if (!osm)
63880         return;
63881       let changesetURL = osm.changesetURL(_changeset2.id);
63882       let table = summary.append("table").attr("class", "summary-table");
63883       let row = table.append("tr").attr("class", "summary-row");
63884       row.append("td").attr("class", "cell-icon summary-icon").append("a").attr("target", "_blank").attr("href", changesetURL).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-logo-osm");
63885       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
63886       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
63887       summaryDetail.append("div").html(_t.html("success.changeset_id", {
63888         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
63889       }));
63890       ensureOSMCommunityIndex().then((oci) => {
63891         const loc = context.map().center();
63892         const validLocations = _mainLocations.locationsAt(loc);
63893         let communities = [];
63894         oci.resources.forEach((resource) => {
63895           let area = validLocations[resource.locationSetID];
63896           if (!area)
63897             return;
63898           const localizer = (stringID) => _t.html(`community.${stringID}`);
63899           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
63900           communities.push({
63901             area,
63902             order: resource.order || 0,
63903             resource
63904           });
63905         });
63906         communities.sort((a, b) => a.area - b.area || b.order - a.order);
63907         body.call(showCommunityLinks, communities.map((c) => c.resource));
63908       });
63909     }
63910     function showCommunityLinks(selection2, resources) {
63911       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
63912       communityLinks.append("h3").call(_t.append("success.like_osm"));
63913       let table = communityLinks.append("table").attr("class", "community-table");
63914       let row = table.selectAll(".community-row").data(resources);
63915       let rowEnter = row.enter().append("tr").attr("class", "community-row");
63916       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d) => d.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d) => `#community-${d.type}`);
63917       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
63918       communityDetail.each(showCommunityDetails);
63919       communityLinks.append("div").attr("class", "community-missing").call(_t.append("success.missing")).append("a").attr("class", "link-out").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmlab/osm-community-index/issues").append("span").call(_t.append("success.tell_us"));
63920     }
63921     function showCommunityDetails(d) {
63922       let selection2 = select_default2(this);
63923       let communityID = d.id;
63924       selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
63925       selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
63926       if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
63927         selection2.append("div").call(uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.more")).content(showMore));
63928       }
63929       let nextEvents = (d.events || []).map((event) => {
63930         event.date = parseEventDate(event.when);
63931         return event;
63932       }).filter((event) => {
63933         const t = event.date.getTime();
63934         const now3 = new Date().setHours(0, 0, 0, 0);
63935         return !isNaN(t) && t >= now3;
63936       }).sort((a, b) => {
63937         return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
63938       }).slice(0, MAXEVENTS);
63939       if (nextEvents.length) {
63940         selection2.append("div").call(uiDisclosure(context, `community-events-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
63941       }
63942       function showMore(selection3) {
63943         let more = selection3.selectAll(".community-more").data([0]);
63944         let moreEnter = more.enter().append("div").attr("class", "community-more");
63945         if (d.resolved.extendedDescriptionHTML) {
63946           moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
63947         }
63948         if (d.languageCodes && d.languageCodes.length) {
63949           const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
63950           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
63951         }
63952       }
63953       function showNextEvents(selection3) {
63954         let events = selection3.append("div").attr("class", "community-events");
63955         let item = events.selectAll(".community-event").data(nextEvents);
63956         let itemEnter = item.enter().append("div").attr("class", "community-event");
63957         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
63958           let name2 = d2.name;
63959           if (d2.i18n && d2.id) {
63960             name2 = _t(`community.${communityID}.events.${d2.id}.name`, { default: name2 });
63961           }
63962           return name2;
63963         });
63964         itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
63965           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
63966           if (d2.date.getHours() || d2.date.getMinutes()) {
63967             options2.hour = "numeric";
63968             options2.minute = "numeric";
63969           }
63970           return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
63971         });
63972         itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
63973           let where = d2.where;
63974           if (d2.i18n && d2.id) {
63975             where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
63976           }
63977           return where;
63978         });
63979         itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
63980           let description2 = d2.description;
63981           if (d2.i18n && d2.id) {
63982             description2 = _t(`community.${communityID}.events.${d2.id}.description`, { default: description2 });
63983           }
63984           return description2;
63985         });
63986       }
63987     }
63988     success.changeset = function(val) {
63989       if (!arguments.length)
63990         return _changeset2;
63991       _changeset2 = val;
63992       return success;
63993     };
63994     success.location = function(val) {
63995       if (!arguments.length)
63996         return _location;
63997       _location = val;
63998       return success;
63999     };
64000     return utilRebind(success, dispatch10, "on");
64001   }
64002
64003   // modules/ui/version.js
64004   var sawVersion = null;
64005   var isNewVersion = false;
64006   var isNewUser = false;
64007   function uiVersion(context) {
64008     var currVersion = context.version;
64009     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
64010     if (sawVersion === null && matchedVersion !== null) {
64011       if (corePreferences("sawVersion")) {
64012         isNewUser = false;
64013         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
64014       } else {
64015         isNewUser = true;
64016         isNewVersion = true;
64017       }
64018       corePreferences("sawVersion", currVersion);
64019       sawVersion = currVersion;
64020     }
64021     return function(selection2) {
64022       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
64023       if (isNewVersion && !isNewUser) {
64024         selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/release/CHANGELOG.md#whats-new").call(svgIcon("#maki-gift-11")).call(uiTooltip().title(_t.html("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap")));
64025       }
64026     };
64027   }
64028
64029   // modules/ui/zoom.js
64030   function uiZoom(context) {
64031     var zooms = [{
64032       id: "zoom-in",
64033       icon: "iD-icon-plus",
64034       title: _t.html("zoom.in"),
64035       action: zoomIn,
64036       disabled: function() {
64037         return !context.map().canZoomIn();
64038       },
64039       disabledTitle: _t.html("zoom.disabled.in"),
64040       key: "+"
64041     }, {
64042       id: "zoom-out",
64043       icon: "iD-icon-minus",
64044       title: _t.html("zoom.out"),
64045       action: zoomOut,
64046       disabled: function() {
64047         return !context.map().canZoomOut();
64048       },
64049       disabledTitle: _t.html("zoom.disabled.out"),
64050       key: "-"
64051     }];
64052     function zoomIn(d3_event) {
64053       if (d3_event.shiftKey)
64054         return;
64055       d3_event.preventDefault();
64056       context.map().zoomIn();
64057     }
64058     function zoomOut(d3_event) {
64059       if (d3_event.shiftKey)
64060         return;
64061       d3_event.preventDefault();
64062       context.map().zoomOut();
64063     }
64064     function zoomInFurther(d3_event) {
64065       if (d3_event.shiftKey)
64066         return;
64067       d3_event.preventDefault();
64068       context.map().zoomInFurther();
64069     }
64070     function zoomOutFurther(d3_event) {
64071       if (d3_event.shiftKey)
64072         return;
64073       d3_event.preventDefault();
64074       context.map().zoomOutFurther();
64075     }
64076     return function(selection2) {
64077       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
64078         if (d.disabled()) {
64079           return d.disabledTitle;
64080         }
64081         return d.title;
64082       }).keys(function(d) {
64083         return [d.key];
64084       });
64085       var lastPointerUpType;
64086       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
64087         return d.id;
64088       }).on("pointerup.editor", function(d3_event) {
64089         lastPointerUpType = d3_event.pointerType;
64090       }).on("click.editor", function(d3_event, d) {
64091         if (!d.disabled()) {
64092           d.action(d3_event);
64093         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64094           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
64095         }
64096         lastPointerUpType = null;
64097       }).call(tooltipBehavior);
64098       buttons.each(function(d) {
64099         select_default2(this).call(svgIcon("#" + d.icon, "light"));
64100       });
64101       utilKeybinding.plusKeys.forEach(function(key) {
64102         context.keybinding().on([key], zoomIn);
64103         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
64104       });
64105       utilKeybinding.minusKeys.forEach(function(key) {
64106         context.keybinding().on([key], zoomOut);
64107         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
64108       });
64109       function updateButtonStates() {
64110         buttons.classed("disabled", function(d) {
64111           return d.disabled();
64112         }).each(function() {
64113           var selection3 = select_default2(this);
64114           if (!selection3.select(".tooltip.in").empty()) {
64115             selection3.call(tooltipBehavior.updateContent);
64116           }
64117         });
64118       }
64119       updateButtonStates();
64120       context.map().on("move.uiZoom", updateButtonStates);
64121     };
64122   }
64123
64124   // modules/ui/sections/raw_tag_editor.js
64125   function uiSectionRawTagEditor(id2, context) {
64126     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
64127       var count = Object.keys(_tags).filter(function(d) {
64128         return d;
64129       }).length;
64130       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.tags") }, count });
64131     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
64132     var taginfo = services.taginfo;
64133     var dispatch10 = dispatch_default("change");
64134     var availableViews = [
64135       { id: "list", icon: "#fas-th-list" },
64136       { id: "text", icon: "#fas-i-cursor" }
64137     ];
64138     var _tagView = corePreferences("raw-tag-editor-view") || "list";
64139     var _readOnlyTags = [];
64140     var _orderedKeys = [];
64141     var _showBlank = false;
64142     var _pendingChange = null;
64143     var _state;
64144     var _presets;
64145     var _tags;
64146     var _entityIDs;
64147     var _didInteract = false;
64148     function interacted() {
64149       _didInteract = true;
64150     }
64151     function renderDisclosureContent(wrap2) {
64152       _orderedKeys = _orderedKeys.filter(function(key) {
64153         return _tags[key] !== void 0;
64154       });
64155       var all = Object.keys(_tags).sort();
64156       var missingKeys = utilArrayDifference(all, _orderedKeys);
64157       for (var i2 in missingKeys) {
64158         _orderedKeys.push(missingKeys[i2]);
64159       }
64160       var rowData = _orderedKeys.map(function(key, i3) {
64161         return { index: i3, key, value: _tags[key] };
64162       });
64163       if (!rowData.length || _showBlank) {
64164         _showBlank = false;
64165         rowData.push({ index: rowData.length, key: "", value: "" });
64166       }
64167       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
64168       options2.exit().remove();
64169       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
64170       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
64171         return d.id;
64172       }).enter();
64173       optionEnter.append("button").attr("class", function(d) {
64174         return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
64175       }).attr("aria-selected", function(d) {
64176         return _tagView === d.id;
64177       }).attr("role", "tab").attr("title", function(d) {
64178         return _t("icons." + d.id);
64179       }).on("click", function(d3_event, d) {
64180         _tagView = d.id;
64181         corePreferences("raw-tag-editor-view", d.id);
64182         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
64183           return datum2 === d;
64184         }).attr("aria-selected", function(datum2) {
64185           return datum2 === d;
64186         });
64187         wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
64188         wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
64189       }).each(function(d) {
64190         select_default2(this).call(svgIcon(d.icon));
64191       });
64192       var textData = rowsToText(rowData);
64193       var textarea = wrap2.selectAll(".tag-text").data([0]);
64194       textarea = textarea.enter().append("textarea").attr("class", "tag-text" + (_tagView !== "text" ? " hide" : "")).call(utilNoAuto).attr("placeholder", _t("inspector.key_value")).attr("spellcheck", "false").merge(textarea);
64195       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
64196       var list = wrap2.selectAll(".tag-list").data([0]);
64197       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
64198       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
64199       addRowEnter.append("button").attr("class", "add-tag").attr("aria-label", _t("inspector.add_to_tag")).call(svgIcon("#iD-icon-plus", "light")).call(uiTooltip().title(_t.html("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
64200       addRowEnter.append("div").attr("class", "space-value");
64201       addRowEnter.append("div").attr("class", "space-buttons");
64202       var items = list.selectAll(".tag-row").data(rowData, function(d) {
64203         return d.key;
64204       });
64205       items.exit().each(unbind).remove();
64206       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
64207       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
64208       innerWrap.append("div").attr("class", "key-wrap").append("input").property("type", "text").attr("class", "key").call(utilNoAuto).on("focus", interacted).on("blur", keyChange).on("change", keyChange);
64209       innerWrap.append("div").attr("class", "value-wrap").append("input").property("type", "text").attr("class", "value").call(utilNoAuto).on("focus", interacted).on("blur", valueChange).on("change", valueChange).on("keydown.push-more", pushMore);
64210       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
64211       items = items.merge(itemsEnter).sort(function(a, b) {
64212         return a.index - b.index;
64213       });
64214       items.each(function(d) {
64215         var row = select_default2(this);
64216         var key = row.select("input.key");
64217         var value = row.select("input.value");
64218         if (_entityIDs && taginfo && _state !== "hover") {
64219           bindTypeahead(key, value);
64220         }
64221         var referenceOptions = { key: d.key };
64222         if (typeof d.value === "string") {
64223           referenceOptions.value = d.value;
64224         }
64225         var reference = uiTagReference(referenceOptions, context);
64226         if (_state === "hover") {
64227           reference.showing(false);
64228         }
64229         row.select(".inner-wrap").call(reference.button);
64230         row.call(reference.body);
64231         row.select("button.remove");
64232       });
64233       items.selectAll("input.key").attr("title", function(d) {
64234         return d.key;
64235       }).call(utilGetSetValue, function(d) {
64236         return d.key;
64237       }).attr("readonly", function(d) {
64238         return isReadOnly(d) || null;
64239       });
64240       items.selectAll("input.value").attr("title", function(d) {
64241         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
64242       }).classed("mixed", function(d) {
64243         return Array.isArray(d.value);
64244       }).attr("placeholder", function(d) {
64245         return typeof d.value === "string" ? null : _t("inspector.multiple_values");
64246       }).call(utilGetSetValue, function(d) {
64247         return typeof d.value === "string" ? d.value : "";
64248       }).attr("readonly", function(d) {
64249         return isReadOnly(d) || null;
64250       });
64251       items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
64252     }
64253     function isReadOnly(d) {
64254       for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
64255         if (d.key.match(_readOnlyTags[i2]) !== null) {
64256           return true;
64257         }
64258       }
64259       return false;
64260     }
64261     function setTextareaHeight() {
64262       if (_tagView !== "text")
64263         return;
64264       var selection2 = select_default2(this);
64265       var matches = selection2.node().value.match(/\n/g);
64266       var lineCount = 2 + Number(matches && matches.length);
64267       var lineHeight = 20;
64268       selection2.style("height", lineCount * lineHeight + "px");
64269     }
64270     function stringify3(s) {
64271       return JSON.stringify(s).slice(1, -1);
64272     }
64273     function unstringify(s) {
64274       var leading = "";
64275       var trailing = "";
64276       if (s.length < 1 || s.charAt(0) !== '"') {
64277         leading = '"';
64278       }
64279       if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
64280         trailing = '"';
64281       }
64282       return JSON.parse(leading + s + trailing);
64283     }
64284     function rowsToText(rows) {
64285       var str2 = rows.filter(function(row) {
64286         return row.key && row.key.trim() !== "";
64287       }).map(function(row) {
64288         var rawVal = row.value;
64289         if (typeof rawVal !== "string")
64290           rawVal = "*";
64291         var val = rawVal ? stringify3(rawVal) : "";
64292         return stringify3(row.key) + "=" + val;
64293       }).join("\n");
64294       if (_state !== "hover" && str2.length) {
64295         return str2 + "\n";
64296       }
64297       return str2;
64298     }
64299     function textChanged() {
64300       var newText = this.value.trim();
64301       var newTags = {};
64302       newText.split("\n").forEach(function(row) {
64303         var m = row.match(/^\s*([^=]+)=(.*)$/);
64304         if (m !== null) {
64305           var k = context.cleanTagKey(unstringify(m[1].trim()));
64306           var v = context.cleanTagValue(unstringify(m[2].trim()));
64307           newTags[k] = v;
64308         }
64309       });
64310       var tagDiff = utilTagDiff(_tags, newTags);
64311       if (!tagDiff.length)
64312         return;
64313       _pendingChange = _pendingChange || {};
64314       tagDiff.forEach(function(change) {
64315         if (isReadOnly({ key: change.key }))
64316           return;
64317         if (change.newVal === "*" && typeof change.oldVal !== "string")
64318           return;
64319         if (change.type === "-") {
64320           _pendingChange[change.key] = void 0;
64321         } else if (change.type === "+") {
64322           _pendingChange[change.key] = change.newVal || "";
64323         }
64324       });
64325       if (Object.keys(_pendingChange).length === 0) {
64326         _pendingChange = null;
64327         return;
64328       }
64329       scheduleChange();
64330     }
64331     function pushMore(d3_event) {
64332       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
64333         addTag();
64334       }
64335     }
64336     function bindTypeahead(key, value) {
64337       if (isReadOnly(key.datum()))
64338         return;
64339       if (Array.isArray(value.datum().value)) {
64340         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
64341           var keyString = utilGetSetValue(key);
64342           if (!_tags[keyString])
64343             return;
64344           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
64345             return {
64346               value: tagValue,
64347               title: tagValue
64348             };
64349           });
64350           callback(data);
64351         }));
64352         return;
64353       }
64354       var geometry = context.graph().geometry(_entityIDs[0]);
64355       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
64356         taginfo.keys({
64357           debounce: true,
64358           geometry,
64359           query: value2
64360         }, function(err, data) {
64361           if (!err) {
64362             var filtered = data.filter(function(d) {
64363               return _tags[d.value] === void 0;
64364             });
64365             callback(sort(value2, filtered));
64366           }
64367         });
64368       }));
64369       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
64370         taginfo.values({
64371           debounce: true,
64372           key: utilGetSetValue(key),
64373           geometry,
64374           query: value2
64375         }, function(err, data) {
64376           if (!err)
64377             callback(sort(value2, data));
64378         });
64379       }));
64380       function sort(value2, data) {
64381         var sameletter = [];
64382         var other = [];
64383         for (var i2 = 0; i2 < data.length; i2++) {
64384           if (data[i2].value.substring(0, value2.length) === value2) {
64385             sameletter.push(data[i2]);
64386           } else {
64387             other.push(data[i2]);
64388           }
64389         }
64390         return sameletter.concat(other);
64391       }
64392     }
64393     function unbind() {
64394       var row = select_default2(this);
64395       row.selectAll("input.key").call(uiCombobox.off, context);
64396       row.selectAll("input.value").call(uiCombobox.off, context);
64397     }
64398     function keyChange(d3_event, d) {
64399       if (select_default2(this).attr("readonly"))
64400         return;
64401       var kOld = d.key;
64402       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
64403         return;
64404       var kNew = context.cleanTagKey(this.value.trim());
64405       if (isReadOnly({ key: kNew })) {
64406         this.value = kOld;
64407         return;
64408       }
64409       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
64410         this.value = kOld;
64411         section.selection().selectAll(".tag-list input.value").each(function(d2) {
64412           if (d2.key === kNew) {
64413             var input = select_default2(this).node();
64414             input.focus();
64415             input.select();
64416           }
64417         });
64418         return;
64419       }
64420       _pendingChange = _pendingChange || {};
64421       if (kOld) {
64422         if (kOld === kNew)
64423           return;
64424         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
64425         _pendingChange[kOld] = void 0;
64426       } else {
64427         let row = this.parentNode.parentNode;
64428         let inputVal = select_default2(row).selectAll("input.value");
64429         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
64430         _pendingChange[kNew] = vNew;
64431         utilGetSetValue(inputVal, vNew);
64432       }
64433       var existingKeyIndex = _orderedKeys.indexOf(kOld);
64434       if (existingKeyIndex !== -1)
64435         _orderedKeys[existingKeyIndex] = kNew;
64436       d.key = kNew;
64437       this.value = kNew;
64438       scheduleChange();
64439     }
64440     function valueChange(d3_event, d) {
64441       if (isReadOnly(d))
64442         return;
64443       if (typeof d.value !== "string" && !this.value)
64444         return;
64445       if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
64446         return;
64447       _pendingChange = _pendingChange || {};
64448       _pendingChange[d.key] = context.cleanTagValue(this.value);
64449       scheduleChange();
64450     }
64451     function removeTag(d3_event, d) {
64452       if (isReadOnly(d))
64453         return;
64454       if (d.key === "") {
64455         _showBlank = false;
64456         section.reRender();
64457       } else {
64458         _orderedKeys = _orderedKeys.filter(function(key) {
64459           return key !== d.key;
64460         });
64461         _pendingChange = _pendingChange || {};
64462         _pendingChange[d.key] = void 0;
64463         scheduleChange();
64464       }
64465     }
64466     function addTag() {
64467       window.setTimeout(function() {
64468         _showBlank = true;
64469         section.reRender();
64470         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
64471       }, 20);
64472     }
64473     function scheduleChange() {
64474       var entityIDs = _entityIDs;
64475       window.setTimeout(function() {
64476         if (!_pendingChange)
64477           return;
64478         dispatch10.call("change", this, entityIDs, _pendingChange);
64479         _pendingChange = null;
64480       }, 10);
64481     }
64482     section.state = function(val) {
64483       if (!arguments.length)
64484         return _state;
64485       if (_state !== val) {
64486         _orderedKeys = [];
64487         _state = val;
64488       }
64489       return section;
64490     };
64491     section.presets = function(val) {
64492       if (!arguments.length)
64493         return _presets;
64494       _presets = val;
64495       if (_presets && _presets.length && _presets[0].isFallback()) {
64496         section.disclosureExpanded(true);
64497       } else if (!_didInteract) {
64498         section.disclosureExpanded(null);
64499       }
64500       return section;
64501     };
64502     section.tags = function(val) {
64503       if (!arguments.length)
64504         return _tags;
64505       _tags = val;
64506       return section;
64507     };
64508     section.entityIDs = function(val) {
64509       if (!arguments.length)
64510         return _entityIDs;
64511       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
64512         _entityIDs = val;
64513         _orderedKeys = [];
64514       }
64515       return section;
64516     };
64517     section.readOnlyTags = function(val) {
64518       if (!arguments.length)
64519         return _readOnlyTags;
64520       _readOnlyTags = val;
64521       return section;
64522     };
64523     return utilRebind(section, dispatch10, "on");
64524   }
64525
64526   // modules/ui/data_editor.js
64527   function uiDataEditor(context) {
64528     var dataHeader = uiDataHeader();
64529     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
64530     var _datum;
64531     function dataEditor(selection2) {
64532       var header = selection2.selectAll(".header").data([0]);
64533       var headerEnter = header.enter().append("div").attr("class", "header fillL");
64534       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
64535         context.enter(modeBrowse(context));
64536       }).call(svgIcon("#iD-icon-close"));
64537       headerEnter.append("h2").call(_t.append("map_data.title"));
64538       var body = selection2.selectAll(".body").data([0]);
64539       body = body.enter().append("div").attr("class", "body").merge(body);
64540       var editor = body.selectAll(".data-editor").data([0]);
64541       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
64542       var rte = body.selectAll(".raw-tag-editor").data([0]);
64543       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
64544     }
64545     dataEditor.datum = function(val) {
64546       if (!arguments.length)
64547         return _datum;
64548       _datum = val;
64549       return this;
64550     };
64551     return dataEditor;
64552   }
64553
64554   // modules/ui/osmose_details.js
64555   function uiOsmoseDetails(context) {
64556     let _qaItem;
64557     function issueString(d, type3) {
64558       if (!d)
64559         return "";
64560       const s = services.osmose.getStrings(d.itemType);
64561       return type3 in s ? s[type3] : "";
64562     }
64563     function osmoseDetails(selection2) {
64564       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64565       details.exit().remove();
64566       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
64567       if (issueString(_qaItem, "detail")) {
64568         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64569         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
64570         div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64571       }
64572       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
64573       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
64574       if (issueString(_qaItem, "fix")) {
64575         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64576         div.append("h4").call(_t.append("QA.osmose.fix_title"));
64577         div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64578       }
64579       if (issueString(_qaItem, "trap")) {
64580         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64581         div.append("h4").call(_t.append("QA.osmose.trap_title"));
64582         div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64583       }
64584       const thisItem = _qaItem;
64585       services.osmose.loadIssueDetail(_qaItem).then((d) => {
64586         if (!d.elems || d.elems.length === 0)
64587           return;
64588         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
64589           return;
64590         if (d.detail) {
64591           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
64592           detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64593         }
64594         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
64595         elemsDiv.append("ul").selectAll("li").data(d.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d2) => d2).each(function() {
64596           const link2 = select_default2(this);
64597           const entityID = this.textContent;
64598           const entity = context.hasEntity(entityID);
64599           link2.on("mouseenter", () => {
64600             utilHighlightEntities([entityID], true, context);
64601           }).on("mouseleave", () => {
64602             utilHighlightEntities([entityID], false, context);
64603           }).on("click", (d3_event) => {
64604             d3_event.preventDefault();
64605             utilHighlightEntities([entityID], false, context);
64606             const osmlayer = context.layers().layer("osm");
64607             if (!osmlayer.enabled()) {
64608               osmlayer.enabled(true);
64609             }
64610             context.map().centerZoom(d.loc, 20);
64611             if (entity) {
64612               context.enter(modeSelect(context, [entityID]));
64613             } else {
64614               context.loadEntity(entityID, (err, result) => {
64615                 if (err)
64616                   return;
64617                 const entity2 = result.data.find((e) => e.id === entityID);
64618                 if (entity2)
64619                   context.enter(modeSelect(context, [entityID]));
64620               });
64621             }
64622           });
64623           if (entity) {
64624             let name2 = utilDisplayName(entity);
64625             if (!name2) {
64626               const preset = _mainPresetIndex.match(entity, context.graph());
64627               name2 = preset && !preset.isFallback() && preset.name();
64628             }
64629             if (name2) {
64630               this.innerText = name2;
64631             }
64632           }
64633         });
64634         context.features().forceVisible(d.elems);
64635         context.map().pan([0, 0]);
64636       }).catch((err) => {
64637         console.log(err);
64638       });
64639     }
64640     osmoseDetails.issue = function(val) {
64641       if (!arguments.length)
64642         return _qaItem;
64643       _qaItem = val;
64644       return osmoseDetails;
64645     };
64646     return osmoseDetails;
64647   }
64648
64649   // modules/ui/osmose_header.js
64650   function uiOsmoseHeader() {
64651     let _qaItem;
64652     function issueTitle(d) {
64653       const unknown = _t("inspector.unknown");
64654       if (!d)
64655         return unknown;
64656       const s = services.osmose.getStrings(d.itemType);
64657       return "title" in s ? s.title : unknown;
64658     }
64659     function osmoseHeader(selection2) {
64660       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64661       header.exit().remove();
64662       const headerEnter = header.enter().append("div").attr("class", "qa-header");
64663       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
64664       svgEnter.append("polygon").attr("fill", (d) => services.osmose.getColor(d.item)).attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
64665       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
64666       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
64667     }
64668     osmoseHeader.issue = function(val) {
64669       if (!arguments.length)
64670         return _qaItem;
64671       _qaItem = val;
64672       return osmoseHeader;
64673     };
64674     return osmoseHeader;
64675   }
64676
64677   // modules/ui/view_on_osmose.js
64678   function uiViewOnOsmose() {
64679     let _qaItem;
64680     function viewOnOsmose(selection2) {
64681       let url;
64682       if (services.osmose && _qaItem instanceof QAItem) {
64683         url = services.osmose.itemURL(_qaItem);
64684       }
64685       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
64686       link2.exit().remove();
64687       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
64688       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
64689     }
64690     viewOnOsmose.what = function(val) {
64691       if (!arguments.length)
64692         return _qaItem;
64693       _qaItem = val;
64694       return viewOnOsmose;
64695     };
64696     return viewOnOsmose;
64697   }
64698
64699   // modules/ui/osmose_editor.js
64700   function uiOsmoseEditor(context) {
64701     const dispatch10 = dispatch_default("change");
64702     const qaDetails = uiOsmoseDetails(context);
64703     const qaHeader = uiOsmoseHeader(context);
64704     let _qaItem;
64705     function osmoseEditor(selection2) {
64706       const header = selection2.selectAll(".header").data([0]);
64707       const headerEnter = header.enter().append("div").attr("class", "header fillL");
64708       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
64709       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
64710       let body = selection2.selectAll(".body").data([0]);
64711       body = body.enter().append("div").attr("class", "body").merge(body);
64712       let editor = body.selectAll(".qa-editor").data([0]);
64713       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
64714       const footer = selection2.selectAll(".footer").data([0]);
64715       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
64716     }
64717     function osmoseSaveSection(selection2) {
64718       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64719       const isShown = _qaItem && isSelected;
64720       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64721       saveSection.exit().remove();
64722       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
64723       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
64724     }
64725     function qaSaveButtons(selection2) {
64726       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64727       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
64728       buttonSection.exit().remove();
64729       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64730       buttonEnter.append("button").attr("class", "button close-button action");
64731       buttonEnter.append("button").attr("class", "button ignore-button action");
64732       buttonSection = buttonSection.merge(buttonEnter);
64733       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
64734         this.blur();
64735         const qaService = services.osmose;
64736         if (qaService) {
64737           d.newStatus = "done";
64738           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64739         }
64740       });
64741       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
64742         this.blur();
64743         const qaService = services.osmose;
64744         if (qaService) {
64745           d.newStatus = "false";
64746           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64747         }
64748       });
64749     }
64750     osmoseEditor.error = function(val) {
64751       if (!arguments.length)
64752         return _qaItem;
64753       _qaItem = val;
64754       return osmoseEditor;
64755     };
64756     return utilRebind(osmoseEditor, dispatch10, "on");
64757   }
64758
64759   // modules/ui/sidebar.js
64760   function uiSidebar(context) {
64761     var inspector = uiInspector(context);
64762     var dataEditor = uiDataEditor(context);
64763     var noteEditor = uiNoteEditor(context);
64764     var improveOsmEditor = uiImproveOsmEditor(context);
64765     var keepRightEditor = uiKeepRightEditor(context);
64766     var osmoseEditor = uiOsmoseEditor(context);
64767     var _current;
64768     var _wasData = false;
64769     var _wasNote = false;
64770     var _wasQaItem = false;
64771     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
64772     function sidebar(selection2) {
64773       var container = context.container();
64774       var minWidth = 240;
64775       var sidebarWidth;
64776       var containerWidth;
64777       var dragOffset;
64778       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
64779       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
64780       var downPointerId, lastClientX, containerLocGetter;
64781       function pointerdown(d3_event) {
64782         if (downPointerId)
64783           return;
64784         if ("button" in d3_event && d3_event.button !== 0)
64785           return;
64786         downPointerId = d3_event.pointerId || "mouse";
64787         lastClientX = d3_event.clientX;
64788         containerLocGetter = utilFastMouse(container.node());
64789         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
64790         sidebarWidth = selection2.node().getBoundingClientRect().width;
64791         containerWidth = container.node().getBoundingClientRect().width;
64792         var widthPct = sidebarWidth / containerWidth * 100;
64793         selection2.style("width", widthPct + "%").style("max-width", "85%");
64794         resizer.classed("dragging", true);
64795         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
64796           d3_event2.preventDefault();
64797         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
64798       }
64799       function pointermove(d3_event) {
64800         if (downPointerId !== (d3_event.pointerId || "mouse"))
64801           return;
64802         d3_event.preventDefault();
64803         var dx = d3_event.clientX - lastClientX;
64804         lastClientX = d3_event.clientX;
64805         var isRTL = _mainLocalizer.textDirection() === "rtl";
64806         var scaleX = isRTL ? 0 : 1;
64807         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
64808         var x = containerLocGetter(d3_event)[0] - dragOffset;
64809         sidebarWidth = isRTL ? containerWidth - x : x;
64810         var isCollapsed = selection2.classed("collapsed");
64811         var shouldCollapse = sidebarWidth < minWidth;
64812         selection2.classed("collapsed", shouldCollapse);
64813         if (shouldCollapse) {
64814           if (!isCollapsed) {
64815             selection2.style(xMarginProperty, "-400px").style("width", "400px");
64816             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
64817           }
64818         } else {
64819           var widthPct = sidebarWidth / containerWidth * 100;
64820           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
64821           if (isCollapsed) {
64822             context.ui().onResize([-sidebarWidth * scaleX, 0]);
64823           } else {
64824             context.ui().onResize([-dx * scaleX, 0]);
64825           }
64826         }
64827       }
64828       function pointerup(d3_event) {
64829         if (downPointerId !== (d3_event.pointerId || "mouse"))
64830           return;
64831         downPointerId = null;
64832         resizer.classed("dragging", false);
64833         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
64834       }
64835       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
64836       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
64837       var hoverModeSelect = function(targets) {
64838         context.container().selectAll(".feature-list-item button").classed("hover", false);
64839         if (context.selectedIDs().length > 1 && targets && targets.length) {
64840           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
64841             return targets.indexOf(node) !== -1;
64842           });
64843           if (!elements.empty()) {
64844             elements.classed("hover", true);
64845           }
64846         }
64847       };
64848       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
64849       function hover(targets) {
64850         var datum2 = targets && targets.length && targets[0];
64851         if (datum2 && datum2.__featurehash__) {
64852           _wasData = true;
64853           sidebar.show(dataEditor.datum(datum2));
64854           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64855         } else if (datum2 instanceof osmNote) {
64856           if (context.mode().id === "drag-note")
64857             return;
64858           _wasNote = true;
64859           var osm = services.osm;
64860           if (osm) {
64861             datum2 = osm.getNote(datum2.id);
64862           }
64863           sidebar.show(noteEditor.note(datum2));
64864           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64865         } else if (datum2 instanceof QAItem) {
64866           _wasQaItem = true;
64867           var errService = services[datum2.service];
64868           if (errService) {
64869             datum2 = errService.getError(datum2.id);
64870           }
64871           var errEditor;
64872           if (datum2.service === "keepRight") {
64873             errEditor = keepRightEditor;
64874           } else if (datum2.service === "osmose") {
64875             errEditor = osmoseEditor;
64876           } else {
64877             errEditor = improveOsmEditor;
64878           }
64879           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
64880             return d.id === datum2.id;
64881           });
64882           sidebar.show(errEditor.error(datum2));
64883           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64884         } else if (!_current && datum2 instanceof osmEntity) {
64885           featureListWrap.classed("inspector-hidden", true);
64886           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
64887           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
64888             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
64889             inspectorWrap.call(inspector);
64890           }
64891         } else if (!_current) {
64892           featureListWrap.classed("inspector-hidden", false);
64893           inspectorWrap.classed("inspector-hidden", true);
64894           inspector.state("hide");
64895         } else if (_wasData || _wasNote || _wasQaItem) {
64896           _wasNote = false;
64897           _wasData = false;
64898           _wasQaItem = false;
64899           context.container().selectAll(".note").classed("hover", false);
64900           context.container().selectAll(".qaItem").classed("hover", false);
64901           sidebar.hide();
64902         }
64903       }
64904       sidebar.hover = throttle_default(hover, 200);
64905       sidebar.intersects = function(extent) {
64906         var rect = selection2.node().getBoundingClientRect();
64907         return extent.intersects([
64908           context.projection.invert([0, rect.height]),
64909           context.projection.invert([rect.width, 0])
64910         ]);
64911       };
64912       sidebar.select = function(ids, newFeature) {
64913         sidebar.hide();
64914         if (ids && ids.length) {
64915           var entity = ids.length === 1 && context.entity(ids[0]);
64916           if (entity && newFeature && selection2.classed("collapsed")) {
64917             var extent = entity.extent(context.graph());
64918             sidebar.expand(sidebar.intersects(extent));
64919           }
64920           featureListWrap.classed("inspector-hidden", true);
64921           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
64922           inspector.state("select").entityIDs(ids).newFeature(newFeature);
64923           inspectorWrap.call(inspector);
64924         } else {
64925           inspector.state("hide");
64926         }
64927       };
64928       sidebar.showPresetList = function() {
64929         inspector.showList();
64930       };
64931       sidebar.show = function(component, element) {
64932         featureListWrap.classed("inspector-hidden", true);
64933         inspectorWrap.classed("inspector-hidden", true);
64934         if (_current)
64935           _current.remove();
64936         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
64937       };
64938       sidebar.hide = function() {
64939         featureListWrap.classed("inspector-hidden", false);
64940         inspectorWrap.classed("inspector-hidden", true);
64941         if (_current)
64942           _current.remove();
64943         _current = null;
64944       };
64945       sidebar.expand = function(moveMap) {
64946         if (selection2.classed("collapsed")) {
64947           sidebar.toggle(moveMap);
64948         }
64949       };
64950       sidebar.collapse = function(moveMap) {
64951         if (!selection2.classed("collapsed")) {
64952           sidebar.toggle(moveMap);
64953         }
64954       };
64955       sidebar.toggle = function(moveMap) {
64956         if (context.inIntro())
64957           return;
64958         var isCollapsed = selection2.classed("collapsed");
64959         var isCollapsing = !isCollapsed;
64960         var isRTL = _mainLocalizer.textDirection() === "rtl";
64961         var scaleX = isRTL ? 0 : 1;
64962         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
64963         sidebarWidth = selection2.node().getBoundingClientRect().width;
64964         selection2.style("width", sidebarWidth + "px");
64965         var startMargin, endMargin, lastMargin;
64966         if (isCollapsing) {
64967           startMargin = lastMargin = 0;
64968           endMargin = -sidebarWidth;
64969         } else {
64970           startMargin = lastMargin = -sidebarWidth;
64971           endMargin = 0;
64972         }
64973         if (!isCollapsing) {
64974           selection2.classed("collapsed", isCollapsing);
64975         }
64976         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
64977           var i2 = number_default(startMargin, endMargin);
64978           return function(t) {
64979             var dx = lastMargin - Math.round(i2(t));
64980             lastMargin = lastMargin - dx;
64981             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
64982           };
64983         }).on("end", function() {
64984           if (isCollapsing) {
64985             selection2.classed("collapsed", isCollapsing);
64986           }
64987           if (!isCollapsing) {
64988             var containerWidth2 = container.node().getBoundingClientRect().width;
64989             var widthPct = sidebarWidth / containerWidth2 * 100;
64990             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
64991           }
64992         });
64993       };
64994       resizer.on("dblclick", function(d3_event) {
64995         d3_event.preventDefault();
64996         if (d3_event.sourceEvent) {
64997           d3_event.sourceEvent.preventDefault();
64998         }
64999         sidebar.toggle();
65000       });
65001       context.map().on("crossEditableZoom.sidebar", function(within) {
65002         if (!within && !selection2.select(".inspector-hover").empty()) {
65003           hover([]);
65004         }
65005       });
65006     }
65007     sidebar.showPresetList = function() {
65008     };
65009     sidebar.hover = function() {
65010     };
65011     sidebar.hover.cancel = function() {
65012     };
65013     sidebar.intersects = function() {
65014     };
65015     sidebar.select = function() {
65016     };
65017     sidebar.show = function() {
65018     };
65019     sidebar.hide = function() {
65020     };
65021     sidebar.expand = function() {
65022     };
65023     sidebar.collapse = function() {
65024     };
65025     sidebar.toggle = function() {
65026     };
65027     return sidebar;
65028   }
65029
65030   // modules/modes/draw_area.js
65031   function modeDrawArea(context, wayID, startGraph, button) {
65032     var mode = {
65033       button,
65034       id: "draw-area"
65035     };
65036     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
65037       context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.areas"))();
65038     });
65039     mode.wayID = wayID;
65040     mode.enter = function() {
65041       context.install(behavior);
65042     };
65043     mode.exit = function() {
65044       context.uninstall(behavior);
65045     };
65046     mode.selectedIDs = function() {
65047       return [wayID];
65048     };
65049     mode.activeID = function() {
65050       return behavior && behavior.activeID() || [];
65051     };
65052     return mode;
65053   }
65054
65055   // modules/modes/add_area.js
65056   function modeAddArea(context, mode) {
65057     mode.id = "add-area";
65058     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
65059     var defaultTags = { area: "yes" };
65060     if (mode.preset)
65061       defaultTags = mode.preset.setTags(defaultTags, "area");
65062     function actionClose(wayId) {
65063       return function(graph) {
65064         return graph.replace(graph.entity(wayId).close());
65065       };
65066     }
65067     function start2(loc) {
65068       var startGraph = context.graph();
65069       var node = osmNode({ loc });
65070       var way = osmWay({ tags: defaultTags });
65071       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
65072       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65073     }
65074     function startFromWay(loc, edge) {
65075       var startGraph = context.graph();
65076       var node = osmNode({ loc });
65077       var way = osmWay({ tags: defaultTags });
65078       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id), actionAddMidpoint({ loc, edge }, node));
65079       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65080     }
65081     function startFromNode(node) {
65082       var startGraph = context.graph();
65083       var way = osmWay({ tags: defaultTags });
65084       context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
65085       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65086     }
65087     mode.enter = function() {
65088       context.install(behavior);
65089     };
65090     mode.exit = function() {
65091       context.uninstall(behavior);
65092     };
65093     return mode;
65094   }
65095
65096   // modules/modes/add_line.js
65097   function modeAddLine(context, mode) {
65098     mode.id = "add-line";
65099     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
65100     var defaultTags = {};
65101     if (mode.preset)
65102       defaultTags = mode.preset.setTags(defaultTags, "line");
65103     function start2(loc) {
65104       var startGraph = context.graph();
65105       var node = osmNode({ loc });
65106       var way = osmWay({ tags: defaultTags });
65107       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id));
65108       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65109     }
65110     function startFromWay(loc, edge) {
65111       var startGraph = context.graph();
65112       var node = osmNode({ loc });
65113       var way = osmWay({ tags: defaultTags });
65114       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionAddMidpoint({ loc, edge }, node));
65115       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65116     }
65117     function startFromNode(node) {
65118       var startGraph = context.graph();
65119       var way = osmWay({ tags: defaultTags });
65120       context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id));
65121       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65122     }
65123     mode.enter = function() {
65124       context.install(behavior);
65125     };
65126     mode.exit = function() {
65127       context.uninstall(behavior);
65128     };
65129     return mode;
65130   }
65131
65132   // modules/modes/add_point.js
65133   function modeAddPoint(context, mode) {
65134     mode.id = "add-point";
65135     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
65136     var defaultTags = {};
65137     if (mode.preset)
65138       defaultTags = mode.preset.setTags(defaultTags, "point");
65139     function add(loc) {
65140       var node = osmNode({ loc, tags: defaultTags });
65141       context.perform(actionAddEntity(node), _t("operations.add.annotation.point"));
65142       enterSelectMode(node);
65143     }
65144     function addWay(loc, edge) {
65145       var node = osmNode({ tags: defaultTags });
65146       context.perform(actionAddMidpoint({ loc, edge }, node), _t("operations.add.annotation.vertex"));
65147       enterSelectMode(node);
65148     }
65149     function enterSelectMode(node) {
65150       context.enter(modeSelect(context, [node.id]).newFeature(true));
65151     }
65152     function addNode(node) {
65153       if (Object.keys(defaultTags).length === 0) {
65154         enterSelectMode(node);
65155         return;
65156       }
65157       var tags = Object.assign({}, node.tags);
65158       for (var key in defaultTags) {
65159         tags[key] = defaultTags[key];
65160       }
65161       context.perform(actionChangeTags(node.id, tags), _t("operations.add.annotation.point"));
65162       enterSelectMode(node);
65163     }
65164     function cancel() {
65165       context.enter(modeBrowse(context));
65166     }
65167     mode.enter = function() {
65168       context.install(behavior);
65169     };
65170     mode.exit = function() {
65171       context.uninstall(behavior);
65172     };
65173     return mode;
65174   }
65175
65176   // modules/modes/select_note.js
65177   function modeSelectNote(context, selectedNoteID) {
65178     var mode = {
65179       id: "select-note",
65180       button: "browse"
65181     };
65182     var _keybinding = utilKeybinding("select-note");
65183     var _noteEditor = uiNoteEditor(context).on("change", function() {
65184       context.map().pan([0, 0]);
65185       var note = checkSelectedID();
65186       if (!note)
65187         return;
65188       context.ui().sidebar.show(_noteEditor.note(note));
65189     });
65190     var _behaviors = [
65191       behaviorBreathe(context),
65192       behaviorHover(context),
65193       behaviorSelect(context),
65194       behaviorLasso(context),
65195       modeDragNode(context).behavior,
65196       modeDragNote(context).behavior
65197     ];
65198     var _newFeature = false;
65199     function checkSelectedID() {
65200       if (!services.osm)
65201         return;
65202       var note = services.osm.getNote(selectedNoteID);
65203       if (!note) {
65204         context.enter(modeBrowse(context));
65205       }
65206       return note;
65207     }
65208     function selectNote(d3_event, drawn) {
65209       if (!checkSelectedID())
65210         return;
65211       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
65212       if (selection2.empty()) {
65213         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
65214         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
65215           context.enter(modeBrowse(context));
65216         }
65217       } else {
65218         selection2.classed("selected", true);
65219         context.selectedNoteID(selectedNoteID);
65220       }
65221     }
65222     function esc() {
65223       if (context.container().select(".combobox").size())
65224         return;
65225       context.enter(modeBrowse(context));
65226     }
65227     mode.zoomToSelected = function() {
65228       if (!services.osm)
65229         return;
65230       var note = services.osm.getNote(selectedNoteID);
65231       if (note) {
65232         context.map().centerZoomEase(note.loc, 20);
65233       }
65234     };
65235     mode.newFeature = function(val) {
65236       if (!arguments.length)
65237         return _newFeature;
65238       _newFeature = val;
65239       return mode;
65240     };
65241     mode.enter = function() {
65242       var note = checkSelectedID();
65243       if (!note)
65244         return;
65245       _behaviors.forEach(context.install);
65246       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
65247       select_default2(document).call(_keybinding);
65248       selectNote();
65249       var sidebar = context.ui().sidebar;
65250       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
65251       sidebar.expand(sidebar.intersects(note.extent()));
65252       context.map().on("drawn.select", selectNote);
65253     };
65254     mode.exit = function() {
65255       _behaviors.forEach(context.uninstall);
65256       select_default2(document).call(_keybinding.unbind);
65257       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
65258       context.map().on("drawn.select", null);
65259       context.ui().sidebar.hide();
65260       context.selectedNoteID(null);
65261     };
65262     return mode;
65263   }
65264
65265   // modules/modes/add_note.js
65266   function modeAddNote(context) {
65267     var mode = {
65268       id: "add-note",
65269       button: "note",
65270       description: _t.html("modes.add_note.description"),
65271       key: _t("modes.add_note.key")
65272     };
65273     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
65274     function add(loc) {
65275       var osm = services.osm;
65276       if (!osm)
65277         return;
65278       var note = osmNote({ loc, status: "open", comments: [] });
65279       osm.replaceNote(note);
65280       context.map().pan([0, 0]);
65281       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
65282     }
65283     function cancel() {
65284       context.enter(modeBrowse(context));
65285     }
65286     mode.enter = function() {
65287       context.install(behavior);
65288     };
65289     mode.exit = function() {
65290       context.uninstall(behavior);
65291     };
65292     return mode;
65293   }
65294
65295   // modules/modes/save.js
65296   function modeSave(context) {
65297     var mode = { id: "save" };
65298     var keybinding = utilKeybinding("modeSave");
65299     var commit = uiCommit(context).on("cancel", cancel);
65300     var _conflictsUi;
65301     var _location;
65302     var _success;
65303     var uploader = context.uploader().on("saveStarted.modeSave", function() {
65304       keybindingOff();
65305     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
65306       cancel();
65307     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
65308     function cancel() {
65309       context.enter(modeBrowse(context));
65310     }
65311     function showProgress(num, total) {
65312       var modal = context.container().select(".loading-modal .modal-section");
65313       var progress = modal.selectAll(".progress").data([0]);
65314       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
65315     }
65316     function showConflicts(changeset, conflicts, origChanges) {
65317       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
65318       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
65319       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
65320         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65321         selection2.remove();
65322         keybindingOn();
65323         uploader.cancelConflictResolution();
65324       }).on("save", function() {
65325         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65326         selection2.remove();
65327         uploader.processResolvedConflicts(changeset);
65328       });
65329       selection2.call(_conflictsUi);
65330     }
65331     function showErrors(errors) {
65332       keybindingOn();
65333       var selection2 = uiConfirm(context.container());
65334       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
65335       addErrors(selection2, errors);
65336       selection2.okButton();
65337     }
65338     function addErrors(selection2, data) {
65339       var message = selection2.select(".modal-section.message-text");
65340       var items = message.selectAll(".error-container").data(data);
65341       var enter = items.enter().append("div").attr("class", "error-container");
65342       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
65343         return d.msg || _t("save.unknown_error_details");
65344       }).on("click", function(d3_event) {
65345         d3_event.preventDefault();
65346         var error = select_default2(this);
65347         var detail = select_default2(this.nextElementSibling);
65348         var exp2 = error.classed("expanded");
65349         detail.style("display", exp2 ? "none" : "block");
65350         error.classed("expanded", !exp2);
65351       });
65352       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
65353       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
65354         return d.details || [];
65355       }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
65356         return d;
65357       });
65358       items.exit().remove();
65359     }
65360     function showSuccess(changeset) {
65361       commit.reset();
65362       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
65363         context.ui().sidebar.hide();
65364       });
65365       context.enter(modeBrowse(context).sidebar(ui));
65366     }
65367     function keybindingOn() {
65368       select_default2(document).call(keybinding.on("\u238B", cancel, true));
65369     }
65370     function keybindingOff() {
65371       select_default2(document).call(keybinding.unbind);
65372     }
65373     function prepareForSuccess() {
65374       _success = uiSuccess(context);
65375       _location = null;
65376       if (!services.geocoder)
65377         return;
65378       services.geocoder.reverse(context.map().center(), function(err, result) {
65379         if (err || !result || !result.address)
65380           return;
65381         var addr = result.address;
65382         var place = addr && (addr.town || addr.city || addr.county) || "";
65383         var region = addr && (addr.state || addr.country) || "";
65384         var separator = place && region ? _t("success.thank_you_where.separator") : "";
65385         _location = _t("success.thank_you_where.format", { place, separator, region });
65386       });
65387     }
65388     mode.selectedIDs = function() {
65389       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
65390     };
65391     mode.enter = function() {
65392       context.ui().sidebar.expand();
65393       function done() {
65394         context.ui().sidebar.show(commit);
65395       }
65396       keybindingOn();
65397       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65398       var osm = context.connection();
65399       if (!osm) {
65400         cancel();
65401         return;
65402       }
65403       if (osm.authenticated()) {
65404         done();
65405       } else {
65406         osm.authenticate(function(err) {
65407           if (err) {
65408             cancel();
65409           } else {
65410             done();
65411           }
65412         });
65413       }
65414     };
65415     mode.exit = function() {
65416       keybindingOff();
65417       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
65418       context.ui().sidebar.hide();
65419     };
65420     return mode;
65421   }
65422
65423   // modules/modes/select_error.js
65424   function modeSelectError(context, selectedErrorID, selectedErrorService) {
65425     var mode = {
65426       id: "select-error",
65427       button: "browse"
65428     };
65429     var keybinding = utilKeybinding("select-error");
65430     var errorService = services[selectedErrorService];
65431     var errorEditor;
65432     switch (selectedErrorService) {
65433       case "improveOSM":
65434         errorEditor = uiImproveOsmEditor(context).on("change", function() {
65435           context.map().pan([0, 0]);
65436           var error = checkSelectedID();
65437           if (!error)
65438             return;
65439           context.ui().sidebar.show(errorEditor.error(error));
65440         });
65441         break;
65442       case "keepRight":
65443         errorEditor = uiKeepRightEditor(context).on("change", function() {
65444           context.map().pan([0, 0]);
65445           var error = checkSelectedID();
65446           if (!error)
65447             return;
65448           context.ui().sidebar.show(errorEditor.error(error));
65449         });
65450         break;
65451       case "osmose":
65452         errorEditor = uiOsmoseEditor(context).on("change", function() {
65453           context.map().pan([0, 0]);
65454           var error = checkSelectedID();
65455           if (!error)
65456             return;
65457           context.ui().sidebar.show(errorEditor.error(error));
65458         });
65459         break;
65460     }
65461     var behaviors = [
65462       behaviorBreathe(context),
65463       behaviorHover(context),
65464       behaviorSelect(context),
65465       behaviorLasso(context),
65466       modeDragNode(context).behavior,
65467       modeDragNote(context).behavior
65468     ];
65469     function checkSelectedID() {
65470       if (!errorService)
65471         return;
65472       var error = errorService.getError(selectedErrorID);
65473       if (!error) {
65474         context.enter(modeBrowse(context));
65475       }
65476       return error;
65477     }
65478     mode.zoomToSelected = function() {
65479       if (!errorService)
65480         return;
65481       var error = errorService.getError(selectedErrorID);
65482       if (error) {
65483         context.map().centerZoomEase(error.loc, 20);
65484       }
65485     };
65486     mode.enter = function() {
65487       var error = checkSelectedID();
65488       if (!error)
65489         return;
65490       behaviors.forEach(context.install);
65491       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
65492       select_default2(document).call(keybinding);
65493       selectError();
65494       var sidebar = context.ui().sidebar;
65495       sidebar.show(errorEditor.error(error));
65496       context.map().on("drawn.select-error", selectError);
65497       function selectError(d3_event, drawn) {
65498         if (!checkSelectedID())
65499           return;
65500         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
65501         if (selection2.empty()) {
65502           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
65503           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
65504             context.enter(modeBrowse(context));
65505           }
65506         } else {
65507           selection2.classed("selected", true);
65508           context.selectedErrorID(selectedErrorID);
65509         }
65510       }
65511       function esc() {
65512         if (context.container().select(".combobox").size())
65513           return;
65514         context.enter(modeBrowse(context));
65515       }
65516     };
65517     mode.exit = function() {
65518       behaviors.forEach(context.uninstall);
65519       select_default2(document).call(keybinding.unbind);
65520       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
65521       context.map().on("drawn.select-error", null);
65522       context.ui().sidebar.hide();
65523       context.selectedErrorID(null);
65524       context.features().forceVisible([]);
65525     };
65526     return mode;
65527   }
65528
65529   // modules/ui/tools/modes.js
65530   function uiToolDrawModes(context) {
65531     var tool = {
65532       id: "old_modes",
65533       label: _t.html("toolbar.add_feature")
65534     };
65535     var modes = [
65536       modeAddPoint(context, {
65537         title: _t.html("modes.add_point.title"),
65538         button: "point",
65539         description: _t.html("modes.add_point.description"),
65540         preset: _mainPresetIndex.item("point"),
65541         key: "1"
65542       }),
65543       modeAddLine(context, {
65544         title: _t.html("modes.add_line.title"),
65545         button: "line",
65546         description: _t.html("modes.add_line.description"),
65547         preset: _mainPresetIndex.item("line"),
65548         key: "2"
65549       }),
65550       modeAddArea(context, {
65551         title: _t.html("modes.add_area.title"),
65552         button: "area",
65553         description: _t.html("modes.add_area.description"),
65554         preset: _mainPresetIndex.item("area"),
65555         key: "3"
65556       })
65557     ];
65558     function enabled(_mode) {
65559       return osmEditable();
65560     }
65561     function osmEditable() {
65562       return context.editable();
65563     }
65564     modes.forEach(function(mode) {
65565       context.keybinding().on(mode.key, function() {
65566         if (!enabled(mode))
65567           return;
65568         if (mode.id === context.mode().id) {
65569           context.enter(modeBrowse(context));
65570         } else {
65571           context.enter(mode);
65572         }
65573       });
65574     });
65575     tool.render = function(selection2) {
65576       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
65577       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65578       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
65579       context.on("enter.modes", update);
65580       update();
65581       function update() {
65582         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
65583           return d.id;
65584         });
65585         buttons.exit().remove();
65586         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
65587           return d.id + " add-button bar-button";
65588         }).on("click.mode-buttons", function(d3_event, d) {
65589           if (!enabled(d))
65590             return;
65591           var currMode = context.mode().id;
65592           if (/^draw/.test(currMode))
65593             return;
65594           if (d.id === currMode) {
65595             context.enter(modeBrowse(context));
65596           } else {
65597             context.enter(d);
65598           }
65599         }).call(uiTooltip().placement("bottom").title(function(d) {
65600           return d.description;
65601         }).keys(function(d) {
65602           return [d.key];
65603         }).scrollContainer(context.container().select(".top-toolbar")));
65604         buttonsEnter.each(function(d) {
65605           select_default2(this).call(svgIcon("#iD-icon-" + d.button));
65606         });
65607         buttonsEnter.append("span").attr("class", "label").html(function(mode) {
65608           return mode.title;
65609         });
65610         if (buttons.enter().size() || buttons.exit().size()) {
65611           context.ui().checkOverflow(".top-toolbar", true);
65612         }
65613         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
65614           return !enabled(d);
65615         }).classed("disabled", function(d) {
65616           return !enabled(d);
65617         }).attr("aria-pressed", function(d) {
65618           return context.mode() && context.mode().button === d.button;
65619         }).classed("active", function(d) {
65620           return context.mode() && context.mode().button === d.button;
65621         });
65622       }
65623     };
65624     return tool;
65625   }
65626
65627   // modules/ui/tools/notes.js
65628   function uiToolNotes(context) {
65629     var tool = {
65630       id: "notes",
65631       label: _t.html("modes.add_note.label")
65632     };
65633     var mode = modeAddNote(context);
65634     function enabled() {
65635       return notesEnabled() && notesEditable();
65636     }
65637     function notesEnabled() {
65638       var noteLayer = context.layers().layer("notes");
65639       return noteLayer && noteLayer.enabled();
65640     }
65641     function notesEditable() {
65642       var mode2 = context.mode();
65643       return context.map().notesEditable() && mode2 && mode2.id !== "save";
65644     }
65645     context.keybinding().on(mode.key, function() {
65646       if (!enabled())
65647         return;
65648       if (mode.id === context.mode().id) {
65649         context.enter(modeBrowse(context));
65650       } else {
65651         context.enter(mode);
65652       }
65653     });
65654     tool.render = function(selection2) {
65655       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65656       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
65657       context.on("enter.notes", update);
65658       update();
65659       function update() {
65660         var showNotes = notesEnabled();
65661         var data = showNotes ? [mode] : [];
65662         var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
65663           return d.id;
65664         });
65665         buttons.exit().remove();
65666         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
65667           return d.id + " add-button bar-button";
65668         }).on("click.notes", function(d3_event, d) {
65669           if (!enabled())
65670             return;
65671           var currMode = context.mode().id;
65672           if (/^draw/.test(currMode))
65673             return;
65674           if (d.id === currMode) {
65675             context.enter(modeBrowse(context));
65676           } else {
65677             context.enter(d);
65678           }
65679         }).call(uiTooltip().placement("bottom").title(function(d) {
65680           return d.description;
65681         }).keys(function(d) {
65682           return [d.key];
65683         }).scrollContainer(context.container().select(".top-toolbar")));
65684         buttonsEnter.each(function(d) {
65685           select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
65686         });
65687         if (buttons.enter().size() || buttons.exit().size()) {
65688           context.ui().checkOverflow(".top-toolbar", true);
65689         }
65690         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
65691           return !enabled();
65692         }).attr("aria-disabled", function() {
65693           return !enabled();
65694         }).classed("active", function(d) {
65695           return context.mode() && context.mode().button === d.button;
65696         }).attr("aria-pressed", function(d) {
65697           return context.mode() && context.mode().button === d.button;
65698         });
65699       }
65700     };
65701     tool.uninstall = function() {
65702       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
65703       context.map().on("move.notes", null).on("drawn.notes", null);
65704     };
65705     return tool;
65706   }
65707
65708   // modules/ui/tools/save.js
65709   function uiToolSave(context) {
65710     var tool = {
65711       id: "save",
65712       label: _t.html("save.title")
65713     };
65714     var button = null;
65715     var tooltipBehavior = null;
65716     var history = context.history();
65717     var key = uiCmd("\u2318S");
65718     var _numChanges = 0;
65719     function isSaving() {
65720       var mode = context.mode();
65721       return mode && mode.id === "save";
65722     }
65723     function isDisabled() {
65724       return _numChanges === 0 || isSaving();
65725     }
65726     function save(d3_event) {
65727       d3_event.preventDefault();
65728       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
65729         context.enter(modeSave(context));
65730       }
65731     }
65732     function bgColor(numChanges) {
65733       var step;
65734       if (numChanges === 0) {
65735         return null;
65736       } else if (numChanges <= 50) {
65737         step = numChanges / 50;
65738         return rgb_default("#fff", "#ff8")(step);
65739       } else {
65740         step = Math.min((numChanges - 50) / 50, 1);
65741         return rgb_default("#ff8", "#f88")(step);
65742       }
65743     }
65744     function updateCount() {
65745       var val = history.difference().summary().length;
65746       if (val === _numChanges)
65747         return;
65748       _numChanges = val;
65749       if (tooltipBehavior) {
65750         tooltipBehavior.title(_t.html(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
65751       }
65752       if (button) {
65753         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
65754         button.select("span.count").text(_numChanges);
65755       }
65756     }
65757     tool.render = function(selection2) {
65758       tooltipBehavior = uiTooltip().placement("bottom").title(_t.html("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
65759       var lastPointerUpType;
65760       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
65761         lastPointerUpType = d3_event.pointerType;
65762       }).on("click", function(d3_event) {
65763         save(d3_event);
65764         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
65765           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.html("save.no_changes"))();
65766         }
65767         lastPointerUpType = null;
65768       }).call(tooltipBehavior);
65769       button.call(svgIcon("#iD-icon-save"));
65770       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
65771       updateCount();
65772       context.keybinding().on(key, save, true);
65773       context.history().on("change.save", updateCount);
65774       context.on("enter.save", function() {
65775         if (button) {
65776           button.classed("disabled", isDisabled());
65777           if (isSaving()) {
65778             button.call(tooltipBehavior.hide);
65779           }
65780         }
65781       });
65782     };
65783     tool.uninstall = function() {
65784       context.keybinding().off(key, true);
65785       context.history().on("change.save", null);
65786       context.on("enter.save", null);
65787       button = null;
65788       tooltipBehavior = null;
65789     };
65790     return tool;
65791   }
65792
65793   // modules/ui/tools/sidebar_toggle.js
65794   function uiToolSidebarToggle(context) {
65795     var tool = {
65796       id: "sidebar_toggle",
65797       label: _t.html("toolbar.inspect")
65798     };
65799     tool.render = function(selection2) {
65800       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
65801         context.ui().sidebar.toggle();
65802       }).call(uiTooltip().placement("bottom").title(_t.html("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
65803     };
65804     return tool;
65805   }
65806
65807   // modules/ui/tools/undo_redo.js
65808   function uiToolUndoRedo(context) {
65809     var tool = {
65810       id: "undo_redo",
65811       label: _t.html("toolbar.undo_redo")
65812     };
65813     var commands = [{
65814       id: "undo",
65815       cmd: uiCmd("\u2318Z"),
65816       action: function() {
65817         context.undo();
65818       },
65819       annotation: function() {
65820         return context.history().undoAnnotation();
65821       },
65822       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
65823     }, {
65824       id: "redo",
65825       cmd: uiCmd("\u2318\u21E7Z"),
65826       action: function() {
65827         context.redo();
65828       },
65829       annotation: function() {
65830         return context.history().redoAnnotation();
65831       },
65832       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
65833     }];
65834     function editable() {
65835       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(true);
65836     }
65837     tool.render = function(selection2) {
65838       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
65839         return d.annotation() ? _t.html(d.id + ".tooltip", { action: d.annotation() }) : _t.html(d.id + ".nothing");
65840       }).keys(function(d) {
65841         return [d.cmd];
65842       }).scrollContainer(context.container().select(".top-toolbar"));
65843       var lastPointerUpType;
65844       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
65845         return "disabled " + d.id + "-button bar-button";
65846       }).on("pointerup", function(d3_event) {
65847         lastPointerUpType = d3_event.pointerType;
65848       }).on("click", function(d3_event, d) {
65849         d3_event.preventDefault();
65850         var annotation = d.annotation();
65851         if (editable() && annotation) {
65852           d.action();
65853         }
65854         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
65855           var text2 = annotation ? _t.html(d.id + ".tooltip", { action: annotation }) : _t.html(d.id + ".nothing");
65856           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(text2)();
65857         }
65858         lastPointerUpType = null;
65859       }).call(tooltipBehavior);
65860       buttons.each(function(d) {
65861         select_default2(this).call(svgIcon("#" + d.icon));
65862       });
65863       context.keybinding().on(commands[0].cmd, function(d3_event) {
65864         d3_event.preventDefault();
65865         if (editable())
65866           commands[0].action();
65867       }).on(commands[1].cmd, function(d3_event) {
65868         d3_event.preventDefault();
65869         if (editable())
65870           commands[1].action();
65871       });
65872       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65873       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
65874       context.history().on("change.undo_redo", function(difference) {
65875         if (difference)
65876           update();
65877       });
65878       context.on("enter.undo_redo", update);
65879       function update() {
65880         buttons.classed("disabled", function(d) {
65881           return !editable() || !d.annotation();
65882         }).each(function() {
65883           var selection3 = select_default2(this);
65884           if (!selection3.select(".tooltip.in").empty()) {
65885             selection3.call(tooltipBehavior.updateContent);
65886           }
65887         });
65888       }
65889     };
65890     tool.uninstall = function() {
65891       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
65892       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
65893       context.history().on("change.undo_redo", null);
65894       context.on("enter.undo_redo", null);
65895     };
65896     return tool;
65897   }
65898
65899   // modules/ui/top_toolbar.js
65900   function uiTopToolbar(context) {
65901     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
65902     function notesEnabled() {
65903       var noteLayer = context.layers().layer("notes");
65904       return noteLayer && noteLayer.enabled();
65905     }
65906     function topToolbar(bar) {
65907       bar.on("wheel.topToolbar", function(d3_event) {
65908         if (!d3_event.deltaX) {
65909           bar.node().scrollLeft += d3_event.deltaY;
65910         }
65911       });
65912       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65913       context.layers().on("change.topToolbar", debouncedUpdate);
65914       update();
65915       function update() {
65916         var tools = [
65917           sidebarToggle,
65918           "spacer",
65919           modes
65920         ];
65921         tools.push("spacer");
65922         if (notesEnabled()) {
65923           tools = tools.concat([notes, "spacer"]);
65924         }
65925         tools = tools.concat([undoRedo, save]);
65926         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
65927           return d.id || d;
65928         });
65929         toolbarItems.exit().each(function(d) {
65930           if (d.uninstall) {
65931             d.uninstall();
65932           }
65933         }).remove();
65934         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
65935           var classes = "toolbar-item " + (d.id || d).replace("_", "-");
65936           if (d.klass)
65937             classes += " " + d.klass;
65938           return classes;
65939         });
65940         var actionableItems = itemsEnter.filter(function(d) {
65941           return d !== "spacer";
65942         });
65943         actionableItems.append("div").attr("class", "item-content").each(function(d) {
65944           select_default2(this).call(d.render, bar);
65945         });
65946         actionableItems.append("div").attr("class", "item-label").html(function(d) {
65947           return d.label;
65948         });
65949       }
65950     }
65951     return topToolbar;
65952   }
65953
65954   // modules/ui/zoom_to_selection.js
65955   function uiZoomToSelection(context) {
65956     function isDisabled() {
65957       var mode = context.mode();
65958       return !mode || !mode.zoomToSelected;
65959     }
65960     var _lastPointerUpType;
65961     function pointerup(d3_event) {
65962       _lastPointerUpType = d3_event.pointerType;
65963     }
65964     function click(d3_event) {
65965       d3_event.preventDefault();
65966       if (isDisabled()) {
65967         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
65968           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.html("inspector.zoom_to.no_selection"))();
65969         }
65970       } else {
65971         var mode = context.mode();
65972         if (mode && mode.zoomToSelected) {
65973           mode.zoomToSelected();
65974         }
65975       }
65976       _lastPointerUpType = null;
65977     }
65978     return function(selection2) {
65979       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
65980         if (isDisabled()) {
65981           return _t.html("inspector.zoom_to.no_selection");
65982         }
65983         return _t.html("inspector.zoom_to.title");
65984       }).keys([_t("inspector.zoom_to.key")]);
65985       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
65986       function setEnabledState() {
65987         button.classed("disabled", isDisabled());
65988         if (!button.select(".tooltip.in").empty()) {
65989           button.call(tooltipBehavior.updateContent);
65990         }
65991       }
65992       context.on("enter.uiZoomToSelection", setEnabledState);
65993       setEnabledState();
65994     };
65995   }
65996
65997   // modules/ui/pane.js
65998   function uiPane(id2, context) {
65999     var _key;
66000     var _label = "";
66001     var _description = "";
66002     var _iconName = "";
66003     var _sections;
66004     var _paneSelection = select_default2(null);
66005     var _paneTooltip;
66006     var pane = {
66007       id: id2
66008     };
66009     pane.label = function(val) {
66010       if (!arguments.length)
66011         return _label;
66012       _label = val;
66013       return pane;
66014     };
66015     pane.key = function(val) {
66016       if (!arguments.length)
66017         return _key;
66018       _key = val;
66019       return pane;
66020     };
66021     pane.description = function(val) {
66022       if (!arguments.length)
66023         return _description;
66024       _description = val;
66025       return pane;
66026     };
66027     pane.iconName = function(val) {
66028       if (!arguments.length)
66029         return _iconName;
66030       _iconName = val;
66031       return pane;
66032     };
66033     pane.sections = function(val) {
66034       if (!arguments.length)
66035         return _sections;
66036       _sections = val;
66037       return pane;
66038     };
66039     pane.selection = function() {
66040       return _paneSelection;
66041     };
66042     function hidePane() {
66043       context.ui().togglePanes();
66044     }
66045     pane.togglePane = function(d3_event) {
66046       if (d3_event)
66047         d3_event.preventDefault();
66048       _paneTooltip.hide();
66049       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
66050     };
66051     pane.renderToggleButton = function(selection2) {
66052       if (!_paneTooltip) {
66053         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(_description).keys([_key]);
66054       }
66055       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
66056     };
66057     pane.renderContent = function(selection2) {
66058       if (_sections) {
66059         _sections.forEach(function(section) {
66060           selection2.call(section.render);
66061         });
66062       }
66063     };
66064     pane.renderPane = function(selection2) {
66065       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
66066       var heading = _paneSelection.append("div").attr("class", "pane-heading");
66067       heading.append("h2").html(_label);
66068       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
66069       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
66070       if (_key) {
66071         context.keybinding().on(_key, pane.togglePane);
66072       }
66073     };
66074     return pane;
66075   }
66076
66077   // modules/ui/sections/background_display_options.js
66078   function uiSectionBackgroundDisplayOptions(context) {
66079     var section = uiSection("background-display-options", context).label(_t.html("background.display_options")).disclosureContent(renderDisclosureContent);
66080     var _storedOpacity = corePreferences("background-opacity");
66081     var _minVal = 0;
66082     var _maxVal = 3;
66083     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
66084     var _options = {
66085       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
66086       contrast: 1,
66087       saturation: 1,
66088       sharpness: 1
66089     };
66090     function clamp3(x, min3, max3) {
66091       return Math.max(min3, Math.min(x, max3));
66092     }
66093     function updateValue(d, val) {
66094       val = clamp3(val, _minVal, _maxVal);
66095       _options[d] = val;
66096       context.background()[d](val);
66097       if (d === "brightness") {
66098         corePreferences("background-opacity", val);
66099       }
66100       section.reRender();
66101     }
66102     function renderDisclosureContent(selection2) {
66103       var container = selection2.selectAll(".display-options-container").data([0]);
66104       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
66105       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
66106         return "display-control display-control-" + d;
66107       });
66108       slidersEnter.html(function(d) {
66109         return _t.html("background." + d);
66110       }).append("span").attr("class", function(d) {
66111         return "display-option-value display-option-value-" + d;
66112       });
66113       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
66114       sildersControlEnter.append("input").attr("class", function(d) {
66115         return "display-option-input display-option-input-" + d;
66116       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
66117         var val = select_default2(this).property("value");
66118         if (!val && d3_event && d3_event.target) {
66119           val = d3_event.target.value;
66120         }
66121         updateValue(d, val);
66122       });
66123       sildersControlEnter.append("button").attr("title", function(d) {
66124         return `${_t("background.reset")} ${_t("background." + d)}`;
66125       }).attr("class", function(d) {
66126         return "display-option-reset display-option-reset-" + d;
66127       }).on("click", function(d3_event, d) {
66128         if (d3_event.button !== 0)
66129           return;
66130         updateValue(d, 1);
66131       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
66132       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
66133         d3_event.preventDefault();
66134         for (var i2 = 0; i2 < _sliders.length; i2++) {
66135           updateValue(_sliders[i2], 1);
66136         }
66137       });
66138       container = containerEnter.merge(container);
66139       container.selectAll(".display-option-input").property("value", function(d) {
66140         return _options[d];
66141       });
66142       container.selectAll(".display-option-value").text(function(d) {
66143         return Math.floor(_options[d] * 100) + "%";
66144       });
66145       container.selectAll(".display-option-reset").classed("disabled", function(d) {
66146         return _options[d] === 1;
66147       });
66148       if (containerEnter.size() && _options.brightness !== 1) {
66149         context.background().brightness(_options.brightness);
66150       }
66151     }
66152     return section;
66153   }
66154
66155   // modules/ui/settings/custom_background.js
66156   function uiSettingsCustomBackground() {
66157     var dispatch10 = dispatch_default("change");
66158     function render(selection2) {
66159       var _origSettings = {
66160         template: corePreferences("background-custom-template")
66161       };
66162       var _currSettings = {
66163         template: corePreferences("background-custom-template")
66164       };
66165       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
66166       var modal = uiConfirm(selection2).okButton();
66167       modal.classed("settings-modal settings-custom-background", true);
66168       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
66169       var textSection = modal.select(".modal-section.message-text");
66170       var instructions = `${_t.html("settings.custom_background.instructions.info")}
66171
66172 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
66173 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
66174 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
66175 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
66176 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
66177
66178 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
66179 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
66180 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
66181 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
66182 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
66183 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
66184
66185 #### ${_t.html("settings.custom_background.instructions.example")}
66186 \`${example}\``;
66187       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
66188       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
66189       var buttonSection = modal.select(".modal-section.buttons");
66190       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
66191       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
66192       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
66193       function isSaveDisabled() {
66194         return null;
66195       }
66196       function clickCancel() {
66197         textSection.select(".field-template").property("value", _origSettings.template);
66198         corePreferences("background-custom-template", _origSettings.template);
66199         this.blur();
66200         modal.close();
66201       }
66202       function clickSave() {
66203         _currSettings.template = textSection.select(".field-template").property("value");
66204         corePreferences("background-custom-template", _currSettings.template);
66205         this.blur();
66206         modal.close();
66207         dispatch10.call("change", this, _currSettings);
66208       }
66209     }
66210     return utilRebind(render, dispatch10, "on");
66211   }
66212
66213   // modules/ui/sections/background_list.js
66214   function uiSectionBackgroundList(context) {
66215     var _backgroundList = select_default2(null);
66216     var _customSource = context.background().findSource("custom");
66217     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
66218     var section = uiSection("background-list", context).label(_t.html("background.backgrounds")).disclosureContent(renderDisclosureContent);
66219     function previousBackgroundID() {
66220       return corePreferences("background-last-used-toggle");
66221     }
66222     function renderDisclosureContent(selection2) {
66223       var container = selection2.selectAll(".layer-background-list").data([0]);
66224       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
66225       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
66226       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(uiTooltip().title(_t.html("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top"));
66227       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66228         d3_event.preventDefault();
66229         uiMapInMap.toggle();
66230       });
66231       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
66232       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top"));
66233       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66234         d3_event.preventDefault();
66235         context.ui().info.toggle("background");
66236       });
66237       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
66238       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top"));
66239       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66240         d3_event.preventDefault();
66241         context.ui().info.toggle("location");
66242       });
66243       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
66244       selection2.selectAll(".imagery-faq").data([0]).enter().append("div").attr("class", "imagery-faq").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery").append("span").call(_t.append("background.imagery_problem_faq"));
66245       _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
66246         chooseBackground(d);
66247       }, function(d) {
66248         return !d.isHidden() && !d.overlay;
66249       });
66250     }
66251     function setTooltips(selection2) {
66252       selection2.each(function(d, i2, nodes) {
66253         var item = select_default2(this).select("label");
66254         var span = item.select("span");
66255         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
66256         var description2 = d.description();
66257         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
66258         item.call(uiTooltip().destroyAny);
66259         if (d.id === previousBackgroundID()) {
66260           item.call(uiTooltip().placement(placement).title("<div>" + _t.html("background.switch") + "</div>").keys([uiCmd("\u2318" + _t("background.key"))]));
66261         } else if (description2 || isOverflowing) {
66262           item.call(uiTooltip().placement(placement).title(description2 || d.label()));
66263         }
66264       });
66265     }
66266     function drawListItems(layerList, type3, change, filter2) {
66267       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
66268         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
66269       });
66270       var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
66271         return d.id + "---" + i2;
66272       });
66273       layerLinks.exit().remove();
66274       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
66275         return d.id === "custom";
66276       }).classed("best", function(d) {
66277         return d.best();
66278       });
66279       var label = enter.append("label");
66280       label.append("input").attr("type", type3).attr("name", "background-layer").attr("value", function(d) {
66281         return d.id;
66282       }).on("change", change);
66283       label.append("span").html(function(d) {
66284         return d.label();
66285       });
66286       enter.filter(function(d) {
66287         return d.id === "custom";
66288       }).append("button").attr("class", "layer-browse").call(uiTooltip().title(_t.html("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
66289         d3_event.preventDefault();
66290         editCustom();
66291       }).call(svgIcon("#iD-icon-more"));
66292       enter.filter(function(d) {
66293         return d.best();
66294       }).append("div").attr("class", "best").call(uiTooltip().title(_t.html("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).append("span").html("&#9733;");
66295       layerList.call(updateLayerSelections);
66296     }
66297     function updateLayerSelections(selection2) {
66298       function active(d) {
66299         return context.background().showsLayer(d);
66300       }
66301       selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
66302         return d.id === previousBackgroundID();
66303       }).call(setTooltips).selectAll("input").property("checked", active);
66304     }
66305     function chooseBackground(d) {
66306       if (d.id === "custom" && !d.template()) {
66307         return editCustom();
66308       }
66309       var previousBackground = context.background().baseLayerSource();
66310       corePreferences("background-last-used-toggle", previousBackground.id);
66311       corePreferences("background-last-used", d.id);
66312       context.background().baseLayerSource(d);
66313     }
66314     function customChanged(d) {
66315       if (d && d.template) {
66316         _customSource.template(d.template);
66317         chooseBackground(_customSource);
66318       } else {
66319         _customSource.template("");
66320         chooseBackground(context.background().findSource("none"));
66321       }
66322     }
66323     function editCustom() {
66324       context.container().call(_settingsCustomBackground);
66325     }
66326     context.background().on("change.background_list", function() {
66327       _backgroundList.call(updateLayerSelections);
66328     });
66329     context.map().on("move.background_list", debounce_default(function() {
66330       window.requestIdleCallback(section.reRender);
66331     }, 1e3));
66332     return section;
66333   }
66334
66335   // modules/ui/sections/background_offset.js
66336   function uiSectionBackgroundOffset(context) {
66337     var section = uiSection("background-offset", context).label(_t.html("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
66338     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
66339     var _directions = [
66340       ["top", [0, -0.5]],
66341       ["left", [-0.5, 0]],
66342       ["right", [0.5, 0]],
66343       ["bottom", [0, 0.5]]
66344     ];
66345     function updateValue() {
66346       var meters = geoOffsetToMeters(context.background().offset());
66347       var x = +meters[0].toFixed(2);
66348       var y = +meters[1].toFixed(2);
66349       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
66350       context.container().selectAll(".nudge-reset").classed("disabled", function() {
66351         return x === 0 && y === 0;
66352       });
66353     }
66354     function resetOffset() {
66355       context.background().offset([0, 0]);
66356       updateValue();
66357     }
66358     function nudge(d) {
66359       context.background().nudge(d, context.map().zoom());
66360       updateValue();
66361     }
66362     function inputOffset() {
66363       var input = select_default2(this);
66364       var d = input.node().value;
66365       if (d === "")
66366         return resetOffset();
66367       d = d.replace(/;/g, ",").split(",").map(function(n2) {
66368         return !isNaN(n2) && n2;
66369       });
66370       if (d.length !== 2 || !d[0] || !d[1]) {
66371         input.classed("error", true);
66372         return;
66373       }
66374       context.background().offset(geoMetersToOffset(d));
66375       updateValue();
66376     }
66377     function dragOffset(d3_event) {
66378       if (d3_event.button !== 0)
66379         return;
66380       var origin = [d3_event.clientX, d3_event.clientY];
66381       var pointerId = d3_event.pointerId || "mouse";
66382       context.container().append("div").attr("class", "nudge-surface");
66383       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
66384       if (_pointerPrefix === "pointer") {
66385         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
66386       }
66387       function pointermove(d3_event2) {
66388         if (pointerId !== (d3_event2.pointerId || "mouse"))
66389           return;
66390         var latest = [d3_event2.clientX, d3_event2.clientY];
66391         var d = [
66392           -(origin[0] - latest[0]) / 4,
66393           -(origin[1] - latest[1]) / 4
66394         ];
66395         origin = latest;
66396         nudge(d);
66397       }
66398       function pointerup(d3_event2) {
66399         if (pointerId !== (d3_event2.pointerId || "mouse"))
66400           return;
66401         if (d3_event2.button !== 0)
66402           return;
66403         context.container().selectAll(".nudge-surface").remove();
66404         select_default2(window).on(".drag-bg-offset", null);
66405       }
66406     }
66407     function renderDisclosureContent(selection2) {
66408       var container = selection2.selectAll(".nudge-container").data([0]);
66409       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
66410       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
66411       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
66412       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
66413       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
66414       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
66415         return _t(`background.nudge.${d[0]}`);
66416       }).attr("class", function(d) {
66417         return d[0] + " nudge";
66418       }).on("click", function(d3_event, d) {
66419         nudge(d[1]);
66420       });
66421       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
66422         d3_event.preventDefault();
66423         resetOffset();
66424       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
66425       updateValue();
66426     }
66427     context.background().on("change.backgroundOffset-update", updateValue);
66428     return section;
66429   }
66430
66431   // modules/ui/sections/overlay_list.js
66432   function uiSectionOverlayList(context) {
66433     var section = uiSection("overlay-list", context).label(_t.html("background.overlays")).disclosureContent(renderDisclosureContent);
66434     var _overlayList = select_default2(null);
66435     function setTooltips(selection2) {
66436       selection2.each(function(d, i2, nodes) {
66437         var item = select_default2(this).select("label");
66438         var span = item.select("span");
66439         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
66440         var description2 = d.description();
66441         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
66442         item.call(uiTooltip().destroyAny);
66443         if (description2 || isOverflowing) {
66444           item.call(uiTooltip().placement(placement).title(description2 || d.name()));
66445         }
66446       });
66447     }
66448     function updateLayerSelections(selection2) {
66449       function active(d) {
66450         return context.background().showsLayer(d);
66451       }
66452       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
66453     }
66454     function chooseOverlay(d3_event, d) {
66455       d3_event.preventDefault();
66456       context.background().toggleOverlayLayer(d);
66457       _overlayList.call(updateLayerSelections);
66458       document.activeElement.blur();
66459     }
66460     function drawListItems(layerList, type3, change, filter2) {
66461       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
66462       var layerLinks = layerList.selectAll("li").data(sources, function(d) {
66463         return d.name();
66464       });
66465       layerLinks.exit().remove();
66466       var enter = layerLinks.enter().append("li");
66467       var label = enter.append("label");
66468       label.append("input").attr("type", type3).attr("name", "layers").on("change", change);
66469       label.append("span").html(function(d) {
66470         return d.label();
66471       });
66472       layerList.selectAll("li").sort(sortSources);
66473       layerList.call(updateLayerSelections);
66474       function sortSources(a, b) {
66475         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
66476       }
66477     }
66478     function renderDisclosureContent(selection2) {
66479       var container = selection2.selectAll(".layer-overlay-list").data([0]);
66480       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
66481       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
66482         return !d.isHidden() && d.overlay;
66483       });
66484     }
66485     context.map().on("move.overlay_list", debounce_default(function() {
66486       window.requestIdleCallback(section.reRender);
66487     }, 1e3));
66488     return section;
66489   }
66490
66491   // modules/ui/panes/background.js
66492   function uiPaneBackground(context) {
66493     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.html("background.title")).description(_t.html("background.description")).iconName("iD-icon-layers").sections([
66494       uiSectionBackgroundList(context),
66495       uiSectionOverlayList(context),
66496       uiSectionBackgroundDisplayOptions(context),
66497       uiSectionBackgroundOffset(context)
66498     ]);
66499     return backgroundPane;
66500   }
66501
66502   // modules/ui/panes/help.js
66503   function uiPaneHelp(context) {
66504     var docKeys = [
66505       ["help", [
66506         "welcome",
66507         "open_data_h",
66508         "open_data",
66509         "before_start_h",
66510         "before_start",
66511         "open_source_h",
66512         "open_source",
66513         "open_source_help"
66514       ]],
66515       ["overview", [
66516         "navigation_h",
66517         "navigation_drag",
66518         "navigation_zoom",
66519         "features_h",
66520         "features",
66521         "nodes_ways"
66522       ]],
66523       ["editing", [
66524         "select_h",
66525         "select_left_click",
66526         "select_right_click",
66527         "select_space",
66528         "multiselect_h",
66529         "multiselect",
66530         "multiselect_shift_click",
66531         "multiselect_lasso",
66532         "undo_redo_h",
66533         "undo_redo",
66534         "save_h",
66535         "save",
66536         "save_validation",
66537         "upload_h",
66538         "upload",
66539         "backups_h",
66540         "backups",
66541         "keyboard_h",
66542         "keyboard"
66543       ]],
66544       ["feature_editor", [
66545         "intro",
66546         "definitions",
66547         "type_h",
66548         "type",
66549         "type_picker",
66550         "fields_h",
66551         "fields_all_fields",
66552         "fields_example",
66553         "fields_add_field",
66554         "tags_h",
66555         "tags_all_tags",
66556         "tags_resources"
66557       ]],
66558       ["points", [
66559         "intro",
66560         "add_point_h",
66561         "add_point",
66562         "add_point_finish",
66563         "move_point_h",
66564         "move_point",
66565         "delete_point_h",
66566         "delete_point",
66567         "delete_point_command"
66568       ]],
66569       ["lines", [
66570         "intro",
66571         "add_line_h",
66572         "add_line",
66573         "add_line_draw",
66574         "add_line_continue",
66575         "add_line_finish",
66576         "modify_line_h",
66577         "modify_line_dragnode",
66578         "modify_line_addnode",
66579         "connect_line_h",
66580         "connect_line",
66581         "connect_line_display",
66582         "connect_line_drag",
66583         "connect_line_tag",
66584         "disconnect_line_h",
66585         "disconnect_line_command",
66586         "move_line_h",
66587         "move_line_command",
66588         "move_line_connected",
66589         "delete_line_h",
66590         "delete_line",
66591         "delete_line_command"
66592       ]],
66593       ["areas", [
66594         "intro",
66595         "point_or_area_h",
66596         "point_or_area",
66597         "add_area_h",
66598         "add_area_command",
66599         "add_area_draw",
66600         "add_area_continue",
66601         "add_area_finish",
66602         "square_area_h",
66603         "square_area_command",
66604         "modify_area_h",
66605         "modify_area_dragnode",
66606         "modify_area_addnode",
66607         "delete_area_h",
66608         "delete_area",
66609         "delete_area_command"
66610       ]],
66611       ["relations", [
66612         "intro",
66613         "edit_relation_h",
66614         "edit_relation",
66615         "edit_relation_add",
66616         "edit_relation_delete",
66617         "maintain_relation_h",
66618         "maintain_relation",
66619         "relation_types_h",
66620         "multipolygon_h",
66621         "multipolygon",
66622         "multipolygon_create",
66623         "multipolygon_merge",
66624         "turn_restriction_h",
66625         "turn_restriction",
66626         "turn_restriction_field",
66627         "turn_restriction_editing",
66628         "route_h",
66629         "route",
66630         "route_add",
66631         "boundary_h",
66632         "boundary",
66633         "boundary_add"
66634       ]],
66635       ["operations", [
66636         "intro",
66637         "intro_2",
66638         "straighten",
66639         "orthogonalize",
66640         "circularize",
66641         "move",
66642         "rotate",
66643         "reflect",
66644         "continue",
66645         "reverse",
66646         "disconnect",
66647         "split",
66648         "extract",
66649         "merge",
66650         "delete",
66651         "downgrade",
66652         "copy_paste"
66653       ]],
66654       ["notes", [
66655         "intro",
66656         "add_note_h",
66657         "add_note",
66658         "place_note",
66659         "move_note",
66660         "update_note_h",
66661         "update_note",
66662         "save_note_h",
66663         "save_note"
66664       ]],
66665       ["imagery", [
66666         "intro",
66667         "sources_h",
66668         "choosing",
66669         "sources",
66670         "offsets_h",
66671         "offset",
66672         "offset_change"
66673       ]],
66674       ["streetlevel", [
66675         "intro",
66676         "using_h",
66677         "using",
66678         "photos",
66679         "viewer"
66680       ]],
66681       ["gps", [
66682         "intro",
66683         "survey",
66684         "using_h",
66685         "using",
66686         "tracing",
66687         "upload"
66688       ]],
66689       ["qa", [
66690         "intro",
66691         "tools_h",
66692         "tools",
66693         "issues_h",
66694         "issues"
66695       ]]
66696     ];
66697     var headings = {
66698       "help.help.open_data_h": 3,
66699       "help.help.before_start_h": 3,
66700       "help.help.open_source_h": 3,
66701       "help.overview.navigation_h": 3,
66702       "help.overview.features_h": 3,
66703       "help.editing.select_h": 3,
66704       "help.editing.multiselect_h": 3,
66705       "help.editing.undo_redo_h": 3,
66706       "help.editing.save_h": 3,
66707       "help.editing.upload_h": 3,
66708       "help.editing.backups_h": 3,
66709       "help.editing.keyboard_h": 3,
66710       "help.feature_editor.type_h": 3,
66711       "help.feature_editor.fields_h": 3,
66712       "help.feature_editor.tags_h": 3,
66713       "help.points.add_point_h": 3,
66714       "help.points.move_point_h": 3,
66715       "help.points.delete_point_h": 3,
66716       "help.lines.add_line_h": 3,
66717       "help.lines.modify_line_h": 3,
66718       "help.lines.connect_line_h": 3,
66719       "help.lines.disconnect_line_h": 3,
66720       "help.lines.move_line_h": 3,
66721       "help.lines.delete_line_h": 3,
66722       "help.areas.point_or_area_h": 3,
66723       "help.areas.add_area_h": 3,
66724       "help.areas.square_area_h": 3,
66725       "help.areas.modify_area_h": 3,
66726       "help.areas.delete_area_h": 3,
66727       "help.relations.edit_relation_h": 3,
66728       "help.relations.maintain_relation_h": 3,
66729       "help.relations.relation_types_h": 2,
66730       "help.relations.multipolygon_h": 3,
66731       "help.relations.turn_restriction_h": 3,
66732       "help.relations.route_h": 3,
66733       "help.relations.boundary_h": 3,
66734       "help.notes.add_note_h": 3,
66735       "help.notes.update_note_h": 3,
66736       "help.notes.save_note_h": 3,
66737       "help.imagery.sources_h": 3,
66738       "help.imagery.offsets_h": 3,
66739       "help.streetlevel.using_h": 3,
66740       "help.gps.using_h": 3,
66741       "help.qa.tools_h": 3,
66742       "help.qa.issues_h": 3
66743     };
66744     var docs = docKeys.map(function(key) {
66745       var helpkey = "help." + key[0];
66746       var helpPaneReplacements = { version: context.version };
66747       var text2 = key[1].reduce(function(all, part) {
66748         var subkey = helpkey + "." + part;
66749         var depth = headings[subkey];
66750         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
66751         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
66752       }, "");
66753       return {
66754         title: _t.html(helpkey + ".title"),
66755         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
66756       };
66757     });
66758     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.html("help.title")).description(_t.html("help.title")).iconName("iD-icon-help");
66759     helpPane.renderContent = function(content) {
66760       function clickHelp(d, i2) {
66761         var rtl = _mainLocalizer.textDirection() === "rtl";
66762         content.property("scrollTop", 0);
66763         helpPane.selection().select(".pane-heading h2").html(d.title);
66764         body.html(d.content);
66765         body.selectAll("a").attr("target", "_blank");
66766         menuItems.classed("selected", function(m) {
66767           return m.title === d.title;
66768         });
66769         nav.html("");
66770         if (rtl) {
66771           nav.call(drawNext).call(drawPrevious);
66772         } else {
66773           nav.call(drawPrevious).call(drawNext);
66774         }
66775         function drawNext(selection2) {
66776           if (i2 < docs.length - 1) {
66777             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
66778               d3_event.preventDefault();
66779               clickHelp(docs[i2 + 1], i2 + 1);
66780             });
66781             nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
66782           }
66783         }
66784         function drawPrevious(selection2) {
66785           if (i2 > 0) {
66786             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
66787               d3_event.preventDefault();
66788               clickHelp(docs[i2 - 1], i2 - 1);
66789             });
66790             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
66791           }
66792         }
66793       }
66794       function clickWalkthrough(d3_event) {
66795         d3_event.preventDefault();
66796         if (context.inIntro())
66797           return;
66798         context.container().call(uiIntro(context));
66799         context.ui().togglePanes();
66800       }
66801       function clickShortcuts(d3_event) {
66802         d3_event.preventDefault();
66803         context.container().call(context.ui().shortcuts, true);
66804       }
66805       var toc = content.append("ul").attr("class", "toc");
66806       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
66807         return d.title;
66808       }).on("click", function(d3_event, d) {
66809         d3_event.preventDefault();
66810         clickHelp(d, docs.indexOf(d));
66811       });
66812       var shortcuts = toc.append("li").attr("class", "shortcuts").call(uiTooltip().title(_t.html("shortcuts.tooltip")).keys(["?"]).placement("top")).append("a").attr("href", "#").on("click", clickShortcuts);
66813       shortcuts.append("div").call(_t.append("shortcuts.title"));
66814       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
66815       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
66816       walkthrough.append("div").call(_t.append("splash.walkthrough"));
66817       var helpContent = content.append("div").attr("class", "left-content");
66818       var body = helpContent.append("div").attr("class", "body");
66819       var nav = helpContent.append("div").attr("class", "nav");
66820       clickHelp(docs[0], 0);
66821     };
66822     return helpPane;
66823   }
66824
66825   // modules/ui/sections/validation_issues.js
66826   function uiSectionValidationIssues(id2, severity, context) {
66827     var _issues = [];
66828     var section = uiSection(id2, context).label(function() {
66829       if (!_issues)
66830         return "";
66831       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
66832       return _t.html("inspector.title_count", { title: { html: _t.html("issues." + severity + "s.list_title") }, count: issueCountText });
66833     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
66834       return _issues && _issues.length;
66835     });
66836     function getOptions() {
66837       return {
66838         what: corePreferences("validate-what") || "edited",
66839         where: corePreferences("validate-where") || "all"
66840       };
66841     }
66842     function reloadIssues() {
66843       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
66844     }
66845     function renderDisclosureContent(selection2) {
66846       var center = context.map().center();
66847       var graph = context.graph();
66848       var issues = _issues.map(function withDistance(issue) {
66849         var extent = issue.extent(graph);
66850         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
66851         return Object.assign(issue, { dist });
66852       }).sort(function byDistance(a, b) {
66853         return a.dist - b.dist;
66854       });
66855       issues = issues.slice(0, 1e3);
66856       selection2.call(drawIssuesList, issues);
66857     }
66858     function drawIssuesList(selection2, issues) {
66859       var list = selection2.selectAll(".issues-list").data([0]);
66860       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
66861       var items = list.selectAll("li").data(issues, function(d) {
66862         return d.key;
66863       });
66864       items.exit().remove();
66865       var itemsEnter = items.enter().append("li").attr("class", function(d) {
66866         return "issue severity-" + d.severity;
66867       });
66868       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
66869         context.validator().focusIssue(d);
66870       }).on("mouseover", function(d3_event, d) {
66871         utilHighlightEntities(d.entityIds, true, context);
66872       }).on("mouseout", function(d3_event, d) {
66873         utilHighlightEntities(d.entityIds, false, context);
66874       });
66875       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
66876       textEnter.append("span").attr("class", "issue-icon").each(function(d) {
66877         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
66878         select_default2(this).call(svgIcon(iconName));
66879       });
66880       textEnter.append("span").attr("class", "issue-message");
66881       items = items.merge(itemsEnter).order();
66882       items.selectAll(".issue-message").html(function(d) {
66883         return d.message(context);
66884       });
66885     }
66886     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
66887       window.requestIdleCallback(function() {
66888         reloadIssues();
66889         section.reRender();
66890       });
66891     });
66892     context.map().on("move.uiSectionValidationIssues" + id2, debounce_default(function() {
66893       window.requestIdleCallback(function() {
66894         if (getOptions().where === "visible") {
66895           reloadIssues();
66896         }
66897         section.reRender();
66898       });
66899     }, 1e3));
66900     return section;
66901   }
66902
66903   // modules/ui/sections/validation_options.js
66904   function uiSectionValidationOptions(context) {
66905     var section = uiSection("issues-options", context).content(renderContent);
66906     function renderContent(selection2) {
66907       var container = selection2.selectAll(".issues-options-container").data([0]);
66908       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
66909       var data = [
66910         { key: "what", values: ["edited", "all"] },
66911         { key: "where", values: ["visible", "all"] }
66912       ];
66913       var options2 = container.selectAll(".issues-option").data(data, function(d) {
66914         return d.key;
66915       });
66916       var optionsEnter = options2.enter().append("div").attr("class", function(d) {
66917         return "issues-option issues-option-" + d.key;
66918       });
66919       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
66920         return _t.html("issues.options." + d.key + ".title");
66921       });
66922       var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
66923         return d.values.map(function(val) {
66924           return { value: val, key: d.key };
66925         });
66926       }).enter().append("label");
66927       valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
66928         return "issues-option-" + d.key;
66929       }).attr("value", function(d) {
66930         return d.value;
66931       }).property("checked", function(d) {
66932         return getOptions()[d.key] === d.value;
66933       }).on("change", function(d3_event, d) {
66934         updateOptionValue(d3_event, d.key, d.value);
66935       });
66936       valuesEnter.append("span").html(function(d) {
66937         return _t.html("issues.options." + d.key + "." + d.value);
66938       });
66939     }
66940     function getOptions() {
66941       return {
66942         what: corePreferences("validate-what") || "edited",
66943         where: corePreferences("validate-where") || "all"
66944       };
66945     }
66946     function updateOptionValue(d3_event, d, val) {
66947       if (!val && d3_event && d3_event.target) {
66948         val = d3_event.target.value;
66949       }
66950       corePreferences("validate-" + d, val);
66951       context.validator().validate();
66952     }
66953     return section;
66954   }
66955
66956   // modules/ui/sections/validation_rules.js
66957   function uiSectionValidationRules(context) {
66958     var MINSQUARE = 0;
66959     var MAXSQUARE = 20;
66960     var DEFAULTSQUARE = 5;
66961     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(_t.html("issues.rules.title"));
66962     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
66963       return key !== "maprules";
66964     }).sort(function(key1, key2) {
66965       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
66966     });
66967     function renderDisclosureContent(selection2) {
66968       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
66969       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
66970       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
66971       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
66972       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
66973         d3_event.preventDefault();
66974         context.validator().disableRules(_ruleKeys);
66975       });
66976       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
66977         d3_event.preventDefault();
66978         context.validator().disableRules([]);
66979       });
66980       container = container.merge(containerEnter);
66981       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
66982     }
66983     function drawListItems(selection2, data, type3, name2, change, active) {
66984       var items = selection2.selectAll("li").data(data);
66985       items.exit().remove();
66986       var enter = items.enter().append("li");
66987       if (name2 === "rule") {
66988         enter.call(uiTooltip().title(function(d) {
66989           return _t.html("issues." + d + ".tip");
66990         }).placement("top"));
66991       }
66992       var label = enter.append("label");
66993       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
66994       label.append("span").html(function(d) {
66995         var params = {};
66996         if (d === "unsquare_way") {
66997           params.val = { html: '<span class="square-degrees"></span>' };
66998         }
66999         return _t.html("issues." + d + ".title", params);
67000       });
67001       items = items.merge(enter);
67002       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
67003       var degStr = corePreferences("validate-square-degrees");
67004       if (degStr === null) {
67005         degStr = DEFAULTSQUARE.toString();
67006       }
67007       var span = items.selectAll(".square-degrees");
67008       var input = span.selectAll(".square-degrees-input").data([0]);
67009       input.enter().append("input").attr("type", "number").attr("min", MINSQUARE.toString()).attr("max", MAXSQUARE.toString()).attr("step", "0.5").attr("class", "square-degrees-input").call(utilNoAuto).on("click", function(d3_event) {
67010         d3_event.preventDefault();
67011         d3_event.stopPropagation();
67012         this.select();
67013       }).on("keyup", function(d3_event) {
67014         if (d3_event.keyCode === 13) {
67015           this.blur();
67016           this.select();
67017         }
67018       }).on("blur", changeSquare).merge(input).property("value", degStr);
67019     }
67020     function changeSquare() {
67021       var input = select_default2(this);
67022       var degStr = utilGetSetValue(input).trim();
67023       var degNum = parseFloat(degStr, 10);
67024       if (!isFinite(degNum)) {
67025         degNum = DEFAULTSQUARE;
67026       } else if (degNum > MAXSQUARE) {
67027         degNum = MAXSQUARE;
67028       } else if (degNum < MINSQUARE) {
67029         degNum = MINSQUARE;
67030       }
67031       degNum = Math.round(degNum * 10) / 10;
67032       degStr = degNum.toString();
67033       input.property("value", degStr);
67034       corePreferences("validate-square-degrees", degStr);
67035       context.validator().revalidateUnsquare();
67036     }
67037     function isRuleEnabled(d) {
67038       return context.validator().isRuleEnabled(d);
67039     }
67040     function toggleRule(d3_event, d) {
67041       context.validator().toggleRule(d);
67042     }
67043     context.validator().on("validated.uiSectionValidationRules", function() {
67044       window.requestIdleCallback(section.reRender);
67045     });
67046     return section;
67047   }
67048
67049   // modules/ui/sections/validation_status.js
67050   function uiSectionValidationStatus(context) {
67051     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
67052       var issues = context.validator().getIssues(getOptions());
67053       return issues.length === 0;
67054     });
67055     function getOptions() {
67056       return {
67057         what: corePreferences("validate-what") || "edited",
67058         where: corePreferences("validate-where") || "all"
67059       };
67060     }
67061     function renderContent(selection2) {
67062       var box = selection2.selectAll(".box").data([0]);
67063       var boxEnter = box.enter().append("div").attr("class", "box");
67064       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
67065       var noIssuesMessage = boxEnter.append("span");
67066       noIssuesMessage.append("strong").attr("class", "message");
67067       noIssuesMessage.append("br");
67068       noIssuesMessage.append("span").attr("class", "details");
67069       renderIgnoredIssuesReset(selection2);
67070       setNoIssuesText(selection2);
67071     }
67072     function renderIgnoredIssuesReset(selection2) {
67073       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
67074       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
67075       resetIgnored.exit().remove();
67076       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
67077       resetIgnoredEnter.append("a").attr("href", "#");
67078       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
67079       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
67080       resetIgnored.on("click", function(d3_event) {
67081         d3_event.preventDefault();
67082         context.validator().resetIgnoredIssues();
67083       });
67084     }
67085     function setNoIssuesText(selection2) {
67086       var opts = getOptions();
67087       function checkForHiddenIssues(cases) {
67088         for (var type3 in cases) {
67089           var hiddenOpts = cases[type3];
67090           var hiddenIssues = context.validator().getIssues(hiddenOpts);
67091           if (hiddenIssues.length) {
67092             selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues." + type3, { count: hiddenIssues.length.toString() }));
67093             return;
67094           }
67095         }
67096         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
67097       }
67098       var messageType;
67099       if (opts.what === "edited" && opts.where === "visible") {
67100         messageType = "edits_in_view";
67101         checkForHiddenIssues({
67102           elsewhere: { what: "edited", where: "all" },
67103           everything_else: { what: "all", where: "visible" },
67104           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
67105           everything_else_elsewhere: { what: "all", where: "all" },
67106           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
67107           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
67108           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
67109         });
67110       } else if (opts.what === "edited" && opts.where === "all") {
67111         messageType = "edits";
67112         checkForHiddenIssues({
67113           everything_else: { what: "all", where: "all" },
67114           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
67115           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
67116         });
67117       } else if (opts.what === "all" && opts.where === "visible") {
67118         messageType = "everything_in_view";
67119         checkForHiddenIssues({
67120           elsewhere: { what: "all", where: "all" },
67121           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
67122           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
67123           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
67124           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
67125         });
67126       } else if (opts.what === "all" && opts.where === "all") {
67127         messageType = "everything";
67128         checkForHiddenIssues({
67129           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
67130           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
67131         });
67132       }
67133       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
67134         messageType = "no_edits";
67135       }
67136       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
67137     }
67138     context.validator().on("validated.uiSectionValidationStatus", function() {
67139       window.requestIdleCallback(section.reRender);
67140     });
67141     context.map().on("move.uiSectionValidationStatus", debounce_default(function() {
67142       window.requestIdleCallback(section.reRender);
67143     }, 1e3));
67144     return section;
67145   }
67146
67147   // modules/ui/panes/issues.js
67148   function uiPaneIssues(context) {
67149     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.html("issues.title")).description(_t.html("issues.title")).iconName("iD-icon-alert").sections([
67150       uiSectionValidationOptions(context),
67151       uiSectionValidationStatus(context),
67152       uiSectionValidationIssues("issues-errors", "error", context),
67153       uiSectionValidationIssues("issues-warnings", "warning", context),
67154       uiSectionValidationRules(context)
67155     ]);
67156     return issuesPane;
67157   }
67158
67159   // modules/ui/settings/custom_data.js
67160   function uiSettingsCustomData(context) {
67161     var dispatch10 = dispatch_default("change");
67162     function render(selection2) {
67163       var dataLayer = context.layers().layer("data");
67164       var _origSettings = {
67165         fileList: dataLayer && dataLayer.fileList() || null,
67166         url: corePreferences("settings-custom-data-url")
67167       };
67168       var _currSettings = {
67169         fileList: dataLayer && dataLayer.fileList() || null,
67170         url: corePreferences("settings-custom-data-url")
67171       };
67172       var modal = uiConfirm(selection2).okButton();
67173       modal.classed("settings-modal settings-custom-data", true);
67174       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
67175       var textSection = modal.select(".modal-section.message-text");
67176       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
67177       textSection.append("input").attr("class", "field-file").attr("type", "file").attr("accept", ".gpx,.kml,.geojson,.json,application/gpx+xml,application/vnd.google-earth.kml+xml,application/geo+json,application/json").property("files", _currSettings.fileList).on("change", function(d3_event) {
67178         var files = d3_event.target.files;
67179         if (files && files.length) {
67180           _currSettings.url = "";
67181           textSection.select(".field-url").property("value", "");
67182           _currSettings.fileList = files;
67183         } else {
67184           _currSettings.fileList = null;
67185         }
67186       });
67187       textSection.append("h4").call(_t.append("settings.custom_data.or"));
67188       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
67189       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
67190       var buttonSection = modal.select(".modal-section.buttons");
67191       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
67192       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
67193       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
67194       function isSaveDisabled() {
67195         return null;
67196       }
67197       function clickCancel() {
67198         textSection.select(".field-url").property("value", _origSettings.url);
67199         corePreferences("settings-custom-data-url", _origSettings.url);
67200         this.blur();
67201         modal.close();
67202       }
67203       function clickSave() {
67204         _currSettings.url = textSection.select(".field-url").property("value").trim();
67205         if (_currSettings.url) {
67206           _currSettings.fileList = null;
67207         }
67208         if (_currSettings.fileList) {
67209           _currSettings.url = "";
67210         }
67211         corePreferences("settings-custom-data-url", _currSettings.url);
67212         this.blur();
67213         modal.close();
67214         dispatch10.call("change", this, _currSettings);
67215       }
67216     }
67217     return utilRebind(render, dispatch10, "on");
67218   }
67219
67220   // modules/ui/sections/data_layers.js
67221   function uiSectionDataLayers(context) {
67222     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
67223     var layers = context.layers();
67224     var section = uiSection("data-layers", context).label(_t.html("map_data.data_layers")).disclosureContent(renderDisclosureContent);
67225     function renderDisclosureContent(selection2) {
67226       var container = selection2.selectAll(".data-layer-container").data([0]);
67227       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
67228     }
67229     function showsLayer(which) {
67230       var layer = layers.layer(which);
67231       if (layer) {
67232         return layer.enabled();
67233       }
67234       return false;
67235     }
67236     function setLayer(which, enabled) {
67237       var mode = context.mode();
67238       if (mode && /^draw/.test(mode.id))
67239         return;
67240       var layer = layers.layer(which);
67241       if (layer) {
67242         layer.enabled(enabled);
67243         if (!enabled && (which === "osm" || which === "notes")) {
67244           context.enter(modeBrowse(context));
67245         }
67246       }
67247     }
67248     function toggleLayer(which) {
67249       setLayer(which, !showsLayer(which));
67250     }
67251     function drawOsmItems(selection2) {
67252       var osmKeys = ["osm", "notes"];
67253       var osmLayers = layers.all().filter(function(obj) {
67254         return osmKeys.indexOf(obj.id) !== -1;
67255       });
67256       var ul = selection2.selectAll(".layer-list-osm").data([0]);
67257       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
67258       var li = ul.selectAll(".list-item").data(osmLayers);
67259       li.exit().remove();
67260       var liEnter = li.enter().append("li").attr("class", function(d) {
67261         return "list-item list-item-" + d.id;
67262       });
67263       var labelEnter = liEnter.append("label").each(function(d) {
67264         if (d.id === "osm") {
67265           select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom"));
67266         } else {
67267           select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
67268         }
67269       });
67270       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67271         toggleLayer(d.id);
67272       });
67273       labelEnter.append("span").html(function(d) {
67274         return _t.html("map_data.layers." + d.id + ".title");
67275       });
67276       li.merge(liEnter).classed("active", function(d) {
67277         return d.layer.enabled();
67278       }).selectAll("input").property("checked", function(d) {
67279         return d.layer.enabled();
67280       });
67281     }
67282     function drawQAItems(selection2) {
67283       var qaKeys = ["keepRight", "improveOSM", "osmose"];
67284       var qaLayers = layers.all().filter(function(obj) {
67285         return qaKeys.indexOf(obj.id) !== -1;
67286       });
67287       var ul = selection2.selectAll(".layer-list-qa").data([0]);
67288       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
67289       var li = ul.selectAll(".list-item").data(qaLayers);
67290       li.exit().remove();
67291       var liEnter = li.enter().append("li").attr("class", function(d) {
67292         return "list-item list-item-" + d.id;
67293       });
67294       var labelEnter = liEnter.append("label").each(function(d) {
67295         select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
67296       });
67297       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67298         toggleLayer(d.id);
67299       });
67300       labelEnter.append("span").html(function(d) {
67301         return _t.html("map_data.layers." + d.id + ".title");
67302       });
67303       li.merge(liEnter).classed("active", function(d) {
67304         return d.layer.enabled();
67305       }).selectAll("input").property("checked", function(d) {
67306         return d.layer.enabled();
67307       });
67308     }
67309     function drawVectorItems(selection2) {
67310       var dataLayer = layers.layer("data");
67311       var vtData = [
67312         {
67313           name: "Detroit Neighborhoods/Parks",
67314           src: "neighborhoods-parks",
67315           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
67316           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmur6x34562qp9iv1u3ksf-54hev,jonahadkins.cjksmqxdx33jj2wp90xd9x2md-4e5y2/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
67317         },
67318         {
67319           name: "Detroit Composite POIs",
67320           src: "composite-poi",
67321           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
67322           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmm6a02sli31myxhsr7zf3-2sw8h/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
67323         },
67324         {
67325           name: "Detroit All-The-Places POIs",
67326           src: "alltheplaces-poi",
67327           tooltip: "Public domain business location data created by web scrapers.",
67328           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmswgk340g2vo06p1w9w0j-8fjjc/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
67329         }
67330       ];
67331       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
67332       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
67333       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
67334       container.exit().remove();
67335       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
67336       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
67337       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
67338       containerEnter.append("div").attr("class", "vectortile-footer").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmus/detroit-mapping-challenge").append("span").text("About these layers");
67339       container = container.merge(containerEnter);
67340       var ul = container.selectAll(".layer-list-vectortile");
67341       var li = ul.selectAll(".list-item").data(vtData);
67342       li.exit().remove();
67343       var liEnter = li.enter().append("li").attr("class", function(d) {
67344         return "list-item list-item-" + d.src;
67345       });
67346       var labelEnter = liEnter.append("label").each(function(d) {
67347         select_default2(this).call(uiTooltip().title(d.tooltip).placement("top"));
67348       });
67349       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
67350       labelEnter.append("span").text(function(d) {
67351         return d.name;
67352       });
67353       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
67354       function isVTLayerSelected(d) {
67355         return dataLayer && dataLayer.template() === d.template;
67356       }
67357       function selectVTLayer(d3_event, d) {
67358         corePreferences("settings-custom-data-url", d.template);
67359         if (dataLayer) {
67360           dataLayer.template(d.template, d.src);
67361           dataLayer.enabled(true);
67362         }
67363       }
67364     }
67365     function drawCustomDataItems(selection2) {
67366       var dataLayer = layers.layer("data");
67367       var hasData = dataLayer && dataLayer.hasData();
67368       var showsData = hasData && dataLayer.enabled();
67369       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
67370       ul.exit().remove();
67371       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
67372       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
67373       var labelEnter = liEnter.append("label").call(uiTooltip().title(_t.html("map_data.layers.custom.tooltip")).placement("top"));
67374       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
67375         toggleLayer("data");
67376       });
67377       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
67378       liEnter.append("button").attr("class", "open-data-options").call(uiTooltip().title(_t.html("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
67379         d3_event.preventDefault();
67380         editCustom();
67381       }).call(svgIcon("#iD-icon-more"));
67382       liEnter.append("button").attr("class", "zoom-to-data").call(uiTooltip().title(_t.html("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
67383         if (select_default2(this).classed("disabled"))
67384           return;
67385         d3_event.preventDefault();
67386         d3_event.stopPropagation();
67387         dataLayer.fitZoom();
67388       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
67389       ul = ul.merge(ulEnter);
67390       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
67391       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
67392     }
67393     function editCustom() {
67394       context.container().call(settingsCustomData);
67395     }
67396     function customChanged(d) {
67397       var dataLayer = layers.layer("data");
67398       if (d && d.url) {
67399         dataLayer.url(d.url);
67400       } else if (d && d.fileList) {
67401         dataLayer.fileList(d.fileList);
67402       }
67403     }
67404     function drawPanelItems(selection2) {
67405       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
67406       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top"));
67407       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67408         d3_event.preventDefault();
67409         context.ui().info.toggle("history");
67410       });
67411       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
67412       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top"));
67413       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67414         d3_event.preventDefault();
67415         context.ui().info.toggle("measurement");
67416       });
67417       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
67418     }
67419     context.layers().on("change.uiSectionDataLayers", section.reRender);
67420     context.map().on("move.uiSectionDataLayers", debounce_default(function() {
67421       window.requestIdleCallback(section.reRender);
67422     }, 1e3));
67423     return section;
67424   }
67425
67426   // modules/ui/sections/map_features.js
67427   function uiSectionMapFeatures(context) {
67428     var _features = context.features().keys();
67429     var section = uiSection("map-features", context).label(_t.html("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67430     function renderDisclosureContent(selection2) {
67431       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
67432       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
67433       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
67434       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
67435       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
67436         d3_event.preventDefault();
67437         context.features().disableAll();
67438       });
67439       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
67440         d3_event.preventDefault();
67441         context.features().enableAll();
67442       });
67443       container = container.merge(containerEnter);
67444       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
67445     }
67446     function drawListItems(selection2, data, type3, name2, change, active) {
67447       var items = selection2.selectAll("li").data(data);
67448       items.exit().remove();
67449       var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
67450         var tip = _t.html(name2 + "." + d + ".tooltip");
67451         if (autoHiddenFeature(d)) {
67452           var msg = showsLayer("osm") ? _t.html("map_data.autohidden") : _t.html("map_data.osmhidden");
67453           tip += "<div>" + msg + "</div>";
67454         }
67455         return tip;
67456       }).placement("top"));
67457       var label = enter.append("label");
67458       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
67459       label.append("span").html(function(d) {
67460         return _t.html(name2 + "." + d + ".description");
67461       });
67462       items = items.merge(enter);
67463       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
67464     }
67465     function autoHiddenFeature(d) {
67466       return context.features().autoHidden(d);
67467     }
67468     function showsFeature(d) {
67469       return context.features().enabled(d);
67470     }
67471     function clickFeature(d3_event, d) {
67472       context.features().toggle(d);
67473     }
67474     function showsLayer(id2) {
67475       var layer = context.layers().layer(id2);
67476       return layer && layer.enabled();
67477     }
67478     context.features().on("change.map_features", section.reRender);
67479     return section;
67480   }
67481
67482   // modules/ui/sections/map_style_options.js
67483   function uiSectionMapStyleOptions(context) {
67484     var section = uiSection("fill-area", context).label(_t.html("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67485     function renderDisclosureContent(selection2) {
67486       var container = selection2.selectAll(".layer-fill-list").data([0]);
67487       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
67488       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
67489       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
67490         return context.surface().classed("highlight-edited");
67491       });
67492     }
67493     function drawListItems(selection2, data, type3, name2, change, active) {
67494       var items = selection2.selectAll("li").data(data);
67495       items.exit().remove();
67496       var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
67497         return _t.html(name2 + "." + d + ".tooltip");
67498       }).keys(function(d) {
67499         var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
67500         if (d === "highlight_edits")
67501           key = _t("map_data.highlight_edits.key");
67502         return key ? [key] : null;
67503       }).placement("top"));
67504       var label = enter.append("label");
67505       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
67506       label.append("span").html(function(d) {
67507         return _t.html(name2 + "." + d + ".description");
67508       });
67509       items = items.merge(enter);
67510       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
67511     }
67512     function isActiveFill(d) {
67513       return context.map().activeAreaFill() === d;
67514     }
67515     function toggleHighlightEdited(d3_event) {
67516       d3_event.preventDefault();
67517       context.map().toggleHighlightEdited();
67518     }
67519     function setFill(d3_event, d) {
67520       context.map().activeAreaFill(d);
67521     }
67522     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
67523     return section;
67524   }
67525
67526   // modules/ui/sections/photo_overlays.js
67527   function uiSectionPhotoOverlays(context) {
67528     var layers = context.layers();
67529     var section = uiSection("photo-overlays", context).label(_t.html("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67530     function renderDisclosureContent(selection2) {
67531       var container = selection2.selectAll(".photo-overlay-container").data([0]);
67532       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
67533     }
67534     function drawPhotoItems(selection2) {
67535       var photoKeys = context.photos().overlayLayerIDs();
67536       var photoLayers = layers.all().filter(function(obj) {
67537         return photoKeys.indexOf(obj.id) !== -1;
67538       });
67539       var data = photoLayers.filter(function(obj) {
67540         return obj.layer.supported();
67541       });
67542       function layerSupported(d) {
67543         return d.layer && d.layer.supported();
67544       }
67545       function layerEnabled(d) {
67546         return layerSupported(d) && d.layer.enabled();
67547       }
67548       var ul = selection2.selectAll(".layer-list-photos").data([0]);
67549       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
67550       var li = ul.selectAll(".list-item-photos").data(data);
67551       li.exit().remove();
67552       var liEnter = li.enter().append("li").attr("class", function(d) {
67553         var classes = "list-item-photos list-item-" + d.id;
67554         if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
67555           classes += " indented";
67556         }
67557         return classes;
67558       });
67559       var labelEnter = liEnter.append("label").each(function(d) {
67560         var titleID;
67561         if (d.id === "mapillary-signs")
67562           titleID = "mapillary.signs.tooltip";
67563         else if (d.id === "mapillary")
67564           titleID = "mapillary_images.tooltip";
67565         else if (d.id === "kartaview")
67566           titleID = "kartaview_images.tooltip";
67567         else
67568           titleID = d.id.replace(/-/g, "_") + ".tooltip";
67569         select_default2(this).call(uiTooltip().title(_t.html(titleID)).placement("top"));
67570       });
67571       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67572         toggleLayer(d.id);
67573       });
67574       labelEnter.append("span").html(function(d) {
67575         var id2 = d.id;
67576         if (id2 === "mapillary-signs")
67577           id2 = "photo_overlays.traffic_signs";
67578         return _t.html(id2.replace(/-/g, "_") + ".title");
67579       });
67580       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
67581     }
67582     function drawPhotoTypeItems(selection2) {
67583       var data = context.photos().allPhotoTypes();
67584       function typeEnabled(d) {
67585         return context.photos().showsPhotoType(d);
67586       }
67587       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
67588       ul.exit().remove();
67589       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
67590       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
67591       li.exit().remove();
67592       var liEnter = li.enter().append("li").attr("class", function(d) {
67593         return "list-item-photo-types list-item-" + d;
67594       });
67595       var labelEnter = liEnter.append("label").each(function(d) {
67596         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.photo_type." + d + ".tooltip")).placement("top"));
67597       });
67598       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67599         context.photos().togglePhotoType(d);
67600       });
67601       labelEnter.append("span").html(function(d) {
67602         return _t.html("photo_overlays.photo_type." + d + ".title");
67603       });
67604       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
67605     }
67606     function drawDateFilter(selection2) {
67607       var data = context.photos().dateFilters();
67608       function filterEnabled(d) {
67609         return context.photos().dateFilterValue(d);
67610       }
67611       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
67612       ul.exit().remove();
67613       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
67614       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
67615       li.exit().remove();
67616       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
67617       var labelEnter = liEnter.append("label").each(function(d) {
67618         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.date_filter." + d + ".tooltip")).placement("top"));
67619       });
67620       labelEnter.append("span").html(function(d) {
67621         return _t.html("photo_overlays.date_filter." + d + ".title");
67622       });
67623       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
67624         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
67625       }).on("change", function(d3_event, d) {
67626         var value = utilGetSetValue(select_default2(this)).trim();
67627         context.photos().setDateFilter(d, value, true);
67628         li.selectAll("input").each(function(d2) {
67629           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
67630         });
67631       });
67632       li = li.merge(liEnter).classed("active", filterEnabled);
67633     }
67634     function drawUsernameFilter(selection2) {
67635       function filterEnabled() {
67636         return context.photos().usernames();
67637       }
67638       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
67639       ul.exit().remove();
67640       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
67641       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
67642       li.exit().remove();
67643       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
67644       var labelEnter = liEnter.append("label").each(function() {
67645         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.username_filter.tooltip")).placement("top"));
67646       });
67647       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
67648       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
67649         var value = select_default2(this).property("value");
67650         context.photos().setUsernameFilter(value, true);
67651         select_default2(this).property("value", usernameValue);
67652       });
67653       li.merge(liEnter).classed("active", filterEnabled);
67654       function usernameValue() {
67655         var usernames = context.photos().usernames();
67656         if (usernames)
67657           return usernames.join("; ");
67658         return usernames;
67659       }
67660     }
67661     function toggleLayer(which) {
67662       setLayer(which, !showsLayer(which));
67663     }
67664     function showsLayer(which) {
67665       var layer = layers.layer(which);
67666       if (layer) {
67667         return layer.enabled();
67668       }
67669       return false;
67670     }
67671     function setLayer(which, enabled) {
67672       var layer = layers.layer(which);
67673       if (layer) {
67674         layer.enabled(enabled);
67675       }
67676     }
67677     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
67678     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
67679     return section;
67680   }
67681
67682   // modules/ui/panes/map_data.js
67683   function uiPaneMapData(context) {
67684     var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.html("map_data.title")).description(_t.html("map_data.description")).iconName("iD-icon-data").sections([
67685       uiSectionDataLayers(context),
67686       uiSectionPhotoOverlays(context),
67687       uiSectionMapStyleOptions(context),
67688       uiSectionMapFeatures(context)
67689     ]);
67690     return mapDataPane;
67691   }
67692
67693   // modules/ui/panes/preferences.js
67694   function uiPanePreferences(context) {
67695     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.html("preferences.title")).description(_t.html("preferences.description")).iconName("fas-user-cog").sections([
67696       uiSectionPrivacy(context)
67697     ]);
67698     return preferencesPane;
67699   }
67700
67701   // modules/ui/init.js
67702   function uiInit(context) {
67703     var _initCounter = 0;
67704     var _needWidth = {};
67705     var _lastPointerType;
67706     function render(container) {
67707       container.on("click.ui", function(d3_event) {
67708         if (d3_event.button !== 0)
67709           return;
67710         if (!d3_event.composedPath)
67711           return;
67712         var isOkayTarget = d3_event.composedPath().some(function(node) {
67713           return node.nodeType === 1 && (node.nodeName === "INPUT" || node.nodeName === "LABEL" || node.nodeName === "A");
67714         });
67715         if (isOkayTarget)
67716           return;
67717         d3_event.preventDefault();
67718       });
67719       var detected = utilDetect();
67720       if ("GestureEvent" in window && !detected.isMobileWebKit) {
67721         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
67722           d3_event.preventDefault();
67723         });
67724       }
67725       if ("PointerEvent" in window) {
67726         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
67727           var pointerType = d3_event.pointerType || "mouse";
67728           if (_lastPointerType !== pointerType) {
67729             _lastPointerType = pointerType;
67730             container.attr("pointer", pointerType);
67731           }
67732         }, true);
67733       } else {
67734         _lastPointerType = "mouse";
67735         container.attr("pointer", "mouse");
67736       }
67737       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
67738       container.call(uiFullScreen(context));
67739       var map2 = context.map();
67740       map2.redrawEnable(false);
67741       map2.on("hitMinZoom.ui", function() {
67742         ui.flash.iconName("#iD-icon-no").label(_t.html("cannot_zoom"))();
67743       });
67744       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
67745       container.append("div").attr("class", "sidebar").call(ui.sidebar);
67746       var content = container.append("div").attr("class", "main-content active");
67747       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
67748       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
67749       var overMap = content.append("div").attr("class", "over-map");
67750       overMap.append("div").attr("class", "select-trap").text("t");
67751       overMap.call(uiMapInMap(context)).call(uiNotice(context));
67752       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
67753       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
67754       var controls = controlsWrap.append("div").attr("class", "map-controls");
67755       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
67756       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
67757       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
67758       controlsWrap.on("wheel.mapControls", function(d3_event) {
67759         if (!d3_event.deltaX) {
67760           controlsWrap.node().scrollTop += d3_event.deltaY;
67761         }
67762       });
67763       var panes = overMap.append("div").attr("class", "map-panes");
67764       var uiPanes = [
67765         uiPaneBackground(context),
67766         uiPaneMapData(context),
67767         uiPaneIssues(context),
67768         uiPanePreferences(context),
67769         uiPaneHelp(context)
67770       ];
67771       uiPanes.forEach(function(pane) {
67772         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
67773         panes.call(pane.renderPane);
67774       });
67775       ui.info = uiInfo(context);
67776       overMap.call(ui.info);
67777       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
67778       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
67779       var about = content.append("div").attr("class", "map-footer");
67780       about.append("div").attr("class", "api-status").call(uiStatus(context));
67781       var footer = about.append("div").attr("class", "map-footer-bar fillD");
67782       footer.append("div").attr("class", "flash-wrap footer-hide");
67783       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
67784       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
67785       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
67786       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
67787       var apiConnections = context.apiConnections();
67788       if (apiConnections && apiConnections.length > 1) {
67789         aboutList.append("li").attr("class", "source-switch").call(uiSourceSwitch(context).keys(apiConnections));
67790       }
67791       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
67792       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
67793       var issueLinks = aboutList.append("li");
67794       issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/issues").attr("aria-label", _t("report_a_bug")).call(svgIcon("#iD-icon-bug", "light")).call(uiTooltip().title(_t.html("report_a_bug")).placement("top"));
67795       issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/develop/CONTRIBUTING.md#translating").attr("aria-label", _t("help_translate")).call(svgIcon("#iD-icon-translate", "light")).call(uiTooltip().title(_t.html("help_translate")).placement("top"));
67796       aboutList.append("li").attr("class", "version").call(uiVersion(context));
67797       if (!context.embed()) {
67798         aboutList.call(uiAccount(context));
67799       }
67800       ui.onResize();
67801       map2.redrawEnable(true);
67802       ui.hash = behaviorHash(context);
67803       ui.hash();
67804       if (!ui.hash.hadHash) {
67805         map2.centerZoom([0, 0], 2);
67806       }
67807       window.onbeforeunload = function() {
67808         return context.save();
67809       };
67810       window.onunload = function() {
67811         context.history().unlock();
67812       };
67813       select_default2(window).on("resize.editor", function() {
67814         ui.onResize();
67815       });
67816       var panPixels = 80;
67817       context.keybinding().on("\u232B", function(d3_event) {
67818         d3_event.preventDefault();
67819       }).on([_t("sidebar.key"), "`", "\xB2", "@"], ui.sidebar.toggle).on("\u2190", pan([panPixels, 0])).on("\u2191", pan([0, panPixels])).on("\u2192", pan([-panPixels, 0])).on("\u2193", pan([0, -panPixels])).on(uiCmd("\u2325\u2190"), pan([map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2191"), pan([0, map2.dimensions()[1]])).on(uiCmd("\u2325\u2192"), pan([-map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2193"), pan([0, -map2.dimensions()[1]])).on(uiCmd("\u2318" + _t("background.key")), function quickSwitch(d3_event) {
67820         if (d3_event) {
67821           d3_event.stopImmediatePropagation();
67822           d3_event.preventDefault();
67823         }
67824         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
67825         if (previousBackground) {
67826           var currentBackground = context.background().baseLayerSource();
67827           corePreferences("background-last-used-toggle", currentBackground.id);
67828           corePreferences("background-last-used", previousBackground.id);
67829           context.background().baseLayerSource(previousBackground);
67830         }
67831       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
67832         d3_event.preventDefault();
67833         d3_event.stopPropagation();
67834         context.map().toggleWireframe();
67835       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
67836         d3_event.preventDefault();
67837         d3_event.stopPropagation();
67838         var mode = context.mode();
67839         if (mode && /^draw/.test(mode.id))
67840           return;
67841         var layer = context.layers().layer("osm");
67842         if (layer) {
67843           layer.enabled(!layer.enabled());
67844           if (!layer.enabled()) {
67845             context.enter(modeBrowse(context));
67846           }
67847         }
67848       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
67849         d3_event.preventDefault();
67850         context.map().toggleHighlightEdited();
67851       });
67852       context.on("enter.editor", function(entered) {
67853         container.classed("mode-" + entered.id, true);
67854       }).on("exit.editor", function(exited) {
67855         container.classed("mode-" + exited.id, false);
67856       });
67857       context.enter(modeBrowse(context));
67858       if (!_initCounter++) {
67859         if (!ui.hash.startWalkthrough) {
67860           context.container().call(uiSplash(context)).call(uiRestore(context));
67861         }
67862         context.container().call(ui.shortcuts);
67863       }
67864       var osm = context.connection();
67865       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
67866       if (osm && auth) {
67867         osm.on("authLoading.ui", function() {
67868           context.container().call(auth);
67869         }).on("authDone.ui", function() {
67870           auth.close();
67871         });
67872       }
67873       _initCounter++;
67874       if (ui.hash.startWalkthrough) {
67875         ui.hash.startWalkthrough = false;
67876         context.container().call(uiIntro(context));
67877       }
67878       function pan(d) {
67879         return function(d3_event) {
67880           if (d3_event.shiftKey)
67881             return;
67882           if (context.container().select(".combobox").size())
67883             return;
67884           d3_event.preventDefault();
67885           context.map().pan(d, 100);
67886         };
67887       }
67888     }
67889     let ui = {};
67890     let _loadPromise;
67891     ui.ensureLoaded = () => {
67892       if (_loadPromise)
67893         return _loadPromise;
67894       return _loadPromise = Promise.all([
67895         _mainLocalizer.ensureLoaded(),
67896         _mainPresetIndex.ensureLoaded()
67897       ]).then(() => {
67898         if (!context.container().empty())
67899           render(context.container());
67900       }).catch((err) => console.error(err));
67901     };
67902     ui.restart = function() {
67903       context.keybinding().clear();
67904       _loadPromise = null;
67905       context.container().selectAll("*").remove();
67906       ui.ensureLoaded();
67907     };
67908     ui.lastPointerType = function() {
67909       return _lastPointerType;
67910     };
67911     ui.svgDefs = svgDefs(context);
67912     ui.flash = uiFlash(context);
67913     ui.sidebar = uiSidebar(context);
67914     ui.photoviewer = uiPhotoviewer(context);
67915     ui.shortcuts = uiShortcuts(context);
67916     ui.onResize = function(withPan) {
67917       var map2 = context.map();
67918       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
67919       utilGetDimensions(context.container().select(".sidebar"), true);
67920       if (withPan !== void 0) {
67921         map2.redrawEnable(false);
67922         map2.pan(withPan);
67923         map2.redrawEnable(true);
67924       }
67925       map2.dimensions(mapDimensions);
67926       ui.photoviewer.onMapResize();
67927       ui.checkOverflow(".top-toolbar");
67928       ui.checkOverflow(".map-footer-bar");
67929       var resizeWindowEvent = document.createEvent("Event");
67930       resizeWindowEvent.initEvent("resizeWindow", true, true);
67931       document.dispatchEvent(resizeWindowEvent);
67932     };
67933     ui.checkOverflow = function(selector, reset) {
67934       if (reset) {
67935         delete _needWidth[selector];
67936       }
67937       var selection2 = context.container().select(selector);
67938       if (selection2.empty())
67939         return;
67940       var scrollWidth = selection2.property("scrollWidth");
67941       var clientWidth = selection2.property("clientWidth");
67942       var needed = _needWidth[selector] || scrollWidth;
67943       if (scrollWidth > clientWidth) {
67944         selection2.classed("narrow", true);
67945         if (!_needWidth[selector]) {
67946           _needWidth[selector] = scrollWidth;
67947         }
67948       } else if (scrollWidth >= needed) {
67949         selection2.classed("narrow", false);
67950       }
67951     };
67952     ui.togglePanes = function(showPane) {
67953       var hidePanes = context.container().selectAll(".map-pane.shown");
67954       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
67955       hidePanes.classed("shown", false).classed("hide", true);
67956       context.container().selectAll(".map-pane-control button").classed("active", false);
67957       if (showPane) {
67958         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
67959         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
67960         showPane.classed("shown", true).classed("hide", false);
67961         if (hidePanes.empty()) {
67962           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
67963         } else {
67964           showPane.style(side, "0px");
67965         }
67966       } else {
67967         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
67968           select_default2(this).classed("shown", false).classed("hide", true);
67969         });
67970       }
67971     };
67972     var _editMenu = uiEditMenu(context);
67973     ui.editMenu = function() {
67974       return _editMenu;
67975     };
67976     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
67977       ui.closeEditMenu();
67978       if (!operations && context.mode().operations)
67979         operations = context.mode().operations();
67980       if (!operations || !operations.length)
67981         return;
67982       if (!context.map().editableDataEnabled())
67983         return;
67984       var surfaceNode = context.surface().node();
67985       if (surfaceNode.focus) {
67986         surfaceNode.focus();
67987       }
67988       operations.forEach(function(operation) {
67989         if (operation.point)
67990           operation.point(anchorPoint);
67991       });
67992       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
67993       context.map().supersurface.call(_editMenu);
67994     };
67995     ui.closeEditMenu = function() {
67996       context.map().supersurface.select(".edit-menu").remove();
67997     };
67998     var _saveLoading = select_default2(null);
67999     context.uploader().on("saveStarted.ui", function() {
68000       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
68001       context.container().call(_saveLoading);
68002     }).on("saveEnded.ui", function() {
68003       _saveLoading.close();
68004       _saveLoading = select_default2(null);
68005     });
68006     return ui;
68007   }
68008
68009   // modules/core/context.js
68010   function coreContext() {
68011     const dispatch10 = dispatch_default("enter", "exit", "change");
68012     let context = utilRebind({}, dispatch10, "on");
68013     let _deferred2 = /* @__PURE__ */ new Set();
68014     context.version = "2.21.1";
68015     context.privacyVersion = "20201202";
68016     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
68017     context.changeset = null;
68018     let _defaultChangesetComment = context.initialHashParams.comment;
68019     let _defaultChangesetSource = context.initialHashParams.source;
68020     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
68021     context.defaultChangesetComment = function(val) {
68022       if (!arguments.length)
68023         return _defaultChangesetComment;
68024       _defaultChangesetComment = val;
68025       return context;
68026     };
68027     context.defaultChangesetSource = function(val) {
68028       if (!arguments.length)
68029         return _defaultChangesetSource;
68030       _defaultChangesetSource = val;
68031       return context;
68032     };
68033     context.defaultChangesetHashtags = function(val) {
68034       if (!arguments.length)
68035         return _defaultChangesetHashtags;
68036       _defaultChangesetHashtags = val;
68037       return context;
68038     };
68039     let _setsDocumentTitle = true;
68040     context.setsDocumentTitle = function(val) {
68041       if (!arguments.length)
68042         return _setsDocumentTitle;
68043       _setsDocumentTitle = val;
68044       return context;
68045     };
68046     let _documentTitleBase = document.title;
68047     context.documentTitleBase = function(val) {
68048       if (!arguments.length)
68049         return _documentTitleBase;
68050       _documentTitleBase = val;
68051       return context;
68052     };
68053     let _ui;
68054     context.ui = () => _ui;
68055     context.lastPointerType = () => _ui.lastPointerType();
68056     let _keybinding = utilKeybinding("context");
68057     context.keybinding = () => _keybinding;
68058     select_default2(document).call(_keybinding);
68059     let _connection = services.osm;
68060     let _history;
68061     let _validator;
68062     let _uploader;
68063     context.connection = () => _connection;
68064     context.history = () => _history;
68065     context.validator = () => _validator;
68066     context.uploader = () => _uploader;
68067     context.preauth = (options2) => {
68068       if (_connection) {
68069         _connection.switch(options2);
68070       }
68071       return context;
68072     };
68073     let _apiConnections;
68074     context.apiConnections = function(val) {
68075       if (!arguments.length)
68076         return _apiConnections;
68077       _apiConnections = val;
68078       return context;
68079     };
68080     context.locale = function(locale2) {
68081       if (!arguments.length)
68082         return _mainLocalizer.localeCode();
68083       _mainLocalizer.preferredLocaleCodes(locale2);
68084       return context;
68085     };
68086     function afterLoad(cid, callback) {
68087       return (err, result) => {
68088         if (err) {
68089           if (err.status === 400 || err.status === 401 || err.status === 403) {
68090             if (_connection) {
68091               _connection.logout();
68092             }
68093           }
68094           if (typeof callback === "function") {
68095             callback(err);
68096           }
68097           return;
68098         } else if (_connection && _connection.getConnectionId() !== cid) {
68099           if (typeof callback === "function") {
68100             callback({ message: "Connection Switched", status: -1 });
68101           }
68102           return;
68103         } else {
68104           _history.merge(result.data, result.extent);
68105           if (typeof callback === "function") {
68106             callback(err, result);
68107           }
68108           return;
68109         }
68110       };
68111     }
68112     context.loadTiles = (projection2, callback) => {
68113       const handle = window.requestIdleCallback(() => {
68114         _deferred2.delete(handle);
68115         if (_connection && context.editableDataEnabled()) {
68116           const cid = _connection.getConnectionId();
68117           _connection.loadTiles(projection2, afterLoad(cid, callback));
68118         }
68119       });
68120       _deferred2.add(handle);
68121     };
68122     context.loadTileAtLoc = (loc, callback) => {
68123       const handle = window.requestIdleCallback(() => {
68124         _deferred2.delete(handle);
68125         if (_connection && context.editableDataEnabled()) {
68126           const cid = _connection.getConnectionId();
68127           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
68128         }
68129       });
68130       _deferred2.add(handle);
68131     };
68132     context.loadEntity = (entityID, callback) => {
68133       if (_connection) {
68134         const cid = _connection.getConnectionId();
68135         _connection.loadEntity(entityID, afterLoad(cid, callback));
68136         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
68137       }
68138     };
68139     context.zoomToEntity = (entityID, zoomTo) => {
68140       context.loadEntity(entityID, (err, result) => {
68141         if (err)
68142           return;
68143         if (zoomTo !== false) {
68144           const entity = result.data.find((e) => e.id === entityID);
68145           if (entity) {
68146             _map.zoomTo(entity);
68147           }
68148         }
68149       });
68150       _map.on("drawn.zoomToEntity", () => {
68151         if (!context.hasEntity(entityID))
68152           return;
68153         _map.on("drawn.zoomToEntity", null);
68154         context.on("enter.zoomToEntity", null);
68155         context.enter(modeSelect(context, [entityID]));
68156       });
68157       context.on("enter.zoomToEntity", () => {
68158         if (_mode.id !== "browse") {
68159           _map.on("drawn.zoomToEntity", null);
68160           context.on("enter.zoomToEntity", null);
68161         }
68162       });
68163     };
68164     let _minEditableZoom = 16;
68165     context.minEditableZoom = function(val) {
68166       if (!arguments.length)
68167         return _minEditableZoom;
68168       _minEditableZoom = val;
68169       if (_connection) {
68170         _connection.tileZoom(val);
68171       }
68172       return context;
68173     };
68174     context.maxCharsForTagKey = () => 255;
68175     context.maxCharsForTagValue = () => 255;
68176     context.maxCharsForRelationRole = () => 255;
68177     function cleanOsmString(val, maxChars) {
68178       if (val === void 0 || val === null) {
68179         val = "";
68180       } else {
68181         val = val.toString();
68182       }
68183       val = val.trim();
68184       if (val.normalize)
68185         val = val.normalize("NFC");
68186       return utilUnicodeCharsTruncated(val, maxChars);
68187     }
68188     context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey());
68189     context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue());
68190     context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole());
68191     let _inIntro = false;
68192     context.inIntro = function(val) {
68193       if (!arguments.length)
68194         return _inIntro;
68195       _inIntro = val;
68196       return context;
68197     };
68198     context.save = () => {
68199       if (_inIntro || context.container().select(".modal").size())
68200         return;
68201       let canSave;
68202       if (_mode && _mode.id === "save") {
68203         canSave = false;
68204         if (services.osm && services.osm.isChangesetInflight()) {
68205           _history.clearSaved();
68206           return;
68207         }
68208       } else {
68209         canSave = context.selectedIDs().every((id2) => {
68210           const entity = context.hasEntity(id2);
68211           return entity && !entity.isDegenerate();
68212         });
68213       }
68214       if (canSave) {
68215         _history.save();
68216       }
68217       if (_history.hasChanges()) {
68218         return _t("save.unsaved_changes");
68219       }
68220     };
68221     context.debouncedSave = debounce_default(context.save, 350);
68222     function withDebouncedSave(fn) {
68223       return function() {
68224         const result = fn.apply(_history, arguments);
68225         context.debouncedSave();
68226         return result;
68227       };
68228     }
68229     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
68230     context.entity = (id2) => _history.graph().entity(id2);
68231     let _mode;
68232     context.mode = () => _mode;
68233     context.enter = (newMode) => {
68234       if (_mode) {
68235         _mode.exit();
68236         dispatch10.call("exit", this, _mode);
68237       }
68238       _mode = newMode;
68239       _mode.enter();
68240       dispatch10.call("enter", this, _mode);
68241     };
68242     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
68243     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
68244     let _selectedNoteID;
68245     context.selectedNoteID = function(noteID) {
68246       if (!arguments.length)
68247         return _selectedNoteID;
68248       _selectedNoteID = noteID;
68249       return context;
68250     };
68251     let _selectedErrorID;
68252     context.selectedErrorID = function(errorID) {
68253       if (!arguments.length)
68254         return _selectedErrorID;
68255       _selectedErrorID = errorID;
68256       return context;
68257     };
68258     context.install = (behavior) => context.surface().call(behavior);
68259     context.uninstall = (behavior) => context.surface().call(behavior.off);
68260     let _copyGraph;
68261     context.copyGraph = () => _copyGraph;
68262     let _copyIDs = [];
68263     context.copyIDs = function(val) {
68264       if (!arguments.length)
68265         return _copyIDs;
68266       _copyIDs = val;
68267       _copyGraph = _history.graph();
68268       return context;
68269     };
68270     let _copyLonLat;
68271     context.copyLonLat = function(val) {
68272       if (!arguments.length)
68273         return _copyLonLat;
68274       _copyLonLat = val;
68275       return context;
68276     };
68277     let _background;
68278     context.background = () => _background;
68279     let _features;
68280     context.features = () => _features;
68281     context.hasHiddenConnections = (id2) => {
68282       const graph = _history.graph();
68283       const entity = graph.entity(id2);
68284       return _features.hasHiddenConnections(entity, graph);
68285     };
68286     let _photos;
68287     context.photos = () => _photos;
68288     let _map;
68289     context.map = () => _map;
68290     context.layers = () => _map.layers();
68291     context.surface = () => _map.surface;
68292     context.editableDataEnabled = () => _map.editableDataEnabled();
68293     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
68294     context.editable = () => {
68295       const mode = context.mode();
68296       if (!mode || mode.id === "save")
68297         return false;
68298       return _map.editableDataEnabled();
68299     };
68300     let _debugFlags = {
68301       tile: false,
68302       collision: false,
68303       imagery: false,
68304       target: false,
68305       downloaded: false
68306     };
68307     context.debugFlags = () => _debugFlags;
68308     context.getDebug = (flag) => flag && _debugFlags[flag];
68309     context.setDebug = function(flag, val) {
68310       if (arguments.length === 1)
68311         val = true;
68312       _debugFlags[flag] = val;
68313       dispatch10.call("change");
68314       return context;
68315     };
68316     let _container = select_default2(null);
68317     context.container = function(val) {
68318       if (!arguments.length)
68319         return _container;
68320       _container = val;
68321       _container.classed("ideditor", true);
68322       return context;
68323     };
68324     context.containerNode = function(val) {
68325       if (!arguments.length)
68326         return context.container().node();
68327       context.container(select_default2(val));
68328       return context;
68329     };
68330     let _embed;
68331     context.embed = function(val) {
68332       if (!arguments.length)
68333         return _embed;
68334       _embed = val;
68335       return context;
68336     };
68337     let _assetPath = "";
68338     context.assetPath = function(val) {
68339       if (!arguments.length)
68340         return _assetPath;
68341       _assetPath = val;
68342       _mainFileFetcher.assetPath(val);
68343       return context;
68344     };
68345     let _assetMap = {};
68346     context.assetMap = function(val) {
68347       if (!arguments.length)
68348         return _assetMap;
68349       _assetMap = val;
68350       _mainFileFetcher.assetMap(val);
68351       return context;
68352     };
68353     context.asset = (val) => {
68354       if (/^http(s)?:\/\//i.test(val))
68355         return val;
68356       const filename = _assetPath + val;
68357       return _assetMap[filename] || filename;
68358     };
68359     context.imagePath = (val) => context.asset(`img/${val}`);
68360     context.reset = context.flush = () => {
68361       context.debouncedSave.cancel();
68362       Array.from(_deferred2).forEach((handle) => {
68363         window.cancelIdleCallback(handle);
68364         _deferred2.delete(handle);
68365       });
68366       Object.values(services).forEach((service) => {
68367         if (service && typeof service.reset === "function") {
68368           service.reset(context);
68369         }
68370       });
68371       context.changeset = null;
68372       _validator.reset();
68373       _features.reset();
68374       _history.reset();
68375       _uploader.reset();
68376       context.container().select(".inspector-wrap *").remove();
68377       return context;
68378     };
68379     context.projection = geoRawMercator();
68380     context.curtainProjection = geoRawMercator();
68381     context.init = () => {
68382       instantiateInternal();
68383       initializeDependents();
68384       return context;
68385       function instantiateInternal() {
68386         _history = coreHistory(context);
68387         context.graph = _history.graph;
68388         context.pauseChangeDispatch = _history.pauseChangeDispatch;
68389         context.resumeChangeDispatch = _history.resumeChangeDispatch;
68390         context.perform = withDebouncedSave(_history.perform);
68391         context.replace = withDebouncedSave(_history.replace);
68392         context.pop = withDebouncedSave(_history.pop);
68393         context.overwrite = withDebouncedSave(_history.overwrite);
68394         context.undo = withDebouncedSave(_history.undo);
68395         context.redo = withDebouncedSave(_history.redo);
68396         _validator = coreValidator(context);
68397         _uploader = coreUploader(context);
68398         _background = rendererBackground(context);
68399         _features = rendererFeatures(context);
68400         _map = rendererMap(context);
68401         _photos = rendererPhotos(context);
68402         _ui = uiInit(context);
68403       }
68404       function initializeDependents() {
68405         if (context.initialHashParams.presets) {
68406           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
68407         }
68408         if (context.initialHashParams.locale) {
68409           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
68410         }
68411         _mainLocalizer.ensureLoaded();
68412         _background.ensureLoaded();
68413         _mainPresetIndex.ensureLoaded();
68414         Object.values(services).forEach((service) => {
68415           if (service && typeof service.init === "function") {
68416             service.init();
68417           }
68418         });
68419         _map.init();
68420         _validator.init();
68421         _features.init();
68422         if (services.maprules && context.initialHashParams.maprules) {
68423           json_default(context.initialHashParams.maprules).then((mapcss) => {
68424             services.maprules.init();
68425             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
68426           }).catch(() => {
68427           });
68428         }
68429         if (!context.container().empty()) {
68430           _ui.ensureLoaded().then(() => {
68431             _photos.init();
68432           });
68433         }
68434       }
68435     };
68436     return context;
68437   }
68438
68439   // modules/services/nsi.js
68440   var _nsiStatus = "loading";
68441   var _nsi = {};
68442   var buildingPreset = {
68443     "building/commercial": true,
68444     "building/government": true,
68445     "building/hotel": true,
68446     "building/retail": true,
68447     "building/office": true,
68448     "building/supermarket": true,
68449     "building/yes": true
68450   };
68451   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
68452   var notBranches = /(coop|express|wireless|factory|outlet)/i;
68453   function setNsiSources() {
68454     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
68455     const v = (0, import_vparse2.default)(nsiVersion);
68456     const vMinor = `${v.major}.${v.minor}`;
68457     const sources = {
68458       "nsi_data": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/nsi.min.json`,
68459       "nsi_dissolved": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/dissolved.min.json`,
68460       "nsi_features": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/featureCollection.min.json`,
68461       "nsi_generics": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/genericWords.min.json`,
68462       "nsi_presets": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/presets/nsi-id-presets.min.json`,
68463       "nsi_replacements": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/replacements.min.json`,
68464       "nsi_trees": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/trees.min.json`
68465     };
68466     let fileMap = _mainFileFetcher.fileMap();
68467     for (const k in sources) {
68468       if (!fileMap[k])
68469         fileMap[k] = sources[k];
68470     }
68471   }
68472   function loadNsiPresets() {
68473     return Promise.all([
68474       _mainFileFetcher.get("nsi_presets"),
68475       _mainFileFetcher.get("nsi_features")
68476     ]).then((vals) => {
68477       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
68478       _mainPresetIndex.merge({
68479         presets: vals[0].presets,
68480         featureCollection: vals[1]
68481       });
68482     });
68483   }
68484   function loadNsiData() {
68485     return Promise.all([
68486       _mainFileFetcher.get("nsi_data"),
68487       _mainFileFetcher.get("nsi_dissolved"),
68488       _mainFileFetcher.get("nsi_replacements"),
68489       _mainFileFetcher.get("nsi_trees")
68490     ]).then((vals) => {
68491       _nsi = {
68492         data: vals[0].nsi,
68493         dissolved: vals[1].dissolved,
68494         replacements: vals[2].replacements,
68495         trees: vals[3].trees,
68496         kvt: /* @__PURE__ */ new Map(),
68497         qids: /* @__PURE__ */ new Map(),
68498         ids: /* @__PURE__ */ new Map()
68499       };
68500       _nsi.matcher = new Matcher();
68501       _nsi.matcher.buildMatchIndex(_nsi.data);
68502       _nsi.matcher.buildLocationIndex(_nsi.data, _mainLocations.loco());
68503       Object.keys(_nsi.data).forEach((tkv) => {
68504         const category = _nsi.data[tkv];
68505         const parts = tkv.split("/", 3);
68506         const t = parts[0];
68507         const k = parts[1];
68508         const v = parts[2];
68509         let vmap = _nsi.kvt.get(k);
68510         if (!vmap) {
68511           vmap = /* @__PURE__ */ new Map();
68512           _nsi.kvt.set(k, vmap);
68513         }
68514         vmap.set(v, t);
68515         const tree = _nsi.trees[t];
68516         const mainTag = tree.mainTag;
68517         const items = category.items || [];
68518         items.forEach((item) => {
68519           item.tkv = tkv;
68520           item.mainTag = mainTag;
68521           _nsi.ids.set(item.id, item);
68522           const wd = item.tags[mainTag];
68523           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
68524           if (wd)
68525             _nsi.qids.set(wd, wd);
68526           if (wp && wd)
68527             _nsi.qids.set(wp, wd);
68528         });
68529       });
68530     });
68531   }
68532   function gatherKVs(tags) {
68533     let primary = /* @__PURE__ */ new Set();
68534     let alternate = /* @__PURE__ */ new Set();
68535     Object.keys(tags).forEach((osmkey) => {
68536       const osmvalue = tags[osmkey];
68537       if (!osmvalue)
68538         return;
68539       if (osmkey === "route_master")
68540         osmkey = "route";
68541       const vmap = _nsi.kvt.get(osmkey);
68542       if (!vmap)
68543         return;
68544       if (vmap.get(osmvalue)) {
68545         primary.add(`${osmkey}/${osmvalue}`);
68546       } else if (osmvalue === "yes") {
68547         alternate.add(`${osmkey}/${osmvalue}`);
68548       }
68549     });
68550     const preset = _mainPresetIndex.matchTags(tags, "area");
68551     if (buildingPreset[preset.id]) {
68552       alternate.add("building/yes");
68553     }
68554     return { primary, alternate };
68555   }
68556   function identifyTree(tags) {
68557     let unknown;
68558     let t;
68559     Object.keys(tags).forEach((osmkey) => {
68560       if (t)
68561         return;
68562       const osmvalue = tags[osmkey];
68563       if (!osmvalue)
68564         return;
68565       if (osmkey === "route_master")
68566         osmkey = "route";
68567       const vmap = _nsi.kvt.get(osmkey);
68568       if (!vmap)
68569         return;
68570       if (osmvalue === "yes") {
68571         unknown = "unknown";
68572       } else {
68573         t = vmap.get(osmvalue);
68574       }
68575     });
68576     return t || unknown || null;
68577   }
68578   function gatherNames(tags) {
68579     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
68580     let primary = /* @__PURE__ */ new Set();
68581     let alternate = /* @__PURE__ */ new Set();
68582     let foundSemi = false;
68583     let testNameFragments = false;
68584     let patterns2;
68585     let t = identifyTree(tags);
68586     if (!t)
68587       return empty2;
68588     if (t === "transit") {
68589       patterns2 = {
68590         primary: /^network$/i,
68591         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
68592       };
68593     } else if (t === "flags") {
68594       patterns2 = {
68595         primary: /^(flag:name|flag:name:\w+)$/i,
68596         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
68597       };
68598     } else if (t === "brands") {
68599       testNameFragments = true;
68600       patterns2 = {
68601         primary: /^(name|name:\w+)$/i,
68602         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
68603       };
68604     } else if (t === "operators") {
68605       testNameFragments = true;
68606       patterns2 = {
68607         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
68608         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
68609       };
68610     } else {
68611       testNameFragments = true;
68612       patterns2 = {
68613         primary: /^(name|name:\w+)$/i,
68614         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
68615       };
68616     }
68617     if (tags.name && testNameFragments) {
68618       const nameParts = tags.name.split(/[\s\-\/,.]/);
68619       for (let split = nameParts.length; split > 0; split--) {
68620         const name2 = nameParts.slice(0, split).join(" ");
68621         primary.add(name2);
68622       }
68623     }
68624     Object.keys(tags).forEach((osmkey) => {
68625       const osmvalue = tags[osmkey];
68626       if (!osmvalue)
68627         return;
68628       if (isNamelike(osmkey, "primary")) {
68629         if (/;/.test(osmvalue)) {
68630           foundSemi = true;
68631         } else {
68632           primary.add(osmvalue);
68633           alternate.delete(osmvalue);
68634         }
68635       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
68636         if (/;/.test(osmvalue)) {
68637           foundSemi = true;
68638         } else {
68639           alternate.add(osmvalue);
68640         }
68641       }
68642     });
68643     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
68644       const osmvalue = tags.country;
68645       if (/;/.test(osmvalue)) {
68646         foundSemi = true;
68647       } else {
68648         alternate.add(osmvalue);
68649       }
68650     }
68651     if (foundSemi) {
68652       return empty2;
68653     } else {
68654       return { primary, alternate };
68655     }
68656     function isNamelike(osmkey, which) {
68657       if (osmkey === "old_name")
68658         return false;
68659       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
68660     }
68661   }
68662   function gatherTuples(tryKVs, tryNames) {
68663     let tuples = [];
68664     ["primary", "alternate"].forEach((whichName) => {
68665       const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
68666       arr.forEach((n2) => {
68667         ["primary", "alternate"].forEach((whichKV) => {
68668           tryKVs[whichKV].forEach((kv) => {
68669             const parts = kv.split("/", 2);
68670             const k = parts[0];
68671             const v = parts[1];
68672             tuples.push({ k, v, n: n2 });
68673           });
68674         });
68675       });
68676     });
68677     return tuples;
68678   }
68679   function _upgradeTags(tags, loc) {
68680     let newTags = Object.assign({}, tags);
68681     let changed = false;
68682     Object.keys(newTags).forEach((osmkey) => {
68683       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
68684       if (matchTag) {
68685         const prefix = matchTag[1] || "";
68686         const wd = newTags[osmkey];
68687         const replace = _nsi.replacements[wd];
68688         if (replace && replace.wikidata !== void 0) {
68689           changed = true;
68690           if (replace.wikidata) {
68691             newTags[osmkey] = replace.wikidata;
68692           } else {
68693             delete newTags[osmkey];
68694           }
68695         }
68696         if (replace && replace.wikipedia !== void 0) {
68697           changed = true;
68698           const wpkey = `${prefix}wikipedia`;
68699           if (replace.wikipedia) {
68700             newTags[wpkey] = replace.wikipedia;
68701           } else {
68702             delete newTags[wpkey];
68703           }
68704         }
68705       }
68706     });
68707     const isRouteMaster = tags.type === "route_master";
68708     const tryKVs = gatherKVs(tags);
68709     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
68710       return changed ? { newTags, matched: null } : null;
68711     }
68712     const tryNames = gatherNames(tags);
68713     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
68714     if (foundQID)
68715       tryNames.primary.add(foundQID);
68716     if (!tryNames.primary.size && !tryNames.alternate.size) {
68717       return changed ? { newTags, matched: null } : null;
68718     }
68719     const tuples = gatherTuples(tryKVs, tryNames);
68720     let foundPrimary = false;
68721     let bestItem;
68722     for (let i2 = 0; i2 < tuples.length && !foundPrimary; i2++) {
68723       const tuple = tuples[i2];
68724       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
68725       if (!hits || !hits.length)
68726         continue;
68727       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
68728         break;
68729       for (let j2 = 0; j2 < hits.length; j2++) {
68730         const hit = hits[j2];
68731         const isPrimary = hits[j2].match === "primary";
68732         const itemID = hit.itemID;
68733         if (_nsi.dissolved[itemID])
68734           continue;
68735         const item = _nsi.ids.get(itemID);
68736         if (!item)
68737           continue;
68738         const mainTag = item.mainTag;
68739         const itemQID = item.tags[mainTag];
68740         const notQID = newTags[`not:${mainTag}`];
68741         if (!itemQID || itemQID === notQID || newTags.office && !item.tags.office) {
68742           continue;
68743         }
68744         if (!bestItem || isPrimary) {
68745           bestItem = item;
68746           if (isPrimary) {
68747             foundPrimary = true;
68748           }
68749           break;
68750         }
68751       }
68752     }
68753     if (bestItem) {
68754       const itemID = bestItem.id;
68755       const item = JSON.parse(JSON.stringify(bestItem));
68756       const tkv = item.tkv;
68757       const parts = tkv.split("/", 3);
68758       const k = parts[1];
68759       const v = parts[2];
68760       const category = _nsi.data[tkv];
68761       const properties = category.properties || {};
68762       let preserveTags = item.preserveTags || properties.preserveTags || [];
68763       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
68764         if (k !== osmkey)
68765           preserveTags.push(`^${osmkey}$`);
68766       });
68767       const regexes = preserveTags.map((s) => new RegExp(s, "i"));
68768       let keepTags = {};
68769       Object.keys(newTags).forEach((osmkey) => {
68770         if (regexes.some((regex) => regex.test(osmkey))) {
68771           keepTags[osmkey] = newTags[osmkey];
68772         }
68773       });
68774       _nsi.kvt.forEach((vmap, k2) => {
68775         if (newTags[k2] === "yes")
68776           delete newTags[k2];
68777       });
68778       if (foundQID) {
68779         delete newTags.wikipedia;
68780         delete newTags.wikidata;
68781       }
68782       Object.assign(newTags, item.tags, keepTags);
68783       if (isRouteMaster) {
68784         newTags.route_master = newTags.route;
68785         delete newTags.route;
68786       }
68787       const origName = tags.name;
68788       const newName = newTags.name;
68789       if (newName && origName && newName !== origName && !newTags.branch) {
68790         const newNames = gatherNames(newTags);
68791         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
68792         const isMoved = newSet.has(origName);
68793         if (!isMoved) {
68794           const nameParts = origName.split(/[\s\-\/,.]/);
68795           for (let split = nameParts.length; split > 0; split--) {
68796             const name2 = nameParts.slice(0, split).join(" ");
68797             const branch = nameParts.slice(split).join(" ");
68798             const nameHits = _nsi.matcher.match(k, v, name2, loc);
68799             if (!nameHits || !nameHits.length)
68800               continue;
68801             if (nameHits.some((hit) => hit.itemID === itemID)) {
68802               if (branch) {
68803                 if (notBranches.test(branch)) {
68804                   newTags.name = origName;
68805                 } else {
68806                   const branchHits = _nsi.matcher.match(k, v, branch, loc);
68807                   if (branchHits && branchHits.length) {
68808                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
68809                       return null;
68810                     }
68811                   } else {
68812                     newTags.branch = branch;
68813                   }
68814                 }
68815               }
68816               break;
68817             }
68818           }
68819         }
68820       }
68821       return { newTags, matched: item };
68822     }
68823     return changed ? { newTags, matched: null } : null;
68824   }
68825   function _isGenericName(tags) {
68826     const n2 = tags.name;
68827     if (!n2)
68828       return false;
68829     const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
68830     const tryKVs = gatherKVs(tags);
68831     if (!tryKVs.primary.size && !tryKVs.alternate.size)
68832       return false;
68833     const tuples = gatherTuples(tryKVs, tryNames);
68834     for (let i2 = 0; i2 < tuples.length; i2++) {
68835       const tuple = tuples[i2];
68836       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
68837       if (hits && hits.length && hits[0].match === "excludeGeneric")
68838         return true;
68839     }
68840     return false;
68841   }
68842   var nsi_default = {
68843     init: () => {
68844       setNsiSources();
68845       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => delay(100)).then(() => _mainLocations.mergeLocationSets([])).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
68846       function delay(msec) {
68847         return new Promise((resolve) => {
68848           window.setTimeout(resolve, msec);
68849         });
68850       }
68851     },
68852     reset: () => {
68853     },
68854     status: () => _nsiStatus,
68855     isGenericName: (tags) => _isGenericName(tags),
68856     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
68857     cache: () => _nsi
68858   };
68859
68860   // modules/services/kartaview.js
68861   var import_rbush8 = __toESM(require_rbush_min());
68862   var apibase2 = "https://kartaview.org";
68863   var maxResults = 1e3;
68864   var tileZoom = 14;
68865   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
68866   var dispatch6 = dispatch_default("loadedImages");
68867   var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
68868   var _oscCache;
68869   var _oscSelectedImage;
68870   var _loadViewerPromise2;
68871   function abortRequest4(controller) {
68872     controller.abort();
68873   }
68874   function maxPageAtZoom(z) {
68875     if (z < 15)
68876       return 2;
68877     if (z === 15)
68878       return 5;
68879     if (z === 16)
68880       return 10;
68881     if (z === 17)
68882       return 20;
68883     if (z === 18)
68884       return 40;
68885     if (z > 18)
68886       return 80;
68887   }
68888   function loadTiles2(which, url, projection2) {
68889     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
68890     var tiles = tiler4.getTiles(projection2);
68891     var cache = _oscCache[which];
68892     Object.keys(cache.inflight).forEach(function(k) {
68893       var wanted = tiles.find(function(tile) {
68894         return k.indexOf(tile.id + ",") === 0;
68895       });
68896       if (!wanted) {
68897         abortRequest4(cache.inflight[k]);
68898         delete cache.inflight[k];
68899       }
68900     });
68901     tiles.forEach(function(tile) {
68902       loadNextTilePage(which, currZoom, url, tile);
68903     });
68904   }
68905   function loadNextTilePage(which, currZoom, url, tile) {
68906     var cache = _oscCache[which];
68907     var bbox = tile.extent.bbox();
68908     var maxPages = maxPageAtZoom(currZoom);
68909     var nextPage = cache.nextPage[tile.id] || 1;
68910     var params = utilQsString({
68911       ipp: maxResults,
68912       page: nextPage,
68913       bbTopLeft: [bbox.maxY, bbox.minX].join(","),
68914       bbBottomRight: [bbox.minY, bbox.maxX].join(",")
68915     }, true);
68916     if (nextPage > maxPages)
68917       return;
68918     var id2 = tile.id + "," + String(nextPage);
68919     if (cache.loaded[id2] || cache.inflight[id2])
68920       return;
68921     var controller = new AbortController();
68922     cache.inflight[id2] = controller;
68923     var options2 = {
68924       method: "POST",
68925       signal: controller.signal,
68926       body: params,
68927       headers: { "Content-Type": "application/x-www-form-urlencoded" }
68928     };
68929     json_default(url, options2).then(function(data) {
68930       cache.loaded[id2] = true;
68931       delete cache.inflight[id2];
68932       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
68933         throw new Error("No Data");
68934       }
68935       var features2 = data.currentPageItems.map(function(item) {
68936         var loc = [+item.lng, +item.lat];
68937         var d;
68938         if (which === "images") {
68939           d = {
68940             loc,
68941             key: item.id,
68942             ca: +item.heading,
68943             captured_at: item.shot_date || item.date_added,
68944             captured_by: item.username,
68945             imagePath: item.lth_name,
68946             sequence_id: item.sequence_id,
68947             sequence_index: +item.sequence_index
68948           };
68949           var seq = _oscCache.sequences[d.sequence_id];
68950           if (!seq) {
68951             seq = { rotation: 0, images: [] };
68952             _oscCache.sequences[d.sequence_id] = seq;
68953           }
68954           seq.images[d.sequence_index] = d;
68955           _oscCache.images.forImageKey[d.key] = d;
68956         }
68957         return {
68958           minX: loc[0],
68959           minY: loc[1],
68960           maxX: loc[0],
68961           maxY: loc[1],
68962           data: d
68963         };
68964       });
68965       cache.rtree.load(features2);
68966       if (data.currentPageItems.length === maxResults) {
68967         cache.nextPage[tile.id] = nextPage + 1;
68968         loadNextTilePage(which, currZoom, url, tile);
68969       } else {
68970         cache.nextPage[tile.id] = Infinity;
68971       }
68972       if (which === "images") {
68973         dispatch6.call("loadedImages");
68974       }
68975     }).catch(function() {
68976       cache.loaded[id2] = true;
68977       delete cache.inflight[id2];
68978     });
68979   }
68980   function partitionViewport2(projection2) {
68981     var z = geoScaleToZoom(projection2.scale());
68982     var z2 = Math.ceil(z * 2) / 2 + 2.5;
68983     var tiler8 = utilTiler().zoomExtent([z2, z2]);
68984     return tiler8.getTiles(projection2).map(function(tile) {
68985       return tile.extent;
68986     });
68987   }
68988   function searchLimited2(limit, projection2, rtree) {
68989     limit = limit || 5;
68990     return partitionViewport2(projection2).reduce(function(result, extent) {
68991       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
68992         return d.data;
68993       });
68994       return found.length ? result.concat(found) : result;
68995     }, []);
68996   }
68997   var kartaview_default = {
68998     init: function() {
68999       if (!_oscCache) {
69000         this.reset();
69001       }
69002       this.event = utilRebind(this, dispatch6, "on");
69003     },
69004     reset: function() {
69005       if (_oscCache) {
69006         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
69007       }
69008       _oscCache = {
69009         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
69010         sequences: {}
69011       };
69012       _oscSelectedImage = null;
69013     },
69014     images: function(projection2) {
69015       var limit = 5;
69016       return searchLimited2(limit, projection2, _oscCache.images.rtree);
69017     },
69018     sequences: function(projection2) {
69019       var viewport = projection2.clipExtent();
69020       var min3 = [viewport[0][0], viewport[1][1]];
69021       var max3 = [viewport[1][0], viewport[0][1]];
69022       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
69023       var sequenceKeys = {};
69024       _oscCache.images.rtree.search(bbox).forEach(function(d) {
69025         sequenceKeys[d.data.sequence_id] = true;
69026       });
69027       var lineStrings = [];
69028       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
69029         var seq = _oscCache.sequences[sequenceKey];
69030         var images = seq && seq.images;
69031         if (images) {
69032           lineStrings.push({
69033             type: "LineString",
69034             coordinates: images.map(function(d) {
69035               return d.loc;
69036             }).filter(Boolean),
69037             properties: {
69038               captured_at: images[0] ? images[0].captured_at : null,
69039               captured_by: images[0] ? images[0].captured_by : null,
69040               key: sequenceKey
69041             }
69042           });
69043         }
69044       });
69045       return lineStrings;
69046     },
69047     cachedImage: function(imageKey) {
69048       return _oscCache.images.forImageKey[imageKey];
69049     },
69050     loadImages: function(projection2) {
69051       var url = apibase2 + "/1.0/list/nearby-photos/";
69052       loadTiles2("images", url, projection2);
69053     },
69054     ensureViewerLoaded: function(context) {
69055       if (_loadViewerPromise2)
69056         return _loadViewerPromise2;
69057       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
69058       var that = this;
69059       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
69060       wrapEnter.append("div").attr("class", "photo-attribution fillD");
69061       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
69062       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
69063       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
69064       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
69065       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
69066       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
69067       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
69068         imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
69069       });
69070       function zoomPan(d3_event) {
69071         var t = d3_event.transform;
69072         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
69073       }
69074       function rotate(deg) {
69075         return function() {
69076           if (!_oscSelectedImage)
69077             return;
69078           var sequenceKey = _oscSelectedImage.sequence_id;
69079           var sequence = _oscCache.sequences[sequenceKey];
69080           if (!sequence)
69081             return;
69082           var r = sequence.rotation || 0;
69083           r += deg;
69084           if (r > 180)
69085             r -= 360;
69086           if (r < -180)
69087             r += 360;
69088           sequence.rotation = r;
69089           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
69090           wrap3.transition().duration(100).call(imgZoom.transform, identity2);
69091           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
69092         };
69093       }
69094       function step(stepBy) {
69095         return function() {
69096           if (!_oscSelectedImage)
69097             return;
69098           var sequenceKey = _oscSelectedImage.sequence_id;
69099           var sequence = _oscCache.sequences[sequenceKey];
69100           if (!sequence)
69101             return;
69102           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
69103           var nextImage = sequence.images[nextIndex];
69104           if (!nextImage)
69105             return;
69106           context.map().centerEase(nextImage.loc);
69107           that.selectImage(context, nextImage.key);
69108         };
69109       }
69110       _loadViewerPromise2 = Promise.resolve();
69111       return _loadViewerPromise2;
69112     },
69113     showViewer: function(context) {
69114       var viewer = context.container().select(".photoviewer").classed("hide", false);
69115       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
69116       if (isHidden) {
69117         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
69118         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
69119       }
69120       return this;
69121     },
69122     hideViewer: function(context) {
69123       _oscSelectedImage = null;
69124       this.updateUrlImage(null);
69125       var viewer = context.container().select(".photoviewer");
69126       if (!viewer.empty())
69127         viewer.datum(null);
69128       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
69129       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
69130       return this.setStyles(context, null, true);
69131     },
69132     selectImage: function(context, imageKey) {
69133       var d = this.cachedImage(imageKey);
69134       _oscSelectedImage = d;
69135       this.updateUrlImage(imageKey);
69136       var viewer = context.container().select(".photoviewer");
69137       if (!viewer.empty())
69138         viewer.datum(d);
69139       this.setStyles(context, null, true);
69140       context.container().selectAll(".icon-sign").classed("currentView", false);
69141       if (!d)
69142         return this;
69143       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
69144       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
69145       var attribution = wrap2.selectAll(".photo-attribution").text("");
69146       wrap2.transition().duration(100).call(imgZoom.transform, identity2);
69147       imageWrap.selectAll(".kartaview-image").remove();
69148       if (d) {
69149         var sequence = _oscCache.sequences[d.sequence_id];
69150         var r = sequence && sequence.rotation || 0;
69151         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
69152         if (d.captured_by) {
69153           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
69154           attribution.append("span").text("|");
69155         }
69156         if (d.captured_at) {
69157           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
69158           attribution.append("span").text("|");
69159         }
69160         attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d.sequence_id + "/" + d.sequence_index).text("kartaview.org");
69161       }
69162       return this;
69163       function localeDateString2(s) {
69164         if (!s)
69165           return null;
69166         var options2 = { day: "numeric", month: "short", year: "numeric" };
69167         var d2 = new Date(s);
69168         if (isNaN(d2.getTime()))
69169           return null;
69170         return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
69171       }
69172     },
69173     getSelectedImage: function() {
69174       return _oscSelectedImage;
69175     },
69176     getSequenceKeyForImage: function(d) {
69177       return d && d.sequence_id;
69178     },
69179     setStyles: function(context, hovered, reset) {
69180       if (reset) {
69181         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
69182         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
69183       }
69184       var hoveredImageKey = hovered && hovered.key;
69185       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
69186       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
69187       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
69188         return d.key;
69189       }) || [];
69190       var viewer = context.container().select(".photoviewer");
69191       var selected = viewer.empty() ? void 0 : viewer.datum();
69192       var selectedImageKey = selected && selected.key;
69193       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
69194       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
69195       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
69196         return d.key;
69197       }) || [];
69198       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
69199       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
69200         return highlightedImageKeys.indexOf(d.key) !== -1;
69201       }).classed("hovered", function(d) {
69202         return d.key === hoveredImageKey;
69203       }).classed("currentView", function(d) {
69204         return d.key === selectedImageKey;
69205       });
69206       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
69207         return d.properties.key === hoveredSequenceKey;
69208       }).classed("currentView", function(d) {
69209         return d.properties.key === selectedSequenceKey;
69210       });
69211       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
69212       function viewfieldPath() {
69213         var d = this.parentNode.__data__;
69214         if (d.pano && d.key !== selectedImageKey) {
69215           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
69216         } else {
69217           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
69218         }
69219       }
69220       return this;
69221     },
69222     updateUrlImage: function(imageKey) {
69223       if (!window.mocha) {
69224         var hash = utilStringQs(window.location.hash);
69225         if (imageKey) {
69226           hash.photo = "kartaview/" + imageKey;
69227         } else {
69228           delete hash.photo;
69229         }
69230         window.location.replace("#" + utilQsString(hash, true));
69231       }
69232     },
69233     cache: function() {
69234       return _oscCache;
69235     }
69236   };
69237
69238   // node_modules/osm-auth/src/osm-auth.mjs
69239   var import_store = __toESM(require_store_legacy(), 1);
69240   function osmAuth(o) {
69241     var oauth2 = {};
69242     oauth2.authenticated = function() {
69243       return !!token("oauth2_access_token");
69244     };
69245     oauth2.logout = function() {
69246       token("oauth2_access_token", "");
69247       token("oauth_token", "");
69248       token("oauth_token_secret", "");
69249       token("oauth_request_token_secret", "");
69250       return oauth2;
69251     };
69252     oauth2.authenticate = function(callback) {
69253       if (oauth2.authenticated()) {
69254         callback(null, oauth2);
69255         return;
69256       }
69257       oauth2.logout();
69258       var url = o.url + "/oauth2/authorize?" + utilQsString2({
69259         client_id: o.client_id,
69260         redirect_uri: o.redirect_uri,
69261         response_type: "code",
69262         scope: o.scope
69263       });
69264       if (!o.singlepage) {
69265         var w = 600;
69266         var h = 550;
69267         var settings = [
69268           ["width", w],
69269           ["height", h],
69270           ["left", screen.width / 2 - w / 2],
69271           ["top", screen.height / 2 - h / 2]
69272         ].map(function(x) {
69273           return x.join("=");
69274         }).join(",");
69275         var popup = window.open("about:blank", "oauth_window", settings);
69276         oauth2.popupWindow = popup;
69277         popup.location = url;
69278         if (!popup) {
69279           var error = new Error("Popup was blocked");
69280           error.status = "popup-blocked";
69281           throw error;
69282         }
69283       }
69284       window.authComplete = function(url2) {
69285         var params = utilStringQs2(url2.split("?")[1]);
69286         getAccessToken(params.code);
69287         delete window.authComplete;
69288       };
69289       function getAccessToken(auth_code) {
69290         var url2 = o.url + "/oauth2/token?" + utilQsString2({
69291           client_id: o.client_id,
69292           grant_type: "authorization_code",
69293           code: auth_code,
69294           redirect_uri: o.redirect_uri,
69295           client_secret: o.client_secret
69296         });
69297         oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
69298         o.loading();
69299       }
69300       function accessTokenDone(err, xhr) {
69301         o.done();
69302         if (err) {
69303           callback(err);
69304           return;
69305         }
69306         var access_token = JSON.parse(xhr.response);
69307         token("oauth2_access_token", access_token.access_token);
69308         callback(null, oauth2);
69309       }
69310     };
69311     oauth2.bringPopupWindowToFront = function() {
69312       var broughtPopupToFront = false;
69313       try {
69314         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
69315           oauth2.popupWindow.focus();
69316           broughtPopupToFront = true;
69317         }
69318       } catch (err) {
69319       }
69320       return broughtPopupToFront;
69321     };
69322     oauth2.bootstrapToken = function(auth_code, callback) {
69323       function getAccessToken(auth_code2) {
69324         var url = o.url + "/oauth2/token?" + utilQsString2({
69325           client_id: o.client_id,
69326           grant_type: "authorization_code",
69327           code: auth_code2,
69328           redirect_uri: o.redirect_uri,
69329           client_secret: o.client_secret
69330         });
69331         oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
69332         o.loading();
69333       }
69334       function accessTokenDone(err, xhr) {
69335         o.done();
69336         if (err) {
69337           callback(err);
69338           return;
69339         }
69340         var access_token = JSON.parse(xhr.response);
69341         token("oauth2_access_token", access_token.access_token);
69342         callback(null, oauth2);
69343       }
69344       getAccessToken(auth_code);
69345     };
69346     oauth2.xhr = function(options2, callback) {
69347       if (oauth2.authenticated()) {
69348         return run();
69349       } else {
69350         if (o.auto) {
69351           oauth2.authenticate(run);
69352           return;
69353         } else {
69354           callback("not authenticated", null);
69355           return;
69356         }
69357       }
69358       function run() {
69359         var url = options2.prefix !== false ? o.url + options2.path : options2.path;
69360         return oauth2.rawxhr(options2.method, url, token("oauth2_access_token"), options2.content, options2.headers, done);
69361       }
69362       function done(err, xhr) {
69363         if (err) {
69364           callback(err);
69365         } else if (xhr.responseXML) {
69366           callback(err, xhr.responseXML);
69367         } else {
69368           callback(err, xhr.response);
69369         }
69370       }
69371     };
69372     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
69373       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
69374       if (access_token) {
69375         headers.Authorization = "Bearer " + access_token;
69376       }
69377       var xhr = new XMLHttpRequest();
69378       xhr.onreadystatechange = function() {
69379         if (xhr.readyState === 4 && xhr.status !== 0) {
69380           if (/^20\d$/.test(xhr.status)) {
69381             callback(null, xhr);
69382           } else {
69383             callback(xhr, null);
69384           }
69385         }
69386       };
69387       xhr.onerror = function(e) {
69388         callback(e, null);
69389       };
69390       xhr.open(method, url, true);
69391       for (var h in headers)
69392         xhr.setRequestHeader(h, headers[h]);
69393       xhr.send(data);
69394       return xhr;
69395     };
69396     oauth2.preauth = function(val) {
69397       if (val && val.access_token) {
69398         token("oauth2_access_token", val.access_token);
69399       }
69400       return oauth2;
69401     };
69402     oauth2.options = function(val) {
69403       if (!arguments.length)
69404         return o;
69405       o = val;
69406       o.url = o.url || "https://www.openstreetmap.org";
69407       o.auto = o.auto || false;
69408       o.singlepage = o.singlepage || false;
69409       o.loading = o.loading || function() {
69410       };
69411       o.done = o.done || function() {
69412       };
69413       return oauth2.preauth(o);
69414     };
69415     var token;
69416     if (import_store.default.enabled) {
69417       token = function(x, y) {
69418         if (arguments.length === 1)
69419           return import_store.default.get(o.url + x);
69420         else if (arguments.length === 2)
69421           return import_store.default.set(o.url + x, y);
69422       };
69423     } else {
69424       var storage = {};
69425       token = function(x, y) {
69426         if (arguments.length === 1)
69427           return storage[o.url + x];
69428         else if (arguments.length === 2)
69429           return storage[o.url + x] = y;
69430       };
69431     }
69432     oauth2.options(o);
69433     return oauth2;
69434   }
69435   function utilQsString2(obj) {
69436     return Object.keys(obj).sort().map(function(key) {
69437       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
69438     }).join("&");
69439   }
69440   function utilStringQs2(str2) {
69441     var i2 = 0;
69442     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
69443       i2++;
69444     str2 = str2.slice(i2);
69445     return str2.split("&").reduce(function(obj, pair2) {
69446       var parts = pair2.split("=");
69447       if (parts.length === 2) {
69448         obj[parts[0]] = decodeURIComponent(parts[1]);
69449       }
69450       return obj;
69451     }, {});
69452   }
69453
69454   // modules/services/osm.js
69455   var import_rbush9 = __toESM(require_rbush_min());
69456   var tiler5 = utilTiler();
69457   var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
69458   var urlroot = "https://www.openstreetmap.org";
69459   var redirectPath = window.location.origin + window.location.pathname;
69460   var oauth = osmAuth({
69461     url: urlroot,
69462     client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
69463     client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q",
69464     scope: "read_prefs write_prefs write_api read_gpx write_notes",
69465     redirect_uri: redirectPath + "land.html",
69466     loading: authLoading,
69467     done: authDone
69468   });
69469   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
69470   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
69471   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
69472   var _userCache = { toLoad: {}, user: {} };
69473   var _cachedApiStatus;
69474   var _changeset = {};
69475   var _deferred = /* @__PURE__ */ new Set();
69476   var _connectionID = 1;
69477   var _tileZoom4 = 16;
69478   var _noteZoom = 12;
69479   var _rateLimitError;
69480   var _userChangesets;
69481   var _userDetails;
69482   var _off;
69483   var _maxWayNodes = 2e3;
69484   function authLoading() {
69485     dispatch7.call("authLoading");
69486   }
69487   function authDone() {
69488     dispatch7.call("authDone");
69489   }
69490   function abortRequest5(controllerOrXHR) {
69491     if (controllerOrXHR) {
69492       controllerOrXHR.abort();
69493     }
69494   }
69495   function hasInflightRequests(cache) {
69496     return Object.keys(cache.inflight).length;
69497   }
69498   function abortUnwantedRequests4(cache, visibleTiles) {
69499     Object.keys(cache.inflight).forEach(function(k) {
69500       if (cache.toLoad[k])
69501         return;
69502       if (visibleTiles.find(function(tile) {
69503         return k === tile.id;
69504       }))
69505         return;
69506       abortRequest5(cache.inflight[k]);
69507       delete cache.inflight[k];
69508     });
69509   }
69510   function getLoc(attrs) {
69511     var lon = attrs.lon && attrs.lon.value;
69512     var lat = attrs.lat && attrs.lat.value;
69513     return [parseFloat(lon), parseFloat(lat)];
69514   }
69515   function getNodes(obj) {
69516     var elems = obj.getElementsByTagName("nd");
69517     var nodes = new Array(elems.length);
69518     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69519       nodes[i2] = "n" + elems[i2].attributes.ref.value;
69520     }
69521     return nodes;
69522   }
69523   function getNodesJSON(obj) {
69524     var elems = obj.nodes;
69525     var nodes = new Array(elems.length);
69526     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69527       nodes[i2] = "n" + elems[i2];
69528     }
69529     return nodes;
69530   }
69531   function getTags(obj) {
69532     var elems = obj.getElementsByTagName("tag");
69533     var tags = {};
69534     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69535       var attrs = elems[i2].attributes;
69536       tags[attrs.k.value] = attrs.v.value;
69537     }
69538     return tags;
69539   }
69540   function getMembers(obj) {
69541     var elems = obj.getElementsByTagName("member");
69542     var members = new Array(elems.length);
69543     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69544       var attrs = elems[i2].attributes;
69545       members[i2] = {
69546         id: attrs.type.value[0] + attrs.ref.value,
69547         type: attrs.type.value,
69548         role: attrs.role.value
69549       };
69550     }
69551     return members;
69552   }
69553   function getMembersJSON(obj) {
69554     var elems = obj.members;
69555     var members = new Array(elems.length);
69556     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69557       var attrs = elems[i2];
69558       members[i2] = {
69559         id: attrs.type[0] + attrs.ref,
69560         type: attrs.type,
69561         role: attrs.role
69562       };
69563     }
69564     return members;
69565   }
69566   function getVisible(attrs) {
69567     return !attrs.visible || attrs.visible.value !== "false";
69568   }
69569   function parseComments(comments) {
69570     var parsedComments = [];
69571     for (var i2 = 0; i2 < comments.length; i2++) {
69572       var comment = comments[i2];
69573       if (comment.nodeName === "comment") {
69574         var childNodes = comment.childNodes;
69575         var parsedComment = {};
69576         for (var j2 = 0; j2 < childNodes.length; j2++) {
69577           var node = childNodes[j2];
69578           var nodeName = node.nodeName;
69579           if (nodeName === "#text")
69580             continue;
69581           parsedComment[nodeName] = node.textContent;
69582           if (nodeName === "uid") {
69583             var uid = node.textContent;
69584             if (uid && !_userCache.user[uid]) {
69585               _userCache.toLoad[uid] = true;
69586             }
69587           }
69588         }
69589         if (parsedComment) {
69590           parsedComments.push(parsedComment);
69591         }
69592       }
69593     }
69594     return parsedComments;
69595   }
69596   function encodeNoteRtree(note) {
69597     return {
69598       minX: note.loc[0],
69599       minY: note.loc[1],
69600       maxX: note.loc[0],
69601       maxY: note.loc[1],
69602       data: note
69603     };
69604   }
69605   var jsonparsers = {
69606     node: function nodeData(obj, uid) {
69607       return new osmNode({
69608         id: uid,
69609         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69610         version: obj.version && obj.version.toString(),
69611         changeset: obj.changeset && obj.changeset.toString(),
69612         timestamp: obj.timestamp,
69613         user: obj.user,
69614         uid: obj.uid && obj.uid.toString(),
69615         loc: [parseFloat(obj.lon), parseFloat(obj.lat)],
69616         tags: obj.tags
69617       });
69618     },
69619     way: function wayData(obj, uid) {
69620       return new osmWay({
69621         id: uid,
69622         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69623         version: obj.version && obj.version.toString(),
69624         changeset: obj.changeset && obj.changeset.toString(),
69625         timestamp: obj.timestamp,
69626         user: obj.user,
69627         uid: obj.uid && obj.uid.toString(),
69628         tags: obj.tags,
69629         nodes: getNodesJSON(obj)
69630       });
69631     },
69632     relation: function relationData(obj, uid) {
69633       return new osmRelation({
69634         id: uid,
69635         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69636         version: obj.version && obj.version.toString(),
69637         changeset: obj.changeset && obj.changeset.toString(),
69638         timestamp: obj.timestamp,
69639         user: obj.user,
69640         uid: obj.uid && obj.uid.toString(),
69641         tags: obj.tags,
69642         members: getMembersJSON(obj)
69643       });
69644     },
69645     user: function parseUser(obj, uid) {
69646       return {
69647         id: uid,
69648         display_name: obj.display_name,
69649         account_created: obj.account_created,
69650         image_url: obj.img && obj.img.href,
69651         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
69652         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
69653       };
69654     }
69655   };
69656   function parseJSON(payload, callback, options2) {
69657     options2 = Object.assign({ skipSeen: true }, options2);
69658     if (!payload) {
69659       return callback({ message: "No JSON", status: -1 });
69660     }
69661     var json = payload;
69662     if (typeof json !== "object")
69663       json = JSON.parse(payload);
69664     if (!json.elements)
69665       return callback({ message: "No JSON", status: -1 });
69666     var children2 = json.elements;
69667     var handle = window.requestIdleCallback(function() {
69668       _deferred.delete(handle);
69669       var results = [];
69670       var result;
69671       for (var i2 = 0; i2 < children2.length; i2++) {
69672         result = parseChild(children2[i2]);
69673         if (result)
69674           results.push(result);
69675       }
69676       callback(null, results);
69677     });
69678     _deferred.add(handle);
69679     function parseChild(child) {
69680       var parser3 = jsonparsers[child.type];
69681       if (!parser3)
69682         return null;
69683       var uid;
69684       uid = osmEntity.id.fromOSM(child.type, child.id);
69685       if (options2.skipSeen) {
69686         if (_tileCache.seen[uid])
69687           return null;
69688         _tileCache.seen[uid] = true;
69689       }
69690       return parser3(child, uid);
69691     }
69692   }
69693   function parseUserJSON(payload, callback, options2) {
69694     options2 = Object.assign({ skipSeen: true }, options2);
69695     if (!payload) {
69696       return callback({ message: "No JSON", status: -1 });
69697     }
69698     var json = payload;
69699     if (typeof json !== "object")
69700       json = JSON.parse(payload);
69701     if (!json.users && !json.user)
69702       return callback({ message: "No JSON", status: -1 });
69703     var objs = json.users || [json];
69704     var handle = window.requestIdleCallback(function() {
69705       _deferred.delete(handle);
69706       var results = [];
69707       var result;
69708       for (var i2 = 0; i2 < objs.length; i2++) {
69709         result = parseObj(objs[i2]);
69710         if (result)
69711           results.push(result);
69712       }
69713       callback(null, results);
69714     });
69715     _deferred.add(handle);
69716     function parseObj(obj) {
69717       var uid = obj.user.id && obj.user.id.toString();
69718       if (options2.skipSeen && _userCache.user[uid]) {
69719         delete _userCache.toLoad[uid];
69720         return null;
69721       }
69722       var user = jsonparsers.user(obj.user, uid);
69723       _userCache.user[uid] = user;
69724       delete _userCache.toLoad[uid];
69725       return user;
69726     }
69727   }
69728   var parsers = {
69729     node: function nodeData2(obj, uid) {
69730       var attrs = obj.attributes;
69731       return new osmNode({
69732         id: uid,
69733         visible: getVisible(attrs),
69734         version: attrs.version.value,
69735         changeset: attrs.changeset && attrs.changeset.value,
69736         timestamp: attrs.timestamp && attrs.timestamp.value,
69737         user: attrs.user && attrs.user.value,
69738         uid: attrs.uid && attrs.uid.value,
69739         loc: getLoc(attrs),
69740         tags: getTags(obj)
69741       });
69742     },
69743     way: function wayData2(obj, uid) {
69744       var attrs = obj.attributes;
69745       return new osmWay({
69746         id: uid,
69747         visible: getVisible(attrs),
69748         version: attrs.version.value,
69749         changeset: attrs.changeset && attrs.changeset.value,
69750         timestamp: attrs.timestamp && attrs.timestamp.value,
69751         user: attrs.user && attrs.user.value,
69752         uid: attrs.uid && attrs.uid.value,
69753         tags: getTags(obj),
69754         nodes: getNodes(obj)
69755       });
69756     },
69757     relation: function relationData2(obj, uid) {
69758       var attrs = obj.attributes;
69759       return new osmRelation({
69760         id: uid,
69761         visible: getVisible(attrs),
69762         version: attrs.version.value,
69763         changeset: attrs.changeset && attrs.changeset.value,
69764         timestamp: attrs.timestamp && attrs.timestamp.value,
69765         user: attrs.user && attrs.user.value,
69766         uid: attrs.uid && attrs.uid.value,
69767         tags: getTags(obj),
69768         members: getMembers(obj)
69769       });
69770     },
69771     note: function parseNote(obj, uid) {
69772       var attrs = obj.attributes;
69773       var childNodes = obj.childNodes;
69774       var props = {};
69775       props.id = uid;
69776       props.loc = getLoc(attrs);
69777       var coincident = false;
69778       var epsilon3 = 1e-5;
69779       do {
69780         if (coincident) {
69781           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
69782         }
69783         var bbox = geoExtent(props.loc).bbox();
69784         coincident = _noteCache.rtree.search(bbox).length;
69785       } while (coincident);
69786       for (var i2 = 0; i2 < childNodes.length; i2++) {
69787         var node = childNodes[i2];
69788         var nodeName = node.nodeName;
69789         if (nodeName === "#text")
69790           continue;
69791         if (nodeName === "comments") {
69792           props[nodeName] = parseComments(node.childNodes);
69793         } else {
69794           props[nodeName] = node.textContent;
69795         }
69796       }
69797       var note = new osmNote(props);
69798       var item = encodeNoteRtree(note);
69799       _noteCache.note[note.id] = note;
69800       _noteCache.rtree.insert(item);
69801       return note;
69802     },
69803     user: function parseUser2(obj, uid) {
69804       var attrs = obj.attributes;
69805       var user = {
69806         id: uid,
69807         display_name: attrs.display_name && attrs.display_name.value,
69808         account_created: attrs.account_created && attrs.account_created.value,
69809         changesets_count: "0",
69810         active_blocks: "0"
69811       };
69812       var img = obj.getElementsByTagName("img");
69813       if (img && img[0] && img[0].getAttribute("href")) {
69814         user.image_url = img[0].getAttribute("href");
69815       }
69816       var changesets = obj.getElementsByTagName("changesets");
69817       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
69818         user.changesets_count = changesets[0].getAttribute("count");
69819       }
69820       var blocks = obj.getElementsByTagName("blocks");
69821       if (blocks && blocks[0]) {
69822         var received = blocks[0].getElementsByTagName("received");
69823         if (received && received[0] && received[0].getAttribute("active")) {
69824           user.active_blocks = received[0].getAttribute("active");
69825         }
69826       }
69827       _userCache.user[uid] = user;
69828       delete _userCache.toLoad[uid];
69829       return user;
69830     }
69831   };
69832   function parseXML(xml, callback, options2) {
69833     options2 = Object.assign({ skipSeen: true }, options2);
69834     if (!xml || !xml.childNodes) {
69835       return callback({ message: "No XML", status: -1 });
69836     }
69837     var root3 = xml.childNodes[0];
69838     var children2 = root3.childNodes;
69839     var handle = window.requestIdleCallback(function() {
69840       _deferred.delete(handle);
69841       var results = [];
69842       var result;
69843       for (var i2 = 0; i2 < children2.length; i2++) {
69844         result = parseChild(children2[i2]);
69845         if (result)
69846           results.push(result);
69847       }
69848       callback(null, results);
69849     });
69850     _deferred.add(handle);
69851     function parseChild(child) {
69852       var parser3 = parsers[child.nodeName];
69853       if (!parser3)
69854         return null;
69855       var uid;
69856       if (child.nodeName === "user") {
69857         uid = child.attributes.id.value;
69858         if (options2.skipSeen && _userCache.user[uid]) {
69859           delete _userCache.toLoad[uid];
69860           return null;
69861         }
69862       } else if (child.nodeName === "note") {
69863         uid = child.getElementsByTagName("id")[0].textContent;
69864       } else {
69865         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
69866         if (options2.skipSeen) {
69867           if (_tileCache.seen[uid])
69868             return null;
69869           _tileCache.seen[uid] = true;
69870         }
69871       }
69872       return parser3(child, uid);
69873     }
69874   }
69875   function updateRtree4(item, replace) {
69876     _noteCache.rtree.remove(item, function isEql(a, b) {
69877       return a.data.id === b.data.id;
69878     });
69879     if (replace) {
69880       _noteCache.rtree.insert(item);
69881     }
69882   }
69883   function wrapcb(thisArg, callback, cid) {
69884     return function(err, result) {
69885       if (err) {
69886         if (err.status === 400 || err.status === 401 || err.status === 403) {
69887           thisArg.logout();
69888         }
69889         return callback.call(thisArg, err);
69890       } else if (thisArg.getConnectionId() !== cid) {
69891         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
69892       } else {
69893         return callback.call(thisArg, err, result);
69894       }
69895     };
69896   }
69897   var osm_default = {
69898     init: function() {
69899       utilRebind(this, dispatch7, "on");
69900     },
69901     reset: function() {
69902       Array.from(_deferred).forEach(function(handle) {
69903         window.cancelIdleCallback(handle);
69904         _deferred.delete(handle);
69905       });
69906       _connectionID++;
69907       _userChangesets = void 0;
69908       _userDetails = void 0;
69909       _rateLimitError = void 0;
69910       Object.values(_tileCache.inflight).forEach(abortRequest5);
69911       Object.values(_noteCache.inflight).forEach(abortRequest5);
69912       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
69913       if (_changeset.inflight)
69914         abortRequest5(_changeset.inflight);
69915       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
69916       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
69917       _userCache = { toLoad: {}, user: {} };
69918       _cachedApiStatus = void 0;
69919       _changeset = {};
69920       return this;
69921     },
69922     getConnectionId: function() {
69923       return _connectionID;
69924     },
69925     getUrlRoot: function() {
69926       return urlroot;
69927     },
69928     changesetURL: function(changesetID) {
69929       return urlroot + "/changeset/" + changesetID;
69930     },
69931     changesetsURL: function(center, zoom) {
69932       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
69933       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
69934     },
69935     entityURL: function(entity) {
69936       return urlroot + "/" + entity.type + "/" + entity.osmId();
69937     },
69938     historyURL: function(entity) {
69939       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
69940     },
69941     userURL: function(username) {
69942       return urlroot + "/user/" + encodeURIComponent(username);
69943     },
69944     noteURL: function(note) {
69945       return urlroot + "/note/" + note.id;
69946     },
69947     noteReportURL: function(note) {
69948       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
69949     },
69950     loadFromAPI: function(path, callback, options2) {
69951       options2 = Object.assign({ skipSeen: true }, options2);
69952       var that = this;
69953       var cid = _connectionID;
69954       function done(err, payload) {
69955         if (that.getConnectionId() !== cid) {
69956           if (callback)
69957             callback({ message: "Connection Switched", status: -1 });
69958           return;
69959         }
69960         var isAuthenticated = that.authenticated();
69961         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
69962           that.logout();
69963           that.loadFromAPI(path, callback, options2);
69964         } else {
69965           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
69966             _rateLimitError = err;
69967             dispatch7.call("change");
69968             that.reloadApiStatus();
69969           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
69970             that.reloadApiStatus();
69971           }
69972           if (callback) {
69973             if (err) {
69974               return callback(err);
69975             } else {
69976               if (path.indexOf(".json") !== -1) {
69977                 return parseJSON(payload, callback, options2);
69978               } else {
69979                 return parseXML(payload, callback, options2);
69980               }
69981             }
69982           }
69983         }
69984       }
69985       if (this.authenticated()) {
69986         return oauth.xhr({ method: "GET", path }, done);
69987       } else {
69988         var url = urlroot + path;
69989         var controller = new AbortController();
69990         var fn;
69991         if (path.indexOf(".json") !== -1) {
69992           fn = json_default;
69993         } else {
69994           fn = xml_default;
69995         }
69996         fn(url, { signal: controller.signal }).then(function(data) {
69997           done(null, data);
69998         }).catch(function(err) {
69999           if (err.name === "AbortError")
70000             return;
70001           var match = err.message.match(/^\d{3}/);
70002           if (match) {
70003             done({ status: +match[0], statusText: err.message });
70004           } else {
70005             done(err.message);
70006           }
70007         });
70008         return controller;
70009       }
70010     },
70011     loadEntity: function(id2, callback) {
70012       var type3 = osmEntity.id.type(id2);
70013       var osmID = osmEntity.id.toOSM(id2);
70014       var options2 = { skipSeen: false };
70015       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + (type3 !== "node" ? "/full" : "") + ".json", function(err, entities) {
70016         if (callback)
70017           callback(err, { data: entities });
70018       }, options2);
70019     },
70020     loadEntityVersion: function(id2, version2, callback) {
70021       var type3 = osmEntity.id.type(id2);
70022       var osmID = osmEntity.id.toOSM(id2);
70023       var options2 = { skipSeen: false };
70024       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/" + version2 + ".json", function(err, entities) {
70025         if (callback)
70026           callback(err, { data: entities });
70027       }, options2);
70028     },
70029     loadEntityRelations: function(id2, callback) {
70030       var type3 = osmEntity.id.type(id2);
70031       var osmID = osmEntity.id.toOSM(id2);
70032       var options2 = { skipSeen: false };
70033       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/relations.json", function(err, entities) {
70034         if (callback)
70035           callback(err, { data: entities });
70036       }, options2);
70037     },
70038     loadMultiple: function(ids, callback) {
70039       var that = this;
70040       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
70041       Object.keys(groups).forEach(function(k) {
70042         var type3 = k + "s";
70043         var osmIDs = groups[k].map(function(id2) {
70044           return osmEntity.id.toOSM(id2);
70045         });
70046         var options2 = { skipSeen: false };
70047         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
70048           that.loadFromAPI("/api/0.6/" + type3 + ".json?" + type3 + "=" + arr.join(), function(err, entities) {
70049             if (callback)
70050               callback(err, { data: entities });
70051           }, options2);
70052         });
70053       });
70054     },
70055     putChangeset: function(changeset, changes, callback) {
70056       var cid = _connectionID;
70057       if (_changeset.inflight) {
70058         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
70059       } else if (_changeset.open) {
70060         return createdChangeset.call(this, null, _changeset.open);
70061       } else {
70062         var options2 = {
70063           method: "PUT",
70064           path: "/api/0.6/changeset/create",
70065           headers: { "Content-Type": "text/xml" },
70066           content: JXON.stringify(changeset.asJXON())
70067         };
70068         _changeset.inflight = oauth.xhr(options2, wrapcb(this, createdChangeset, cid));
70069       }
70070       function createdChangeset(err, changesetID) {
70071         _changeset.inflight = null;
70072         if (err) {
70073           return callback(err, changeset);
70074         }
70075         _changeset.open = changesetID;
70076         changeset = changeset.update({ id: changesetID });
70077         var options3 = {
70078           method: "POST",
70079           path: "/api/0.6/changeset/" + changesetID + "/upload",
70080           headers: { "Content-Type": "text/xml" },
70081           content: JXON.stringify(changeset.osmChangeJXON(changes))
70082         };
70083         _changeset.inflight = oauth.xhr(options3, wrapcb(this, uploadedChangeset, cid));
70084       }
70085       function uploadedChangeset(err) {
70086         _changeset.inflight = null;
70087         if (err)
70088           return callback(err, changeset);
70089         window.setTimeout(function() {
70090           callback(null, changeset);
70091         }, 2500);
70092         _changeset.open = null;
70093         if (this.getConnectionId() === cid) {
70094           oauth.xhr({
70095             method: "PUT",
70096             path: "/api/0.6/changeset/" + changeset.id + "/close",
70097             headers: { "Content-Type": "text/xml" }
70098           }, function() {
70099             return true;
70100           });
70101         }
70102       }
70103     },
70104     loadUsers: function(uids, callback) {
70105       var toLoad = [];
70106       var cached = [];
70107       utilArrayUniq(uids).forEach(function(uid) {
70108         if (_userCache.user[uid]) {
70109           delete _userCache.toLoad[uid];
70110           cached.push(_userCache.user[uid]);
70111         } else {
70112           toLoad.push(uid);
70113         }
70114       });
70115       if (cached.length || !this.authenticated()) {
70116         callback(void 0, cached);
70117         if (!this.authenticated())
70118           return;
70119       }
70120       utilArrayChunk(toLoad, 150).forEach(function(arr) {
70121         oauth.xhr({ method: "GET", path: "/api/0.6/users.json?users=" + arr.join() }, wrapcb(this, done, _connectionID));
70122       }.bind(this));
70123       function done(err, payload) {
70124         if (err)
70125           return callback(err);
70126         var options2 = { skipSeen: true };
70127         return parseUserJSON(payload, function(err2, results) {
70128           if (err2)
70129             return callback(err2);
70130           return callback(void 0, results);
70131         }, options2);
70132       }
70133     },
70134     loadUser: function(uid, callback) {
70135       if (_userCache.user[uid] || !this.authenticated()) {
70136         delete _userCache.toLoad[uid];
70137         return callback(void 0, _userCache.user[uid]);
70138       }
70139       oauth.xhr({ method: "GET", path: "/api/0.6/user/" + uid + ".json" }, wrapcb(this, done, _connectionID));
70140       function done(err, payload) {
70141         if (err)
70142           return callback(err);
70143         var options2 = { skipSeen: true };
70144         return parseUserJSON(payload, function(err2, results) {
70145           if (err2)
70146             return callback(err2);
70147           return callback(void 0, results[0]);
70148         }, options2);
70149       }
70150     },
70151     userDetails: function(callback) {
70152       if (_userDetails) {
70153         return callback(void 0, _userDetails);
70154       }
70155       oauth.xhr({ method: "GET", path: "/api/0.6/user/details.json" }, wrapcb(this, done, _connectionID));
70156       function done(err, payload) {
70157         if (err)
70158           return callback(err);
70159         var options2 = { skipSeen: false };
70160         return parseUserJSON(payload, function(err2, results) {
70161           if (err2)
70162             return callback(err2);
70163           _userDetails = results[0];
70164           return callback(void 0, _userDetails);
70165         }, options2);
70166       }
70167     },
70168     userChangesets: function(callback) {
70169       if (_userChangesets) {
70170         return callback(void 0, _userChangesets);
70171       }
70172       this.userDetails(wrapcb(this, gotDetails, _connectionID));
70173       function gotDetails(err, user) {
70174         if (err) {
70175           return callback(err);
70176         }
70177         oauth.xhr({ method: "GET", path: "/api/0.6/changesets?user=" + user.id }, wrapcb(this, done, _connectionID));
70178       }
70179       function done(err, xml) {
70180         if (err) {
70181           return callback(err);
70182         }
70183         _userChangesets = Array.prototype.map.call(xml.getElementsByTagName("changeset"), function(changeset) {
70184           return { tags: getTags(changeset) };
70185         }).filter(function(changeset) {
70186           var comment = changeset.tags.comment;
70187           return comment && comment !== "";
70188         });
70189         return callback(void 0, _userChangesets);
70190       }
70191     },
70192     status: function(callback) {
70193       var url = urlroot + "/api/capabilities";
70194       var errback = wrapcb(this, done, _connectionID);
70195       xml_default(url).then(function(data) {
70196         errback(null, data);
70197       }).catch(function(err) {
70198         errback(err.message);
70199       });
70200       function done(err, xml) {
70201         if (err) {
70202           return callback(err, null);
70203         }
70204         var elements = xml.getElementsByTagName("blacklist");
70205         var regexes = [];
70206         for (var i2 = 0; i2 < elements.length; i2++) {
70207           var regexString = elements[i2].getAttribute("regex");
70208           if (regexString) {
70209             try {
70210               var regex = new RegExp(regexString);
70211               regexes.push(regex);
70212             } catch (e) {
70213             }
70214           }
70215         }
70216         if (regexes.length) {
70217           _imageryBlocklists = regexes;
70218         }
70219         if (_rateLimitError) {
70220           return callback(_rateLimitError, "rateLimited");
70221         } else {
70222           var waynodes = xml.getElementsByTagName("waynodes");
70223           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
70224           if (maxWayNodes && isFinite(maxWayNodes))
70225             _maxWayNodes = maxWayNodes;
70226           var apiStatus = xml.getElementsByTagName("status");
70227           var val = apiStatus[0].getAttribute("api");
70228           return callback(void 0, val);
70229         }
70230       }
70231     },
70232     reloadApiStatus: function() {
70233       if (!this.throttledReloadApiStatus) {
70234         var that = this;
70235         this.throttledReloadApiStatus = throttle_default(function() {
70236           that.status(function(err, status) {
70237             if (status !== _cachedApiStatus) {
70238               _cachedApiStatus = status;
70239               dispatch7.call("apiStatusChange", that, err, status);
70240             }
70241           });
70242         }, 500);
70243       }
70244       this.throttledReloadApiStatus();
70245     },
70246     maxWayNodes: function() {
70247       return _maxWayNodes;
70248     },
70249     loadTiles: function(projection2, callback) {
70250       if (_off)
70251         return;
70252       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
70253       var hadRequests = hasInflightRequests(_tileCache);
70254       abortUnwantedRequests4(_tileCache, tiles);
70255       if (hadRequests && !hasInflightRequests(_tileCache)) {
70256         dispatch7.call("loaded");
70257       }
70258       tiles.forEach(function(tile) {
70259         this.loadTile(tile, callback);
70260       }, this);
70261     },
70262     loadTile: function(tile, callback) {
70263       if (_off)
70264         return;
70265       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
70266         return;
70267       if (!hasInflightRequests(_tileCache)) {
70268         dispatch7.call("loading");
70269       }
70270       var path = "/api/0.6/map.json?bbox=";
70271       var options2 = { skipSeen: true };
70272       _tileCache.inflight[tile.id] = this.loadFromAPI(path + tile.extent.toParam(), tileCallback, options2);
70273       function tileCallback(err, parsed) {
70274         delete _tileCache.inflight[tile.id];
70275         if (!err) {
70276           delete _tileCache.toLoad[tile.id];
70277           _tileCache.loaded[tile.id] = true;
70278           var bbox = tile.extent.bbox();
70279           bbox.id = tile.id;
70280           _tileCache.rtree.insert(bbox);
70281         }
70282         if (callback) {
70283           callback(err, Object.assign({ data: parsed }, tile));
70284         }
70285         if (!hasInflightRequests(_tileCache)) {
70286           dispatch7.call("loaded");
70287         }
70288       }
70289     },
70290     isDataLoaded: function(loc) {
70291       var bbox = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
70292       return _tileCache.rtree.collides(bbox);
70293     },
70294     loadTileAtLoc: function(loc, callback) {
70295       if (Object.keys(_tileCache.toLoad).length > 50)
70296         return;
70297       var k = geoZoomToScale(_tileZoom4 + 1);
70298       var offset = geoRawMercator().scale(k)(loc);
70299       var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
70300       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
70301       tiles.forEach(function(tile) {
70302         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
70303           return;
70304         _tileCache.toLoad[tile.id] = true;
70305         this.loadTile(tile, callback);
70306       }, this);
70307     },
70308     loadNotes: function(projection2, noteOptions) {
70309       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
70310       if (_off)
70311         return;
70312       var that = this;
70313       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
70314       var throttleLoadUsers = throttle_default(function() {
70315         var uids = Object.keys(_userCache.toLoad);
70316         if (!uids.length)
70317           return;
70318         that.loadUsers(uids, function() {
70319         });
70320       }, 750);
70321       var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
70322       abortUnwantedRequests4(_noteCache, tiles);
70323       tiles.forEach(function(tile) {
70324         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
70325           return;
70326         var options2 = { skipSeen: false };
70327         _noteCache.inflight[tile.id] = that.loadFromAPI(path + tile.extent.toParam(), function(err) {
70328           delete _noteCache.inflight[tile.id];
70329           if (!err) {
70330             _noteCache.loaded[tile.id] = true;
70331           }
70332           throttleLoadUsers();
70333           dispatch7.call("loadedNotes");
70334         }, options2);
70335       });
70336     },
70337     postNoteCreate: function(note, callback) {
70338       if (!this.authenticated()) {
70339         return callback({ message: "Not Authenticated", status: -3 }, note);
70340       }
70341       if (_noteCache.inflightPost[note.id]) {
70342         return callback({ message: "Note update already inflight", status: -2 }, note);
70343       }
70344       if (!note.loc[0] || !note.loc[1] || !note.newComment)
70345         return;
70346       var comment = note.newComment;
70347       if (note.newCategory && note.newCategory !== "None") {
70348         comment += " #" + note.newCategory;
70349       }
70350       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
70351       _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
70352       function done(err, xml) {
70353         delete _noteCache.inflightPost[note.id];
70354         if (err) {
70355           return callback(err);
70356         }
70357         this.removeNote(note);
70358         var options2 = { skipSeen: false };
70359         return parseXML(xml, function(err2, results) {
70360           if (err2) {
70361             return callback(err2);
70362           } else {
70363             return callback(void 0, results[0]);
70364           }
70365         }, options2);
70366       }
70367     },
70368     postNoteUpdate: function(note, newStatus, callback) {
70369       if (!this.authenticated()) {
70370         return callback({ message: "Not Authenticated", status: -3 }, note);
70371       }
70372       if (_noteCache.inflightPost[note.id]) {
70373         return callback({ message: "Note update already inflight", status: -2 }, note);
70374       }
70375       var action;
70376       if (note.status !== "closed" && newStatus === "closed") {
70377         action = "close";
70378       } else if (note.status !== "open" && newStatus === "open") {
70379         action = "reopen";
70380       } else {
70381         action = "comment";
70382         if (!note.newComment)
70383           return;
70384       }
70385       var path = "/api/0.6/notes/" + note.id + "/" + action;
70386       if (note.newComment) {
70387         path += "?" + utilQsString({ text: note.newComment });
70388       }
70389       _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
70390       function done(err, xml) {
70391         delete _noteCache.inflightPost[note.id];
70392         if (err) {
70393           return callback(err);
70394         }
70395         this.removeNote(note);
70396         if (action === "close") {
70397           _noteCache.closed[note.id] = true;
70398         } else if (action === "reopen") {
70399           delete _noteCache.closed[note.id];
70400         }
70401         var options2 = { skipSeen: false };
70402         return parseXML(xml, function(err2, results) {
70403           if (err2) {
70404             return callback(err2);
70405           } else {
70406             return callback(void 0, results[0]);
70407           }
70408         }, options2);
70409       }
70410     },
70411     switch: function(newOptions) {
70412       urlroot = newOptions.url;
70413       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
70414       oauth.options(Object.assign(oldOptions, newOptions));
70415       this.reset();
70416       this.userChangesets(function() {
70417       });
70418       dispatch7.call("change");
70419       return this;
70420     },
70421     toggle: function(val) {
70422       _off = !val;
70423       return this;
70424     },
70425     isChangesetInflight: function() {
70426       return !!_changeset.inflight;
70427     },
70428     caches: function(obj) {
70429       function cloneCache(source) {
70430         var target = {};
70431         Object.keys(source).forEach(function(k) {
70432           if (k === "rtree") {
70433             target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
70434           } else if (k === "note") {
70435             target.note = {};
70436             Object.keys(source.note).forEach(function(id2) {
70437               target.note[id2] = osmNote(source.note[id2]);
70438             });
70439           } else {
70440             target[k] = JSON.parse(JSON.stringify(source[k]));
70441           }
70442         });
70443         return target;
70444       }
70445       if (!arguments.length) {
70446         return {
70447           tile: cloneCache(_tileCache),
70448           note: cloneCache(_noteCache),
70449           user: cloneCache(_userCache)
70450         };
70451       }
70452       if (obj === "get") {
70453         return {
70454           tile: _tileCache,
70455           note: _noteCache,
70456           user: _userCache
70457         };
70458       }
70459       if (obj.tile) {
70460         _tileCache = obj.tile;
70461         _tileCache.inflight = {};
70462       }
70463       if (obj.note) {
70464         _noteCache = obj.note;
70465         _noteCache.inflight = {};
70466         _noteCache.inflightPost = {};
70467       }
70468       if (obj.user) {
70469         _userCache = obj.user;
70470       }
70471       return this;
70472     },
70473     logout: function() {
70474       _userChangesets = void 0;
70475       _userDetails = void 0;
70476       oauth.logout();
70477       dispatch7.call("change");
70478       return this;
70479     },
70480     authenticated: function() {
70481       return oauth.authenticated();
70482     },
70483     authenticate: function(callback) {
70484       var that = this;
70485       var cid = _connectionID;
70486       _userChangesets = void 0;
70487       _userDetails = void 0;
70488       function done(err, res) {
70489         if (err) {
70490           if (callback)
70491             callback(err);
70492           return;
70493         }
70494         if (that.getConnectionId() !== cid) {
70495           if (callback)
70496             callback({ message: "Connection Switched", status: -1 });
70497           return;
70498         }
70499         _rateLimitError = void 0;
70500         dispatch7.call("change");
70501         if (callback)
70502           callback(err, res);
70503         that.userChangesets(function() {
70504         });
70505       }
70506       oauth.authenticate(done);
70507     },
70508     imageryBlocklists: function() {
70509       return _imageryBlocklists;
70510     },
70511     tileZoom: function(val) {
70512       if (!arguments.length)
70513         return _tileZoom4;
70514       _tileZoom4 = val;
70515       return this;
70516     },
70517     notes: function(projection2) {
70518       var viewport = projection2.clipExtent();
70519       var min3 = [viewport[0][0], viewport[1][1]];
70520       var max3 = [viewport[1][0], viewport[0][1]];
70521       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
70522       return _noteCache.rtree.search(bbox).map(function(d) {
70523         return d.data;
70524       });
70525     },
70526     getNote: function(id2) {
70527       return _noteCache.note[id2];
70528     },
70529     removeNote: function(note) {
70530       if (!(note instanceof osmNote) || !note.id)
70531         return;
70532       delete _noteCache.note[note.id];
70533       updateRtree4(encodeNoteRtree(note), false);
70534     },
70535     replaceNote: function(note) {
70536       if (!(note instanceof osmNote) || !note.id)
70537         return;
70538       _noteCache.note[note.id] = note;
70539       updateRtree4(encodeNoteRtree(note), true);
70540       return note;
70541     },
70542     getClosedIDs: function() {
70543       return Object.keys(_noteCache.closed).sort();
70544     }
70545   };
70546
70547   // modules/services/osm_wikibase.js
70548   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
70549   var _inflight2 = {};
70550   var _wikibaseCache = {};
70551   var _localeIDs = { en: false };
70552   var debouncedRequest = debounce_default(request, 500, { leading: false });
70553   function request(url, callback) {
70554     if (_inflight2[url])
70555       return;
70556     var controller = new AbortController();
70557     _inflight2[url] = controller;
70558     json_default(url, { signal: controller.signal }).then(function(result) {
70559       delete _inflight2[url];
70560       if (callback)
70561         callback(null, result);
70562     }).catch(function(err) {
70563       delete _inflight2[url];
70564       if (err.name === "AbortError")
70565         return;
70566       if (callback)
70567         callback(err.message);
70568     });
70569   }
70570   var osm_wikibase_default = {
70571     init: function() {
70572       _inflight2 = {};
70573       _wikibaseCache = {};
70574       _localeIDs = {};
70575     },
70576     reset: function() {
70577       Object.values(_inflight2).forEach(function(controller) {
70578         controller.abort();
70579       });
70580       _inflight2 = {};
70581     },
70582     claimToValue: function(entity, property, langCode) {
70583       if (!entity.claims[property])
70584         return void 0;
70585       var locale2 = _localeIDs[langCode];
70586       var preferredPick, localePick;
70587       entity.claims[property].forEach(function(stmt) {
70588         if (!preferredPick && stmt.rank === "preferred") {
70589           preferredPick = stmt;
70590         }
70591         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
70592           localePick = stmt;
70593         }
70594       });
70595       var result = localePick || preferredPick;
70596       if (result) {
70597         var datavalue = result.mainsnak.datavalue;
70598         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
70599       } else {
70600         return void 0;
70601       }
70602     },
70603     monolingualClaimToValueObj: function(entity, property) {
70604       if (!entity || !entity.claims[property])
70605         return void 0;
70606       return entity.claims[property].reduce(function(acc, obj) {
70607         var value = obj.mainsnak.datavalue.value;
70608         acc[value.language] = value.text;
70609         return acc;
70610       }, {});
70611     },
70612     toSitelink: function(key, value) {
70613       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
70614       return result.replace(/_/g, " ").trim();
70615     },
70616     getEntity: function(params, callback) {
70617       var doRequest = params.debounce ? debouncedRequest : request;
70618       var that = this;
70619       var titles = [];
70620       var result = {};
70621       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
70622       var keySitelink = params.key ? this.toSitelink(params.key) : false;
70623       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
70624       var localeSitelink;
70625       if (params.langCodes) {
70626         params.langCodes.forEach(function(langCode) {
70627           if (_localeIDs[langCode] === void 0) {
70628             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
70629             titles.push(localeSitelink);
70630           }
70631         });
70632       }
70633       if (rtypeSitelink) {
70634         if (_wikibaseCache[rtypeSitelink]) {
70635           result.rtype = _wikibaseCache[rtypeSitelink];
70636         } else {
70637           titles.push(rtypeSitelink);
70638         }
70639       }
70640       if (keySitelink) {
70641         if (_wikibaseCache[keySitelink]) {
70642           result.key = _wikibaseCache[keySitelink];
70643         } else {
70644           titles.push(keySitelink);
70645         }
70646       }
70647       if (tagSitelink) {
70648         if (_wikibaseCache[tagSitelink]) {
70649           result.tag = _wikibaseCache[tagSitelink];
70650         } else {
70651           titles.push(tagSitelink);
70652         }
70653       }
70654       if (!titles.length) {
70655         return callback(null, result);
70656       }
70657       var obj = {
70658         action: "wbgetentities",
70659         sites: "wiki",
70660         titles: titles.join("|"),
70661         languages: params.langCodes.join("|"),
70662         languagefallback: 1,
70663         origin: "*",
70664         format: "json"
70665       };
70666       var url = apibase3 + "?" + utilQsString(obj);
70667       doRequest(url, function(err, d) {
70668         if (err) {
70669           callback(err);
70670         } else if (!d.success || d.error) {
70671           callback(d.error.messages.map(function(v) {
70672             return v.html["*"];
70673           }).join("<br>"));
70674         } else {
70675           var localeID = false;
70676           Object.values(d.entities).forEach(function(res) {
70677             if (res.missing !== "") {
70678               var title = res.sitelinks.wiki.title;
70679               if (title === rtypeSitelink) {
70680                 _wikibaseCache[rtypeSitelink] = res;
70681                 result.rtype = res;
70682               } else if (title === keySitelink) {
70683                 _wikibaseCache[keySitelink] = res;
70684                 result.key = res;
70685               } else if (title === tagSitelink) {
70686                 _wikibaseCache[tagSitelink] = res;
70687                 result.tag = res;
70688               } else if (title === localeSitelink) {
70689                 localeID = res.id;
70690               } else {
70691                 console.log("Unexpected title " + title);
70692               }
70693             }
70694           });
70695           if (localeSitelink) {
70696             that.addLocale(params.langCodes[0], localeID);
70697           }
70698           callback(null, result);
70699         }
70700       });
70701     },
70702     getDocs: function(params, callback) {
70703       var that = this;
70704       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
70705         return code.toLowerCase();
70706       });
70707       params.langCodes = langCodes;
70708       this.getEntity(params, function(err, data) {
70709         if (err) {
70710           callback(err);
70711           return;
70712         }
70713         var entity = data.rtype || data.tag || data.key;
70714         if (!entity) {
70715           callback("No entity");
70716           return;
70717         }
70718         var i2;
70719         var description2;
70720         for (i2 in langCodes) {
70721           let code2 = langCodes[i2];
70722           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
70723             description2 = entity.descriptions[code2];
70724             break;
70725           }
70726         }
70727         if (!description2 && Object.values(entity.descriptions).length)
70728           description2 = Object.values(entity.descriptions)[0];
70729         var result = {
70730           title: entity.title,
70731           description: description2 ? description2.value : "",
70732           descriptionLocaleCode: description2 ? description2.language : "",
70733           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
70734         };
70735         if (entity.claims) {
70736           var imageroot;
70737           var image = that.claimToValue(entity, "P4", langCodes[0]);
70738           if (image) {
70739             imageroot = "https://commons.wikimedia.org/w/index.php";
70740           } else {
70741             image = that.claimToValue(entity, "P28", langCodes[0]);
70742             if (image) {
70743               imageroot = "https://wiki.openstreetmap.org/w/index.php";
70744             }
70745           }
70746           if (imageroot && image) {
70747             result.imageURL = imageroot + "?" + utilQsString({
70748               title: "Special:Redirect/file/" + image,
70749               width: 400
70750             });
70751           }
70752         }
70753         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
70754         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
70755         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
70756         var wikis = [rtypeWiki, tagWiki, keyWiki];
70757         for (i2 in wikis) {
70758           var wiki = wikis[i2];
70759           for (var j2 in langCodes) {
70760             var code = langCodes[j2];
70761             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
70762             var info = getWikiInfo(wiki, code, referenceId);
70763             if (info) {
70764               result.wiki = info;
70765               break;
70766             }
70767           }
70768           if (result.wiki)
70769             break;
70770         }
70771         callback(null, result);
70772         function getWikiInfo(wiki2, langCode, tKey) {
70773           if (wiki2 && wiki2[langCode]) {
70774             return {
70775               title: wiki2[langCode],
70776               text: tKey,
70777               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
70778             };
70779           }
70780         }
70781       });
70782     },
70783     addLocale: function(langCode, qid) {
70784       _localeIDs[langCode] = qid;
70785     },
70786     apibase: function(val) {
70787       if (!arguments.length)
70788         return apibase3;
70789       apibase3 = val;
70790       return this;
70791     }
70792   };
70793
70794   // modules/services/streetside.js
70795   var import_rbush10 = __toESM(require_rbush_min());
70796
70797   // modules/util/jsonp_request.js
70798   var jsonpCache = {};
70799   window.jsonpCache = jsonpCache;
70800   function jsonpRequest(url, callback) {
70801     var request3 = {
70802       abort: function() {
70803       }
70804     };
70805     if (window.JSONP_FIX) {
70806       if (window.JSONP_DELAY === 0) {
70807         callback(window.JSONP_FIX);
70808       } else {
70809         var t = window.setTimeout(function() {
70810           callback(window.JSONP_FIX);
70811         }, window.JSONP_DELAY || 0);
70812         request3.abort = function() {
70813           window.clearTimeout(t);
70814         };
70815       }
70816       return request3;
70817     }
70818     function rand() {
70819       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
70820       var c = "";
70821       var i2 = -1;
70822       while (++i2 < 15)
70823         c += chars.charAt(Math.floor(Math.random() * 52));
70824       return c;
70825     }
70826     function create2(url2) {
70827       var e = url2.match(/callback=(\w+)/);
70828       var c = e ? e[1] : rand();
70829       jsonpCache[c] = function(data) {
70830         if (jsonpCache[c]) {
70831           callback(data);
70832         }
70833         finalize();
70834       };
70835       function finalize() {
70836         delete jsonpCache[c];
70837         script.remove();
70838       }
70839       request3.abort = finalize;
70840       return "jsonpCache." + c;
70841     }
70842     var cb = create2(url);
70843     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
70844     return request3;
70845   }
70846
70847   // modules/services/streetside.js
70848   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
70849   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
70850   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
70851   var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
70852   var pannellumViewerJS = "pannellum-streetside/pannellum.js";
70853   var maxResults2 = 2e3;
70854   var tileZoom2 = 16.5;
70855   var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
70856   var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
70857   var minHfov = 10;
70858   var maxHfov = 90;
70859   var defaultHfov = 45;
70860   var _hires = false;
70861   var _resolution = 512;
70862   var _currScene = 0;
70863   var _ssCache;
70864   var _pannellumViewer;
70865   var _sceneOptions = {
70866     showFullscreenCtrl: false,
70867     autoLoad: true,
70868     compass: true,
70869     yaw: 0,
70870     minHfov,
70871     maxHfov,
70872     hfov: defaultHfov,
70873     type: "cubemap",
70874     cubeMap: []
70875   };
70876   var _loadViewerPromise3;
70877   function abortRequest6(i2) {
70878     i2.abort();
70879   }
70880   function localeTimestamp(s) {
70881     if (!s)
70882       return null;
70883     const options2 = { day: "numeric", month: "short", year: "numeric" };
70884     const d = new Date(s);
70885     if (isNaN(d.getTime()))
70886       return null;
70887     return d.toLocaleString(_mainLocalizer.localeCode(), options2);
70888   }
70889   function loadTiles3(which, url, projection2, margin) {
70890     const tiles = tiler6.margin(margin).getTiles(projection2);
70891     const cache = _ssCache[which];
70892     Object.keys(cache.inflight).forEach((k) => {
70893       const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
70894       if (!wanted) {
70895         abortRequest6(cache.inflight[k]);
70896         delete cache.inflight[k];
70897       }
70898     });
70899     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
70900   }
70901   function loadNextTilePage2(which, url, tile) {
70902     const cache = _ssCache[which];
70903     const nextPage = cache.nextPage[tile.id] || 0;
70904     const id2 = tile.id + "," + String(nextPage);
70905     if (cache.loaded[id2] || cache.inflight[id2])
70906       return;
70907     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
70908       cache.loaded[id2] = true;
70909       delete cache.inflight[id2];
70910       if (!bubbles)
70911         return;
70912       bubbles.shift();
70913       const features2 = bubbles.map((bubble) => {
70914         if (cache.points[bubble.id])
70915           return null;
70916         const loc = [bubble.lo, bubble.la];
70917         const d = {
70918           loc,
70919           key: bubble.id,
70920           ca: bubble.he,
70921           captured_at: bubble.cd,
70922           captured_by: "microsoft",
70923           pr: bubble.pr,
70924           ne: bubble.ne,
70925           pano: true,
70926           sequenceKey: null
70927         };
70928         cache.points[bubble.id] = d;
70929         if (bubble.pr === void 0) {
70930           cache.leaders.push(bubble.id);
70931         }
70932         return {
70933           minX: loc[0],
70934           minY: loc[1],
70935           maxX: loc[0],
70936           maxY: loc[1],
70937           data: d
70938         };
70939       }).filter(Boolean);
70940       cache.rtree.load(features2);
70941       connectSequences();
70942       if (which === "bubbles") {
70943         dispatch8.call("loadedImages");
70944       }
70945     });
70946   }
70947   function connectSequences() {
70948     let cache = _ssCache.bubbles;
70949     let keepLeaders = [];
70950     for (let i2 = 0; i2 < cache.leaders.length; i2++) {
70951       let bubble = cache.points[cache.leaders[i2]];
70952       let seen = {};
70953       let sequence = { key: bubble.key, bubbles: [] };
70954       let complete = false;
70955       do {
70956         sequence.bubbles.push(bubble);
70957         seen[bubble.key] = true;
70958         if (bubble.ne === void 0) {
70959           complete = true;
70960         } else {
70961           bubble = cache.points[bubble.ne];
70962         }
70963       } while (bubble && !seen[bubble.key] && !complete);
70964       if (complete) {
70965         _ssCache.sequences[sequence.key] = sequence;
70966         for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
70967           sequence.bubbles[j2].sequenceKey = sequence.key;
70968         }
70969         sequence.geojson = {
70970           type: "LineString",
70971           properties: {
70972             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
70973             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
70974             key: sequence.key
70975           },
70976           coordinates: sequence.bubbles.map((d) => d.loc)
70977         };
70978       } else {
70979         keepLeaders.push(cache.leaders[i2]);
70980       }
70981     }
70982     cache.leaders = keepLeaders;
70983   }
70984   function getBubbles(url, tile, callback) {
70985     let rect = tile.extent.rectangle();
70986     let urlForRequest = url + utilQsString({
70987       n: rect[3],
70988       s: rect[1],
70989       e: rect[2],
70990       w: rect[0],
70991       c: maxResults2,
70992       appkey: bubbleAppKey,
70993       jsCallback: "{callback}"
70994     });
70995     return jsonpRequest(urlForRequest, (data) => {
70996       if (!data || data.error) {
70997         callback(null);
70998       } else {
70999         callback(data);
71000       }
71001     });
71002   }
71003   function partitionViewport3(projection2) {
71004     let z = geoScaleToZoom(projection2.scale());
71005     let z2 = Math.ceil(z * 2) / 2 + 2.5;
71006     let tiler8 = utilTiler().zoomExtent([z2, z2]);
71007     return tiler8.getTiles(projection2).map((tile) => tile.extent);
71008   }
71009   function searchLimited3(limit, projection2, rtree) {
71010     limit = limit || 5;
71011     return partitionViewport3(projection2).reduce((result, extent) => {
71012       let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
71013       return found.length ? result.concat(found) : result;
71014     }, []);
71015   }
71016   function loadImage(imgInfo) {
71017     return new Promise((resolve) => {
71018       let img = new Image();
71019       img.onload = () => {
71020         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
71021         let ctx = canvas.getContext("2d");
71022         ctx.drawImage(img, imgInfo.x, imgInfo.y);
71023         resolve({ imgInfo, status: "ok" });
71024       };
71025       img.onerror = () => {
71026         resolve({ data: imgInfo, status: "error" });
71027       };
71028       img.setAttribute("crossorigin", "");
71029       img.src = imgInfo.url;
71030     });
71031   }
71032   function loadCanvas(imageGroup) {
71033     return Promise.all(imageGroup.map(loadImage)).then((data) => {
71034       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
71035       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
71036       let face = data[0].imgInfo.face;
71037       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
71038       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
71039     });
71040   }
71041   function loadFaces(faceGroup) {
71042     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
71043       return { status: "loadFaces done" };
71044     });
71045   }
71046   function setupCanvas(selection2, reset) {
71047     if (reset) {
71048       selection2.selectAll("#ideditor-stitcher-canvases").remove();
71049     }
71050     selection2.selectAll("#ideditor-stitcher-canvases").data([0]).enter().append("div").attr("id", "ideditor-stitcher-canvases").attr("display", "none").selectAll("canvas").data(["canvas01", "canvas02", "canvas03", "canvas10", "canvas11", "canvas12"]).enter().append("canvas").attr("id", (d) => "ideditor-" + d).attr("width", _resolution).attr("height", _resolution);
71051   }
71052   function qkToXY(qk) {
71053     let x = 0;
71054     let y = 0;
71055     let scale = 256;
71056     for (let i2 = qk.length; i2 > 0; i2--) {
71057       const key = qk[i2 - 1];
71058       x += +(key === "1" || key === "3") * scale;
71059       y += +(key === "2" || key === "3") * scale;
71060       scale *= 2;
71061     }
71062     return [x, y];
71063   }
71064   function getQuadKeys() {
71065     let dim = _resolution / 256;
71066     let quadKeys;
71067     if (dim === 16) {
71068       quadKeys = [
71069         "0000",
71070         "0001",
71071         "0010",
71072         "0011",
71073         "0100",
71074         "0101",
71075         "0110",
71076         "0111",
71077         "1000",
71078         "1001",
71079         "1010",
71080         "1011",
71081         "1100",
71082         "1101",
71083         "1110",
71084         "1111",
71085         "0002",
71086         "0003",
71087         "0012",
71088         "0013",
71089         "0102",
71090         "0103",
71091         "0112",
71092         "0113",
71093         "1002",
71094         "1003",
71095         "1012",
71096         "1013",
71097         "1102",
71098         "1103",
71099         "1112",
71100         "1113",
71101         "0020",
71102         "0021",
71103         "0030",
71104         "0031",
71105         "0120",
71106         "0121",
71107         "0130",
71108         "0131",
71109         "1020",
71110         "1021",
71111         "1030",
71112         "1031",
71113         "1120",
71114         "1121",
71115         "1130",
71116         "1131",
71117         "0022",
71118         "0023",
71119         "0032",
71120         "0033",
71121         "0122",
71122         "0123",
71123         "0132",
71124         "0133",
71125         "1022",
71126         "1023",
71127         "1032",
71128         "1033",
71129         "1122",
71130         "1123",
71131         "1132",
71132         "1133",
71133         "0200",
71134         "0201",
71135         "0210",
71136         "0211",
71137         "0300",
71138         "0301",
71139         "0310",
71140         "0311",
71141         "1200",
71142         "1201",
71143         "1210",
71144         "1211",
71145         "1300",
71146         "1301",
71147         "1310",
71148         "1311",
71149         "0202",
71150         "0203",
71151         "0212",
71152         "0213",
71153         "0302",
71154         "0303",
71155         "0312",
71156         "0313",
71157         "1202",
71158         "1203",
71159         "1212",
71160         "1213",
71161         "1302",
71162         "1303",
71163         "1312",
71164         "1313",
71165         "0220",
71166         "0221",
71167         "0230",
71168         "0231",
71169         "0320",
71170         "0321",
71171         "0330",
71172         "0331",
71173         "1220",
71174         "1221",
71175         "1230",
71176         "1231",
71177         "1320",
71178         "1321",
71179         "1330",
71180         "1331",
71181         "0222",
71182         "0223",
71183         "0232",
71184         "0233",
71185         "0322",
71186         "0323",
71187         "0332",
71188         "0333",
71189         "1222",
71190         "1223",
71191         "1232",
71192         "1233",
71193         "1322",
71194         "1323",
71195         "1332",
71196         "1333",
71197         "2000",
71198         "2001",
71199         "2010",
71200         "2011",
71201         "2100",
71202         "2101",
71203         "2110",
71204         "2111",
71205         "3000",
71206         "3001",
71207         "3010",
71208         "3011",
71209         "3100",
71210         "3101",
71211         "3110",
71212         "3111",
71213         "2002",
71214         "2003",
71215         "2012",
71216         "2013",
71217         "2102",
71218         "2103",
71219         "2112",
71220         "2113",
71221         "3002",
71222         "3003",
71223         "3012",
71224         "3013",
71225         "3102",
71226         "3103",
71227         "3112",
71228         "3113",
71229         "2020",
71230         "2021",
71231         "2030",
71232         "2031",
71233         "2120",
71234         "2121",
71235         "2130",
71236         "2131",
71237         "3020",
71238         "3021",
71239         "3030",
71240         "3031",
71241         "3120",
71242         "3121",
71243         "3130",
71244         "3131",
71245         "2022",
71246         "2023",
71247         "2032",
71248         "2033",
71249         "2122",
71250         "2123",
71251         "2132",
71252         "2133",
71253         "3022",
71254         "3023",
71255         "3032",
71256         "3033",
71257         "3122",
71258         "3123",
71259         "3132",
71260         "3133",
71261         "2200",
71262         "2201",
71263         "2210",
71264         "2211",
71265         "2300",
71266         "2301",
71267         "2310",
71268         "2311",
71269         "3200",
71270         "3201",
71271         "3210",
71272         "3211",
71273         "3300",
71274         "3301",
71275         "3310",
71276         "3311",
71277         "2202",
71278         "2203",
71279         "2212",
71280         "2213",
71281         "2302",
71282         "2303",
71283         "2312",
71284         "2313",
71285         "3202",
71286         "3203",
71287         "3212",
71288         "3213",
71289         "3302",
71290         "3303",
71291         "3312",
71292         "3313",
71293         "2220",
71294         "2221",
71295         "2230",
71296         "2231",
71297         "2320",
71298         "2321",
71299         "2330",
71300         "2331",
71301         "3220",
71302         "3221",
71303         "3230",
71304         "3231",
71305         "3320",
71306         "3321",
71307         "3330",
71308         "3331",
71309         "2222",
71310         "2223",
71311         "2232",
71312         "2233",
71313         "2322",
71314         "2323",
71315         "2332",
71316         "2333",
71317         "3222",
71318         "3223",
71319         "3232",
71320         "3233",
71321         "3322",
71322         "3323",
71323         "3332",
71324         "3333"
71325       ];
71326     } else if (dim === 8) {
71327       quadKeys = [
71328         "000",
71329         "001",
71330         "010",
71331         "011",
71332         "100",
71333         "101",
71334         "110",
71335         "111",
71336         "002",
71337         "003",
71338         "012",
71339         "013",
71340         "102",
71341         "103",
71342         "112",
71343         "113",
71344         "020",
71345         "021",
71346         "030",
71347         "031",
71348         "120",
71349         "121",
71350         "130",
71351         "131",
71352         "022",
71353         "023",
71354         "032",
71355         "033",
71356         "122",
71357         "123",
71358         "132",
71359         "133",
71360         "200",
71361         "201",
71362         "210",
71363         "211",
71364         "300",
71365         "301",
71366         "310",
71367         "311",
71368         "202",
71369         "203",
71370         "212",
71371         "213",
71372         "302",
71373         "303",
71374         "312",
71375         "313",
71376         "220",
71377         "221",
71378         "230",
71379         "231",
71380         "320",
71381         "321",
71382         "330",
71383         "331",
71384         "222",
71385         "223",
71386         "232",
71387         "233",
71388         "322",
71389         "323",
71390         "332",
71391         "333"
71392       ];
71393     } else if (dim === 4) {
71394       quadKeys = [
71395         "00",
71396         "01",
71397         "10",
71398         "11",
71399         "02",
71400         "03",
71401         "12",
71402         "13",
71403         "20",
71404         "21",
71405         "30",
71406         "31",
71407         "22",
71408         "23",
71409         "32",
71410         "33"
71411       ];
71412     } else {
71413       quadKeys = [
71414         "0",
71415         "1",
71416         "2",
71417         "3"
71418       ];
71419     }
71420     return quadKeys;
71421   }
71422   var streetside_default = {
71423     init: function() {
71424       if (!_ssCache) {
71425         this.reset();
71426       }
71427       this.event = utilRebind(this, dispatch8, "on");
71428     },
71429     reset: function() {
71430       if (_ssCache) {
71431         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
71432       }
71433       _ssCache = {
71434         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
71435         sequences: {}
71436       };
71437     },
71438     bubbles: function(projection2) {
71439       const limit = 5;
71440       return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
71441     },
71442     cachedImage: function(imageKey) {
71443       return _ssCache.bubbles.points[imageKey];
71444     },
71445     sequences: function(projection2) {
71446       const viewport = projection2.clipExtent();
71447       const min3 = [viewport[0][0], viewport[1][1]];
71448       const max3 = [viewport[1][0], viewport[0][1]];
71449       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
71450       let seen = {};
71451       let results = [];
71452       _ssCache.bubbles.rtree.search(bbox).forEach((d) => {
71453         const key = d.data.sequenceKey;
71454         if (key && !seen[key]) {
71455           seen[key] = true;
71456           results.push(_ssCache.sequences[key].geojson);
71457         }
71458       });
71459       return results;
71460     },
71461     loadBubbles: function(projection2, margin) {
71462       if (margin === void 0)
71463         margin = 2;
71464       loadTiles3("bubbles", bubbleApi, projection2, margin);
71465     },
71466     viewer: function() {
71467       return _pannellumViewer;
71468     },
71469     initViewer: function() {
71470       if (!window.pannellum)
71471         return;
71472       if (_pannellumViewer)
71473         return;
71474       _currScene += 1;
71475       const sceneID = _currScene.toString();
71476       const options2 = {
71477         "default": { firstScene: sceneID },
71478         scenes: {}
71479       };
71480       options2.scenes[sceneID] = _sceneOptions;
71481       _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
71482     },
71483     ensureViewerLoaded: function(context) {
71484       if (_loadViewerPromise3)
71485         return _loadViewerPromise3;
71486       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
71487       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
71488       let that = this;
71489       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71490       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
71491         select_default2(window).on(pointerPrefix + "move.streetside", () => {
71492           dispatch8.call("viewerChanged");
71493         }, true);
71494       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
71495         select_default2(window).on(pointerPrefix + "move.streetside", null);
71496         let t = timer((elapsed) => {
71497           dispatch8.call("viewerChanged");
71498           if (elapsed > 2e3) {
71499             t.stop();
71500           }
71501         });
71502       }).append("div").attr("class", "photo-attribution fillD");
71503       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
71504       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
71505       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
71506       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
71507       context.ui().photoviewer.on("resize.streetside", () => {
71508         if (_pannellumViewer) {
71509           _pannellumViewer.resize();
71510         }
71511       });
71512       _loadViewerPromise3 = new Promise((resolve, reject) => {
71513         let loadedCount = 0;
71514         function loaded() {
71515           loadedCount += 1;
71516           if (loadedCount === 2)
71517             resolve();
71518         }
71519         const head = select_default2("head");
71520         head.selectAll("#ideditor-streetside-viewercss").data([0]).enter().append("link").attr("id", "ideditor-streetside-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
71521           reject();
71522         });
71523         head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
71524           reject();
71525         });
71526       }).catch(function() {
71527         _loadViewerPromise3 = null;
71528       });
71529       return _loadViewerPromise3;
71530       function step(stepBy) {
71531         return () => {
71532           let viewer = context.container().select(".photoviewer");
71533           let selected = viewer.empty() ? void 0 : viewer.datum();
71534           if (!selected)
71535             return;
71536           let nextID = stepBy === 1 ? selected.ne : selected.pr;
71537           let yaw = _pannellumViewer.getYaw();
71538           let ca = selected.ca + yaw;
71539           let origin = selected.loc;
71540           const meters = 35;
71541           let p1 = [
71542             origin[0] + geoMetersToLon(meters / 5, origin[1]),
71543             origin[1]
71544           ];
71545           let p2 = [
71546             origin[0] + geoMetersToLon(meters / 2, origin[1]),
71547             origin[1] + geoMetersToLat(meters)
71548           ];
71549           let p3 = [
71550             origin[0] - geoMetersToLon(meters / 2, origin[1]),
71551             origin[1] + geoMetersToLat(meters)
71552           ];
71553           let p4 = [
71554             origin[0] - geoMetersToLon(meters / 5, origin[1]),
71555             origin[1]
71556           ];
71557           let poly = [p1, p2, p3, p4, p1];
71558           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
71559           poly = geoRotate(poly, -angle2, origin);
71560           let extent = poly.reduce((extent2, point) => {
71561             return extent2.extend(geoExtent(point));
71562           }, geoExtent());
71563           let minDist = Infinity;
71564           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
71565             if (d.data.key === selected.key)
71566               return;
71567             if (!geoPointInPolygon(d.data.loc, poly))
71568               return;
71569             let dist = geoVecLength(d.data.loc, selected.loc);
71570             let theta = selected.ca - d.data.ca;
71571             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
71572             if (minTheta > 20) {
71573               dist += 5;
71574             }
71575             if (dist < minDist) {
71576               nextID = d.data.key;
71577               minDist = dist;
71578             }
71579           });
71580           let nextBubble = nextID && that.cachedImage(nextID);
71581           if (!nextBubble)
71582             return;
71583           context.map().centerEase(nextBubble.loc);
71584           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
71585         };
71586       }
71587     },
71588     yaw: function(yaw) {
71589       if (typeof yaw !== "number")
71590         return yaw;
71591       _sceneOptions.yaw = yaw;
71592       return this;
71593     },
71594     showViewer: function(context) {
71595       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
71596       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
71597       if (isHidden) {
71598         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
71599         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
71600       }
71601       return this;
71602     },
71603     hideViewer: function(context) {
71604       let viewer = context.container().select(".photoviewer");
71605       if (!viewer.empty())
71606         viewer.datum(null);
71607       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
71608       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
71609       this.updateUrlImage(null);
71610       return this.setStyles(context, null, true);
71611     },
71612     selectImage: function(context, key) {
71613       let that = this;
71614       let d = this.cachedImage(key);
71615       let viewer = context.container().select(".photoviewer");
71616       if (!viewer.empty())
71617         viewer.datum(d);
71618       this.setStyles(context, null, true);
71619       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
71620       let attribution = wrap2.selectAll(".photo-attribution").html("");
71621       wrap2.selectAll(".pnlm-load-box").style("display", "block");
71622       if (!d)
71623         return this;
71624       this.updateUrlImage(key);
71625       _sceneOptions.northOffset = d.ca;
71626       let line1 = attribution.append("div").attr("class", "attribution-row");
71627       const hiresDomId = utilUniqueDomId("streetside-hires");
71628       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
71629       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
71630         d3_event.stopPropagation();
71631         _hires = !_hires;
71632         _resolution = _hires ? 1024 : 512;
71633         wrap2.call(setupCanvas, true);
71634         let viewstate = {
71635           yaw: _pannellumViewer.getYaw(),
71636           pitch: _pannellumViewer.getPitch(),
71637           hfov: _pannellumViewer.getHfov()
71638         };
71639         _sceneOptions = Object.assign(_sceneOptions, viewstate);
71640         that.selectImage(context, d.key).showViewer(context);
71641       });
71642       label.append("span").call(_t.append("streetside.hires"));
71643       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
71644       if (d.captured_by) {
71645         const yyyy = new Date().getFullYear();
71646         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
71647         captureInfo.append("span").text("|");
71648       }
71649       if (d.captured_at) {
71650         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
71651       }
71652       let line2 = attribution.append("div").attr("class", "attribution-row");
71653       line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d.loc[1] + "~" + d.loc[0] + "&lvl=17&dir=" + d.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
71654       line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d.key) + "&focus=photo&lat=" + d.loc[1] + "&lng=" + d.loc[0] + "&z=17").call(_t.append("streetside.report"));
71655       let bubbleIdQuadKey = d.key.toString(4);
71656       const paddingNeeded = 16 - bubbleIdQuadKey.length;
71657       for (let i2 = 0; i2 < paddingNeeded; i2++) {
71658         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
71659       }
71660       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
71661       const imgUrlSuffix = ".jpg?g=6338&n=z";
71662       const faceKeys = ["01", "02", "03", "10", "11", "12"];
71663       let quadKeys = getQuadKeys();
71664       let faces = faceKeys.map((faceKey) => {
71665         return quadKeys.map((quadKey) => {
71666           const xy = qkToXY(quadKey);
71667           return {
71668             face: faceKey,
71669             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
71670             x: xy[0],
71671             y: xy[1]
71672           };
71673         });
71674       });
71675       loadFaces(faces).then(function() {
71676         if (!_pannellumViewer) {
71677           that.initViewer();
71678         } else {
71679           _currScene += 1;
71680           let sceneID = _currScene.toString();
71681           _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
71682           if (_currScene > 2) {
71683             sceneID = (_currScene - 1).toString();
71684             _pannellumViewer.removeScene(sceneID);
71685           }
71686         }
71687       });
71688       return this;
71689     },
71690     getSequenceKeyForBubble: function(d) {
71691       return d && d.sequenceKey;
71692     },
71693     setStyles: function(context, hovered, reset) {
71694       if (reset) {
71695         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
71696         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
71697       }
71698       let hoveredBubbleKey = hovered && hovered.key;
71699       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
71700       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
71701       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
71702       let viewer = context.container().select(".photoviewer");
71703       let selected = viewer.empty() ? void 0 : viewer.datum();
71704       let selectedBubbleKey = selected && selected.key;
71705       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
71706       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
71707       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
71708       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
71709       context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d) => highlightedBubbleKeys.indexOf(d.key) !== -1).classed("hovered", (d) => d.key === hoveredBubbleKey).classed("currentView", (d) => d.key === selectedBubbleKey);
71710       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
71711       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
71712       function viewfieldPath() {
71713         let d = this.parentNode.__data__;
71714         if (d.pano && d.key !== selectedBubbleKey) {
71715           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
71716         } else {
71717           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
71718         }
71719       }
71720       return this;
71721     },
71722     updateUrlImage: function(imageKey) {
71723       if (!window.mocha) {
71724         var hash = utilStringQs(window.location.hash);
71725         if (imageKey) {
71726           hash.photo = "streetside/" + imageKey;
71727         } else {
71728           delete hash.photo;
71729         }
71730         window.location.replace("#" + utilQsString(hash, true));
71731       }
71732     },
71733     cache: function() {
71734       return _ssCache;
71735     }
71736   };
71737
71738   // modules/services/taginfo.js
71739   var apibase4 = "https://taginfo.openstreetmap.org/api/4/";
71740   var _inflight3 = {};
71741   var _popularKeys = {};
71742   var _taginfoCache = {};
71743   var tag_sorts = {
71744     point: "count_nodes",
71745     vertex: "count_nodes",
71746     area: "count_ways",
71747     line: "count_ways"
71748   };
71749   var tag_sort_members = {
71750     point: "count_node_members",
71751     vertex: "count_node_members",
71752     area: "count_way_members",
71753     line: "count_way_members",
71754     relation: "count_relation_members"
71755   };
71756   var tag_filters = {
71757     point: "nodes",
71758     vertex: "nodes",
71759     area: "ways",
71760     line: "ways"
71761   };
71762   var tag_members_fractions = {
71763     point: "count_node_members_fraction",
71764     vertex: "count_node_members_fraction",
71765     area: "count_way_members_fraction",
71766     line: "count_way_members_fraction",
71767     relation: "count_relation_members_fraction"
71768   };
71769   function sets(params, n2, o) {
71770     if (params.geometry && o[params.geometry]) {
71771       params[n2] = o[params.geometry];
71772     }
71773     return params;
71774   }
71775   function setFilter(params) {
71776     return sets(params, "filter", tag_filters);
71777   }
71778   function setSort(params) {
71779     return sets(params, "sortname", tag_sorts);
71780   }
71781   function setSortMembers(params) {
71782     return sets(params, "sortname", tag_sort_members);
71783   }
71784   function clean(params) {
71785     return utilObjectOmit(params, ["geometry", "debounce"]);
71786   }
71787   function filterKeys(type3) {
71788     var count_type = type3 ? "count_" + type3 : "count_all";
71789     return function(d) {
71790       return parseFloat(d[count_type]) > 2500 || d.in_wiki;
71791     };
71792   }
71793   function filterMultikeys(prefix) {
71794     return function(d) {
71795       var re2 = new RegExp("^" + prefix + "(.*)$");
71796       var matches = d.key.match(re2) || [];
71797       return matches.length === 2 && matches[1].indexOf(":") === -1;
71798     };
71799   }
71800   function filterValues(allowUpperCase) {
71801     return function(d) {
71802       if (d.value.match(/[;,]/) !== null)
71803         return false;
71804       if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
71805         return false;
71806       return parseFloat(d.fraction) > 0;
71807     };
71808   }
71809   function filterRoles(geometry) {
71810     return function(d) {
71811       if (d.role === "")
71812         return false;
71813       if (d.role.match(/[A-Z*;,]/) !== null)
71814         return false;
71815       return parseFloat(d[tag_members_fractions[geometry]]) > 0;
71816     };
71817   }
71818   function valKey(d) {
71819     return {
71820       value: d.key,
71821       title: d.key
71822     };
71823   }
71824   function valKeyDescription(d) {
71825     var obj = {
71826       value: d.value,
71827       title: d.description || d.value
71828     };
71829     if (d.count) {
71830       obj.count = d.count;
71831     }
71832     return obj;
71833   }
71834   function roleKey(d) {
71835     return {
71836       value: d.role,
71837       title: d.role
71838     };
71839   }
71840   function sortKeys(a, b) {
71841     return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
71842   }
71843   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
71844   function request2(url, params, exactMatch, callback, loaded) {
71845     if (_inflight3[url])
71846       return;
71847     if (checkCache(url, params, exactMatch, callback))
71848       return;
71849     var controller = new AbortController();
71850     _inflight3[url] = controller;
71851     json_default(url, { signal: controller.signal }).then(function(result) {
71852       delete _inflight3[url];
71853       if (loaded)
71854         loaded(null, result);
71855     }).catch(function(err) {
71856       delete _inflight3[url];
71857       if (err.name === "AbortError")
71858         return;
71859       if (loaded)
71860         loaded(err.message);
71861     });
71862   }
71863   function checkCache(url, params, exactMatch, callback) {
71864     var rp = params.rp || 25;
71865     var testQuery = params.query || "";
71866     var testUrl = url;
71867     do {
71868       var hit = _taginfoCache[testUrl];
71869       if (hit && (url === testUrl || hit.length < rp)) {
71870         callback(null, hit);
71871         return true;
71872       }
71873       if (exactMatch || !testQuery.length)
71874         return false;
71875       testQuery = testQuery.slice(0, -1);
71876       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
71877     } while (testQuery.length >= 0);
71878     return false;
71879   }
71880   var taginfo_default = {
71881     init: function() {
71882       _inflight3 = {};
71883       _taginfoCache = {};
71884       _popularKeys = {
71885         postal_code: true,
71886         full_name: true,
71887         loc_name: true,
71888         reg_name: true,
71889         short_name: true,
71890         sorting_name: true,
71891         artist_name: true,
71892         nat_name: true,
71893         long_name: true,
71894         "bridge:name": true
71895       };
71896       var params = {
71897         rp: 100,
71898         sortname: "values_all",
71899         sortorder: "desc",
71900         page: 1,
71901         debounce: false,
71902         lang: _mainLocalizer.languageCode()
71903       };
71904       this.keys(params, function(err, data) {
71905         if (err)
71906           return;
71907         data.forEach(function(d) {
71908           if (d.value === "opening_hours")
71909             return;
71910           _popularKeys[d.value] = true;
71911         });
71912       });
71913     },
71914     reset: function() {
71915       Object.values(_inflight3).forEach(function(controller) {
71916         controller.abort();
71917       });
71918       _inflight3 = {};
71919     },
71920     keys: function(params, callback) {
71921       var doRequest = params.debounce ? debouncedRequest2 : request2;
71922       params = clean(setSort(params));
71923       params = Object.assign({
71924         rp: 10,
71925         sortname: "count_all",
71926         sortorder: "desc",
71927         page: 1,
71928         lang: _mainLocalizer.languageCode()
71929       }, params);
71930       var url = apibase4 + "keys/all?" + utilQsString(params);
71931       doRequest(url, params, false, callback, function(err, d) {
71932         if (err) {
71933           callback(err);
71934         } else {
71935           var f2 = filterKeys(params.filter);
71936           var result = d.data.filter(f2).sort(sortKeys).map(valKey);
71937           _taginfoCache[url] = result;
71938           callback(null, result);
71939         }
71940       });
71941     },
71942     multikeys: function(params, callback) {
71943       var doRequest = params.debounce ? debouncedRequest2 : request2;
71944       params = clean(setSort(params));
71945       params = Object.assign({
71946         rp: 25,
71947         sortname: "count_all",
71948         sortorder: "desc",
71949         page: 1,
71950         lang: _mainLocalizer.languageCode()
71951       }, params);
71952       var prefix = params.query;
71953       var url = apibase4 + "keys/all?" + utilQsString(params);
71954       doRequest(url, params, true, callback, function(err, d) {
71955         if (err) {
71956           callback(err);
71957         } else {
71958           var f2 = filterMultikeys(prefix);
71959           var result = d.data.filter(f2).map(valKey);
71960           _taginfoCache[url] = result;
71961           callback(null, result);
71962         }
71963       });
71964     },
71965     values: function(params, callback) {
71966       var key = params.key;
71967       if (key && _popularKeys[key]) {
71968         callback(null, []);
71969         return;
71970       }
71971       var doRequest = params.debounce ? debouncedRequest2 : request2;
71972       params = clean(setSort(setFilter(params)));
71973       params = Object.assign({
71974         rp: 25,
71975         sortname: "count_all",
71976         sortorder: "desc",
71977         page: 1,
71978         lang: _mainLocalizer.languageCode()
71979       }, params);
71980       var url = apibase4 + "key/values?" + utilQsString(params);
71981       doRequest(url, params, false, callback, function(err, d) {
71982         if (err) {
71983           callback(err);
71984         } else {
71985           var re2 = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/;
71986           var allowUpperCase = re2.test(params.key);
71987           var f2 = filterValues(allowUpperCase);
71988           var result = d.data.filter(f2).map(valKeyDescription);
71989           _taginfoCache[url] = result;
71990           callback(null, result);
71991         }
71992       });
71993     },
71994     roles: function(params, callback) {
71995       var doRequest = params.debounce ? debouncedRequest2 : request2;
71996       var geometry = params.geometry;
71997       params = clean(setSortMembers(params));
71998       params = Object.assign({
71999         rp: 25,
72000         sortname: "count_all_members",
72001         sortorder: "desc",
72002         page: 1,
72003         lang: _mainLocalizer.languageCode()
72004       }, params);
72005       var url = apibase4 + "relation/roles?" + utilQsString(params);
72006       doRequest(url, params, true, callback, function(err, d) {
72007         if (err) {
72008           callback(err);
72009         } else {
72010           var f2 = filterRoles(geometry);
72011           var result = d.data.filter(f2).map(roleKey);
72012           _taginfoCache[url] = result;
72013           callback(null, result);
72014         }
72015       });
72016     },
72017     docs: function(params, callback) {
72018       var doRequest = params.debounce ? debouncedRequest2 : request2;
72019       params = clean(setSort(params));
72020       var path = "key/wiki_pages?";
72021       if (params.value) {
72022         path = "tag/wiki_pages?";
72023       } else if (params.rtype) {
72024         path = "relation/wiki_pages?";
72025       }
72026       var url = apibase4 + path + utilQsString(params);
72027       doRequest(url, params, true, callback, function(err, d) {
72028         if (err) {
72029           callback(err);
72030         } else {
72031           _taginfoCache[url] = d.data;
72032           callback(null, d.data);
72033         }
72034       });
72035     },
72036     apibase: function(_) {
72037       if (!arguments.length)
72038         return apibase4;
72039       apibase4 = _;
72040       return this;
72041     }
72042   };
72043
72044   // modules/services/vector_tile.js
72045   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
72046
72047   // node_modules/@turf/helpers/dist/es/index.js
72048   var earthRadius = 63710088e-1;
72049   var factors = {
72050     centimeters: earthRadius * 100,
72051     centimetres: earthRadius * 100,
72052     degrees: earthRadius / 111325,
72053     feet: earthRadius * 3.28084,
72054     inches: earthRadius * 39.37,
72055     kilometers: earthRadius / 1e3,
72056     kilometres: earthRadius / 1e3,
72057     meters: earthRadius,
72058     metres: earthRadius,
72059     miles: earthRadius / 1609.344,
72060     millimeters: earthRadius * 1e3,
72061     millimetres: earthRadius * 1e3,
72062     nauticalmiles: earthRadius / 1852,
72063     radians: 1,
72064     yards: earthRadius * 1.0936
72065   };
72066   var unitsFactors = {
72067     centimeters: 100,
72068     centimetres: 100,
72069     degrees: 1 / 111325,
72070     feet: 3.28084,
72071     inches: 39.37,
72072     kilometers: 1 / 1e3,
72073     kilometres: 1 / 1e3,
72074     meters: 1,
72075     metres: 1,
72076     miles: 1 / 1609.344,
72077     millimeters: 1e3,
72078     millimetres: 1e3,
72079     nauticalmiles: 1 / 1852,
72080     radians: 1 / earthRadius,
72081     yards: 1.0936133
72082   };
72083   function feature2(geom, properties, options2) {
72084     if (options2 === void 0) {
72085       options2 = {};
72086     }
72087     var feat = { type: "Feature" };
72088     if (options2.id === 0 || options2.id) {
72089       feat.id = options2.id;
72090     }
72091     if (options2.bbox) {
72092       feat.bbox = options2.bbox;
72093     }
72094     feat.properties = properties || {};
72095     feat.geometry = geom;
72096     return feat;
72097   }
72098   function polygon(coordinates, properties, options2) {
72099     if (options2 === void 0) {
72100       options2 = {};
72101     }
72102     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
72103       var ring = coordinates_1[_i];
72104       if (ring.length < 4) {
72105         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
72106       }
72107       for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
72108         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
72109           throw new Error("First and last Position are not equivalent.");
72110         }
72111       }
72112     }
72113     var geom = {
72114       type: "Polygon",
72115       coordinates
72116     };
72117     return feature2(geom, properties, options2);
72118   }
72119   function lineString(coordinates, properties, options2) {
72120     if (options2 === void 0) {
72121       options2 = {};
72122     }
72123     if (coordinates.length < 2) {
72124       throw new Error("coordinates must be an array of two or more positions");
72125     }
72126     var geom = {
72127       type: "LineString",
72128       coordinates
72129     };
72130     return feature2(geom, properties, options2);
72131   }
72132   function multiLineString(coordinates, properties, options2) {
72133     if (options2 === void 0) {
72134       options2 = {};
72135     }
72136     var geom = {
72137       type: "MultiLineString",
72138       coordinates
72139     };
72140     return feature2(geom, properties, options2);
72141   }
72142   function multiPolygon(coordinates, properties, options2) {
72143     if (options2 === void 0) {
72144       options2 = {};
72145     }
72146     var geom = {
72147       type: "MultiPolygon",
72148       coordinates
72149     };
72150     return feature2(geom, properties, options2);
72151   }
72152
72153   // node_modules/@turf/invariant/dist/es/index.js
72154   function getGeom(geojson) {
72155     if (geojson.type === "Feature") {
72156       return geojson.geometry;
72157     }
72158     return geojson;
72159   }
72160
72161   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
72162   function lineclip(points, bbox, result) {
72163     var len = points.length, codeA = bitCode(points[0], bbox), part = [], i2, codeB, lastCode;
72164     var a;
72165     var b;
72166     if (!result)
72167       result = [];
72168     for (i2 = 1; i2 < len; i2++) {
72169       a = points[i2 - 1];
72170       b = points[i2];
72171       codeB = lastCode = bitCode(b, bbox);
72172       while (true) {
72173         if (!(codeA | codeB)) {
72174           part.push(a);
72175           if (codeB !== lastCode) {
72176             part.push(b);
72177             if (i2 < len - 1) {
72178               result.push(part);
72179               part = [];
72180             }
72181           } else if (i2 === len - 1) {
72182             part.push(b);
72183           }
72184           break;
72185         } else if (codeA & codeB) {
72186           break;
72187         } else if (codeA) {
72188           a = intersect(a, b, codeA, bbox);
72189           codeA = bitCode(a, bbox);
72190         } else {
72191           b = intersect(a, b, codeB, bbox);
72192           codeB = bitCode(b, bbox);
72193         }
72194       }
72195       codeA = lastCode;
72196     }
72197     if (part.length)
72198       result.push(part);
72199     return result;
72200   }
72201   function polygonclip(points, bbox) {
72202     var result, edge, prev, prevInside, i2, p, inside;
72203     for (edge = 1; edge <= 8; edge *= 2) {
72204       result = [];
72205       prev = points[points.length - 1];
72206       prevInside = !(bitCode(prev, bbox) & edge);
72207       for (i2 = 0; i2 < points.length; i2++) {
72208         p = points[i2];
72209         inside = !(bitCode(p, bbox) & edge);
72210         if (inside !== prevInside)
72211           result.push(intersect(prev, p, edge, bbox));
72212         if (inside)
72213           result.push(p);
72214         prev = p;
72215         prevInside = inside;
72216       }
72217       points = result;
72218       if (!points.length)
72219         break;
72220     }
72221     return result;
72222   }
72223   function intersect(a, b, edge, bbox) {
72224     return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
72225   }
72226   function bitCode(p, bbox) {
72227     var code = 0;
72228     if (p[0] < bbox[0])
72229       code |= 1;
72230     else if (p[0] > bbox[2])
72231       code |= 2;
72232     if (p[1] < bbox[1])
72233       code |= 4;
72234     else if (p[1] > bbox[3])
72235       code |= 8;
72236     return code;
72237   }
72238
72239   // node_modules/@turf/bbox-clip/dist/es/index.js
72240   function bboxClip(feature3, bbox) {
72241     var geom = getGeom(feature3);
72242     var type3 = geom.type;
72243     var properties = feature3.type === "Feature" ? feature3.properties : {};
72244     var coords = geom.coordinates;
72245     switch (type3) {
72246       case "LineString":
72247       case "MultiLineString": {
72248         var lines_1 = [];
72249         if (type3 === "LineString") {
72250           coords = [coords];
72251         }
72252         coords.forEach(function(line) {
72253           lineclip(line, bbox, lines_1);
72254         });
72255         if (lines_1.length === 1) {
72256           return lineString(lines_1[0], properties);
72257         }
72258         return multiLineString(lines_1, properties);
72259       }
72260       case "Polygon":
72261         return polygon(clipPolygon(coords, bbox), properties);
72262       case "MultiPolygon":
72263         return multiPolygon(coords.map(function(poly) {
72264           return clipPolygon(poly, bbox);
72265         }), properties);
72266       default:
72267         throw new Error("geometry " + type3 + " not supported");
72268     }
72269   }
72270   function clipPolygon(rings, bbox) {
72271     var outRings = [];
72272     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
72273       var ring = rings_1[_i];
72274       var clipped = polygonclip(ring, bbox);
72275       if (clipped.length > 0) {
72276         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
72277           clipped.push(clipped[0]);
72278         }
72279         if (clipped.length >= 4) {
72280           outRings.push(clipped);
72281         }
72282       }
72283     }
72284     return outRings;
72285   }
72286
72287   // modules/services/vector_tile.js
72288   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
72289   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
72290   var import_pbf2 = __toESM(require_pbf());
72291   var import_vector_tile2 = __toESM(require_vector_tile());
72292   var tiler7 = utilTiler().tileSize(512).margin(1);
72293   var dispatch9 = dispatch_default("loadedData");
72294   var _vtCache;
72295   function abortRequest7(controller) {
72296     controller.abort();
72297   }
72298   function vtToGeoJSON(data, tile, mergeCache) {
72299     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
72300     var layers = Object.keys(vectorTile.layers);
72301     if (!Array.isArray(layers)) {
72302       layers = [layers];
72303     }
72304     var features2 = [];
72305     layers.forEach(function(layerID) {
72306       var layer = vectorTile.layers[layerID];
72307       if (layer) {
72308         for (var i2 = 0; i2 < layer.length; i2++) {
72309           var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
72310           var geometry = feature3.geometry;
72311           if (geometry.type === "Polygon") {
72312             geometry.type = "MultiPolygon";
72313             geometry.coordinates = [geometry.coordinates];
72314           }
72315           var isClipped = false;
72316           if (geometry.type === "MultiPolygon") {
72317             var featureClip = bboxClip(feature3, tile.extent.rectangle());
72318             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
72319               isClipped = true;
72320             }
72321             if (!feature3.geometry.coordinates.length)
72322               continue;
72323             if (!feature3.geometry.coordinates[0].length)
72324               continue;
72325           }
72326           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
72327           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
72328           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
72329           feature3.__featurehash__ = featurehash;
72330           feature3.__propertyhash__ = propertyhash;
72331           features2.push(feature3);
72332           if (isClipped && geometry.type === "MultiPolygon") {
72333             var merged = mergeCache[propertyhash];
72334             if (merged && merged.length) {
72335               var other = merged[0];
72336               var coords = import_polygon_clipping2.default.union(feature3.geometry.coordinates, other.geometry.coordinates);
72337               if (!coords || !coords.length) {
72338                 continue;
72339               }
72340               merged.push(feature3);
72341               for (var j2 = 0; j2 < merged.length; j2++) {
72342                 merged[j2].geometry.coordinates = coords;
72343                 merged[j2].__featurehash__ = featurehash;
72344               }
72345             } else {
72346               mergeCache[propertyhash] = [feature3];
72347             }
72348           }
72349         }
72350       }
72351     });
72352     return features2;
72353   }
72354   function loadTile2(source, tile) {
72355     if (source.loaded[tile.id] || source.inflight[tile.id])
72356       return;
72357     var url = source.template.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace(/\{[t-]y\}/, Math.pow(2, tile.xyz[2]) - tile.xyz[1] - 1).replace(/\{z(oom)?\}/, tile.xyz[2]).replace(/\{switch:([^}]+)\}/, function(s, r) {
72358       var subdomains = r.split(",");
72359       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
72360     });
72361     var controller = new AbortController();
72362     source.inflight[tile.id] = controller;
72363     fetch(url, { signal: controller.signal }).then(function(response) {
72364       if (!response.ok) {
72365         throw new Error(response.status + " " + response.statusText);
72366       }
72367       source.loaded[tile.id] = [];
72368       delete source.inflight[tile.id];
72369       return response.arrayBuffer();
72370     }).then(function(data) {
72371       if (!data) {
72372         throw new Error("No Data");
72373       }
72374       var z = tile.xyz[2];
72375       if (!source.canMerge[z]) {
72376         source.canMerge[z] = {};
72377       }
72378       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
72379       dispatch9.call("loadedData");
72380     }).catch(function() {
72381       source.loaded[tile.id] = [];
72382       delete source.inflight[tile.id];
72383     });
72384   }
72385   var vector_tile_default = {
72386     init: function() {
72387       if (!_vtCache) {
72388         this.reset();
72389       }
72390       this.event = utilRebind(this, dispatch9, "on");
72391     },
72392     reset: function() {
72393       for (var sourceID in _vtCache) {
72394         var source = _vtCache[sourceID];
72395         if (source && source.inflight) {
72396           Object.values(source.inflight).forEach(abortRequest7);
72397         }
72398       }
72399       _vtCache = {};
72400     },
72401     addSource: function(sourceID, template) {
72402       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
72403       return _vtCache[sourceID];
72404     },
72405     data: function(sourceID, projection2) {
72406       var source = _vtCache[sourceID];
72407       if (!source)
72408         return [];
72409       var tiles = tiler7.getTiles(projection2);
72410       var seen = {};
72411       var results = [];
72412       for (var i2 = 0; i2 < tiles.length; i2++) {
72413         var features2 = source.loaded[tiles[i2].id];
72414         if (!features2 || !features2.length)
72415           continue;
72416         for (var j2 = 0; j2 < features2.length; j2++) {
72417           var feature3 = features2[j2];
72418           var hash = feature3.__featurehash__;
72419           if (seen[hash])
72420             continue;
72421           seen[hash] = true;
72422           results.push(Object.assign({}, feature3));
72423         }
72424       }
72425       return results;
72426     },
72427     loadTiles: function(sourceID, template, projection2) {
72428       var source = _vtCache[sourceID];
72429       if (!source) {
72430         source = this.addSource(sourceID, template);
72431       }
72432       var tiles = tiler7.getTiles(projection2);
72433       Object.keys(source.inflight).forEach(function(k) {
72434         var wanted = tiles.find(function(tile) {
72435           return k === tile.id;
72436         });
72437         if (!wanted) {
72438           abortRequest7(source.inflight[k]);
72439           delete source.inflight[k];
72440         }
72441       });
72442       tiles.forEach(function(tile) {
72443         loadTile2(source, tile);
72444       });
72445     },
72446     cache: function() {
72447       return _vtCache;
72448     }
72449   };
72450
72451   // modules/services/wikidata.js
72452   var apibase5 = "https://www.wikidata.org/w/api.php?";
72453   var _wikidataCache = {};
72454   var wikidata_default = {
72455     init: function() {
72456     },
72457     reset: function() {
72458       _wikidataCache = {};
72459     },
72460     itemsForSearchQuery: function(query, callback) {
72461       if (!query) {
72462         if (callback)
72463           callback("No query", {});
72464         return;
72465       }
72466       var lang = this.languagesToQuery()[0];
72467       var url = apibase5 + utilQsString({
72468         action: "wbsearchentities",
72469         format: "json",
72470         formatversion: 2,
72471         search: query,
72472         type: "item",
72473         language: lang,
72474         uselang: lang,
72475         limit: 10,
72476         origin: "*"
72477       });
72478       json_default(url).then(function(result) {
72479         if (result && result.error) {
72480           throw new Error(result.error);
72481         }
72482         if (callback)
72483           callback(null, result.search || {});
72484       }).catch(function(err) {
72485         if (callback)
72486           callback(err.message, {});
72487       });
72488     },
72489     itemsByTitle: function(lang, title, callback) {
72490       if (!title) {
72491         if (callback)
72492           callback("No title", {});
72493         return;
72494       }
72495       lang = lang || "en";
72496       var url = apibase5 + utilQsString({
72497         action: "wbgetentities",
72498         format: "json",
72499         formatversion: 2,
72500         sites: lang.replace(/-/g, "_") + "wiki",
72501         titles: title,
72502         languages: "en",
72503         origin: "*"
72504       });
72505       json_default(url).then(function(result) {
72506         if (result && result.error) {
72507           throw new Error(result.error);
72508         }
72509         if (callback)
72510           callback(null, result.entities || {});
72511       }).catch(function(err) {
72512         if (callback)
72513           callback(err.message, {});
72514       });
72515     },
72516     languagesToQuery: function() {
72517       return _mainLocalizer.localeCodes().map(function(code) {
72518         return code.toLowerCase();
72519       }).filter(function(code) {
72520         return code !== "en-us";
72521       });
72522     },
72523     entityByQID: function(qid, callback) {
72524       if (!qid) {
72525         callback("No qid", {});
72526         return;
72527       }
72528       if (_wikidataCache[qid]) {
72529         if (callback)
72530           callback(null, _wikidataCache[qid]);
72531         return;
72532       }
72533       var langs = this.languagesToQuery();
72534       var url = apibase5 + utilQsString({
72535         action: "wbgetentities",
72536         format: "json",
72537         formatversion: 2,
72538         ids: qid,
72539         props: "labels|descriptions|claims|sitelinks",
72540         sitefilter: langs.map(function(d) {
72541           return d + "wiki";
72542         }).join("|"),
72543         languages: langs.join("|"),
72544         languagefallback: 1,
72545         origin: "*"
72546       });
72547       json_default(url).then(function(result) {
72548         if (result && result.error) {
72549           throw new Error(result.error);
72550         }
72551         if (callback)
72552           callback(null, result.entities[qid] || {});
72553       }).catch(function(err) {
72554         if (callback)
72555           callback(err.message, {});
72556       });
72557     },
72558     getDocs: function(params, callback) {
72559       var langs = this.languagesToQuery();
72560       this.entityByQID(params.qid, function(err, entity) {
72561         if (err || !entity) {
72562           callback(err || "No entity");
72563           return;
72564         }
72565         var i2;
72566         var description2;
72567         for (i2 in langs) {
72568           let code = langs[i2];
72569           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
72570             description2 = entity.descriptions[code];
72571             break;
72572           }
72573         }
72574         if (!description2 && Object.values(entity.descriptions).length)
72575           description2 = Object.values(entity.descriptions)[0];
72576         var result = {
72577           title: entity.id,
72578           description: description2 ? description2.value : "",
72579           descriptionLocaleCode: description2 ? description2.language : "",
72580           editURL: "https://www.wikidata.org/wiki/" + entity.id
72581         };
72582         if (entity.claims) {
72583           var imageroot = "https://commons.wikimedia.org/w/index.php";
72584           var props = ["P154", "P18"];
72585           var prop, image;
72586           for (i2 = 0; i2 < props.length; i2++) {
72587             prop = entity.claims[props[i2]];
72588             if (prop && Object.keys(prop).length > 0) {
72589               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
72590               if (image) {
72591                 result.imageURL = imageroot + "?" + utilQsString({
72592                   title: "Special:Redirect/file/" + image,
72593                   width: 400
72594                 });
72595                 break;
72596               }
72597             }
72598           }
72599         }
72600         if (entity.sitelinks) {
72601           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
72602           for (i2 = 0; i2 < langs.length; i2++) {
72603             var w = langs[i2] + "wiki";
72604             if (entity.sitelinks[w]) {
72605               var title = entity.sitelinks[w].title;
72606               var tKey = "inspector.wiki_reference";
72607               if (!englishLocale && langs[i2] === "en") {
72608                 tKey = "inspector.wiki_en_reference";
72609               }
72610               result.wiki = {
72611                 title,
72612                 text: tKey,
72613                 url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
72614               };
72615               break;
72616             }
72617           }
72618         }
72619         callback(null, result);
72620       });
72621     }
72622   };
72623
72624   // modules/services/wikipedia.js
72625   var endpoint = "https://en.wikipedia.org/w/api.php?";
72626   var wikipedia_default = {
72627     init: function() {
72628     },
72629     reset: function() {
72630     },
72631     search: function(lang, query, callback) {
72632       if (!query) {
72633         if (callback)
72634           callback("No Query", []);
72635         return;
72636       }
72637       lang = lang || "en";
72638       var url = endpoint.replace("en", lang) + utilQsString({
72639         action: "query",
72640         list: "search",
72641         srlimit: "10",
72642         srinfo: "suggestion",
72643         format: "json",
72644         origin: "*",
72645         srsearch: query
72646       });
72647       json_default(url).then(function(result) {
72648         if (result && result.error) {
72649           throw new Error(result.error);
72650         } else if (!result || !result.query || !result.query.search) {
72651           throw new Error("No Results");
72652         }
72653         if (callback) {
72654           var titles = result.query.search.map(function(d) {
72655             return d.title;
72656           });
72657           callback(null, titles);
72658         }
72659       }).catch(function(err) {
72660         if (callback)
72661           callback(err, []);
72662       });
72663     },
72664     suggestions: function(lang, query, callback) {
72665       if (!query) {
72666         if (callback)
72667           callback("", []);
72668         return;
72669       }
72670       lang = lang || "en";
72671       var url = endpoint.replace("en", lang) + utilQsString({
72672         action: "opensearch",
72673         namespace: 0,
72674         suggest: "",
72675         format: "json",
72676         origin: "*",
72677         search: query
72678       });
72679       json_default(url).then(function(result) {
72680         if (result && result.error) {
72681           throw new Error(result.error);
72682         } else if (!result || result.length < 2) {
72683           throw new Error("No Results");
72684         }
72685         if (callback)
72686           callback(null, result[1] || []);
72687       }).catch(function(err) {
72688         if (callback)
72689           callback(err.message, []);
72690       });
72691     },
72692     translations: function(lang, title, callback) {
72693       if (!title) {
72694         if (callback)
72695           callback("No Title");
72696         return;
72697       }
72698       var url = endpoint.replace("en", lang) + utilQsString({
72699         action: "query",
72700         prop: "langlinks",
72701         format: "json",
72702         origin: "*",
72703         lllimit: 500,
72704         titles: title
72705       });
72706       json_default(url).then(function(result) {
72707         if (result && result.error) {
72708           throw new Error(result.error);
72709         } else if (!result || !result.query || !result.query.pages) {
72710           throw new Error("No Results");
72711         }
72712         if (callback) {
72713           var list = result.query.pages[Object.keys(result.query.pages)[0]];
72714           var translations = {};
72715           if (list && list.langlinks) {
72716             list.langlinks.forEach(function(d) {
72717               translations[d.lang] = d["*"];
72718             });
72719           }
72720           callback(null, translations);
72721         }
72722       }).catch(function(err) {
72723         if (callback)
72724           callback(err.message);
72725       });
72726     }
72727   };
72728
72729   // modules/services/index.js
72730   var services = {
72731     geocoder: nominatim_default,
72732     keepRight: keepRight_default,
72733     improveOSM: improveOSM_default,
72734     osmose: osmose_default,
72735     mapillary: mapillary_default,
72736     nsi: nsi_default,
72737     kartaview: kartaview_default,
72738     osm: osm_default,
72739     osmWikibase: osm_wikibase_default,
72740     maprules: maprules_default,
72741     streetside: streetside_default,
72742     taginfo: taginfo_default,
72743     vectorTile: vector_tile_default,
72744     wikidata: wikidata_default,
72745     wikipedia: wikipedia_default
72746   };
72747
72748   // modules/modes/drag_note.js
72749   function modeDragNote(context) {
72750     var mode = {
72751       id: "drag-note",
72752       button: "browse"
72753     };
72754     var edit2 = behaviorEdit(context);
72755     var _nudgeInterval;
72756     var _lastLoc;
72757     var _note;
72758     function startNudge(d3_event, nudge) {
72759       if (_nudgeInterval)
72760         window.clearInterval(_nudgeInterval);
72761       _nudgeInterval = window.setInterval(function() {
72762         context.map().pan(nudge);
72763         doMove(d3_event, nudge);
72764       }, 50);
72765     }
72766     function stopNudge() {
72767       if (_nudgeInterval) {
72768         window.clearInterval(_nudgeInterval);
72769         _nudgeInterval = null;
72770       }
72771     }
72772     function origin(note) {
72773       return context.projection(note.loc);
72774     }
72775     function start2(d3_event, note) {
72776       _note = note;
72777       var osm = services.osm;
72778       if (osm) {
72779         _note = osm.getNote(_note.id);
72780       }
72781       context.surface().selectAll(".note-" + _note.id).classed("active", true);
72782       context.perform(actionNoop());
72783       context.enter(mode);
72784       context.selectedNoteID(_note.id);
72785     }
72786     function move(d3_event, entity, point) {
72787       d3_event.stopPropagation();
72788       _lastLoc = context.projection.invert(point);
72789       doMove(d3_event);
72790       var nudge = geoViewportEdge(point, context.map().dimensions());
72791       if (nudge) {
72792         startNudge(d3_event, nudge);
72793       } else {
72794         stopNudge();
72795       }
72796     }
72797     function doMove(d3_event, nudge) {
72798       nudge = nudge || [0, 0];
72799       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
72800       var currMouse = geoVecSubtract(currPoint, nudge);
72801       var loc = context.projection.invert(currMouse);
72802       _note = _note.move(loc);
72803       var osm = services.osm;
72804       if (osm) {
72805         osm.replaceNote(_note);
72806       }
72807       context.replace(actionNoop());
72808     }
72809     function end() {
72810       context.replace(actionNoop());
72811       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
72812     }
72813     var drag = behaviorDrag().selector(".layer-touch.markers .target.note.new").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
72814     mode.enter = function() {
72815       context.install(edit2);
72816     };
72817     mode.exit = function() {
72818       context.ui().sidebar.hover.cancel();
72819       context.uninstall(edit2);
72820       context.surface().selectAll(".active").classed("active", false);
72821       stopNudge();
72822     };
72823     mode.behavior = drag;
72824     return mode;
72825   }
72826
72827   // modules/modes/select_data.js
72828   function modeSelectData(context, selectedDatum) {
72829     var mode = {
72830       id: "select-data",
72831       button: "browse"
72832     };
72833     var keybinding = utilKeybinding("select-data");
72834     var dataEditor = uiDataEditor(context);
72835     var behaviors = [
72836       behaviorBreathe(context),
72837       behaviorHover(context),
72838       behaviorSelect(context),
72839       behaviorLasso(context),
72840       modeDragNode(context).behavior,
72841       modeDragNote(context).behavior
72842     ];
72843     function selectData(d3_event, drawn) {
72844       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
72845       if (selection2.empty()) {
72846         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
72847         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
72848           context.enter(modeBrowse(context));
72849         }
72850       } else {
72851         selection2.classed("selected", true);
72852       }
72853     }
72854     function esc() {
72855       if (context.container().select(".combobox").size())
72856         return;
72857       context.enter(modeBrowse(context));
72858     }
72859     mode.zoomToSelected = function() {
72860       var extent = geoExtent(bounds_default(selectedDatum));
72861       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
72862     };
72863     mode.enter = function() {
72864       behaviors.forEach(context.install);
72865       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
72866       select_default2(document).call(keybinding);
72867       selectData();
72868       var sidebar = context.ui().sidebar;
72869       sidebar.show(dataEditor.datum(selectedDatum));
72870       var extent = geoExtent(bounds_default(selectedDatum));
72871       sidebar.expand(sidebar.intersects(extent));
72872       context.map().on("drawn.select-data", selectData);
72873     };
72874     mode.exit = function() {
72875       behaviors.forEach(context.uninstall);
72876       select_default2(document).call(keybinding.unbind);
72877       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
72878       context.map().on("drawn.select-data", null);
72879       context.ui().sidebar.hide();
72880     };
72881     return mode;
72882   }
72883
72884   // modules/behavior/select.js
72885   function behaviorSelect(context) {
72886     var _tolerancePx = 4;
72887     var _lastMouseEvent = null;
72888     var _showMenu = false;
72889     var _downPointers = {};
72890     var _longPressTimeout = null;
72891     var _lastInteractionType = null;
72892     var _multiselectionPointerId = null;
72893     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72894     function keydown(d3_event) {
72895       if (d3_event.keyCode === 32) {
72896         var activeNode = document.activeElement;
72897         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
72898           return;
72899       }
72900       if (d3_event.keyCode === 93 || d3_event.keyCode === 32) {
72901         d3_event.preventDefault();
72902       }
72903       if (d3_event.repeat)
72904         return;
72905       cancelLongPress();
72906       if (d3_event.shiftKey) {
72907         context.surface().classed("behavior-multiselect", true);
72908       }
72909       if (d3_event.keyCode === 32) {
72910         if (!_downPointers.spacebar && _lastMouseEvent) {
72911           cancelLongPress();
72912           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
72913           _downPointers.spacebar = {
72914             firstEvent: _lastMouseEvent,
72915             lastEvent: _lastMouseEvent
72916           };
72917         }
72918       }
72919     }
72920     function keyup(d3_event) {
72921       cancelLongPress();
72922       if (!d3_event.shiftKey) {
72923         context.surface().classed("behavior-multiselect", false);
72924       }
72925       if (d3_event.keyCode === 93) {
72926         d3_event.preventDefault();
72927         _lastInteractionType = "menukey";
72928         contextmenu(d3_event);
72929       } else if (d3_event.keyCode === 32) {
72930         var pointer = _downPointers.spacebar;
72931         if (pointer) {
72932           delete _downPointers.spacebar;
72933           if (pointer.done)
72934             return;
72935           d3_event.preventDefault();
72936           _lastInteractionType = "spacebar";
72937           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
72938         }
72939       }
72940     }
72941     function pointerdown(d3_event) {
72942       var id2 = (d3_event.pointerId || "mouse").toString();
72943       cancelLongPress();
72944       if (d3_event.buttons && d3_event.buttons !== 1)
72945         return;
72946       context.ui().closeEditMenu();
72947       _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
72948       _downPointers[id2] = {
72949         firstEvent: d3_event,
72950         lastEvent: d3_event
72951       };
72952     }
72953     function didLongPress(id2, interactionType) {
72954       var pointer = _downPointers[id2];
72955       if (!pointer)
72956         return;
72957       for (var i2 in _downPointers) {
72958         _downPointers[i2].done = true;
72959       }
72960       _longPressTimeout = null;
72961       _lastInteractionType = interactionType;
72962       _showMenu = true;
72963       click(pointer.firstEvent, pointer.lastEvent, id2);
72964     }
72965     function pointermove(d3_event) {
72966       var id2 = (d3_event.pointerId || "mouse").toString();
72967       if (_downPointers[id2]) {
72968         _downPointers[id2].lastEvent = d3_event;
72969       }
72970       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
72971         _lastMouseEvent = d3_event;
72972         if (_downPointers.spacebar) {
72973           _downPointers.spacebar.lastEvent = d3_event;
72974         }
72975       }
72976     }
72977     function pointerup(d3_event) {
72978       var id2 = (d3_event.pointerId || "mouse").toString();
72979       var pointer = _downPointers[id2];
72980       if (!pointer)
72981         return;
72982       delete _downPointers[id2];
72983       if (_multiselectionPointerId === id2) {
72984         _multiselectionPointerId = null;
72985       }
72986       if (pointer.done)
72987         return;
72988       click(pointer.firstEvent, d3_event, id2);
72989     }
72990     function pointercancel(d3_event) {
72991       var id2 = (d3_event.pointerId || "mouse").toString();
72992       if (!_downPointers[id2])
72993         return;
72994       delete _downPointers[id2];
72995       if (_multiselectionPointerId === id2) {
72996         _multiselectionPointerId = null;
72997       }
72998     }
72999     function contextmenu(d3_event) {
73000       d3_event.preventDefault();
73001       if (!+d3_event.clientX && !+d3_event.clientY) {
73002         if (_lastMouseEvent) {
73003           d3_event.sourceEvent = _lastMouseEvent;
73004         } else {
73005           return;
73006         }
73007       } else {
73008         _lastMouseEvent = d3_event;
73009         _lastInteractionType = "rightclick";
73010       }
73011       _showMenu = true;
73012       click(d3_event, d3_event);
73013     }
73014     function click(firstEvent, lastEvent, pointerId) {
73015       cancelLongPress();
73016       var mapNode = context.container().select(".main-map").node();
73017       var pointGetter = utilFastMouse(mapNode);
73018       var p1 = pointGetter(firstEvent);
73019       var p2 = pointGetter(lastEvent);
73020       var dist = geoVecLength(p1, p2);
73021       if (dist > _tolerancePx || !mapContains(lastEvent)) {
73022         resetProperties();
73023         return;
73024       }
73025       var targetDatum = lastEvent.target.__data__;
73026       var multiselectEntityId;
73027       if (!_multiselectionPointerId) {
73028         var selectPointerInfo = pointerDownOnSelection(pointerId);
73029         if (selectPointerInfo) {
73030           _multiselectionPointerId = selectPointerInfo.pointerId;
73031           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
73032           _downPointers[selectPointerInfo.pointerId].done = true;
73033         }
73034       }
73035       var isMultiselect = context.mode().id === "select" && (lastEvent && lastEvent.shiftKey || context.surface().select(".lasso").node() || _multiselectionPointerId && !multiselectEntityId);
73036       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
73037       function mapContains(event) {
73038         var rect = mapNode.getBoundingClientRect();
73039         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
73040       }
73041       function pointerDownOnSelection(skipPointerId) {
73042         var mode = context.mode();
73043         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
73044         for (var pointerId2 in _downPointers) {
73045           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
73046             continue;
73047           var pointerInfo = _downPointers[pointerId2];
73048           var p12 = pointGetter(pointerInfo.firstEvent);
73049           var p22 = pointGetter(pointerInfo.lastEvent);
73050           if (geoVecLength(p12, p22) > _tolerancePx)
73051             continue;
73052           var datum2 = pointerInfo.firstEvent.target.__data__;
73053           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
73054           if (context.graph().hasEntity(entity.id)) {
73055             return {
73056               pointerId: pointerId2,
73057               entityId: entity.id,
73058               selected: selectedIDs.indexOf(entity.id) !== -1
73059             };
73060           }
73061         }
73062         return null;
73063       }
73064     }
73065     function processClick(datum2, isMultiselect, point, alsoSelectId) {
73066       var mode = context.mode();
73067       var showMenu = _showMenu;
73068       var interactionType = _lastInteractionType;
73069       var entity = datum2 && datum2.properties && datum2.properties.entity;
73070       if (entity)
73071         datum2 = entity;
73072       if (datum2 && datum2.type === "midpoint") {
73073         datum2 = datum2.parents[0];
73074       }
73075       var newMode;
73076       if (datum2 instanceof osmEntity) {
73077         var selectedIDs = context.selectedIDs();
73078         context.selectedNoteID(null);
73079         context.selectedErrorID(null);
73080         if (!isMultiselect) {
73081           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
73082             if (alsoSelectId === datum2.id)
73083               alsoSelectId = null;
73084             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
73085             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
73086             context.enter(newMode);
73087           }
73088         } else {
73089           if (selectedIDs.indexOf(datum2.id) !== -1) {
73090             if (!showMenu) {
73091               selectedIDs = selectedIDs.filter(function(id2) {
73092                 return id2 !== datum2.id;
73093               });
73094               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
73095               context.enter(newMode);
73096             }
73097           } else {
73098             selectedIDs = selectedIDs.concat([datum2.id]);
73099             newMode = mode.selectedIDs(selectedIDs);
73100             context.enter(newMode);
73101           }
73102         }
73103       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
73104         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
73105       } else if (datum2 instanceof osmNote && !isMultiselect) {
73106         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
73107       } else if (datum2 instanceof QAItem && !isMultiselect) {
73108         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
73109       } else {
73110         context.selectedNoteID(null);
73111         context.selectedErrorID(null);
73112         if (!isMultiselect && mode.id !== "browse") {
73113           context.enter(modeBrowse(context));
73114         }
73115       }
73116       context.ui().closeEditMenu();
73117       if (showMenu)
73118         context.ui().showEditMenu(point, interactionType);
73119       resetProperties();
73120     }
73121     function cancelLongPress() {
73122       if (_longPressTimeout)
73123         window.clearTimeout(_longPressTimeout);
73124       _longPressTimeout = null;
73125     }
73126     function resetProperties() {
73127       cancelLongPress();
73128       _showMenu = false;
73129       _lastInteractionType = null;
73130     }
73131     function behavior(selection2) {
73132       resetProperties();
73133       _lastMouseEvent = context.map().lastPointerEvent();
73134       select_default2(window).on("keydown.select", keydown).on("keyup.select", keyup).on(_pointerPrefix + "move.select", pointermove, true).on(_pointerPrefix + "up.select", pointerup, true).on("pointercancel.select", pointercancel, true).on("contextmenu.select-window", function(d3_event) {
73135         var e = d3_event;
73136         if (+e.clientX === 0 && +e.clientY === 0) {
73137           d3_event.preventDefault();
73138         }
73139       });
73140       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
73141     }
73142     behavior.off = function(selection2) {
73143       cancelLongPress();
73144       select_default2(window).on("keydown.select", null).on("keyup.select", null).on("contextmenu.select-window", null).on(_pointerPrefix + "move.select", null, true).on(_pointerPrefix + "up.select", null, true).on("pointercancel.select", null, true);
73145       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
73146       context.surface().classed("behavior-multiselect", false);
73147     };
73148     return behavior;
73149   }
73150
73151   // modules/operations/index.js
73152   var operations_exports = {};
73153   __export(operations_exports, {
73154     operationCircularize: () => operationCircularize,
73155     operationContinue: () => operationContinue,
73156     operationCopy: () => operationCopy,
73157     operationDelete: () => operationDelete,
73158     operationDisconnect: () => operationDisconnect,
73159     operationDowngrade: () => operationDowngrade,
73160     operationExtract: () => operationExtract,
73161     operationMerge: () => operationMerge,
73162     operationMove: () => operationMove,
73163     operationOrthogonalize: () => operationOrthogonalize,
73164     operationPaste: () => operationPaste,
73165     operationReflectLong: () => operationReflectLong,
73166     operationReflectShort: () => operationReflectShort,
73167     operationReverse: () => operationReverse,
73168     operationRotate: () => operationRotate,
73169     operationSplit: () => operationSplit,
73170     operationStraighten: () => operationStraighten
73171   });
73172
73173   // modules/operations/continue.js
73174   function operationContinue(context, selectedIDs) {
73175     var _entities = selectedIDs.map(function(id2) {
73176       return context.graph().entity(id2);
73177     });
73178     var _geometries = Object.assign({ line: [], vertex: [] }, utilArrayGroupBy(_entities, function(entity) {
73179       return entity.geometry(context.graph());
73180     }));
73181     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
73182     function candidateWays() {
73183       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
73184         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
73185       }) : [];
73186     }
73187     var _candidates = candidateWays();
73188     var operation = function() {
73189       var candidate = _candidates[0];
73190       context.enter(modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true));
73191     };
73192     operation.relatedEntityIds = function() {
73193       return _candidates.length ? [_candidates[0].id] : [];
73194     };
73195     operation.available = function() {
73196       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
73197     };
73198     operation.disabled = function() {
73199       if (_candidates.length === 0) {
73200         return "not_eligible";
73201       } else if (_candidates.length > 1) {
73202         return "multiple";
73203       }
73204       return false;
73205     };
73206     operation.tooltip = function() {
73207       var disable = operation.disabled();
73208       return disable ? _t("operations.continue." + disable) : _t("operations.continue.description");
73209     };
73210     operation.annotation = function() {
73211       return _t("operations.continue.annotation.line");
73212     };
73213     operation.id = "continue";
73214     operation.keys = [_t("operations.continue.key")];
73215     operation.title = _t("operations.continue.title");
73216     operation.behavior = behaviorOperation(context).which(operation);
73217     return operation;
73218   }
73219
73220   // modules/operations/copy.js
73221   function operationCopy(context, selectedIDs) {
73222     function getFilteredIdsToCopy() {
73223       return selectedIDs.filter(function(selectedID) {
73224         var entity = context.graph().hasEntity(selectedID);
73225         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
73226       });
73227     }
73228     var operation = function() {
73229       var graph = context.graph();
73230       var selected = groupEntities(getFilteredIdsToCopy(), graph);
73231       var canCopy = [];
73232       var skip = {};
73233       var entity;
73234       var i2;
73235       for (i2 = 0; i2 < selected.relation.length; i2++) {
73236         entity = selected.relation[i2];
73237         if (!skip[entity.id] && entity.isComplete(graph)) {
73238           canCopy.push(entity.id);
73239           skip = getDescendants(entity.id, graph, skip);
73240         }
73241       }
73242       for (i2 = 0; i2 < selected.way.length; i2++) {
73243         entity = selected.way[i2];
73244         if (!skip[entity.id]) {
73245           canCopy.push(entity.id);
73246           skip = getDescendants(entity.id, graph, skip);
73247         }
73248       }
73249       for (i2 = 0; i2 < selected.node.length; i2++) {
73250         entity = selected.node[i2];
73251         if (!skip[entity.id]) {
73252           canCopy.push(entity.id);
73253         }
73254       }
73255       context.copyIDs(canCopy);
73256       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
73257         context.copyLonLat(context.projection.invert(_point));
73258       } else {
73259         context.copyLonLat(null);
73260       }
73261     };
73262     function groupEntities(ids, graph) {
73263       var entities = ids.map(function(id2) {
73264         return graph.entity(id2);
73265       });
73266       return Object.assign({ relation: [], way: [], node: [] }, utilArrayGroupBy(entities, "type"));
73267     }
73268     function getDescendants(id2, graph, descendants) {
73269       var entity = graph.entity(id2);
73270       var children2;
73271       descendants = descendants || {};
73272       if (entity.type === "relation") {
73273         children2 = entity.members.map(function(m) {
73274           return m.id;
73275         });
73276       } else if (entity.type === "way") {
73277         children2 = entity.nodes;
73278       } else {
73279         children2 = [];
73280       }
73281       for (var i2 = 0; i2 < children2.length; i2++) {
73282         if (!descendants[children2[i2]]) {
73283           descendants[children2[i2]] = true;
73284           descendants = getDescendants(children2[i2], graph, descendants);
73285         }
73286       }
73287       return descendants;
73288     }
73289     operation.available = function() {
73290       return getFilteredIdsToCopy().length > 0;
73291     };
73292     operation.disabled = function() {
73293       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
73294       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
73295         return "too_large";
73296       }
73297       return false;
73298     };
73299     operation.availableForKeypress = function() {
73300       var selection2 = window.getSelection && window.getSelection();
73301       return !selection2 || !selection2.toString();
73302     };
73303     operation.tooltip = function() {
73304       var disable = operation.disabled();
73305       return disable ? _t("operations.copy." + disable, { n: selectedIDs.length }) : _t("operations.copy.description", { n: selectedIDs.length });
73306     };
73307     operation.annotation = function() {
73308       return _t("operations.copy.annotation", { n: selectedIDs.length });
73309     };
73310     var _point;
73311     operation.point = function(val) {
73312       _point = val;
73313       return operation;
73314     };
73315     operation.id = "copy";
73316     operation.keys = [uiCmd("\u2318C")];
73317     operation.title = _t("operations.copy.title");
73318     operation.behavior = behaviorOperation(context).which(operation);
73319     return operation;
73320   }
73321
73322   // modules/operations/disconnect.js
73323   function operationDisconnect(context, selectedIDs) {
73324     var _vertexIDs = [];
73325     var _wayIDs = [];
73326     var _otherIDs = [];
73327     var _actions = [];
73328     selectedIDs.forEach(function(id2) {
73329       var entity = context.entity(id2);
73330       if (entity.type === "way") {
73331         _wayIDs.push(id2);
73332       } else if (entity.geometry(context.graph()) === "vertex") {
73333         _vertexIDs.push(id2);
73334       } else {
73335         _otherIDs.push(id2);
73336       }
73337     });
73338     var _coords, _descriptionID = "", _annotationID = "features";
73339     var _disconnectingVertexIds = [];
73340     var _disconnectingWayIds = [];
73341     if (_vertexIDs.length > 0) {
73342       _disconnectingVertexIds = _vertexIDs;
73343       _vertexIDs.forEach(function(vertexID) {
73344         var action = actionDisconnect(vertexID);
73345         if (_wayIDs.length > 0) {
73346           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
73347             var way = context.entity(wayID);
73348             return way.nodes.indexOf(vertexID) !== -1;
73349           });
73350           action.limitWays(waysIDsForVertex);
73351         }
73352         _actions.push(action);
73353         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
73354       });
73355       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
73356         return _wayIDs.indexOf(id2) === -1;
73357       });
73358       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
73359       if (_wayIDs.length === 1) {
73360         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
73361       } else {
73362         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
73363       }
73364     } else if (_wayIDs.length > 0) {
73365       var ways = _wayIDs.map(function(id2) {
73366         return context.entity(id2);
73367       });
73368       var nodes = utilGetAllNodes(_wayIDs, context.graph());
73369       _coords = nodes.map(function(n2) {
73370         return n2.loc;
73371       });
73372       var sharedActions = [];
73373       var sharedNodes = [];
73374       var unsharedActions = [];
73375       var unsharedNodes = [];
73376       nodes.forEach(function(node) {
73377         var action = actionDisconnect(node.id).limitWays(_wayIDs);
73378         if (action.disabled(context.graph()) !== "not_connected") {
73379           var count = 0;
73380           for (var i2 in ways) {
73381             var way = ways[i2];
73382             if (way.nodes.indexOf(node.id) !== -1) {
73383               count += 1;
73384             }
73385             if (count > 1)
73386               break;
73387           }
73388           if (count > 1) {
73389             sharedActions.push(action);
73390             sharedNodes.push(node);
73391           } else {
73392             unsharedActions.push(action);
73393             unsharedNodes.push(node);
73394           }
73395         }
73396       });
73397       _descriptionID += "no_points.";
73398       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
73399       if (sharedActions.length) {
73400         _actions = sharedActions;
73401         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
73402         _descriptionID += "conjoined";
73403         _annotationID = "from_each_other";
73404       } else {
73405         _actions = unsharedActions;
73406         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
73407         if (_wayIDs.length === 1) {
73408           _descriptionID += context.graph().geometry(_wayIDs[0]);
73409         } else {
73410           _descriptionID += "separate";
73411         }
73412       }
73413     }
73414     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
73415     var operation = function() {
73416       context.perform(function(graph) {
73417         return _actions.reduce(function(graph2, action) {
73418           return action(graph2);
73419         }, graph);
73420       }, operation.annotation());
73421       context.validator().validate();
73422     };
73423     operation.relatedEntityIds = function() {
73424       if (_vertexIDs.length) {
73425         return _disconnectingWayIds;
73426       }
73427       return _disconnectingVertexIds;
73428     };
73429     operation.available = function() {
73430       if (_actions.length === 0)
73431         return false;
73432       if (_otherIDs.length !== 0)
73433         return false;
73434       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
73435         return _vertexIDs.some(function(vertexID) {
73436           var way = context.entity(wayID);
73437           return way.nodes.indexOf(vertexID) !== -1;
73438         });
73439       }))
73440         return false;
73441       return true;
73442     };
73443     operation.disabled = function() {
73444       var reason;
73445       for (var actionIndex in _actions) {
73446         reason = _actions[actionIndex].disabled(context.graph());
73447         if (reason)
73448           return reason;
73449       }
73450       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
73451         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
73452       } else if (_coords && someMissing()) {
73453         return "not_downloaded";
73454       } else if (selectedIDs.some(context.hasHiddenConnections)) {
73455         return "connected_to_hidden";
73456       }
73457       return false;
73458       function someMissing() {
73459         if (context.inIntro())
73460           return false;
73461         var osm = context.connection();
73462         if (osm) {
73463           var missing = _coords.filter(function(loc) {
73464             return !osm.isDataLoaded(loc);
73465           });
73466           if (missing.length) {
73467             missing.forEach(function(loc) {
73468               context.loadTileAtLoc(loc);
73469             });
73470             return true;
73471           }
73472         }
73473         return false;
73474       }
73475     };
73476     operation.tooltip = function() {
73477       var disable = operation.disabled();
73478       if (disable) {
73479         return _t("operations.disconnect." + disable);
73480       }
73481       return _t("operations.disconnect.description." + _descriptionID);
73482     };
73483     operation.annotation = function() {
73484       return _t("operations.disconnect.annotation." + _annotationID);
73485     };
73486     operation.id = "disconnect";
73487     operation.keys = [_t("operations.disconnect.key")];
73488     operation.title = _t("operations.disconnect.title");
73489     operation.behavior = behaviorOperation(context).which(operation);
73490     return operation;
73491   }
73492
73493   // modules/operations/downgrade.js
73494   function operationDowngrade(context, selectedIDs) {
73495     var _affectedFeatureCount = 0;
73496     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
73497     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
73498     function downgradeTypeForEntityIDs(entityIds) {
73499       var downgradeType;
73500       _affectedFeatureCount = 0;
73501       for (var i2 in entityIds) {
73502         var entityID = entityIds[i2];
73503         var type3 = downgradeTypeForEntityID(entityID);
73504         if (type3) {
73505           _affectedFeatureCount += 1;
73506           if (downgradeType && type3 !== downgradeType) {
73507             if (downgradeType !== "generic" && type3 !== "generic") {
73508               downgradeType = "building_address";
73509             } else {
73510               downgradeType = "generic";
73511             }
73512           } else {
73513             downgradeType = type3;
73514           }
73515         }
73516       }
73517       return downgradeType;
73518     }
73519     function downgradeTypeForEntityID(entityID) {
73520       var graph = context.graph();
73521       var entity = graph.entity(entityID);
73522       var preset = _mainPresetIndex.match(entity, graph);
73523       if (!preset || preset.isFallback())
73524         return null;
73525       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
73526         return key.match(/^addr:.{1,}/);
73527       })) {
73528         return "address";
73529       }
73530       var geometry = entity.geometry(graph);
73531       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
73532         return "building";
73533       }
73534       if (geometry === "vertex" && Object.keys(entity.tags).length) {
73535         return "generic";
73536       }
73537       return null;
73538     }
73539     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
73540     var addressKeysToKeep = ["source"];
73541     var operation = function() {
73542       context.perform(function(graph) {
73543         for (var i2 in selectedIDs) {
73544           var entityID = selectedIDs[i2];
73545           var type3 = downgradeTypeForEntityID(entityID);
73546           if (!type3)
73547             continue;
73548           var tags = Object.assign({}, graph.entity(entityID).tags);
73549           for (var key in tags) {
73550             if (type3 === "address" && addressKeysToKeep.indexOf(key) !== -1)
73551               continue;
73552             if (type3 === "building") {
73553               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
73554                 continue;
73555             }
73556             if (type3 !== "generic") {
73557               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
73558                 continue;
73559             }
73560             delete tags[key];
73561           }
73562           graph = actionChangeTags(entityID, tags)(graph);
73563         }
73564         return graph;
73565       }, operation.annotation());
73566       context.validator().validate();
73567       context.enter(modeSelect(context, selectedIDs));
73568     };
73569     operation.available = function() {
73570       return _downgradeType;
73571     };
73572     operation.disabled = function() {
73573       if (selectedIDs.some(hasWikidataTag)) {
73574         return "has_wikidata_tag";
73575       }
73576       return false;
73577       function hasWikidataTag(id2) {
73578         var entity = context.entity(id2);
73579         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
73580       }
73581     };
73582     operation.tooltip = function() {
73583       var disable = operation.disabled();
73584       return disable ? _t("operations.downgrade." + disable + "." + _multi) : _t("operations.downgrade.description." + _downgradeType);
73585     };
73586     operation.annotation = function() {
73587       var suffix;
73588       if (_downgradeType === "building_address") {
73589         suffix = "generic";
73590       } else {
73591         suffix = _downgradeType;
73592       }
73593       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
73594     };
73595     operation.id = "downgrade";
73596     operation.keys = [uiCmd("\u232B")];
73597     operation.title = _t("operations.downgrade.title");
73598     operation.behavior = behaviorOperation(context).which(operation);
73599     return operation;
73600   }
73601
73602   // modules/operations/extract.js
73603   function operationExtract(context, selectedIDs) {
73604     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
73605     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
73606       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
73607     }).filter(Boolean));
73608     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
73609     var _extent;
73610     var _actions = selectedIDs.map(function(entityID) {
73611       var graph = context.graph();
73612       var entity = graph.hasEntity(entityID);
73613       if (!entity || !entity.hasInterestingTags())
73614         return null;
73615       if (entity.type === "node" && graph.parentWays(entity).length === 0)
73616         return null;
73617       if (entity.type !== "node") {
73618         var preset = _mainPresetIndex.match(entity, graph);
73619         if (preset.geometry.indexOf("point") === -1)
73620           return null;
73621       }
73622       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
73623       return actionExtract(entityID, context.projection);
73624     }).filter(Boolean);
73625     var operation = function() {
73626       var combinedAction = function(graph) {
73627         _actions.forEach(function(action) {
73628           graph = action(graph);
73629         });
73630         return graph;
73631       };
73632       context.perform(combinedAction, operation.annotation());
73633       var extractedNodeIDs = _actions.map(function(action) {
73634         return action.getExtractedNodeID();
73635       });
73636       context.enter(modeSelect(context, extractedNodeIDs));
73637     };
73638     operation.available = function() {
73639       return _actions.length && selectedIDs.length === _actions.length;
73640     };
73641     operation.disabled = function() {
73642       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
73643         return "too_large";
73644       } else if (selectedIDs.some(function(entityID) {
73645         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
73646       })) {
73647         return "connected_to_hidden";
73648       }
73649       return false;
73650     };
73651     operation.tooltip = function() {
73652       var disableReason = operation.disabled();
73653       if (disableReason) {
73654         return _t("operations.extract." + disableReason + "." + _amount);
73655       } else {
73656         return _t("operations.extract.description." + _geometryID + "." + _amount);
73657       }
73658     };
73659     operation.annotation = function() {
73660       return _t("operations.extract.annotation", { n: selectedIDs.length });
73661     };
73662     operation.id = "extract";
73663     operation.keys = [_t("operations.extract.key")];
73664     operation.title = _t("operations.extract.title");
73665     operation.behavior = behaviorOperation(context).which(operation);
73666     return operation;
73667   }
73668
73669   // modules/operations/merge.js
73670   function operationMerge(context, selectedIDs) {
73671     var _action = getAction();
73672     function getAction() {
73673       var join = actionJoin(selectedIDs);
73674       if (!join.disabled(context.graph()))
73675         return join;
73676       var merge3 = actionMerge(selectedIDs);
73677       if (!merge3.disabled(context.graph()))
73678         return merge3;
73679       var mergePolygon = actionMergePolygon(selectedIDs);
73680       if (!mergePolygon.disabled(context.graph()))
73681         return mergePolygon;
73682       var mergeNodes = actionMergeNodes(selectedIDs);
73683       if (!mergeNodes.disabled(context.graph()))
73684         return mergeNodes;
73685       if (join.disabled(context.graph()) !== "not_eligible")
73686         return join;
73687       if (merge3.disabled(context.graph()) !== "not_eligible")
73688         return merge3;
73689       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
73690         return mergePolygon;
73691       return mergeNodes;
73692     }
73693     var operation = function() {
73694       if (operation.disabled())
73695         return;
73696       context.perform(_action, operation.annotation());
73697       context.validator().validate();
73698       var resultIDs = selectedIDs.filter(context.hasEntity);
73699       if (resultIDs.length > 1) {
73700         var interestingIDs = resultIDs.filter(function(id2) {
73701           return context.entity(id2).hasInterestingTags();
73702         });
73703         if (interestingIDs.length)
73704           resultIDs = interestingIDs;
73705       }
73706       context.enter(modeSelect(context, resultIDs));
73707     };
73708     operation.available = function() {
73709       return selectedIDs.length >= 2;
73710     };
73711     operation.disabled = function() {
73712       var actionDisabled = _action.disabled(context.graph());
73713       if (actionDisabled)
73714         return actionDisabled;
73715       var osm = context.connection();
73716       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
73717         return "too_many_vertices";
73718       }
73719       return false;
73720     };
73721     operation.tooltip = function() {
73722       var disabled = operation.disabled();
73723       if (disabled) {
73724         if (disabled === "conflicting_relations") {
73725           return _t("operations.merge.conflicting_relations");
73726         }
73727         if (disabled === "restriction" || disabled === "connectivity") {
73728           return _t("operations.merge.damage_relation", { relation: _mainPresetIndex.item("type/" + disabled).name() });
73729         }
73730         return _t("operations.merge." + disabled);
73731       }
73732       return _t("operations.merge.description");
73733     };
73734     operation.annotation = function() {
73735       return _t("operations.merge.annotation", { n: selectedIDs.length });
73736     };
73737     operation.id = "merge";
73738     operation.keys = [_t("operations.merge.key")];
73739     operation.title = _t("operations.merge.title");
73740     operation.behavior = behaviorOperation(context).which(operation);
73741     return operation;
73742   }
73743
73744   // modules/operations/paste.js
73745   function operationPaste(context) {
73746     var _pastePoint;
73747     var operation = function() {
73748       if (!_pastePoint)
73749         return;
73750       var oldIDs = context.copyIDs();
73751       if (!oldIDs.length)
73752         return;
73753       var projection2 = context.projection;
73754       var extent = geoExtent();
73755       var oldGraph = context.copyGraph();
73756       var newIDs = [];
73757       var action = actionCopyEntities(oldIDs, oldGraph);
73758       context.perform(action);
73759       var copies = action.copies();
73760       var originals = /* @__PURE__ */ new Set();
73761       Object.values(copies).forEach(function(entity) {
73762         originals.add(entity.id);
73763       });
73764       for (var id2 in copies) {
73765         var oldEntity = oldGraph.entity(id2);
73766         var newEntity = copies[id2];
73767         extent._extend(oldEntity.extent(oldGraph));
73768         var parents = context.graph().parentWays(newEntity);
73769         var parentCopied = parents.some(function(parent) {
73770           return originals.has(parent.id);
73771         });
73772         if (!parentCopied) {
73773           newIDs.push(newEntity.id);
73774         }
73775       }
73776       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
73777       var delta = geoVecSubtract(_pastePoint, copyPoint);
73778       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
73779       context.enter(modeSelect(context, newIDs));
73780     };
73781     operation.point = function(val) {
73782       _pastePoint = val;
73783       return operation;
73784     };
73785     operation.available = function() {
73786       return context.mode().id === "browse";
73787     };
73788     operation.disabled = function() {
73789       return !context.copyIDs().length;
73790     };
73791     operation.tooltip = function() {
73792       var oldGraph = context.copyGraph();
73793       var ids = context.copyIDs();
73794       if (!ids.length) {
73795         return _t("operations.paste.nothing_copied");
73796       }
73797       return _t("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
73798     };
73799     operation.annotation = function() {
73800       var ids = context.copyIDs();
73801       return _t("operations.paste.annotation", { n: ids.length });
73802     };
73803     operation.id = "paste";
73804     operation.keys = [uiCmd("\u2318V")];
73805     operation.title = _t("operations.paste.title");
73806     return operation;
73807   }
73808
73809   // modules/operations/reverse.js
73810   function operationReverse(context, selectedIDs) {
73811     var operation = function() {
73812       context.perform(function combinedReverseAction(graph) {
73813         actions().forEach(function(action) {
73814           graph = action(graph);
73815         });
73816         return graph;
73817       }, operation.annotation());
73818       context.validator().validate();
73819     };
73820     function actions(situation) {
73821       return selectedIDs.map(function(entityID) {
73822         var entity = context.hasEntity(entityID);
73823         if (!entity)
73824           return null;
73825         if (situation === "toolbar") {
73826           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
73827             return null;
73828         }
73829         var geometry = entity.geometry(context.graph());
73830         if (entity.type !== "node" && geometry !== "line")
73831           return null;
73832         var action = actionReverse(entityID);
73833         if (action.disabled(context.graph()))
73834           return null;
73835         return action;
73836       }).filter(Boolean);
73837     }
73838     function reverseTypeID() {
73839       var acts = actions();
73840       var nodeActionCount = acts.filter(function(act) {
73841         var entity = context.hasEntity(act.entityID());
73842         return entity && entity.type === "node";
73843       }).length;
73844       if (nodeActionCount === 0)
73845         return "line";
73846       if (nodeActionCount === acts.length)
73847         return "point";
73848       return "feature";
73849     }
73850     operation.available = function(situation) {
73851       return actions(situation).length > 0;
73852     };
73853     operation.disabled = function() {
73854       return false;
73855     };
73856     operation.tooltip = function() {
73857       return _t("operations.reverse.description." + reverseTypeID());
73858     };
73859     operation.annotation = function() {
73860       var acts = actions();
73861       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
73862     };
73863     operation.id = "reverse";
73864     operation.keys = [_t("operations.reverse.key")];
73865     operation.title = _t("operations.reverse.title");
73866     operation.behavior = behaviorOperation(context).which(operation);
73867     return operation;
73868   }
73869
73870   // modules/operations/split.js
73871   function operationSplit(context, selectedIDs) {
73872     var _vertexIds = selectedIDs.filter(function(id2) {
73873       return context.graph().geometry(id2) === "vertex";
73874     });
73875     var _selectedWayIds = selectedIDs.filter(function(id2) {
73876       var entity = context.graph().hasEntity(id2);
73877       return entity && entity.type === "way";
73878     });
73879     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
73880     var _action = actionSplit(_vertexIds);
73881     var _ways = [];
73882     var _geometry = "feature";
73883     var _waysAmount = "single";
73884     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
73885     if (_isAvailable) {
73886       if (_selectedWayIds.length)
73887         _action.limitWays(_selectedWayIds);
73888       _ways = _action.ways(context.graph());
73889       var geometries = {};
73890       _ways.forEach(function(way) {
73891         geometries[way.geometry(context.graph())] = true;
73892       });
73893       if (Object.keys(geometries).length === 1) {
73894         _geometry = Object.keys(geometries)[0];
73895       }
73896       _waysAmount = _ways.length === 1 ? "single" : "multiple";
73897     }
73898     var operation = function() {
73899       var difference = context.perform(_action, operation.annotation());
73900       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
73901         return context.entity(id2).type === "way";
73902       }));
73903       context.enter(modeSelect(context, idsToSelect));
73904     };
73905     operation.relatedEntityIds = function() {
73906       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
73907     };
73908     operation.available = function() {
73909       return _isAvailable;
73910     };
73911     operation.disabled = function() {
73912       var reason = _action.disabled(context.graph());
73913       if (reason) {
73914         return reason;
73915       } else if (selectedIDs.some(context.hasHiddenConnections)) {
73916         return "connected_to_hidden";
73917       }
73918       return false;
73919     };
73920     operation.tooltip = function() {
73921       var disable = operation.disabled();
73922       if (disable)
73923         return _t("operations.split." + disable);
73924       return _t("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
73925     };
73926     operation.annotation = function() {
73927       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
73928     };
73929     operation.icon = function() {
73930       if (_waysAmount === "multiple") {
73931         return "#iD-operation-split-multiple";
73932       } else {
73933         return "#iD-operation-split";
73934       }
73935     };
73936     operation.id = "split";
73937     operation.keys = [_t("operations.split.key")];
73938     operation.title = _t("operations.split.title");
73939     operation.behavior = behaviorOperation(context).which(operation);
73940     return operation;
73941   }
73942
73943   // modules/operations/straighten.js
73944   function operationStraighten(context, selectedIDs) {
73945     var _wayIDs = selectedIDs.filter(function(id2) {
73946       return id2.charAt(0) === "w";
73947     });
73948     var _nodeIDs = selectedIDs.filter(function(id2) {
73949       return id2.charAt(0) === "n";
73950     });
73951     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
73952     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
73953     var _coords = _nodes.map(function(n2) {
73954       return n2.loc;
73955     });
73956     var _extent = utilTotalExtent(selectedIDs, context.graph());
73957     var _action = chooseAction();
73958     var _geometry;
73959     function chooseAction() {
73960       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
73961         _geometry = "point";
73962         return actionStraightenNodes(_nodeIDs, context.projection);
73963       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
73964         var startNodeIDs = [];
73965         var endNodeIDs = [];
73966         for (var i2 = 0; i2 < selectedIDs.length; i2++) {
73967           var entity = context.entity(selectedIDs[i2]);
73968           if (entity.type === "node") {
73969             continue;
73970           } else if (entity.type !== "way" || entity.isClosed()) {
73971             return null;
73972           }
73973           startNodeIDs.push(entity.first());
73974           endNodeIDs.push(entity.last());
73975         }
73976         startNodeIDs = startNodeIDs.filter(function(n2) {
73977           return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
73978         });
73979         endNodeIDs = endNodeIDs.filter(function(n2) {
73980           return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
73981         });
73982         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
73983           return null;
73984         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
73985           return node.id;
73986         });
73987         if (wayNodeIDs.length <= 2)
73988           return null;
73989         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
73990           return null;
73991         if (_nodeIDs.length) {
73992           _extent = utilTotalExtent(_nodeIDs, context.graph());
73993         }
73994         _geometry = "line";
73995         return actionStraightenWay(selectedIDs, context.projection);
73996       }
73997       return null;
73998     }
73999     function operation() {
74000       if (!_action)
74001         return;
74002       context.perform(_action, operation.annotation());
74003       window.setTimeout(function() {
74004         context.validator().validate();
74005       }, 300);
74006     }
74007     operation.available = function() {
74008       return Boolean(_action);
74009     };
74010     operation.disabled = function() {
74011       var reason = _action.disabled(context.graph());
74012       if (reason) {
74013         return reason;
74014       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
74015         return "too_large";
74016       } else if (someMissing()) {
74017         return "not_downloaded";
74018       } else if (selectedIDs.some(context.hasHiddenConnections)) {
74019         return "connected_to_hidden";
74020       }
74021       return false;
74022       function someMissing() {
74023         if (context.inIntro())
74024           return false;
74025         var osm = context.connection();
74026         if (osm) {
74027           var missing = _coords.filter(function(loc) {
74028             return !osm.isDataLoaded(loc);
74029           });
74030           if (missing.length) {
74031             missing.forEach(function(loc) {
74032               context.loadTileAtLoc(loc);
74033             });
74034             return true;
74035           }
74036         }
74037         return false;
74038       }
74039     };
74040     operation.tooltip = function() {
74041       var disable = operation.disabled();
74042       return disable ? _t("operations.straighten." + disable + "." + _amount) : _t("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
74043     };
74044     operation.annotation = function() {
74045       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
74046     };
74047     operation.id = "straighten";
74048     operation.keys = [_t("operations.straighten.key")];
74049     operation.title = _t("operations.straighten.title");
74050     operation.behavior = behaviorOperation(context).which(operation);
74051     return operation;
74052   }
74053
74054   // modules/modes/select.js
74055   function modeSelect(context, selectedIDs) {
74056     var mode = {
74057       id: "select",
74058       button: "browse"
74059     };
74060     var keybinding = utilKeybinding("select");
74061     var _breatheBehavior = behaviorBreathe(context);
74062     var _modeDragNode = modeDragNode(context);
74063     var _selectBehavior;
74064     var _behaviors = [];
74065     var _operations = [];
74066     var _newFeature = false;
74067     var _follow = false;
74068     var _focusedParentWayId;
74069     var _focusedVertexIds;
74070     function singular() {
74071       if (selectedIDs && selectedIDs.length === 1) {
74072         return context.hasEntity(selectedIDs[0]);
74073       }
74074     }
74075     function selectedEntities() {
74076       return selectedIDs.map(function(id2) {
74077         return context.hasEntity(id2);
74078       }).filter(Boolean);
74079     }
74080     function checkSelectedIDs() {
74081       var ids = [];
74082       if (Array.isArray(selectedIDs)) {
74083         ids = selectedIDs.filter(function(id2) {
74084           return context.hasEntity(id2);
74085         });
74086       }
74087       if (!ids.length) {
74088         context.enter(modeBrowse(context));
74089         return false;
74090       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
74091         context.enter(modeSelect(context, ids));
74092         return false;
74093       }
74094       selectedIDs = ids;
74095       return true;
74096     }
74097     function parentWaysIdsOfSelection(onlyCommonParents) {
74098       var graph = context.graph();
74099       var parents = [];
74100       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
74101         var entity = context.hasEntity(selectedIDs[i2]);
74102         if (!entity || entity.geometry(graph) !== "vertex") {
74103           return [];
74104         }
74105         var currParents = graph.parentWays(entity).map(function(w) {
74106           return w.id;
74107         });
74108         if (!parents.length) {
74109           parents = currParents;
74110           continue;
74111         }
74112         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
74113         if (!parents.length) {
74114           return [];
74115         }
74116       }
74117       return parents;
74118     }
74119     function childNodeIdsOfSelection(onlyCommon) {
74120       var graph = context.graph();
74121       var childs = [];
74122       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
74123         var entity = context.hasEntity(selectedIDs[i2]);
74124         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
74125           return [];
74126         }
74127         var currChilds = graph.childNodes(entity).map(function(node) {
74128           return node.id;
74129         });
74130         if (!childs.length) {
74131           childs = currChilds;
74132           continue;
74133         }
74134         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
74135         if (!childs.length) {
74136           return [];
74137         }
74138       }
74139       return childs;
74140     }
74141     function checkFocusedParent() {
74142       if (_focusedParentWayId) {
74143         var parents = parentWaysIdsOfSelection(true);
74144         if (parents.indexOf(_focusedParentWayId) === -1)
74145           _focusedParentWayId = null;
74146       }
74147     }
74148     function parentWayIdForVertexNavigation() {
74149       var parentIds = parentWaysIdsOfSelection(true);
74150       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
74151         return _focusedParentWayId;
74152       }
74153       return parentIds.length ? parentIds[0] : null;
74154     }
74155     mode.selectedIDs = function(val) {
74156       if (!arguments.length)
74157         return selectedIDs;
74158       selectedIDs = val;
74159       return mode;
74160     };
74161     mode.zoomToSelected = function() {
74162       context.map().zoomToEase(selectedEntities());
74163     };
74164     mode.newFeature = function(val) {
74165       if (!arguments.length)
74166         return _newFeature;
74167       _newFeature = val;
74168       return mode;
74169     };
74170     mode.selectBehavior = function(val) {
74171       if (!arguments.length)
74172         return _selectBehavior;
74173       _selectBehavior = val;
74174       return mode;
74175     };
74176     mode.follow = function(val) {
74177       if (!arguments.length)
74178         return _follow;
74179       _follow = val;
74180       return mode;
74181     };
74182     function loadOperations() {
74183       _operations.forEach(function(operation) {
74184         if (operation.behavior) {
74185           context.uninstall(operation.behavior);
74186         }
74187       });
74188       _operations = Object.values(operations_exports).map(function(o) {
74189         return o(context, selectedIDs);
74190       }).filter(function(o) {
74191         return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
74192       }).concat([
74193         operationCopy(context, selectedIDs),
74194         operationDowngrade(context, selectedIDs),
74195         operationDelete(context, selectedIDs)
74196       ]).filter(function(operation) {
74197         return operation.available();
74198       });
74199       _operations.forEach(function(operation) {
74200         if (operation.behavior) {
74201           context.install(operation.behavior);
74202         }
74203       });
74204       context.ui().closeEditMenu();
74205     }
74206     mode.operations = function() {
74207       return _operations;
74208     };
74209     mode.enter = function() {
74210       if (!checkSelectedIDs())
74211         return;
74212       context.features().forceVisible(selectedIDs);
74213       _modeDragNode.restoreSelectedIDs(selectedIDs);
74214       loadOperations();
74215       if (!_behaviors.length) {
74216         if (!_selectBehavior)
74217           _selectBehavior = behaviorSelect(context);
74218         _behaviors = [
74219           behaviorPaste(context),
74220           _breatheBehavior,
74221           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
74222           _selectBehavior,
74223           behaviorLasso(context),
74224           _modeDragNode.behavior,
74225           modeDragNote(context).behavior
74226         ];
74227       }
74228       _behaviors.forEach(context.install);
74229       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on(["[", "pgup"], previousVertex).on(["]", "pgdown"], nextVertex).on(["{", uiCmd("\u2318["), "home"], firstVertex).on(["}", uiCmd("\u2318]"), "end"], lastVertex).on(uiCmd("\u21E7\u2190"), nudgeSelection([-10, 0])).on(uiCmd("\u21E7\u2191"), nudgeSelection([0, -10])).on(uiCmd("\u21E7\u2192"), nudgeSelection([10, 0])).on(uiCmd("\u21E7\u2193"), nudgeSelection([0, 10])).on(uiCmd("\u21E7\u2325\u2190"), nudgeSelection([-100, 0])).on(uiCmd("\u21E7\u2325\u2191"), nudgeSelection([0, -100])).on(uiCmd("\u21E7\u2325\u2192"), nudgeSelection([100, 0])).on(uiCmd("\u21E7\u2325\u2193"), nudgeSelection([0, 100])).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1.05)).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(Math.pow(1.05, 5))).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1 / 1.05)).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(1 / Math.pow(1.05, 5))).on(["\\", "pause"], focusNextParent).on(uiCmd("\u2318\u2191"), selectParent).on(uiCmd("\u2318\u2193"), selectChild).on("\u238B", esc, true);
74230       select_default2(document).call(keybinding);
74231       context.ui().sidebar.select(selectedIDs, _newFeature);
74232       context.history().on("change.select", function() {
74233         loadOperations();
74234         selectElements();
74235       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
74236       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
74237         selectElements();
74238         _breatheBehavior.restartIfNeeded(context.surface());
74239       });
74240       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
74241       selectElements();
74242       if (_follow) {
74243         var extent = geoExtent();
74244         var graph = context.graph();
74245         selectedIDs.forEach(function(id2) {
74246           var entity = context.entity(id2);
74247           extent._extend(entity.extent(graph));
74248         });
74249         var loc = extent.center();
74250         context.map().centerEase(loc);
74251         _follow = false;
74252       }
74253       function nudgeSelection(delta) {
74254         return function() {
74255           if (!context.map().withinEditableZoom())
74256             return;
74257           var moveOp = operationMove(context, selectedIDs);
74258           if (moveOp.disabled()) {
74259             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip)();
74260           } else {
74261             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
74262             context.validator().validate();
74263           }
74264         };
74265       }
74266       function scaleSelection(factor) {
74267         return function() {
74268           if (!context.map().withinEditableZoom())
74269             return;
74270           let nodes = utilGetAllNodes(selectedIDs, context.graph());
74271           let isUp = factor > 1;
74272           if (nodes.length <= 1)
74273             return;
74274           let extent2 = utilTotalExtent(selectedIDs, context.graph());
74275           function scalingDisabled() {
74276             if (tooSmall()) {
74277               return "too_small";
74278             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
74279               return "too_large";
74280             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
74281               return "not_downloaded";
74282             } else if (selectedIDs.some(context.hasHiddenConnections)) {
74283               return "connected_to_hidden";
74284             }
74285             return false;
74286             function tooSmall() {
74287               if (isUp)
74288                 return false;
74289               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
74290               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
74291               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
74292             }
74293             function someMissing() {
74294               if (context.inIntro())
74295                 return false;
74296               let osm = context.connection();
74297               if (osm) {
74298                 let missing = nodes.filter(function(n2) {
74299                   return !osm.isDataLoaded(n2.loc);
74300                 });
74301                 if (missing.length) {
74302                   missing.forEach(function(loc2) {
74303                     context.loadTileAtLoc(loc2);
74304                   });
74305                   return true;
74306                 }
74307               }
74308               return false;
74309             }
74310             function incompleteRelation(id2) {
74311               let entity = context.entity(id2);
74312               return entity.type === "relation" && !entity.isComplete(context.graph());
74313             }
74314           }
74315           const disabled = scalingDisabled();
74316           if (disabled) {
74317             let multi = selectedIDs.length === 1 ? "single" : "multiple";
74318             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.html("operations.scale." + disabled + "." + multi))();
74319           } else {
74320             const pivot = context.projection(extent2.center());
74321             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
74322             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
74323             context.validator().validate();
74324           }
74325         };
74326       }
74327       function didDoubleUp(d3_event, loc2) {
74328         if (!context.map().withinEditableZoom())
74329           return;
74330         var target = select_default2(d3_event.target);
74331         var datum2 = target.datum();
74332         var entity = datum2 && datum2.properties && datum2.properties.entity;
74333         if (!entity)
74334           return;
74335         if (entity instanceof osmWay && target.classed("target")) {
74336           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
74337           var prev = entity.nodes[choice.index - 1];
74338           var next = entity.nodes[choice.index];
74339           context.perform(actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()), _t("operations.add.annotation.vertex"));
74340           context.validator().validate();
74341         } else if (entity.type === "midpoint") {
74342           context.perform(actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()), _t("operations.add.annotation.vertex"));
74343           context.validator().validate();
74344         }
74345       }
74346       function selectElements() {
74347         if (!checkSelectedIDs())
74348           return;
74349         var surface = context.surface();
74350         surface.selectAll(".selected-member").classed("selected-member", false);
74351         surface.selectAll(".selected").classed("selected", false);
74352         surface.selectAll(".related").classed("related", false);
74353         checkFocusedParent();
74354         if (_focusedParentWayId) {
74355           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
74356         }
74357         if (context.map().withinEditableZoom()) {
74358           surface.selectAll(utilDeepMemberSelector(selectedIDs, context.graph(), true)).classed("selected-member", true);
74359           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
74360         }
74361       }
74362       function esc() {
74363         if (context.container().select(".combobox").size())
74364           return;
74365         context.enter(modeBrowse(context));
74366       }
74367       function firstVertex(d3_event) {
74368         d3_event.preventDefault();
74369         var entity = singular();
74370         var parentId = parentWayIdForVertexNavigation();
74371         var way;
74372         if (entity && entity.type === "way") {
74373           way = entity;
74374         } else if (parentId) {
74375           way = context.entity(parentId);
74376         }
74377         _focusedParentWayId = way && way.id;
74378         if (way) {
74379           context.enter(mode.selectedIDs([way.first()]).follow(true));
74380         }
74381       }
74382       function lastVertex(d3_event) {
74383         d3_event.preventDefault();
74384         var entity = singular();
74385         var parentId = parentWayIdForVertexNavigation();
74386         var way;
74387         if (entity && entity.type === "way") {
74388           way = entity;
74389         } else if (parentId) {
74390           way = context.entity(parentId);
74391         }
74392         _focusedParentWayId = way && way.id;
74393         if (way) {
74394           context.enter(mode.selectedIDs([way.last()]).follow(true));
74395         }
74396       }
74397       function previousVertex(d3_event) {
74398         d3_event.preventDefault();
74399         var parentId = parentWayIdForVertexNavigation();
74400         _focusedParentWayId = parentId;
74401         if (!parentId)
74402           return;
74403         var way = context.entity(parentId);
74404         var length = way.nodes.length;
74405         var curr = way.nodes.indexOf(selectedIDs[0]);
74406         var index = -1;
74407         if (curr > 0) {
74408           index = curr - 1;
74409         } else if (way.isClosed()) {
74410           index = length - 2;
74411         }
74412         if (index !== -1) {
74413           context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
74414         }
74415       }
74416       function nextVertex(d3_event) {
74417         d3_event.preventDefault();
74418         var parentId = parentWayIdForVertexNavigation();
74419         _focusedParentWayId = parentId;
74420         if (!parentId)
74421           return;
74422         var way = context.entity(parentId);
74423         var length = way.nodes.length;
74424         var curr = way.nodes.indexOf(selectedIDs[0]);
74425         var index = -1;
74426         if (curr < length - 1) {
74427           index = curr + 1;
74428         } else if (way.isClosed()) {
74429           index = 0;
74430         }
74431         if (index !== -1) {
74432           context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
74433         }
74434       }
74435       function focusNextParent(d3_event) {
74436         d3_event.preventDefault();
74437         var parents = parentWaysIdsOfSelection(true);
74438         if (!parents || parents.length < 2)
74439           return;
74440         var index = parents.indexOf(_focusedParentWayId);
74441         if (index < 0 || index > parents.length - 2) {
74442           _focusedParentWayId = parents[0];
74443         } else {
74444           _focusedParentWayId = parents[index + 1];
74445         }
74446         var surface = context.surface();
74447         surface.selectAll(".related").classed("related", false);
74448         if (_focusedParentWayId) {
74449           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
74450         }
74451       }
74452       function selectParent(d3_event) {
74453         d3_event.preventDefault();
74454         var currentSelectedIds = mode.selectedIDs();
74455         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
74456         if (!parentIds.length)
74457           return;
74458         context.enter(mode.selectedIDs(parentIds));
74459         _focusedVertexIds = currentSelectedIds;
74460       }
74461       function selectChild(d3_event) {
74462         d3_event.preventDefault();
74463         var currentSelectedIds = mode.selectedIDs();
74464         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
74465         if (!childIds || !childIds.length)
74466           return;
74467         if (currentSelectedIds.length === 1)
74468           _focusedParentWayId = currentSelectedIds[0];
74469         context.enter(mode.selectedIDs(childIds));
74470       }
74471     };
74472     mode.exit = function() {
74473       _newFeature = false;
74474       _focusedVertexIds = null;
74475       _operations.forEach(function(operation) {
74476         if (operation.behavior) {
74477           context.uninstall(operation.behavior);
74478         }
74479       });
74480       _operations = [];
74481       _behaviors.forEach(context.uninstall);
74482       select_default2(document).call(keybinding.unbind);
74483       context.ui().closeEditMenu();
74484       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
74485       var surface = context.surface();
74486       surface.selectAll(".selected-member").classed("selected-member", false);
74487       surface.selectAll(".selected").classed("selected", false);
74488       surface.selectAll(".highlighted").classed("highlighted", false);
74489       surface.selectAll(".related").classed("related", false);
74490       context.map().on("drawn.select", null);
74491       context.ui().sidebar.hide();
74492       context.features().forceVisible([]);
74493       var entity = singular();
74494       if (_newFeature && entity && entity.type === "relation" && Object.keys(entity.tags).length === 0 && context.graph().parentRelations(entity).length === 0 && (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
74495         var deleteAction = actionDeleteRelation(entity.id, true);
74496         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
74497         context.validator().validate();
74498       }
74499     };
74500     return mode;
74501   }
74502
74503   // modules/behavior/lasso.js
74504   function behaviorLasso(context) {
74505     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
74506     var behavior = function(selection2) {
74507       var lasso;
74508       function pointerdown(d3_event) {
74509         var button = 0;
74510         if (d3_event.button === button && d3_event.shiftKey === true) {
74511           lasso = null;
74512           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
74513           d3_event.stopPropagation();
74514         }
74515       }
74516       function pointermove() {
74517         if (!lasso) {
74518           lasso = uiLasso(context);
74519           context.surface().call(lasso);
74520         }
74521         lasso.p(context.map().mouse());
74522       }
74523       function normalize2(a, b) {
74524         return [
74525           [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
74526           [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
74527         ];
74528       }
74529       function lassoed() {
74530         if (!lasso)
74531           return [];
74532         var graph = context.graph();
74533         var limitToNodes;
74534         if (context.map().editableDataEnabled(true) && context.map().isInWideSelection()) {
74535           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
74536         } else if (!context.map().editableDataEnabled()) {
74537           return [];
74538         }
74539         var bounds = lasso.extent().map(context.projection.invert);
74540         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
74541         var intersects = context.history().intersects(extent).filter(function(entity) {
74542           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
74543         });
74544         intersects.sort(function(node1, node2) {
74545           var parents1 = graph.parentWays(node1);
74546           var parents2 = graph.parentWays(node2);
74547           if (parents1.length && parents2.length) {
74548             var sharedParents = utilArrayIntersection(parents1, parents2);
74549             if (sharedParents.length) {
74550               var sharedParentNodes = sharedParents[0].nodes;
74551               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
74552             } else {
74553               return parseFloat(parents1[0].id.slice(1)) - parseFloat(parents2[0].id.slice(1));
74554             }
74555           } else if (parents1.length || parents2.length) {
74556             return parents1.length - parents2.length;
74557           }
74558           return node1.loc[0] - node2.loc[0];
74559         });
74560         return intersects.map(function(entity) {
74561           return entity.id;
74562         });
74563       }
74564       function pointerup() {
74565         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
74566         if (!lasso)
74567           return;
74568         var ids = lassoed();
74569         lasso.close();
74570         if (ids.length) {
74571           context.enter(modeSelect(context, ids));
74572         }
74573       }
74574       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
74575     };
74576     behavior.off = function(selection2) {
74577       selection2.on(_pointerPrefix + "down.lasso", null);
74578     };
74579     return behavior;
74580   }
74581
74582   // modules/modes/browse.js
74583   function modeBrowse(context) {
74584     var mode = {
74585       button: "browse",
74586       id: "browse",
74587       title: _t("modes.browse.title"),
74588       description: _t("modes.browse.description")
74589     };
74590     var sidebar;
74591     var _selectBehavior;
74592     var _behaviors = [];
74593     mode.selectBehavior = function(val) {
74594       if (!arguments.length)
74595         return _selectBehavior;
74596       _selectBehavior = val;
74597       return mode;
74598     };
74599     mode.enter = function() {
74600       if (!_behaviors.length) {
74601         if (!_selectBehavior)
74602           _selectBehavior = behaviorSelect(context);
74603         _behaviors = [
74604           behaviorPaste(context),
74605           behaviorHover(context).on("hover", context.ui().sidebar.hover),
74606           _selectBehavior,
74607           behaviorLasso(context),
74608           modeDragNode(context).behavior,
74609           modeDragNote(context).behavior
74610         ];
74611       }
74612       _behaviors.forEach(context.install);
74613       if (document.activeElement && document.activeElement.blur) {
74614         document.activeElement.blur();
74615       }
74616       if (sidebar) {
74617         context.ui().sidebar.show(sidebar);
74618       } else {
74619         context.ui().sidebar.select(null);
74620       }
74621     };
74622     mode.exit = function() {
74623       context.ui().sidebar.hover.cancel();
74624       _behaviors.forEach(context.uninstall);
74625       if (sidebar) {
74626         context.ui().sidebar.hide();
74627       }
74628     };
74629     mode.sidebar = function(_) {
74630       if (!arguments.length)
74631         return sidebar;
74632       sidebar = _;
74633       return mode;
74634     };
74635     mode.operations = function() {
74636       return [operationPaste(context)];
74637     };
74638     return mode;
74639   }
74640
74641   // modules/behavior/add_way.js
74642   function behaviorAddWay(context) {
74643     var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
74644     var draw = behaviorDraw(context);
74645     function behavior(surface) {
74646       draw.on("click", function() {
74647         dispatch10.apply("start", this, arguments);
74648       }).on("clickWay", function() {
74649         dispatch10.apply("startFromWay", this, arguments);
74650       }).on("clickNode", function() {
74651         dispatch10.apply("startFromNode", this, arguments);
74652       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
74653       context.map().dblclickZoomEnable(false);
74654       surface.call(draw);
74655     }
74656     behavior.off = function(surface) {
74657       surface.call(draw.off);
74658     };
74659     behavior.cancel = function() {
74660       window.setTimeout(function() {
74661         context.map().dblclickZoomEnable(true);
74662       }, 1e3);
74663       context.enter(modeBrowse(context));
74664     };
74665     return utilRebind(behavior, dispatch10, "on");
74666   }
74667
74668   // modules/behavior/hash.js
74669   function behaviorHash(context) {
74670     var _cachedHash = null;
74671     var _latitudeLimit = 90 - 1e-8;
74672     function computedHashParameters() {
74673       var map2 = context.map();
74674       var center = map2.center();
74675       var zoom = map2.zoom();
74676       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
74677       var oldParams = utilObjectOmit(utilStringQs(window.location.hash), ["comment", "source", "hashtags", "walkthrough"]);
74678       var newParams = {};
74679       delete oldParams.id;
74680       var selected = context.selectedIDs().filter(function(id2) {
74681         return context.hasEntity(id2);
74682       });
74683       if (selected.length) {
74684         newParams.id = selected.join(",");
74685       }
74686       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
74687       return Object.assign(oldParams, newParams);
74688     }
74689     function computedHash() {
74690       return "#" + utilQsString(computedHashParameters(), true);
74691     }
74692     function computedTitle(includeChangeCount) {
74693       var baseTitle = context.documentTitleBase() || "iD";
74694       var contextual;
74695       var changeCount;
74696       var titleID;
74697       var selected = context.selectedIDs().filter(function(id2) {
74698         return context.hasEntity(id2);
74699       });
74700       if (selected.length) {
74701         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
74702         if (selected.length > 1) {
74703           contextual = _t("title.labeled_and_more", {
74704             labeled: firstLabel,
74705             count: selected.length - 1
74706           });
74707         } else {
74708           contextual = firstLabel;
74709         }
74710         titleID = "context";
74711       }
74712       if (includeChangeCount) {
74713         changeCount = context.history().difference().summary().length;
74714         if (changeCount > 0) {
74715           titleID = contextual ? "changes_context" : "changes";
74716         }
74717       }
74718       if (titleID) {
74719         return _t("title.format." + titleID, {
74720           changes: changeCount,
74721           base: baseTitle,
74722           context: contextual
74723         });
74724       }
74725       return baseTitle;
74726     }
74727     function updateTitle(includeChangeCount) {
74728       if (!context.setsDocumentTitle())
74729         return;
74730       var newTitle = computedTitle(includeChangeCount);
74731       if (document.title !== newTitle) {
74732         document.title = newTitle;
74733       }
74734     }
74735     function updateHashIfNeeded() {
74736       if (context.inIntro())
74737         return;
74738       var latestHash = computedHash();
74739       if (_cachedHash !== latestHash) {
74740         _cachedHash = latestHash;
74741         window.history.replaceState(null, computedTitle(false), latestHash);
74742         updateTitle(true);
74743       }
74744     }
74745     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
74746     var _throttledUpdateTitle = throttle_default(function() {
74747       updateTitle(true);
74748     }, 500);
74749     function hashchange() {
74750       if (window.location.hash === _cachedHash)
74751         return;
74752       _cachedHash = window.location.hash;
74753       var q = utilStringQs(_cachedHash);
74754       var mapArgs = (q.map || "").split("/").map(Number);
74755       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
74756         updateHashIfNeeded();
74757       } else {
74758         if (_cachedHash === computedHash())
74759           return;
74760         var mode = context.mode();
74761         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
74762         if (q.id && mode) {
74763           var ids = q.id.split(",").filter(function(id2) {
74764             return context.hasEntity(id2);
74765           });
74766           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
74767             context.enter(modeSelect(context, ids));
74768             return;
74769           }
74770         }
74771         var center = context.map().center();
74772         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
74773         var maxdist = 500;
74774         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
74775           context.enter(modeBrowse(context));
74776           return;
74777         }
74778       }
74779     }
74780     function behavior() {
74781       context.map().on("move.behaviorHash", _throttledUpdate);
74782       context.history().on("change.behaviorHash", _throttledUpdateTitle);
74783       context.on("enter.behaviorHash", _throttledUpdate);
74784       select_default2(window).on("hashchange.behaviorHash", hashchange);
74785       if (window.location.hash) {
74786         var q = utilStringQs(window.location.hash);
74787         if (q.id) {
74788           context.zoomToEntity(q.id.split(",")[0], !q.map);
74789         }
74790         if (q.walkthrough === "true") {
74791           behavior.startWalkthrough = true;
74792         }
74793         if (q.map) {
74794           behavior.hadHash = true;
74795         }
74796         hashchange();
74797         updateTitle(false);
74798       }
74799     }
74800     behavior.off = function() {
74801       _throttledUpdate.cancel();
74802       _throttledUpdateTitle.cancel();
74803       context.map().on("move.behaviorHash", null);
74804       context.on("enter.behaviorHash", null);
74805       select_default2(window).on("hashchange.behaviorHash", null);
74806       window.location.hash = "";
74807     };
74808     return behavior;
74809   }
74810
74811   // node_modules/d3-brush/src/brush.js
74812   var { abs: abs2, max: max2, min: min2 } = Math;
74813   function number1(e) {
74814     return [+e[0], +e[1]];
74815   }
74816   function number22(e) {
74817     return [number1(e[0]), number1(e[1])];
74818   }
74819   var X = {
74820     name: "x",
74821     handles: ["w", "e"].map(type2),
74822     input: function(x, e) {
74823       return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
74824     },
74825     output: function(xy) {
74826       return xy && [xy[0][0], xy[1][0]];
74827     }
74828   };
74829   var Y = {
74830     name: "y",
74831     handles: ["n", "s"].map(type2),
74832     input: function(y, e) {
74833       return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
74834     },
74835     output: function(xy) {
74836       return xy && [xy[0][1], xy[1][1]];
74837     }
74838   };
74839   var XY = {
74840     name: "xy",
74841     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
74842     input: function(xy) {
74843       return xy == null ? null : number22(xy);
74844     },
74845     output: function(xy) {
74846       return xy;
74847     }
74848   };
74849   function type2(t) {
74850     return { type: t };
74851   }
74852
74853   // modules/index.js
74854   var debug = false;
74855   var d3 = {
74856     dispatch: dispatch_default,
74857     geoMercator: mercator_default,
74858     geoProjection: projection,
74859     polygonArea: area_default3,
74860     polygonCentroid: centroid_default2,
74861     select: select_default2,
74862     selectAll: selectAll_default2,
74863     timerFlush
74864   };
74865
74866   // modules/id.js
74867   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
74868     var start2 = Date.now();
74869     return window.requestAnimationFrame(function() {
74870       cb({
74871         didTimeout: false,
74872         timeRemaining: function() {
74873           return Math.max(0, 50 - (Date.now() - start2));
74874         }
74875       });
74876     });
74877   };
74878   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
74879     window.cancelAnimationFrame(id2);
74880   };
74881   window.iD = modules_exports;
74882 })();
74883 //# sourceMappingURL=iD.js.map