]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/3561'
[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.0";
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             while (src) {
35015               rawLine = src.split("\n", 1)[0];
35016               line = rawLine;
35017               if (this.options.pedantic) {
35018                 line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
35019               }
35020               if (nextBulletRegex.test(line)) {
35021                 break;
35022               }
35023               if (hrRegex.test(src)) {
35024                 break;
35025               }
35026               if (line.search(/[^ ]/) >= indent2 || !line.trim()) {
35027                 itemContents += "\n" + line.slice(indent2);
35028               } else if (!blankLine) {
35029                 itemContents += "\n" + line;
35030               } else {
35031                 break;
35032               }
35033               if (!blankLine && !line.trim()) {
35034                 blankLine = true;
35035               }
35036               raw += rawLine + "\n";
35037               src = src.substring(rawLine.length + 1);
35038             }
35039           }
35040           if (!list.loose) {
35041             if (endsWithBlankLine) {
35042               list.loose = true;
35043             } else if (/\n *\n *$/.test(raw)) {
35044               endsWithBlankLine = true;
35045             }
35046           }
35047           if (this.options.gfm) {
35048             istask = /^\[[ xX]\] /.exec(itemContents);
35049             if (istask) {
35050               ischecked = istask[0] !== "[ ] ";
35051               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
35052             }
35053           }
35054           list.items.push({
35055             type: "list_item",
35056             raw,
35057             task: !!istask,
35058             checked: ischecked,
35059             loose: false,
35060             text: itemContents
35061           });
35062           list.raw += raw;
35063         }
35064         list.items[list.items.length - 1].raw = raw.trimRight();
35065         list.items[list.items.length - 1].text = itemContents.trimRight();
35066         list.raw = list.raw.trimRight();
35067         const l = list.items.length;
35068         for (i2 = 0; i2 < l; i2++) {
35069           this.lexer.state.top = false;
35070           list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
35071           const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
35072           const hasMultipleLineBreaks = spacers.every((t) => {
35073             const chars = t.raw.split("");
35074             let lineBreaks = 0;
35075             for (const char of chars) {
35076               if (char === "\n") {
35077                 lineBreaks += 1;
35078               }
35079               if (lineBreaks > 1) {
35080                 return true;
35081               }
35082             }
35083             return false;
35084           });
35085           if (!list.loose && spacers.length && hasMultipleLineBreaks) {
35086             list.loose = true;
35087             list.items[i2].loose = true;
35088           }
35089         }
35090         return list;
35091       }
35092     }
35093     html(src) {
35094       const cap = this.rules.block.html.exec(src);
35095       if (cap) {
35096         const token = {
35097           type: "html",
35098           raw: cap[0],
35099           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
35100           text: cap[0]
35101         };
35102         if (this.options.sanitize) {
35103           token.type = "paragraph";
35104           token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
35105           token.tokens = [];
35106           this.lexer.inline(token.text, token.tokens);
35107         }
35108         return token;
35109       }
35110     }
35111     def(src) {
35112       const cap = this.rules.block.def.exec(src);
35113       if (cap) {
35114         if (cap[3])
35115           cap[3] = cap[3].substring(1, cap[3].length - 1);
35116         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
35117         return {
35118           type: "def",
35119           tag,
35120           raw: cap[0],
35121           href: cap[2],
35122           title: cap[3]
35123         };
35124       }
35125     }
35126     table(src) {
35127       const cap = this.rules.block.table.exec(src);
35128       if (cap) {
35129         const item = {
35130           type: "table",
35131           header: splitCells(cap[1]).map((c) => {
35132             return { text: c };
35133           }),
35134           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
35135           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
35136         };
35137         if (item.header.length === item.align.length) {
35138           item.raw = cap[0];
35139           let l = item.align.length;
35140           let i2, j2, k, row;
35141           for (i2 = 0; i2 < l; i2++) {
35142             if (/^ *-+: *$/.test(item.align[i2])) {
35143               item.align[i2] = "right";
35144             } else if (/^ *:-+: *$/.test(item.align[i2])) {
35145               item.align[i2] = "center";
35146             } else if (/^ *:-+ *$/.test(item.align[i2])) {
35147               item.align[i2] = "left";
35148             } else {
35149               item.align[i2] = null;
35150             }
35151           }
35152           l = item.rows.length;
35153           for (i2 = 0; i2 < l; i2++) {
35154             item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
35155               return { text: c };
35156             });
35157           }
35158           l = item.header.length;
35159           for (j2 = 0; j2 < l; j2++) {
35160             item.header[j2].tokens = [];
35161             this.lexer.inline(item.header[j2].text, item.header[j2].tokens);
35162           }
35163           l = item.rows.length;
35164           for (j2 = 0; j2 < l; j2++) {
35165             row = item.rows[j2];
35166             for (k = 0; k < row.length; k++) {
35167               row[k].tokens = [];
35168               this.lexer.inline(row[k].text, row[k].tokens);
35169             }
35170           }
35171           return item;
35172         }
35173       }
35174     }
35175     lheading(src) {
35176       const cap = this.rules.block.lheading.exec(src);
35177       if (cap) {
35178         const token = {
35179           type: "heading",
35180           raw: cap[0],
35181           depth: cap[2].charAt(0) === "=" ? 1 : 2,
35182           text: cap[1],
35183           tokens: []
35184         };
35185         this.lexer.inline(token.text, token.tokens);
35186         return token;
35187       }
35188     }
35189     paragraph(src) {
35190       const cap = this.rules.block.paragraph.exec(src);
35191       if (cap) {
35192         const token = {
35193           type: "paragraph",
35194           raw: cap[0],
35195           text: cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1],
35196           tokens: []
35197         };
35198         this.lexer.inline(token.text, token.tokens);
35199         return token;
35200       }
35201     }
35202     text(src) {
35203       const cap = this.rules.block.text.exec(src);
35204       if (cap) {
35205         const token = {
35206           type: "text",
35207           raw: cap[0],
35208           text: cap[0],
35209           tokens: []
35210         };
35211         this.lexer.inline(token.text, token.tokens);
35212         return token;
35213       }
35214     }
35215     escape(src) {
35216       const cap = this.rules.inline.escape.exec(src);
35217       if (cap) {
35218         return {
35219           type: "escape",
35220           raw: cap[0],
35221           text: escape4(cap[1])
35222         };
35223       }
35224     }
35225     tag(src) {
35226       const cap = this.rules.inline.tag.exec(src);
35227       if (cap) {
35228         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
35229           this.lexer.state.inLink = true;
35230         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
35231           this.lexer.state.inLink = false;
35232         }
35233         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35234           this.lexer.state.inRawBlock = true;
35235         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35236           this.lexer.state.inRawBlock = false;
35237         }
35238         return {
35239           type: this.options.sanitize ? "text" : "html",
35240           raw: cap[0],
35241           inLink: this.lexer.state.inLink,
35242           inRawBlock: this.lexer.state.inRawBlock,
35243           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
35244         };
35245       }
35246     }
35247     link(src) {
35248       const cap = this.rules.inline.link.exec(src);
35249       if (cap) {
35250         const trimmedUrl = cap[2].trim();
35251         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
35252           if (!/>$/.test(trimmedUrl)) {
35253             return;
35254           }
35255           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
35256           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
35257             return;
35258           }
35259         } else {
35260           const lastParenIndex = findClosingBracket(cap[2], "()");
35261           if (lastParenIndex > -1) {
35262             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
35263             const linkLen = start2 + cap[1].length + lastParenIndex;
35264             cap[2] = cap[2].substring(0, lastParenIndex);
35265             cap[0] = cap[0].substring(0, linkLen).trim();
35266             cap[3] = "";
35267           }
35268         }
35269         let href = cap[2];
35270         let title = "";
35271         if (this.options.pedantic) {
35272           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
35273           if (link2) {
35274             href = link2[1];
35275             title = link2[3];
35276           }
35277         } else {
35278           title = cap[3] ? cap[3].slice(1, -1) : "";
35279         }
35280         href = href.trim();
35281         if (/^</.test(href)) {
35282           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
35283             href = href.slice(1);
35284           } else {
35285             href = href.slice(1, -1);
35286           }
35287         }
35288         return outputLink(cap, {
35289           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
35290           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
35291         }, cap[0], this.lexer);
35292       }
35293     }
35294     reflink(src, links) {
35295       let cap;
35296       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
35297         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
35298         link2 = links[link2.toLowerCase()];
35299         if (!link2 || !link2.href) {
35300           const text2 = cap[0].charAt(0);
35301           return {
35302             type: "text",
35303             raw: text2,
35304             text: text2
35305           };
35306         }
35307         return outputLink(cap, link2, cap[0], this.lexer);
35308       }
35309     }
35310     emStrong(src, maskedSrc, prevChar = "") {
35311       let match = this.rules.inline.emStrong.lDelim.exec(src);
35312       if (!match)
35313         return;
35314       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
35315         return;
35316       const nextChar = match[1] || match[2] || "";
35317       if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
35318         const lLength = match[0].length - 1;
35319         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
35320         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
35321         endReg.lastIndex = 0;
35322         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
35323         while ((match = endReg.exec(maskedSrc)) != null) {
35324           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
35325           if (!rDelim)
35326             continue;
35327           rLength = rDelim.length;
35328           if (match[3] || match[4]) {
35329             delimTotal += rLength;
35330             continue;
35331           } else if (match[5] || match[6]) {
35332             if (lLength % 3 && !((lLength + rLength) % 3)) {
35333               midDelimTotal += rLength;
35334               continue;
35335             }
35336           }
35337           delimTotal -= rLength;
35338           if (delimTotal > 0)
35339             continue;
35340           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
35341           if (Math.min(lLength, rLength) % 2) {
35342             const text3 = src.slice(1, lLength + match.index + rLength);
35343             return {
35344               type: "em",
35345               raw: src.slice(0, lLength + match.index + rLength + 1),
35346               text: text3,
35347               tokens: this.lexer.inlineTokens(text3, [])
35348             };
35349           }
35350           const text2 = src.slice(2, lLength + match.index + rLength - 1);
35351           return {
35352             type: "strong",
35353             raw: src.slice(0, lLength + match.index + rLength + 1),
35354             text: text2,
35355             tokens: this.lexer.inlineTokens(text2, [])
35356           };
35357         }
35358       }
35359     }
35360     codespan(src) {
35361       const cap = this.rules.inline.code.exec(src);
35362       if (cap) {
35363         let text2 = cap[2].replace(/\n/g, " ");
35364         const hasNonSpaceChars = /[^ ]/.test(text2);
35365         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
35366         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
35367           text2 = text2.substring(1, text2.length - 1);
35368         }
35369         text2 = escape4(text2, true);
35370         return {
35371           type: "codespan",
35372           raw: cap[0],
35373           text: text2
35374         };
35375       }
35376     }
35377     br(src) {
35378       const cap = this.rules.inline.br.exec(src);
35379       if (cap) {
35380         return {
35381           type: "br",
35382           raw: cap[0]
35383         };
35384       }
35385     }
35386     del(src) {
35387       const cap = this.rules.inline.del.exec(src);
35388       if (cap) {
35389         return {
35390           type: "del",
35391           raw: cap[0],
35392           text: cap[2],
35393           tokens: this.lexer.inlineTokens(cap[2], [])
35394         };
35395       }
35396     }
35397     autolink(src, mangle2) {
35398       const cap = this.rules.inline.autolink.exec(src);
35399       if (cap) {
35400         let text2, href;
35401         if (cap[2] === "@") {
35402           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
35403           href = "mailto:" + text2;
35404         } else {
35405           text2 = escape4(cap[1]);
35406           href = text2;
35407         }
35408         return {
35409           type: "link",
35410           raw: cap[0],
35411           text: text2,
35412           href,
35413           tokens: [
35414             {
35415               type: "text",
35416               raw: text2,
35417               text: text2
35418             }
35419           ]
35420         };
35421       }
35422     }
35423     url(src, mangle2) {
35424       let cap;
35425       if (cap = this.rules.inline.url.exec(src)) {
35426         let text2, href;
35427         if (cap[2] === "@") {
35428           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
35429           href = "mailto:" + text2;
35430         } else {
35431           let prevCapZero;
35432           do {
35433             prevCapZero = cap[0];
35434             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
35435           } while (prevCapZero !== cap[0]);
35436           text2 = escape4(cap[0]);
35437           if (cap[1] === "www.") {
35438             href = "http://" + text2;
35439           } else {
35440             href = text2;
35441           }
35442         }
35443         return {
35444           type: "link",
35445           raw: cap[0],
35446           text: text2,
35447           href,
35448           tokens: [
35449             {
35450               type: "text",
35451               raw: text2,
35452               text: text2
35453             }
35454           ]
35455         };
35456       }
35457     }
35458     inlineText(src, smartypants2) {
35459       const cap = this.rules.inline.text.exec(src);
35460       if (cap) {
35461         let text2;
35462         if (this.lexer.state.inRawBlock) {
35463           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
35464         } else {
35465           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
35466         }
35467         return {
35468           type: "text",
35469           raw: cap[0],
35470           text: text2
35471         };
35472       }
35473     }
35474   };
35475   var block = {
35476     newline: /^(?: *(?:\n|$))+/,
35477     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
35478     fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
35479     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
35480     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
35481     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
35482     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
35483     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|$))",
35484     def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
35485     table: noopTest,
35486     lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
35487     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
35488     text: /^[^\n]+/
35489   };
35490   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
35491   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
35492   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
35493   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
35494   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
35495   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();
35496   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";
35497   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
35498   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
35499   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();
35500   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
35501   block.normal = merge2({}, block);
35502   block.gfm = merge2({}, block.normal, {
35503     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
35504   });
35505   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();
35506   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();
35507   block.pedantic = merge2({}, block.normal, {
35508     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(),
35509     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
35510     heading: /^(#{1,6})(.*)(?:\n+|$)/,
35511     fences: noopTest,
35512     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()
35513   });
35514   var inline = {
35515     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
35516     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
35517     url: noopTest,
35518     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
35519     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
35520     reflink: /^!?\[(label)\]\[(ref)\]/,
35521     nolink: /^!?\[(ref)\](?:\[\])?/,
35522     reflinkSearch: "reflink|nolink(?!\\()",
35523     emStrong: {
35524       lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
35525       rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
35526       rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
35527     },
35528     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
35529     br: /^( {2,}|\\)\n(?!\s*$)/,
35530     del: noopTest,
35531     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
35532     punctuation: /^([\spunctuation])/
35533   };
35534   inline._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
35535   inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
35536   inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
35537   inline.escapedEmSt = /\\\*|\\_/g;
35538   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
35539   inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
35540   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
35541   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
35542   inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
35543   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
35544   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])?)+(?![-_])/;
35545   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
35546   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
35547   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
35548   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
35549   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
35550   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
35551   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
35552   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
35553   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
35554   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
35555   inline.normal = merge2({}, inline);
35556   inline.pedantic = merge2({}, inline.normal, {
35557     strong: {
35558       start: /^__|\*\*/,
35559       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
35560       endAst: /\*\*(?!\*)/g,
35561       endUnd: /__(?!_)/g
35562     },
35563     em: {
35564       start: /^_|\*/,
35565       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
35566       endAst: /\*(?!\*)/g,
35567       endUnd: /_(?!_)/g
35568     },
35569     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
35570     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
35571   });
35572   inline.gfm = merge2({}, inline.normal, {
35573     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
35574     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
35575     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
35576     _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
35577     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
35578     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
35579   });
35580   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
35581   inline.breaks = merge2({}, inline.gfm, {
35582     br: edit(inline.br).replace("{2,}", "*").getRegex(),
35583     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
35584   });
35585   function smartypants(text2) {
35586     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");
35587   }
35588   function mangle(text2) {
35589     let out = "", i2, ch;
35590     const l = text2.length;
35591     for (i2 = 0; i2 < l; i2++) {
35592       ch = text2.charCodeAt(i2);
35593       if (Math.random() > 0.5) {
35594         ch = "x" + ch.toString(16);
35595       }
35596       out += "&#" + ch + ";";
35597     }
35598     return out;
35599   }
35600   var Lexer = class {
35601     constructor(options2) {
35602       this.tokens = [];
35603       this.tokens.links = /* @__PURE__ */ Object.create(null);
35604       this.options = options2 || defaults;
35605       this.options.tokenizer = this.options.tokenizer || new Tokenizer();
35606       this.tokenizer = this.options.tokenizer;
35607       this.tokenizer.options = this.options;
35608       this.tokenizer.lexer = this;
35609       this.inlineQueue = [];
35610       this.state = {
35611         inLink: false,
35612         inRawBlock: false,
35613         top: true
35614       };
35615       const rules = {
35616         block: block.normal,
35617         inline: inline.normal
35618       };
35619       if (this.options.pedantic) {
35620         rules.block = block.pedantic;
35621         rules.inline = inline.pedantic;
35622       } else if (this.options.gfm) {
35623         rules.block = block.gfm;
35624         if (this.options.breaks) {
35625           rules.inline = inline.breaks;
35626         } else {
35627           rules.inline = inline.gfm;
35628         }
35629       }
35630       this.tokenizer.rules = rules;
35631     }
35632     static get rules() {
35633       return {
35634         block,
35635         inline
35636       };
35637     }
35638     static lex(src, options2) {
35639       const lexer2 = new Lexer(options2);
35640       return lexer2.lex(src);
35641     }
35642     static lexInline(src, options2) {
35643       const lexer2 = new Lexer(options2);
35644       return lexer2.inlineTokens(src);
35645     }
35646     lex(src) {
35647       src = src.replace(/\r\n|\r/g, "\n");
35648       this.blockTokens(src, this.tokens);
35649       let next;
35650       while (next = this.inlineQueue.shift()) {
35651         this.inlineTokens(next.src, next.tokens);
35652       }
35653       return this.tokens;
35654     }
35655     blockTokens(src, tokens = []) {
35656       if (this.options.pedantic) {
35657         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
35658       } else {
35659         src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
35660           return leading + "    ".repeat(tabs.length);
35661         });
35662       }
35663       let token, lastToken, cutSrc, lastParagraphClipped;
35664       while (src) {
35665         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
35666           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
35667             src = src.substring(token.raw.length);
35668             tokens.push(token);
35669             return true;
35670           }
35671           return false;
35672         })) {
35673           continue;
35674         }
35675         if (token = this.tokenizer.space(src)) {
35676           src = src.substring(token.raw.length);
35677           if (token.raw.length === 1 && tokens.length > 0) {
35678             tokens[tokens.length - 1].raw += "\n";
35679           } else {
35680             tokens.push(token);
35681           }
35682           continue;
35683         }
35684         if (token = this.tokenizer.code(src)) {
35685           src = src.substring(token.raw.length);
35686           lastToken = tokens[tokens.length - 1];
35687           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35688             lastToken.raw += "\n" + token.raw;
35689             lastToken.text += "\n" + token.text;
35690             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35691           } else {
35692             tokens.push(token);
35693           }
35694           continue;
35695         }
35696         if (token = this.tokenizer.fences(src)) {
35697           src = src.substring(token.raw.length);
35698           tokens.push(token);
35699           continue;
35700         }
35701         if (token = this.tokenizer.heading(src)) {
35702           src = src.substring(token.raw.length);
35703           tokens.push(token);
35704           continue;
35705         }
35706         if (token = this.tokenizer.hr(src)) {
35707           src = src.substring(token.raw.length);
35708           tokens.push(token);
35709           continue;
35710         }
35711         if (token = this.tokenizer.blockquote(src)) {
35712           src = src.substring(token.raw.length);
35713           tokens.push(token);
35714           continue;
35715         }
35716         if (token = this.tokenizer.list(src)) {
35717           src = src.substring(token.raw.length);
35718           tokens.push(token);
35719           continue;
35720         }
35721         if (token = this.tokenizer.html(src)) {
35722           src = src.substring(token.raw.length);
35723           tokens.push(token);
35724           continue;
35725         }
35726         if (token = this.tokenizer.def(src)) {
35727           src = src.substring(token.raw.length);
35728           lastToken = tokens[tokens.length - 1];
35729           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35730             lastToken.raw += "\n" + token.raw;
35731             lastToken.text += "\n" + token.raw;
35732             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35733           } else if (!this.tokens.links[token.tag]) {
35734             this.tokens.links[token.tag] = {
35735               href: token.href,
35736               title: token.title
35737             };
35738           }
35739           continue;
35740         }
35741         if (token = this.tokenizer.table(src)) {
35742           src = src.substring(token.raw.length);
35743           tokens.push(token);
35744           continue;
35745         }
35746         if (token = this.tokenizer.lheading(src)) {
35747           src = src.substring(token.raw.length);
35748           tokens.push(token);
35749           continue;
35750         }
35751         cutSrc = src;
35752         if (this.options.extensions && this.options.extensions.startBlock) {
35753           let startIndex = Infinity;
35754           const tempSrc = src.slice(1);
35755           let tempStart;
35756           this.options.extensions.startBlock.forEach(function(getStartIndex) {
35757             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
35758             if (typeof tempStart === "number" && tempStart >= 0) {
35759               startIndex = Math.min(startIndex, tempStart);
35760             }
35761           });
35762           if (startIndex < Infinity && startIndex >= 0) {
35763             cutSrc = src.substring(0, startIndex + 1);
35764           }
35765         }
35766         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
35767           lastToken = tokens[tokens.length - 1];
35768           if (lastParagraphClipped && lastToken.type === "paragraph") {
35769             lastToken.raw += "\n" + token.raw;
35770             lastToken.text += "\n" + token.text;
35771             this.inlineQueue.pop();
35772             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35773           } else {
35774             tokens.push(token);
35775           }
35776           lastParagraphClipped = cutSrc.length !== src.length;
35777           src = src.substring(token.raw.length);
35778           continue;
35779         }
35780         if (token = this.tokenizer.text(src)) {
35781           src = src.substring(token.raw.length);
35782           lastToken = tokens[tokens.length - 1];
35783           if (lastToken && lastToken.type === "text") {
35784             lastToken.raw += "\n" + token.raw;
35785             lastToken.text += "\n" + token.text;
35786             this.inlineQueue.pop();
35787             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35788           } else {
35789             tokens.push(token);
35790           }
35791           continue;
35792         }
35793         if (src) {
35794           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
35795           if (this.options.silent) {
35796             console.error(errMsg);
35797             break;
35798           } else {
35799             throw new Error(errMsg);
35800           }
35801         }
35802       }
35803       this.state.top = true;
35804       return tokens;
35805     }
35806     inline(src, tokens) {
35807       this.inlineQueue.push({ src, tokens });
35808     }
35809     inlineTokens(src, tokens = []) {
35810       let token, lastToken, cutSrc;
35811       let maskedSrc = src;
35812       let match;
35813       let keepPrevChar, prevChar;
35814       if (this.tokens.links) {
35815         const links = Object.keys(this.tokens.links);
35816         if (links.length > 0) {
35817           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
35818             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
35819               maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
35820             }
35821           }
35822         }
35823       }
35824       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
35825         maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
35826       }
35827       while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
35828         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
35829       }
35830       while (src) {
35831         if (!keepPrevChar) {
35832           prevChar = "";
35833         }
35834         keepPrevChar = false;
35835         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
35836           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
35837             src = src.substring(token.raw.length);
35838             tokens.push(token);
35839             return true;
35840           }
35841           return false;
35842         })) {
35843           continue;
35844         }
35845         if (token = this.tokenizer.escape(src)) {
35846           src = src.substring(token.raw.length);
35847           tokens.push(token);
35848           continue;
35849         }
35850         if (token = this.tokenizer.tag(src)) {
35851           src = src.substring(token.raw.length);
35852           lastToken = tokens[tokens.length - 1];
35853           if (lastToken && token.type === "text" && lastToken.type === "text") {
35854             lastToken.raw += token.raw;
35855             lastToken.text += token.text;
35856           } else {
35857             tokens.push(token);
35858           }
35859           continue;
35860         }
35861         if (token = this.tokenizer.link(src)) {
35862           src = src.substring(token.raw.length);
35863           tokens.push(token);
35864           continue;
35865         }
35866         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
35867           src = src.substring(token.raw.length);
35868           lastToken = tokens[tokens.length - 1];
35869           if (lastToken && token.type === "text" && lastToken.type === "text") {
35870             lastToken.raw += token.raw;
35871             lastToken.text += token.text;
35872           } else {
35873             tokens.push(token);
35874           }
35875           continue;
35876         }
35877         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
35878           src = src.substring(token.raw.length);
35879           tokens.push(token);
35880           continue;
35881         }
35882         if (token = this.tokenizer.codespan(src)) {
35883           src = src.substring(token.raw.length);
35884           tokens.push(token);
35885           continue;
35886         }
35887         if (token = this.tokenizer.br(src)) {
35888           src = src.substring(token.raw.length);
35889           tokens.push(token);
35890           continue;
35891         }
35892         if (token = this.tokenizer.del(src)) {
35893           src = src.substring(token.raw.length);
35894           tokens.push(token);
35895           continue;
35896         }
35897         if (token = this.tokenizer.autolink(src, mangle)) {
35898           src = src.substring(token.raw.length);
35899           tokens.push(token);
35900           continue;
35901         }
35902         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
35903           src = src.substring(token.raw.length);
35904           tokens.push(token);
35905           continue;
35906         }
35907         cutSrc = src;
35908         if (this.options.extensions && this.options.extensions.startInline) {
35909           let startIndex = Infinity;
35910           const tempSrc = src.slice(1);
35911           let tempStart;
35912           this.options.extensions.startInline.forEach(function(getStartIndex) {
35913             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
35914             if (typeof tempStart === "number" && tempStart >= 0) {
35915               startIndex = Math.min(startIndex, tempStart);
35916             }
35917           });
35918           if (startIndex < Infinity && startIndex >= 0) {
35919             cutSrc = src.substring(0, startIndex + 1);
35920           }
35921         }
35922         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
35923           src = src.substring(token.raw.length);
35924           if (token.raw.slice(-1) !== "_") {
35925             prevChar = token.raw.slice(-1);
35926           }
35927           keepPrevChar = true;
35928           lastToken = tokens[tokens.length - 1];
35929           if (lastToken && lastToken.type === "text") {
35930             lastToken.raw += token.raw;
35931             lastToken.text += token.text;
35932           } else {
35933             tokens.push(token);
35934           }
35935           continue;
35936         }
35937         if (src) {
35938           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
35939           if (this.options.silent) {
35940             console.error(errMsg);
35941             break;
35942           } else {
35943             throw new Error(errMsg);
35944           }
35945         }
35946       }
35947       return tokens;
35948     }
35949   };
35950   var Renderer = class {
35951     constructor(options2) {
35952       this.options = options2 || defaults;
35953     }
35954     code(code, infostring, escaped) {
35955       const lang = (infostring || "").match(/\S*/)[0];
35956       if (this.options.highlight) {
35957         const out = this.options.highlight(code, lang);
35958         if (out != null && out !== code) {
35959           escaped = true;
35960           code = out;
35961         }
35962       }
35963       code = code.replace(/\n$/, "") + "\n";
35964       if (!lang) {
35965         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
35966       }
35967       return '<pre><code class="' + this.options.langPrefix + escape4(lang, true) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
35968     }
35969     blockquote(quote2) {
35970       return `<blockquote>
35971 ${quote2}</blockquote>
35972 `;
35973     }
35974     html(html2) {
35975       return html2;
35976     }
35977     heading(text2, level, raw, slugger) {
35978       if (this.options.headerIds) {
35979         const id2 = this.options.headerPrefix + slugger.slug(raw);
35980         return `<h${level} id="${id2}">${text2}</h${level}>
35981 `;
35982       }
35983       return `<h${level}>${text2}</h${level}>
35984 `;
35985     }
35986     hr() {
35987       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
35988     }
35989     list(body, ordered, start2) {
35990       const type3 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
35991       return "<" + type3 + startatt + ">\n" + body + "</" + type3 + ">\n";
35992     }
35993     listitem(text2) {
35994       return `<li>${text2}</li>
35995 `;
35996     }
35997     checkbox(checked) {
35998       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
35999     }
36000     paragraph(text2) {
36001       return `<p>${text2}</p>
36002 `;
36003     }
36004     table(header, body) {
36005       if (body)
36006         body = `<tbody>${body}</tbody>`;
36007       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
36008     }
36009     tablerow(content) {
36010       return `<tr>
36011 ${content}</tr>
36012 `;
36013     }
36014     tablecell(content, flags) {
36015       const type3 = flags.header ? "th" : "td";
36016       const tag = flags.align ? `<${type3} align="${flags.align}">` : `<${type3}>`;
36017       return tag + content + `</${type3}>
36018 `;
36019     }
36020     strong(text2) {
36021       return `<strong>${text2}</strong>`;
36022     }
36023     em(text2) {
36024       return `<em>${text2}</em>`;
36025     }
36026     codespan(text2) {
36027       return `<code>${text2}</code>`;
36028     }
36029     br() {
36030       return this.options.xhtml ? "<br/>" : "<br>";
36031     }
36032     del(text2) {
36033       return `<del>${text2}</del>`;
36034     }
36035     link(href, title, text2) {
36036       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36037       if (href === null) {
36038         return text2;
36039       }
36040       let out = '<a href="' + escape4(href) + '"';
36041       if (title) {
36042         out += ' title="' + title + '"';
36043       }
36044       out += ">" + text2 + "</a>";
36045       return out;
36046     }
36047     image(href, title, text2) {
36048       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36049       if (href === null) {
36050         return text2;
36051       }
36052       let out = `<img src="${href}" alt="${text2}"`;
36053       if (title) {
36054         out += ` title="${title}"`;
36055       }
36056       out += this.options.xhtml ? "/>" : ">";
36057       return out;
36058     }
36059     text(text2) {
36060       return text2;
36061     }
36062   };
36063   var TextRenderer = class {
36064     strong(text2) {
36065       return text2;
36066     }
36067     em(text2) {
36068       return text2;
36069     }
36070     codespan(text2) {
36071       return text2;
36072     }
36073     del(text2) {
36074       return text2;
36075     }
36076     html(text2) {
36077       return text2;
36078     }
36079     text(text2) {
36080       return text2;
36081     }
36082     link(href, title, text2) {
36083       return "" + text2;
36084     }
36085     image(href, title, text2) {
36086       return "" + text2;
36087     }
36088     br() {
36089       return "";
36090     }
36091   };
36092   var Slugger = class {
36093     constructor() {
36094       this.seen = {};
36095     }
36096     serialize(value) {
36097       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
36098     }
36099     getNextSafeSlug(originalSlug, isDryRun) {
36100       let slug = originalSlug;
36101       let occurenceAccumulator = 0;
36102       if (this.seen.hasOwnProperty(slug)) {
36103         occurenceAccumulator = this.seen[originalSlug];
36104         do {
36105           occurenceAccumulator++;
36106           slug = originalSlug + "-" + occurenceAccumulator;
36107         } while (this.seen.hasOwnProperty(slug));
36108       }
36109       if (!isDryRun) {
36110         this.seen[originalSlug] = occurenceAccumulator;
36111         this.seen[slug] = 0;
36112       }
36113       return slug;
36114     }
36115     slug(value, options2 = {}) {
36116       const slug = this.serialize(value);
36117       return this.getNextSafeSlug(slug, options2.dryrun);
36118     }
36119   };
36120   var Parser = class {
36121     constructor(options2) {
36122       this.options = options2 || defaults;
36123       this.options.renderer = this.options.renderer || new Renderer();
36124       this.renderer = this.options.renderer;
36125       this.renderer.options = this.options;
36126       this.textRenderer = new TextRenderer();
36127       this.slugger = new Slugger();
36128     }
36129     static parse(tokens, options2) {
36130       const parser3 = new Parser(options2);
36131       return parser3.parse(tokens);
36132     }
36133     static parseInline(tokens, options2) {
36134       const parser3 = new Parser(options2);
36135       return parser3.parseInline(tokens);
36136     }
36137     parse(tokens, top = true) {
36138       let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
36139       const l = tokens.length;
36140       for (i2 = 0; i2 < l; i2++) {
36141         token = tokens[i2];
36142         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36143           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36144           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
36145             out += ret || "";
36146             continue;
36147           }
36148         }
36149         switch (token.type) {
36150           case "space": {
36151             continue;
36152           }
36153           case "hr": {
36154             out += this.renderer.hr();
36155             continue;
36156           }
36157           case "heading": {
36158             out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
36159             continue;
36160           }
36161           case "code": {
36162             out += this.renderer.code(token.text, token.lang, token.escaped);
36163             continue;
36164           }
36165           case "table": {
36166             header = "";
36167             cell = "";
36168             l2 = token.header.length;
36169             for (j2 = 0; j2 < l2; j2++) {
36170               cell += this.renderer.tablecell(this.parseInline(token.header[j2].tokens), { header: true, align: token.align[j2] });
36171             }
36172             header += this.renderer.tablerow(cell);
36173             body = "";
36174             l2 = token.rows.length;
36175             for (j2 = 0; j2 < l2; j2++) {
36176               row = token.rows[j2];
36177               cell = "";
36178               l3 = row.length;
36179               for (k = 0; k < l3; k++) {
36180                 cell += this.renderer.tablecell(this.parseInline(row[k].tokens), { header: false, align: token.align[k] });
36181               }
36182               body += this.renderer.tablerow(cell);
36183             }
36184             out += this.renderer.table(header, body);
36185             continue;
36186           }
36187           case "blockquote": {
36188             body = this.parse(token.tokens);
36189             out += this.renderer.blockquote(body);
36190             continue;
36191           }
36192           case "list": {
36193             ordered = token.ordered;
36194             start2 = token.start;
36195             loose = token.loose;
36196             l2 = token.items.length;
36197             body = "";
36198             for (j2 = 0; j2 < l2; j2++) {
36199               item = token.items[j2];
36200               checked = item.checked;
36201               task = item.task;
36202               itemBody = "";
36203               if (item.task) {
36204                 checkbox = this.renderer.checkbox(checked);
36205                 if (loose) {
36206                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
36207                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
36208                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
36209                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
36210                     }
36211                   } else {
36212                     item.tokens.unshift({
36213                       type: "text",
36214                       text: checkbox
36215                     });
36216                   }
36217                 } else {
36218                   itemBody += checkbox;
36219                 }
36220               }
36221               itemBody += this.parse(item.tokens, loose);
36222               body += this.renderer.listitem(itemBody, task, checked);
36223             }
36224             out += this.renderer.list(body, ordered, start2);
36225             continue;
36226           }
36227           case "html": {
36228             out += this.renderer.html(token.text);
36229             continue;
36230           }
36231           case "paragraph": {
36232             out += this.renderer.paragraph(this.parseInline(token.tokens));
36233             continue;
36234           }
36235           case "text": {
36236             body = token.tokens ? this.parseInline(token.tokens) : token.text;
36237             while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
36238               token = tokens[++i2];
36239               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
36240             }
36241             out += top ? this.renderer.paragraph(body) : body;
36242             continue;
36243           }
36244           default: {
36245             const errMsg = 'Token with "' + token.type + '" type was not found.';
36246             if (this.options.silent) {
36247               console.error(errMsg);
36248               return;
36249             } else {
36250               throw new Error(errMsg);
36251             }
36252           }
36253         }
36254       }
36255       return out;
36256     }
36257     parseInline(tokens, renderer) {
36258       renderer = renderer || this.renderer;
36259       let out = "", i2, token, ret;
36260       const l = tokens.length;
36261       for (i2 = 0; i2 < l; i2++) {
36262         token = tokens[i2];
36263         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36264           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36265           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
36266             out += ret || "";
36267             continue;
36268           }
36269         }
36270         switch (token.type) {
36271           case "escape": {
36272             out += renderer.text(token.text);
36273             break;
36274           }
36275           case "html": {
36276             out += renderer.html(token.text);
36277             break;
36278           }
36279           case "link": {
36280             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
36281             break;
36282           }
36283           case "image": {
36284             out += renderer.image(token.href, token.title, token.text);
36285             break;
36286           }
36287           case "strong": {
36288             out += renderer.strong(this.parseInline(token.tokens, renderer));
36289             break;
36290           }
36291           case "em": {
36292             out += renderer.em(this.parseInline(token.tokens, renderer));
36293             break;
36294           }
36295           case "codespan": {
36296             out += renderer.codespan(token.text);
36297             break;
36298           }
36299           case "br": {
36300             out += renderer.br();
36301             break;
36302           }
36303           case "del": {
36304             out += renderer.del(this.parseInline(token.tokens, renderer));
36305             break;
36306           }
36307           case "text": {
36308             out += renderer.text(token.text);
36309             break;
36310           }
36311           default: {
36312             const errMsg = 'Token with "' + token.type + '" type was not found.';
36313             if (this.options.silent) {
36314               console.error(errMsg);
36315               return;
36316             } else {
36317               throw new Error(errMsg);
36318             }
36319           }
36320         }
36321       }
36322       return out;
36323     }
36324   };
36325   function marked(src, opt, callback) {
36326     if (typeof src === "undefined" || src === null) {
36327       throw new Error("marked(): input parameter is undefined or null");
36328     }
36329     if (typeof src !== "string") {
36330       throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36331     }
36332     if (typeof opt === "function") {
36333       callback = opt;
36334       opt = null;
36335     }
36336     opt = merge2({}, marked.defaults, opt || {});
36337     checkSanitizeDeprecation(opt);
36338     if (callback) {
36339       const highlight = opt.highlight;
36340       let tokens;
36341       try {
36342         tokens = Lexer.lex(src, opt);
36343       } catch (e) {
36344         return callback(e);
36345       }
36346       const done = function(err) {
36347         let out;
36348         if (!err) {
36349           try {
36350             if (opt.walkTokens) {
36351               marked.walkTokens(tokens, opt.walkTokens);
36352             }
36353             out = Parser.parse(tokens, opt);
36354           } catch (e) {
36355             err = e;
36356           }
36357         }
36358         opt.highlight = highlight;
36359         return err ? callback(err) : callback(null, out);
36360       };
36361       if (!highlight || highlight.length < 3) {
36362         return done();
36363       }
36364       delete opt.highlight;
36365       if (!tokens.length)
36366         return done();
36367       let pending = 0;
36368       marked.walkTokens(tokens, function(token) {
36369         if (token.type === "code") {
36370           pending++;
36371           setTimeout(() => {
36372             highlight(token.text, token.lang, function(err, code) {
36373               if (err) {
36374                 return done(err);
36375               }
36376               if (code != null && code !== token.text) {
36377                 token.text = code;
36378                 token.escaped = true;
36379               }
36380               pending--;
36381               if (pending === 0) {
36382                 done();
36383               }
36384             });
36385           }, 0);
36386         }
36387       });
36388       if (pending === 0) {
36389         done();
36390       }
36391       return;
36392     }
36393     try {
36394       const tokens = Lexer.lex(src, opt);
36395       if (opt.walkTokens) {
36396         marked.walkTokens(tokens, opt.walkTokens);
36397       }
36398       return Parser.parse(tokens, opt);
36399     } catch (e) {
36400       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36401       if (opt.silent) {
36402         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36403       }
36404       throw e;
36405     }
36406   }
36407   marked.options = marked.setOptions = function(opt) {
36408     merge2(marked.defaults, opt);
36409     changeDefaults(marked.defaults);
36410     return marked;
36411   };
36412   marked.getDefaults = getDefaults;
36413   marked.defaults = defaults;
36414   marked.use = function(...args) {
36415     const opts = merge2({}, ...args);
36416     const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
36417     let hasExtensions;
36418     args.forEach((pack) => {
36419       if (pack.extensions) {
36420         hasExtensions = true;
36421         pack.extensions.forEach((ext) => {
36422           if (!ext.name) {
36423             throw new Error("extension name required");
36424           }
36425           if (ext.renderer) {
36426             const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
36427             if (prevRenderer) {
36428               extensions.renderers[ext.name] = function(...args2) {
36429                 let ret = ext.renderer.apply(this, args2);
36430                 if (ret === false) {
36431                   ret = prevRenderer.apply(this, args2);
36432                 }
36433                 return ret;
36434               };
36435             } else {
36436               extensions.renderers[ext.name] = ext.renderer;
36437             }
36438           }
36439           if (ext.tokenizer) {
36440             if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
36441               throw new Error("extension level must be 'block' or 'inline'");
36442             }
36443             if (extensions[ext.level]) {
36444               extensions[ext.level].unshift(ext.tokenizer);
36445             } else {
36446               extensions[ext.level] = [ext.tokenizer];
36447             }
36448             if (ext.start) {
36449               if (ext.level === "block") {
36450                 if (extensions.startBlock) {
36451                   extensions.startBlock.push(ext.start);
36452                 } else {
36453                   extensions.startBlock = [ext.start];
36454                 }
36455               } else if (ext.level === "inline") {
36456                 if (extensions.startInline) {
36457                   extensions.startInline.push(ext.start);
36458                 } else {
36459                   extensions.startInline = [ext.start];
36460                 }
36461               }
36462             }
36463           }
36464           if (ext.childTokens) {
36465             extensions.childTokens[ext.name] = ext.childTokens;
36466           }
36467         });
36468       }
36469       if (pack.renderer) {
36470         const renderer = marked.defaults.renderer || new Renderer();
36471         for (const prop in pack.renderer) {
36472           const prevRenderer = renderer[prop];
36473           renderer[prop] = (...args2) => {
36474             let ret = pack.renderer[prop].apply(renderer, args2);
36475             if (ret === false) {
36476               ret = prevRenderer.apply(renderer, args2);
36477             }
36478             return ret;
36479           };
36480         }
36481         opts.renderer = renderer;
36482       }
36483       if (pack.tokenizer) {
36484         const tokenizer = marked.defaults.tokenizer || new Tokenizer();
36485         for (const prop in pack.tokenizer) {
36486           const prevTokenizer = tokenizer[prop];
36487           tokenizer[prop] = (...args2) => {
36488             let ret = pack.tokenizer[prop].apply(tokenizer, args2);
36489             if (ret === false) {
36490               ret = prevTokenizer.apply(tokenizer, args2);
36491             }
36492             return ret;
36493           };
36494         }
36495         opts.tokenizer = tokenizer;
36496       }
36497       if (pack.walkTokens) {
36498         const walkTokens2 = marked.defaults.walkTokens;
36499         opts.walkTokens = function(token) {
36500           pack.walkTokens.call(this, token);
36501           if (walkTokens2) {
36502             walkTokens2.call(this, token);
36503           }
36504         };
36505       }
36506       if (hasExtensions) {
36507         opts.extensions = extensions;
36508       }
36509       marked.setOptions(opts);
36510     });
36511   };
36512   marked.walkTokens = function(tokens, callback) {
36513     for (const token of tokens) {
36514       callback.call(marked, token);
36515       switch (token.type) {
36516         case "table": {
36517           for (const cell of token.header) {
36518             marked.walkTokens(cell.tokens, callback);
36519           }
36520           for (const row of token.rows) {
36521             for (const cell of row) {
36522               marked.walkTokens(cell.tokens, callback);
36523             }
36524           }
36525           break;
36526         }
36527         case "list": {
36528           marked.walkTokens(token.items, callback);
36529           break;
36530         }
36531         default: {
36532           if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
36533             marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
36534               marked.walkTokens(token[childTokens], callback);
36535             });
36536           } else if (token.tokens) {
36537             marked.walkTokens(token.tokens, callback);
36538           }
36539         }
36540       }
36541     }
36542   };
36543   marked.parseInline = function(src, opt) {
36544     if (typeof src === "undefined" || src === null) {
36545       throw new Error("marked.parseInline(): input parameter is undefined or null");
36546     }
36547     if (typeof src !== "string") {
36548       throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36549     }
36550     opt = merge2({}, marked.defaults, opt || {});
36551     checkSanitizeDeprecation(opt);
36552     try {
36553       const tokens = Lexer.lexInline(src, opt);
36554       if (opt.walkTokens) {
36555         marked.walkTokens(tokens, opt.walkTokens);
36556       }
36557       return Parser.parseInline(tokens, opt);
36558     } catch (e) {
36559       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36560       if (opt.silent) {
36561         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36562       }
36563       throw e;
36564     }
36565   };
36566   marked.Parser = Parser;
36567   marked.parser = Parser.parse;
36568   marked.Renderer = Renderer;
36569   marked.TextRenderer = TextRenderer;
36570   marked.Lexer = Lexer;
36571   marked.lexer = Lexer.lex;
36572   marked.Tokenizer = Tokenizer;
36573   marked.Slugger = Slugger;
36574   marked.parse = marked;
36575   var options = marked.options;
36576   var setOptions = marked.setOptions;
36577   var use = marked.use;
36578   var walkTokens = marked.walkTokens;
36579   var parseInline = marked.parseInline;
36580   var parser2 = Parser.parse;
36581   var lexer = Lexer.lex;
36582
36583   // modules/services/osmose.js
36584   var tiler3 = utilTiler();
36585   var dispatch4 = dispatch_default("loaded");
36586   var _tileZoom3 = 14;
36587   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
36588   var _osmoseData = { icons: {}, items: [] };
36589   var _cache3;
36590   function abortRequest3(controller) {
36591     if (controller) {
36592       controller.abort();
36593     }
36594   }
36595   function abortUnwantedRequests3(cache, tiles) {
36596     Object.keys(cache.inflightTile).forEach((k) => {
36597       let wanted = tiles.find((tile) => k === tile.id);
36598       if (!wanted) {
36599         abortRequest3(cache.inflightTile[k]);
36600         delete cache.inflightTile[k];
36601       }
36602     });
36603   }
36604   function encodeIssueRtree3(d) {
36605     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
36606   }
36607   function updateRtree3(item, replace) {
36608     _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
36609     if (replace) {
36610       _cache3.rtree.insert(item);
36611     }
36612   }
36613   function preventCoincident2(loc) {
36614     let coincident = false;
36615     do {
36616       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36617       loc = geoVecAdd(loc, delta);
36618       let bbox = geoExtent(loc).bbox();
36619       coincident = _cache3.rtree.search(bbox).length;
36620     } while (coincident);
36621     return loc;
36622   }
36623   var osmose_default = {
36624     title: "osmose",
36625     init() {
36626       _mainFileFetcher.get("qa_data").then((d) => {
36627         _osmoseData = d.osmose;
36628         _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
36629       });
36630       if (!_cache3) {
36631         this.reset();
36632       }
36633       this.event = utilRebind(this, dispatch4, "on");
36634     },
36635     reset() {
36636       let _strings = {};
36637       let _colors = {};
36638       if (_cache3) {
36639         Object.values(_cache3.inflightTile).forEach(abortRequest3);
36640         _strings = _cache3.strings;
36641         _colors = _cache3.colors;
36642       }
36643       _cache3 = {
36644         data: {},
36645         loadedTile: {},
36646         inflightTile: {},
36647         inflightPost: {},
36648         closed: {},
36649         rtree: new import_rbush3.default(),
36650         strings: _strings,
36651         colors: _colors
36652       };
36653     },
36654     loadIssues(projection2) {
36655       let params = {
36656         item: _osmoseData.items
36657       };
36658       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
36659       abortUnwantedRequests3(_cache3, tiles);
36660       tiles.forEach((tile) => {
36661         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
36662           return;
36663         let [x, y, z] = tile.xyz;
36664         let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.json?` + utilQsString(params);
36665         let controller = new AbortController();
36666         _cache3.inflightTile[tile.id] = controller;
36667         json_default(url, { signal: controller.signal }).then((data) => {
36668           delete _cache3.inflightTile[tile.id];
36669           _cache3.loadedTile[tile.id] = true;
36670           if (data.features) {
36671             data.features.forEach((issue) => {
36672               const { item, class: cl, uuid: id2 } = issue.properties;
36673               const itemType = `${item}-${cl}`;
36674               if (itemType in _osmoseData.icons) {
36675                 let loc = issue.geometry.coordinates;
36676                 loc = preventCoincident2(loc);
36677                 let d = new QAItem(loc, this, itemType, id2, { item });
36678                 if (item === 8300 || item === 8360) {
36679                   d.elems = [];
36680                 }
36681                 _cache3.data[d.id] = d;
36682                 _cache3.rtree.insert(encodeIssueRtree3(d));
36683               }
36684             });
36685           }
36686           dispatch4.call("loaded");
36687         }).catch(() => {
36688           delete _cache3.inflightTile[tile.id];
36689           _cache3.loadedTile[tile.id] = true;
36690         });
36691       });
36692     },
36693     loadIssueDetail(issue) {
36694       if (issue.elems !== void 0) {
36695         return Promise.resolve(issue);
36696       }
36697       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
36698       const cacheDetails = (data) => {
36699         issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
36700         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
36701         this.replaceItem(issue);
36702       };
36703       return json_default(url).then(cacheDetails).then(() => issue);
36704     },
36705     loadStrings(locale2 = _mainLocalizer.localeCode()) {
36706       const items = Object.keys(_osmoseData.icons);
36707       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
36708         return Promise.resolve(_cache3.strings[locale2]);
36709       }
36710       if (!(locale2 in _cache3.strings)) {
36711         _cache3.strings[locale2] = {};
36712       }
36713       const allRequests = items.map((itemType) => {
36714         if (itemType in _cache3.strings[locale2])
36715           return null;
36716         const cacheData = (data) => {
36717           const [cat = { items: [] }] = data.categories;
36718           const [item2 = { class: [] }] = cat.items;
36719           const [cl2 = null] = item2.class;
36720           if (!cl2) {
36721             console.log(`Osmose strings request (${itemType}) had unexpected data`);
36722             return;
36723           }
36724           const { item: itemInt, color: color2 } = item2;
36725           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
36726             _cache3.colors[itemInt] = color2;
36727           }
36728           const { title, detail, fix, trap } = cl2;
36729           let issueStrings = {};
36730           if (title)
36731             issueStrings.title = title.auto;
36732           if (detail)
36733             issueStrings.detail = marked(detail.auto);
36734           if (trap)
36735             issueStrings.trap = marked(trap.auto);
36736           if (fix)
36737             issueStrings.fix = marked(fix.auto);
36738           _cache3.strings[locale2][itemType] = issueStrings;
36739         };
36740         const [item, cl] = itemType.split("-");
36741         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
36742         return json_default(url).then(cacheData);
36743       }).filter(Boolean);
36744       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
36745     },
36746     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
36747       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
36748     },
36749     getColor(itemType) {
36750       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
36751     },
36752     postUpdate(issue, callback) {
36753       if (_cache3.inflightPost[issue.id]) {
36754         return callback({ message: "Issue update already inflight", status: -2 }, issue);
36755       }
36756       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
36757       const controller = new AbortController();
36758       const after = () => {
36759         delete _cache3.inflightPost[issue.id];
36760         this.removeItem(issue);
36761         if (issue.newStatus === "done") {
36762           if (!(issue.item in _cache3.closed)) {
36763             _cache3.closed[issue.item] = 0;
36764           }
36765           _cache3.closed[issue.item] += 1;
36766         }
36767         if (callback)
36768           callback(null, issue);
36769       };
36770       _cache3.inflightPost[issue.id] = controller;
36771       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
36772         delete _cache3.inflightPost[issue.id];
36773         if (callback)
36774           callback(err.message);
36775       });
36776     },
36777     getItems(projection2) {
36778       const viewport = projection2.clipExtent();
36779       const min3 = [viewport[0][0], viewport[1][1]];
36780       const max3 = [viewport[1][0], viewport[0][1]];
36781       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36782       return _cache3.rtree.search(bbox).map((d) => d.data);
36783     },
36784     getError(id2) {
36785       return _cache3.data[id2];
36786     },
36787     getIcon(itemType) {
36788       return _osmoseData.icons[itemType];
36789     },
36790     replaceItem(item) {
36791       if (!(item instanceof QAItem) || !item.id)
36792         return;
36793       _cache3.data[item.id] = item;
36794       updateRtree3(encodeIssueRtree3(item), true);
36795       return item;
36796     },
36797     removeItem(item) {
36798       if (!(item instanceof QAItem) || !item.id)
36799         return;
36800       delete _cache3.data[item.id];
36801       updateRtree3(encodeIssueRtree3(item), false);
36802     },
36803     getClosedCounts() {
36804       return _cache3.closed;
36805     },
36806     itemURL(item) {
36807       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
36808     }
36809   };
36810
36811   // modules/services/mapillary.js
36812   var import_pbf = __toESM(require_pbf());
36813   var import_rbush4 = __toESM(require_rbush_min());
36814   var import_vector_tile = __toESM(require_vector_tile());
36815   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
36816   var apiUrl = "https://graph.mapillary.com/";
36817   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
36818   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
36819   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
36820   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
36821   var viewercss = "mapillary-js/mapillary.css";
36822   var viewerjs = "mapillary-js/mapillary.js";
36823   var minZoom = 14;
36824   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
36825   var _loadViewerPromise;
36826   var _mlyActiveImage;
36827   var _mlyCache;
36828   var _mlyFallback = false;
36829   var _mlyHighlightedDetection;
36830   var _mlyShowFeatureDetections = false;
36831   var _mlyShowSignDetections = false;
36832   var _mlyViewer;
36833   var _mlyViewerFilter = ["all"];
36834   function loadTiles(which, url, maxZoom2, projection2) {
36835     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
36836     const tiles = tiler8.getTiles(projection2);
36837     tiles.forEach(function(tile) {
36838       loadTile(which, url, tile);
36839     });
36840   }
36841   function loadTile(which, url, tile) {
36842     const cache = _mlyCache.requests;
36843     const tileId = `${tile.id}-${which}`;
36844     if (cache.loaded[tileId] || cache.inflight[tileId])
36845       return;
36846     const controller = new AbortController();
36847     cache.inflight[tileId] = controller;
36848     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
36849     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
36850       if (!response.ok) {
36851         throw new Error(response.status + " " + response.statusText);
36852       }
36853       cache.loaded[tileId] = true;
36854       delete cache.inflight[tileId];
36855       return response.arrayBuffer();
36856     }).then(function(data) {
36857       if (!data) {
36858         throw new Error("No Data");
36859       }
36860       loadTileDataToCache(data, tile, which);
36861       if (which === "images") {
36862         dispatch5.call("loadedImages");
36863       } else if (which === "signs") {
36864         dispatch5.call("loadedSigns");
36865       } else if (which === "points") {
36866         dispatch5.call("loadedMapFeatures");
36867       }
36868     }).catch(function() {
36869       cache.loaded[tileId] = true;
36870       delete cache.inflight[tileId];
36871     });
36872   }
36873   function loadTileDataToCache(data, tile, which) {
36874     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
36875     let features2, cache, layer, i2, feature3, loc, d;
36876     if (vectorTile.layers.hasOwnProperty("image")) {
36877       features2 = [];
36878       cache = _mlyCache.images;
36879       layer = vectorTile.layers.image;
36880       for (i2 = 0; i2 < layer.length; i2++) {
36881         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36882         loc = feature3.geometry.coordinates;
36883         d = {
36884           loc,
36885           captured_at: feature3.properties.captured_at,
36886           ca: feature3.properties.compass_angle,
36887           id: feature3.properties.id,
36888           is_pano: feature3.properties.is_pano,
36889           sequence_id: feature3.properties.sequence_id
36890         };
36891         cache.forImageId[d.id] = d;
36892         features2.push({
36893           minX: loc[0],
36894           minY: loc[1],
36895           maxX: loc[0],
36896           maxY: loc[1],
36897           data: d
36898         });
36899       }
36900       if (cache.rtree) {
36901         cache.rtree.load(features2);
36902       }
36903     }
36904     if (vectorTile.layers.hasOwnProperty("sequence")) {
36905       features2 = [];
36906       cache = _mlyCache.sequences;
36907       layer = vectorTile.layers.sequence;
36908       for (i2 = 0; i2 < layer.length; i2++) {
36909         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36910         if (cache.lineString[feature3.properties.id]) {
36911           cache.lineString[feature3.properties.id].push(feature3);
36912         } else {
36913           cache.lineString[feature3.properties.id] = [feature3];
36914         }
36915       }
36916     }
36917     if (vectorTile.layers.hasOwnProperty("point")) {
36918       features2 = [];
36919       cache = _mlyCache[which];
36920       layer = vectorTile.layers.point;
36921       for (i2 = 0; i2 < layer.length; i2++) {
36922         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36923         loc = feature3.geometry.coordinates;
36924         d = {
36925           loc,
36926           id: feature3.properties.id,
36927           first_seen_at: feature3.properties.first_seen_at,
36928           last_seen_at: feature3.properties.last_seen_at,
36929           value: feature3.properties.value
36930         };
36931         features2.push({
36932           minX: loc[0],
36933           minY: loc[1],
36934           maxX: loc[0],
36935           maxY: loc[1],
36936           data: d
36937         });
36938       }
36939       if (cache.rtree) {
36940         cache.rtree.load(features2);
36941       }
36942     }
36943     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
36944       features2 = [];
36945       cache = _mlyCache[which];
36946       layer = vectorTile.layers.traffic_sign;
36947       for (i2 = 0; i2 < layer.length; i2++) {
36948         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
36949         loc = feature3.geometry.coordinates;
36950         d = {
36951           loc,
36952           id: feature3.properties.id,
36953           first_seen_at: feature3.properties.first_seen_at,
36954           last_seen_at: feature3.properties.last_seen_at,
36955           value: feature3.properties.value
36956         };
36957         features2.push({
36958           minX: loc[0],
36959           minY: loc[1],
36960           maxX: loc[0],
36961           maxY: loc[1],
36962           data: d
36963         });
36964       }
36965       if (cache.rtree) {
36966         cache.rtree.load(features2);
36967       }
36968     }
36969   }
36970   function loadData(url) {
36971     return fetch(url).then(function(response) {
36972       if (!response.ok) {
36973         throw new Error(response.status + " " + response.statusText);
36974       }
36975       return response.json();
36976     }).then(function(result) {
36977       if (!result) {
36978         return [];
36979       }
36980       return result.data || [];
36981     });
36982   }
36983   function partitionViewport(projection2) {
36984     const z = geoScaleToZoom(projection2.scale());
36985     const z2 = Math.ceil(z * 2) / 2 + 2.5;
36986     const tiler8 = utilTiler().zoomExtent([z2, z2]);
36987     return tiler8.getTiles(projection2).map(function(tile) {
36988       return tile.extent;
36989     });
36990   }
36991   function searchLimited(limit, projection2, rtree) {
36992     limit = limit || 5;
36993     return partitionViewport(projection2).reduce(function(result, extent) {
36994       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
36995         return d.data;
36996       });
36997       return found.length ? result.concat(found) : result;
36998     }, []);
36999   }
37000   var mapillary_default = {
37001     init: function() {
37002       if (!_mlyCache) {
37003         this.reset();
37004       }
37005       this.event = utilRebind(this, dispatch5, "on");
37006     },
37007     reset: function() {
37008       if (_mlyCache) {
37009         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
37010           request3.abort();
37011         });
37012       }
37013       _mlyCache = {
37014         images: { rtree: new import_rbush4.default(), forImageId: {} },
37015         image_detections: { forImageId: {} },
37016         signs: { rtree: new import_rbush4.default() },
37017         points: { rtree: new import_rbush4.default() },
37018         sequences: { rtree: new import_rbush4.default(), lineString: {} },
37019         requests: { loaded: {}, inflight: {} }
37020       };
37021       _mlyActiveImage = null;
37022     },
37023     images: function(projection2) {
37024       const limit = 5;
37025       return searchLimited(limit, projection2, _mlyCache.images.rtree);
37026     },
37027     signs: function(projection2) {
37028       const limit = 5;
37029       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
37030     },
37031     mapFeatures: function(projection2) {
37032       const limit = 5;
37033       return searchLimited(limit, projection2, _mlyCache.points.rtree);
37034     },
37035     cachedImage: function(imageId) {
37036       return _mlyCache.images.forImageId[imageId];
37037     },
37038     sequences: function(projection2) {
37039       const viewport = projection2.clipExtent();
37040       const min3 = [viewport[0][0], viewport[1][1]];
37041       const max3 = [viewport[1][0], viewport[0][1]];
37042       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37043       const sequenceIds = {};
37044       let lineStrings = [];
37045       _mlyCache.images.rtree.search(bbox).forEach(function(d) {
37046         if (d.data.sequence_id) {
37047           sequenceIds[d.data.sequence_id] = true;
37048         }
37049       });
37050       Object.keys(sequenceIds).forEach(function(sequenceId) {
37051         if (_mlyCache.sequences.lineString[sequenceId]) {
37052           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
37053         }
37054       });
37055       return lineStrings;
37056     },
37057     loadImages: function(projection2) {
37058       loadTiles("images", tileUrl, 14, projection2);
37059     },
37060     loadSigns: function(projection2) {
37061       loadTiles("signs", trafficSignTileUrl, 14, projection2);
37062     },
37063     loadMapFeatures: function(projection2) {
37064       loadTiles("points", mapFeatureTileUrl, 14, projection2);
37065     },
37066     ensureViewerLoaded: function(context) {
37067       if (_loadViewerPromise)
37068         return _loadViewerPromise;
37069       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
37070       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
37071       const that = this;
37072       _loadViewerPromise = new Promise((resolve, reject) => {
37073         let loadedCount = 0;
37074         function loaded() {
37075           loadedCount += 1;
37076           if (loadedCount === 2)
37077             resolve();
37078         }
37079         const head = select_default2("head");
37080         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() {
37081           reject();
37082         });
37083         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() {
37084           reject();
37085         });
37086       }).catch(function() {
37087         _loadViewerPromise = null;
37088       }).then(function() {
37089         that.initViewer(context);
37090       });
37091       return _loadViewerPromise;
37092     },
37093     loadSignResources: function(context) {
37094       context.ui().svgDefs.addSprites(["mapillary-sprite"], false);
37095       return this;
37096     },
37097     loadObjectResources: function(context) {
37098       context.ui().svgDefs.addSprites(["mapillary-object-sprite"], false);
37099       return this;
37100     },
37101     resetTags: function() {
37102       if (_mlyViewer && !_mlyFallback) {
37103         _mlyViewer.getComponent("tag").removeAll();
37104       }
37105     },
37106     showFeatureDetections: function(value) {
37107       _mlyShowFeatureDetections = value;
37108       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37109         this.resetTags();
37110       }
37111     },
37112     showSignDetections: function(value) {
37113       _mlyShowSignDetections = value;
37114       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37115         this.resetTags();
37116       }
37117     },
37118     filterViewer: function(context) {
37119       const showsPano = context.photos().showsPanoramic();
37120       const showsFlat = context.photos().showsFlat();
37121       const fromDate = context.photos().fromDate();
37122       const toDate = context.photos().toDate();
37123       const filter2 = ["all"];
37124       if (!showsPano)
37125         filter2.push(["!=", "cameraType", "spherical"]);
37126       if (!showsFlat && showsPano)
37127         filter2.push(["==", "pano", true]);
37128       if (fromDate) {
37129         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
37130       }
37131       if (toDate) {
37132         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
37133       }
37134       if (_mlyViewer) {
37135         _mlyViewer.setFilter(filter2);
37136       }
37137       _mlyViewerFilter = filter2;
37138       return filter2;
37139     },
37140     showViewer: function(context) {
37141       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
37142       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
37143       if (isHidden && _mlyViewer) {
37144         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
37145         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
37146         _mlyViewer.resize();
37147       }
37148       return this;
37149     },
37150     hideViewer: function(context) {
37151       _mlyActiveImage = null;
37152       if (!_mlyFallback && _mlyViewer) {
37153         _mlyViewer.getComponent("sequence").stop();
37154       }
37155       const viewer = context.container().select(".photoviewer");
37156       if (!viewer.empty())
37157         viewer.datum(null);
37158       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37159       this.updateUrlImage(null);
37160       dispatch5.call("imageChanged");
37161       dispatch5.call("loadedMapFeatures");
37162       dispatch5.call("loadedSigns");
37163       return this.setStyles(context, null);
37164     },
37165     updateUrlImage: function(imageId) {
37166       if (!window.mocha) {
37167         const hash = utilStringQs(window.location.hash);
37168         if (imageId) {
37169           hash.photo = "mapillary/" + imageId;
37170         } else {
37171           delete hash.photo;
37172         }
37173         window.location.replace("#" + utilQsString(hash, true));
37174       }
37175     },
37176     highlightDetection: function(detection) {
37177       if (detection) {
37178         _mlyHighlightedDetection = detection.id;
37179       }
37180       return this;
37181     },
37182     initViewer: function(context) {
37183       const that = this;
37184       if (!window.mapillary)
37185         return;
37186       const opts = {
37187         accessToken,
37188         component: {
37189           cover: false,
37190           keyboard: false,
37191           tag: true
37192         },
37193         container: "ideditor-mly"
37194       };
37195       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
37196         _mlyFallback = true;
37197         opts.component = {
37198           cover: false,
37199           direction: false,
37200           imagePlane: false,
37201           keyboard: false,
37202           mouse: false,
37203           sequence: false,
37204           tag: false,
37205           image: true,
37206           navigation: true
37207         };
37208       }
37209       _mlyViewer = new mapillary.Viewer(opts);
37210       _mlyViewer.on("image", imageChanged);
37211       _mlyViewer.on("bearing", bearingChanged);
37212       if (_mlyViewerFilter) {
37213         _mlyViewer.setFilter(_mlyViewerFilter);
37214       }
37215       context.ui().photoviewer.on("resize.mapillary", function() {
37216         if (_mlyViewer)
37217           _mlyViewer.resize();
37218       });
37219       function imageChanged(node) {
37220         that.resetTags();
37221         const image = node.image;
37222         that.setActiveImage(image);
37223         that.setStyles(context, null);
37224         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
37225         context.map().centerEase(loc);
37226         that.updateUrlImage(image.id);
37227         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
37228           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
37229         }
37230         dispatch5.call("imageChanged");
37231       }
37232       function bearingChanged(e) {
37233         dispatch5.call("bearingChanged", void 0, e);
37234       }
37235     },
37236     selectImage: function(context, imageId) {
37237       if (_mlyViewer && imageId) {
37238         _mlyViewer.moveTo(imageId).catch(function(e) {
37239           console.error("mly3", e);
37240         });
37241       }
37242       return this;
37243     },
37244     getActiveImage: function() {
37245       return _mlyActiveImage;
37246     },
37247     getDetections: function(id2) {
37248       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
37249     },
37250     setActiveImage: function(image) {
37251       if (image) {
37252         _mlyActiveImage = {
37253           ca: image.originalCompassAngle,
37254           id: image.id,
37255           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
37256           is_pano: image.cameraType === "spherical",
37257           sequence_id: image.sequenceId
37258         };
37259       } else {
37260         _mlyActiveImage = null;
37261       }
37262     },
37263     setStyles: function(context, hovered) {
37264       const hoveredImageId = hovered && hovered.id;
37265       const hoveredSequenceId = hovered && hovered.sequence_id;
37266       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
37267       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
37268         return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
37269       }).classed("hovered", function(d) {
37270         return d.id === hoveredImageId;
37271       });
37272       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
37273         return d.properties.id === hoveredSequenceId;
37274       }).classed("currentView", function(d) {
37275         return d.properties.id === selectedSequenceId;
37276       });
37277       return this;
37278     },
37279     updateDetections: function(imageId, url) {
37280       if (!_mlyViewer || _mlyFallback)
37281         return;
37282       if (!imageId)
37283         return;
37284       const cache = _mlyCache.image_detections;
37285       if (cache.forImageId[imageId]) {
37286         showDetections(_mlyCache.image_detections.forImageId[imageId]);
37287       } else {
37288         loadData(url).then((detections) => {
37289           detections.forEach(function(detection) {
37290             if (!cache.forImageId[imageId]) {
37291               cache.forImageId[imageId] = [];
37292             }
37293             cache.forImageId[imageId].push({
37294               geometry: detection.geometry,
37295               id: detection.id,
37296               image_id: imageId,
37297               value: detection.value
37298             });
37299           });
37300           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
37301         });
37302       }
37303       function showDetections(detections) {
37304         const tagComponent = _mlyViewer.getComponent("tag");
37305         detections.forEach(function(data) {
37306           const tag = makeTag(data);
37307           if (tag) {
37308             tagComponent.add([tag]);
37309           }
37310         });
37311       }
37312       function makeTag(data) {
37313         const valueParts = data.value.split("--");
37314         if (!valueParts.length)
37315           return;
37316         let tag;
37317         let text2;
37318         let color2 = 16777215;
37319         if (_mlyHighlightedDetection === data.id) {
37320           color2 = 16776960;
37321           text2 = valueParts[1];
37322           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
37323             text2 = valueParts[2];
37324           }
37325           text2 = text2.replace(/-/g, " ");
37326           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
37327           _mlyHighlightedDetection = null;
37328         }
37329         var decodedGeometry = window.atob(data.geometry);
37330         var uintArray = new Uint8Array(decodedGeometry.length);
37331         for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
37332           uintArray[i2] = decodedGeometry.charCodeAt(i2);
37333         }
37334         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
37335         const layer = tile.layers["mpy-or"];
37336         const geometries = layer.feature(0).loadGeometry();
37337         const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
37338         tag = new mapillary.OutlineTag(data.id, new mapillary.PolygonGeometry(polygon2[0]), {
37339           text: text2,
37340           textColor: color2,
37341           lineColor: color2,
37342           lineWidth: 2,
37343           fillColor: color2,
37344           fillOpacity: 0.3
37345         });
37346         return tag;
37347       }
37348     },
37349     cache: function() {
37350       return _mlyCache;
37351     }
37352   };
37353
37354   // modules/core/validation/models.js
37355   function validationIssue(attrs) {
37356     this.type = attrs.type;
37357     this.subtype = attrs.subtype;
37358     this.severity = attrs.severity;
37359     this.message = attrs.message;
37360     this.reference = attrs.reference;
37361     this.entityIds = attrs.entityIds;
37362     this.loc = attrs.loc;
37363     this.data = attrs.data;
37364     this.dynamicFixes = attrs.dynamicFixes;
37365     this.hash = attrs.hash;
37366     this.id = generateID.apply(this);
37367     this.key = generateKey.apply(this);
37368     this.autoFix = null;
37369     function generateID() {
37370       var parts = [this.type];
37371       if (this.hash) {
37372         parts.push(this.hash);
37373       }
37374       if (this.subtype) {
37375         parts.push(this.subtype);
37376       }
37377       if (this.entityIds) {
37378         var entityKeys = this.entityIds.slice().sort();
37379         parts.push.apply(parts, entityKeys);
37380       }
37381       return parts.join(":");
37382     }
37383     function generateKey() {
37384       return this.id + ":" + Date.now().toString();
37385     }
37386     this.extent = function(resolver) {
37387       if (this.loc) {
37388         return geoExtent(this.loc);
37389       }
37390       if (this.entityIds && this.entityIds.length) {
37391         return this.entityIds.reduce(function(extent, entityId) {
37392           return extent.extend(resolver.entity(entityId).extent(resolver));
37393         }, geoExtent());
37394       }
37395       return null;
37396     };
37397     this.fixes = function(context) {
37398       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
37399       var issue = this;
37400       if (issue.severity === "warning") {
37401         fixes.push(new validationIssueFix({
37402           title: _t.html("issues.fix.ignore_issue.title"),
37403           icon: "iD-icon-close",
37404           onClick: function() {
37405             context.validator().ignoreIssue(this.issue.id);
37406           }
37407         }));
37408       }
37409       fixes.forEach(function(fix) {
37410         fix.id = fix.title;
37411         fix.issue = issue;
37412         if (fix.autoArgs) {
37413           issue.autoFix = fix;
37414         }
37415       });
37416       return fixes;
37417     };
37418   }
37419   function validationIssueFix(attrs) {
37420     this.title = attrs.title;
37421     this.onClick = attrs.onClick;
37422     this.disabledReason = attrs.disabledReason;
37423     this.icon = attrs.icon;
37424     this.entityIds = attrs.entityIds || [];
37425     this.autoArgs = attrs.autoArgs;
37426     this.issue = null;
37427   }
37428
37429   // modules/services/maprules.js
37430   var buildRuleChecks = function() {
37431     return {
37432       equals: function(equals) {
37433         return function(tags) {
37434           return Object.keys(equals).every(function(k) {
37435             return equals[k] === tags[k];
37436           });
37437         };
37438       },
37439       notEquals: function(notEquals) {
37440         return function(tags) {
37441           return Object.keys(notEquals).some(function(k) {
37442             return notEquals[k] !== tags[k];
37443           });
37444         };
37445       },
37446       absence: function(absence) {
37447         return function(tags) {
37448           return Object.keys(tags).indexOf(absence) === -1;
37449         };
37450       },
37451       presence: function(presence) {
37452         return function(tags) {
37453           return Object.keys(tags).indexOf(presence) > -1;
37454         };
37455       },
37456       greaterThan: function(greaterThan) {
37457         var key = Object.keys(greaterThan)[0];
37458         var value = greaterThan[key];
37459         return function(tags) {
37460           return tags[key] > value;
37461         };
37462       },
37463       greaterThanEqual: function(greaterThanEqual) {
37464         var key = Object.keys(greaterThanEqual)[0];
37465         var value = greaterThanEqual[key];
37466         return function(tags) {
37467           return tags[key] >= value;
37468         };
37469       },
37470       lessThan: function(lessThan) {
37471         var key = Object.keys(lessThan)[0];
37472         var value = lessThan[key];
37473         return function(tags) {
37474           return tags[key] < value;
37475         };
37476       },
37477       lessThanEqual: function(lessThanEqual) {
37478         var key = Object.keys(lessThanEqual)[0];
37479         var value = lessThanEqual[key];
37480         return function(tags) {
37481           return tags[key] <= value;
37482         };
37483       },
37484       positiveRegex: function(positiveRegex) {
37485         var tagKey = Object.keys(positiveRegex)[0];
37486         var expression = positiveRegex[tagKey].join("|");
37487         var regex = new RegExp(expression);
37488         return function(tags) {
37489           return regex.test(tags[tagKey]);
37490         };
37491       },
37492       negativeRegex: function(negativeRegex) {
37493         var tagKey = Object.keys(negativeRegex)[0];
37494         var expression = negativeRegex[tagKey].join("|");
37495         var regex = new RegExp(expression);
37496         return function(tags) {
37497           return !regex.test(tags[tagKey]);
37498         };
37499       }
37500     };
37501   };
37502   var buildLineKeys = function() {
37503     return {
37504       highway: {
37505         rest_area: true,
37506         services: true
37507       },
37508       railway: {
37509         roundhouse: true,
37510         station: true,
37511         traverser: true,
37512         turntable: true,
37513         wash: true
37514       }
37515     };
37516   };
37517   var maprules_default = {
37518     init: function() {
37519       this._ruleChecks = buildRuleChecks();
37520       this._validationRules = [];
37521       this._areaKeys = osmAreaKeys;
37522       this._lineKeys = buildLineKeys();
37523     },
37524     filterRuleChecks: function(selector) {
37525       var _ruleChecks = this._ruleChecks;
37526       return Object.keys(selector).reduce(function(rules, key) {
37527         if (["geometry", "error", "warning"].indexOf(key) === -1) {
37528           rules.push(_ruleChecks[key](selector[key]));
37529         }
37530         return rules;
37531       }, []);
37532     },
37533     buildTagMap: function(selector) {
37534       var getRegexValues = function(regexes) {
37535         return regexes.map(function(regex) {
37536           return regex.replace(/\$|\^/g, "");
37537         });
37538       };
37539       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
37540         var values;
37541         var isRegex = /regex/gi.test(key);
37542         var isEqual = /equals/gi.test(key);
37543         if (isRegex || isEqual) {
37544           Object.keys(selector[key]).forEach(function(selectorKey) {
37545             values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
37546             if (expectedTags.hasOwnProperty(selectorKey)) {
37547               values = values.concat(expectedTags[selectorKey]);
37548             }
37549             expectedTags[selectorKey] = values;
37550           });
37551         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
37552           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
37553           values = [selector[key][tagKey]];
37554           if (expectedTags.hasOwnProperty(tagKey)) {
37555             values = values.concat(expectedTags[tagKey]);
37556           }
37557           expectedTags[tagKey] = values;
37558         }
37559         return expectedTags;
37560       }, {});
37561       return tagMap;
37562     },
37563     inferGeometry: function(tagMap) {
37564       var _lineKeys = this._lineKeys;
37565       var _areaKeys = this._areaKeys;
37566       var keyValueDoesNotImplyArea = function(key2) {
37567         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
37568       };
37569       var keyValueImpliesLine = function(key2) {
37570         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
37571       };
37572       if (tagMap.hasOwnProperty("area")) {
37573         if (tagMap.area.indexOf("yes") > -1) {
37574           return "area";
37575         }
37576         if (tagMap.area.indexOf("no") > -1) {
37577           return "line";
37578         }
37579       }
37580       for (var key in tagMap) {
37581         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
37582           return "area";
37583         }
37584         if (key in _lineKeys && keyValueImpliesLine(key)) {
37585           return "area";
37586         }
37587       }
37588       return "line";
37589     },
37590     addRule: function(selector) {
37591       var rule = {
37592         checks: this.filterRuleChecks(selector),
37593         matches: function(entity) {
37594           return this.checks.every(function(check) {
37595             return check(entity.tags);
37596           });
37597         },
37598         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
37599         geometryMatches: function(entity, graph) {
37600           if (entity.type === "node" || entity.type === "relation") {
37601             return selector.geometry === entity.type;
37602           } else if (entity.type === "way") {
37603             return this.inferredGeometry === entity.geometry(graph);
37604           }
37605         },
37606         findIssues: function(entity, graph, issues) {
37607           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
37608             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
37609             var message = selector[severity];
37610             issues.push(new validationIssue({
37611               type: "maprules",
37612               severity,
37613               message: function() {
37614                 return message;
37615               },
37616               entityIds: [entity.id]
37617             }));
37618           }
37619         }
37620       };
37621       this._validationRules.push(rule);
37622     },
37623     clearRules: function() {
37624       this._validationRules = [];
37625     },
37626     validationRules: function() {
37627       return this._validationRules;
37628     },
37629     ruleChecks: function() {
37630       return this._ruleChecks;
37631     }
37632   };
37633
37634   // modules/services/nominatim.js
37635   var import_rbush5 = __toESM(require_rbush_min());
37636   var apibase = "https://nominatim.openstreetmap.org/";
37637   var _inflight = {};
37638   var _nominatimCache;
37639   var nominatim_default = {
37640     init: function() {
37641       _inflight = {};
37642       _nominatimCache = new import_rbush5.default();
37643     },
37644     reset: function() {
37645       Object.values(_inflight).forEach(function(controller) {
37646         controller.abort();
37647       });
37648       _inflight = {};
37649       _nominatimCache = new import_rbush5.default();
37650     },
37651     countryCode: function(location, callback) {
37652       this.reverse(location, function(err, result) {
37653         if (err) {
37654           return callback(err);
37655         } else if (result.address) {
37656           return callback(null, result.address.country_code);
37657         } else {
37658           return callback("Unable to geocode", null);
37659         }
37660       });
37661     },
37662     reverse: function(loc, callback) {
37663       var cached = _nominatimCache.search({ minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] });
37664       if (cached.length > 0) {
37665         if (callback)
37666           callback(null, cached[0].data);
37667         return;
37668       }
37669       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
37670       var url = apibase + "reverse?" + utilQsString(params);
37671       if (_inflight[url])
37672         return;
37673       var controller = new AbortController();
37674       _inflight[url] = controller;
37675       json_default(url, { signal: controller.signal }).then(function(result) {
37676         delete _inflight[url];
37677         if (result && result.error) {
37678           throw new Error(result.error);
37679         }
37680         var extent = geoExtent(loc).padByMeters(200);
37681         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
37682         if (callback)
37683           callback(null, result);
37684       }).catch(function(err) {
37685         delete _inflight[url];
37686         if (err.name === "AbortError")
37687           return;
37688         if (callback)
37689           callback(err.message);
37690       });
37691     },
37692     search: function(val, callback) {
37693       var searchVal = encodeURIComponent(val);
37694       var url = apibase + "search/" + searchVal + "?limit=10&format=json";
37695       if (_inflight[url])
37696         return;
37697       var controller = new AbortController();
37698       _inflight[url] = controller;
37699       json_default(url, { signal: controller.signal }).then(function(result) {
37700         delete _inflight[url];
37701         if (result && result.error) {
37702           throw new Error(result.error);
37703         }
37704         if (callback)
37705           callback(null, result);
37706       }).catch(function(err) {
37707         delete _inflight[url];
37708         if (err.name === "AbortError")
37709           return;
37710         if (callback)
37711           callback(err.message);
37712       });
37713     }
37714   };
37715
37716   // node_modules/name-suggestion-index/lib/matcher.js
37717   var import_which_polygon3 = __toESM(require_which_polygon(), 1);
37718
37719   // node_modules/name-suggestion-index/lib/simplify.js
37720   var import_diacritics2 = __toESM(require_diacritics(), 1);
37721   function simplify(str2) {
37722     if (typeof str2 !== "string")
37723       return "";
37724     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());
37725   }
37726
37727   // node_modules/name-suggestion-index/config/matchGroups.json
37728   var matchGroups = {
37729     adult_gaming_centre: [
37730       "amenity/casino",
37731       "amenity/gambling",
37732       "leisure/adult_gaming_centre"
37733     ],
37734     beauty: [
37735       "shop/beauty",
37736       "shop/hairdresser_supply"
37737     ],
37738     bed: [
37739       "shop/bed",
37740       "shop/furniture"
37741     ],
37742     beverages: [
37743       "shop/alcohol",
37744       "shop/beer",
37745       "shop/beverages",
37746       "shop/wine"
37747     ],
37748     camping: [
37749       "tourism/camp_site",
37750       "tourism/caravan_site"
37751     ],
37752     car_parts: [
37753       "shop/car_parts",
37754       "shop/car_repair",
37755       "shop/tires",
37756       "shop/tyres"
37757     ],
37758     clinic: [
37759       "amenity/clinic",
37760       "amenity/doctors",
37761       "healthcare/clinic",
37762       "healthcare/laboratory",
37763       "healthcare/physiotherapist",
37764       "healthcare/sample_collection",
37765       "healthcare/dialysis"
37766     ],
37767     convenience: [
37768       "shop/beauty",
37769       "shop/chemist",
37770       "shop/convenience",
37771       "shop/cosmetics",
37772       "shop/grocery",
37773       "shop/newsagent",
37774       "shop/perfumery"
37775     ],
37776     coworking: [
37777       "amenity/coworking_space",
37778       "office/coworking",
37779       "office/coworking_space"
37780     ],
37781     dentist: [
37782       "amenity/dentist",
37783       "amenity/doctors",
37784       "healthcare/dentist"
37785     ],
37786     electronics: [
37787       "office/telecommunication",
37788       "shop/computer",
37789       "shop/electronics",
37790       "shop/hifi",
37791       "shop/mobile",
37792       "shop/mobile_phone",
37793       "shop/telecommunication"
37794     ],
37795     fabric: [
37796       "shop/fabric",
37797       "shop/haberdashery",
37798       "shop/sewing"
37799     ],
37800     fashion: [
37801       "shop/accessories",
37802       "shop/bag",
37803       "shop/boutique",
37804       "shop/clothes",
37805       "shop/department_store",
37806       "shop/fashion",
37807       "shop/fashion_accessories",
37808       "shop/sports",
37809       "shop/shoes"
37810     ],
37811     financial: [
37812       "amenity/bank",
37813       "office/accountant",
37814       "office/financial",
37815       "office/financial_advisor",
37816       "office/tax_advisor",
37817       "shop/tax"
37818     ],
37819     fitness: [
37820       "leisure/fitness_centre",
37821       "leisure/fitness_center",
37822       "leisure/sports_centre",
37823       "leisure/sports_center"
37824     ],
37825     food: [
37826       "amenity/bar",
37827       "amenity/cafe",
37828       "amenity/fast_food",
37829       "amenity/ice_cream",
37830       "amenity/pub",
37831       "amenity/restaurant",
37832       "shop/bakery",
37833       "shop/candy",
37834       "shop/chocolate",
37835       "shop/coffee",
37836       "shop/confectionary",
37837       "shop/confectionery",
37838       "shop/food",
37839       "shop/ice_cream",
37840       "shop/pastry",
37841       "shop/tea"
37842     ],
37843     fuel: [
37844       "amenity/fuel",
37845       "shop/gas",
37846       "shop/convenience;gas",
37847       "shop/gas;convenience"
37848     ],
37849     gift: [
37850       "shop/gift",
37851       "shop/card",
37852       "shop/cards",
37853       "shop/stationery"
37854     ],
37855     hardware: [
37856       "shop/bathroom_furnishing",
37857       "shop/carpet",
37858       "shop/diy",
37859       "shop/doityourself",
37860       "shop/doors",
37861       "shop/electrical",
37862       "shop/flooring",
37863       "shop/hardware",
37864       "shop/hardware_store",
37865       "shop/power_tools",
37866       "shop/tool_hire",
37867       "shop/tools",
37868       "shop/trade"
37869     ],
37870     health_food: [
37871       "shop/health",
37872       "shop/health_food",
37873       "shop/herbalist",
37874       "shop/nutrition_supplements"
37875     ],
37876     hobby: [
37877       "shop/electronics",
37878       "shop/hobby",
37879       "shop/books",
37880       "shop/games",
37881       "shop/collector",
37882       "shop/toys",
37883       "shop/model",
37884       "shop/video_games",
37885       "shop/anime"
37886     ],
37887     hospital: [
37888       "amenity/doctors",
37889       "amenity/hospital",
37890       "healthcare/hospital"
37891     ],
37892     houseware: [
37893       "shop/houseware",
37894       "shop/interior_decoration"
37895     ],
37896     lifeboat_station: [
37897       "amenity/lifeboat_station",
37898       "emergency/lifeboat_station",
37899       "emergency/marine_rescue"
37900     ],
37901     lodging: [
37902       "tourism/hotel",
37903       "tourism/motel"
37904     ],
37905     money_transfer: [
37906       "amenity/money_transfer",
37907       "shop/money_transfer"
37908     ],
37909     office_supplies: [
37910       "shop/office_supplies",
37911       "shop/stationary",
37912       "shop/stationery"
37913     ],
37914     outdoor: [
37915       "shop/clothes",
37916       "shop/outdoor",
37917       "shop/sports"
37918     ],
37919     parcel_locker: [
37920       "amenity/parcel_locker",
37921       "amenity/vending_machine"
37922     ],
37923     pharmacy: [
37924       "amenity/doctors",
37925       "amenity/pharmacy",
37926       "healthcare/pharmacy"
37927     ],
37928     playground: [
37929       "amenity/theme_park",
37930       "leisure/amusement_arcade",
37931       "leisure/playground"
37932     ],
37933     rental: [
37934       "amenity/bicycle_rental",
37935       "amenity/boat_rental",
37936       "amenity/car_rental",
37937       "amenity/truck_rental",
37938       "amenity/vehicle_rental",
37939       "shop/rental"
37940     ],
37941     school: [
37942       "amenity/childcare",
37943       "amenity/college",
37944       "amenity/kindergarten",
37945       "amenity/language_school",
37946       "amenity/prep_school",
37947       "amenity/school",
37948       "amenity/university"
37949     ],
37950     storage: [
37951       "shop/storage_units",
37952       "shop/storage_rental"
37953     ],
37954     substation: [
37955       "power/station",
37956       "power/substation",
37957       "power/sub_station"
37958     ],
37959     supermarket: [
37960       "shop/food",
37961       "shop/frozen_food",
37962       "shop/greengrocer",
37963       "shop/grocery",
37964       "shop/supermarket",
37965       "shop/wholesale"
37966     ],
37967     variety_store: [
37968       "shop/variety_store",
37969       "shop/discount",
37970       "shop/convenience"
37971     ],
37972     vending: [
37973       "amenity/vending_machine",
37974       "shop/vending_machine"
37975     ],
37976     weight_loss: [
37977       "amenity/clinic",
37978       "amenity/doctors",
37979       "amenity/weight_clinic",
37980       "healthcare/counselling",
37981       "leisure/fitness_centre",
37982       "office/therapist",
37983       "shop/beauty",
37984       "shop/diet",
37985       "shop/food",
37986       "shop/health_food",
37987       "shop/herbalist",
37988       "shop/nutrition",
37989       "shop/nutrition_supplements",
37990       "shop/weight_loss"
37991     ],
37992     wholesale: [
37993       "shop/wholesale",
37994       "shop/supermarket",
37995       "shop/department_store"
37996     ]
37997   };
37998   var matchGroups_default = {
37999     matchGroups
38000   };
38001
38002   // node_modules/name-suggestion-index/config/genericWords.json
38003   var genericWords = [
38004     "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
38005     "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
38006     "^(club|green|out|ware)\\s?house$",
38007     "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
38008     "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
38009     "^(hofladen|librairie|magazine?|maison)$",
38010     "^(mobile home|skate)?\\s?park$",
38011     "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
38012     "^\\?+$",
38013     "^private$",
38014     "^tattoo( studio)?$",
38015     "^windmill$",
38016     "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
38017   ];
38018   var genericWords_default = {
38019     genericWords
38020   };
38021
38022   // node_modules/name-suggestion-index/config/trees.json
38023   var trees = {
38024     brands: {
38025       emoji: "\u{1F354}",
38026       mainTag: "brand:wikidata",
38027       sourceTags: ["brand", "name"],
38028       nameTags: {
38029         primary: "^(name|name:\\w+)$",
38030         alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
38031       }
38032     },
38033     flags: {
38034       emoji: "\u{1F6A9}",
38035       mainTag: "flag:wikidata",
38036       nameTags: {
38037         primary: "^(flag:name|flag:name:\\w+)$",
38038         alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
38039       }
38040     },
38041     operators: {
38042       emoji: "\u{1F4BC}",
38043       mainTag: "operator:wikidata",
38044       sourceTags: ["operator"],
38045       nameTags: {
38046         primary: "^(name|name:\\w+|operator|operator:\\w+)$",
38047         alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
38048       }
38049     },
38050     transit: {
38051       emoji: "\u{1F687}",
38052       mainTag: "network:wikidata",
38053       sourceTags: ["network"],
38054       nameTags: {
38055         primary: "^network$",
38056         alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
38057       }
38058     }
38059   };
38060   var trees_default = {
38061     trees
38062   };
38063
38064   // node_modules/name-suggestion-index/lib/matcher.js
38065   var matchGroups2 = matchGroups_default.matchGroups;
38066   var trees2 = trees_default.trees;
38067   var Matcher = class {
38068     constructor() {
38069       this.matchIndex = void 0;
38070       this.genericWords = /* @__PURE__ */ new Map();
38071       (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
38072       this.itemLocation = void 0;
38073       this.locationSets = void 0;
38074       this.locationIndex = void 0;
38075       this.warnings = [];
38076     }
38077     buildMatchIndex(data) {
38078       const that = this;
38079       if (that.matchIndex)
38080         return;
38081       that.matchIndex = /* @__PURE__ */ new Map();
38082       const seenTree = /* @__PURE__ */ new Map();
38083       Object.keys(data).forEach((tkv) => {
38084         const category = data[tkv];
38085         const parts = tkv.split("/", 3);
38086         const t = parts[0];
38087         const k = parts[1];
38088         const v = parts[2];
38089         const thiskv = `${k}/${v}`;
38090         const tree = trees2[t];
38091         let branch = that.matchIndex.get(thiskv);
38092         if (!branch) {
38093           branch = {
38094             primary: /* @__PURE__ */ new Map(),
38095             alternate: /* @__PURE__ */ new Map(),
38096             excludeGeneric: /* @__PURE__ */ new Map(),
38097             excludeNamed: /* @__PURE__ */ new Map()
38098           };
38099           that.matchIndex.set(thiskv, branch);
38100         }
38101         const properties = category.properties || {};
38102         const exclude = properties.exclude || {};
38103         (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
38104         (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
38105         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
38106         let items = category.items;
38107         if (!Array.isArray(items) || !items.length)
38108           return;
38109         const primaryName = new RegExp(tree.nameTags.primary, "i");
38110         const alternateName = new RegExp(tree.nameTags.alternate, "i");
38111         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
38112         const skipGenericKV = skipGenericKVMatches(t, k, v);
38113         const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
38114         const matchGroupKV = /* @__PURE__ */ new Set();
38115         Object.values(matchGroups2).forEach((matchGroup) => {
38116           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
38117           if (!inGroup)
38118             return;
38119           matchGroup.forEach((otherkv) => {
38120             if (otherkv === thiskv)
38121               return;
38122             matchGroupKV.add(otherkv);
38123             const otherk = otherkv.split("/", 2)[0];
38124             genericKV.add(`${otherk}/yes`);
38125           });
38126         });
38127         items.forEach((item) => {
38128           if (!item.id)
38129             return;
38130           if (Array.isArray(item.matchTags) && item.matchTags.length) {
38131             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
38132             if (!item.matchTags.length)
38133               delete item.matchTags;
38134           }
38135           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
38136           if (!skipGenericKV) {
38137             kvTags = kvTags.concat(Array.from(genericKV));
38138           }
38139           Object.keys(item.tags).forEach((osmkey) => {
38140             if (notName.test(osmkey))
38141               return;
38142             const osmvalue = item.tags[osmkey];
38143             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
38144               return;
38145             if (primaryName.test(osmkey)) {
38146               kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id));
38147             } else if (alternateName.test(osmkey)) {
38148               kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id));
38149             }
38150           });
38151           let keepMatchNames = /* @__PURE__ */ new Set();
38152           (item.matchNames || []).forEach((matchName) => {
38153             const nsimple = simplify(matchName);
38154             kvTags.forEach((kv) => {
38155               const branch2 = that.matchIndex.get(kv);
38156               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
38157               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
38158               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
38159               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
38160               if (!inPrimary && !inAlternate) {
38161                 insertName("alternate", t, kv, nsimple, item.id);
38162                 keepMatchNames.add(matchName);
38163               }
38164             });
38165           });
38166           if (keepMatchNames.size) {
38167             item.matchNames = Array.from(keepMatchNames);
38168           } else {
38169             delete item.matchNames;
38170           }
38171         });
38172       });
38173       function insertName(which, t, kv, nsimple, itemID) {
38174         if (!nsimple) {
38175           that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
38176           return;
38177         }
38178         let branch = that.matchIndex.get(kv);
38179         if (!branch) {
38180           branch = {
38181             primary: /* @__PURE__ */ new Map(),
38182             alternate: /* @__PURE__ */ new Map(),
38183             excludeGeneric: /* @__PURE__ */ new Map(),
38184             excludeNamed: /* @__PURE__ */ new Map()
38185           };
38186           that.matchIndex.set(kv, branch);
38187         }
38188         let leaf = branch[which].get(nsimple);
38189         if (!leaf) {
38190           leaf = /* @__PURE__ */ new Set();
38191           branch[which].set(nsimple, leaf);
38192         }
38193         leaf.add(itemID);
38194         if (!/yes$/.test(kv)) {
38195           const kvnsimple = `${kv}/${nsimple}`;
38196           const existing = seenTree.get(kvnsimple);
38197           if (existing && existing !== t) {
38198             const items = Array.from(leaf);
38199             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
38200             return;
38201           }
38202           seenTree.set(kvnsimple, t);
38203         }
38204       }
38205       function skipGenericKVMatches(t, k, v) {
38206         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";
38207       }
38208     }
38209     buildLocationIndex(data, loco) {
38210       const that = this;
38211       if (that.locationIndex)
38212         return;
38213       that.itemLocation = /* @__PURE__ */ new Map();
38214       that.locationSets = /* @__PURE__ */ new Map();
38215       Object.keys(data).forEach((tkv) => {
38216         const items = data[tkv].items;
38217         if (!Array.isArray(items) || !items.length)
38218           return;
38219         items.forEach((item) => {
38220           if (that.itemLocation.has(item.id))
38221             return;
38222           let resolved;
38223           try {
38224             resolved = loco.resolveLocationSet(item.locationSet);
38225           } catch (err) {
38226             console.warn(`buildLocationIndex: ${err.message}`);
38227           }
38228           if (!resolved || !resolved.id)
38229             return;
38230           that.itemLocation.set(item.id, resolved.id);
38231           if (that.locationSets.has(resolved.id))
38232             return;
38233           let feature3 = _cloneDeep2(resolved.feature);
38234           feature3.id = resolved.id;
38235           feature3.properties.id = resolved.id;
38236           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
38237             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
38238             console.warn(JSON.stringify(feature3));
38239             return;
38240           }
38241           that.locationSets.set(resolved.id, feature3);
38242         });
38243       });
38244       that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
38245       function _cloneDeep2(obj) {
38246         return JSON.parse(JSON.stringify(obj));
38247       }
38248     }
38249     match(k, v, n2, loc) {
38250       const that = this;
38251       if (!that.matchIndex) {
38252         throw new Error("match:  matchIndex not built.");
38253       }
38254       let matchLocations;
38255       if (Array.isArray(loc) && that.locationIndex) {
38256         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
38257       }
38258       const nsimple = simplify(n2);
38259       let seen = /* @__PURE__ */ new Set();
38260       let results = [];
38261       gatherResults("primary");
38262       gatherResults("alternate");
38263       if (results.length)
38264         return results;
38265       gatherResults("exclude");
38266       return results.length ? results : null;
38267       function gatherResults(which) {
38268         const kv = `${k}/${v}`;
38269         let didMatch = tryMatch(which, kv);
38270         if (didMatch)
38271           return;
38272         for (let mg in matchGroups2) {
38273           const matchGroup = matchGroups2[mg];
38274           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
38275           if (!inGroup)
38276             continue;
38277           for (let i2 = 0; i2 < matchGroup.length; i2++) {
38278             const otherkv = matchGroup[i2];
38279             if (otherkv === kv)
38280               continue;
38281             didMatch = tryMatch(which, otherkv);
38282             if (didMatch)
38283               return;
38284           }
38285         }
38286         if (which === "exclude") {
38287           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
38288           if (regex) {
38289             results.push({ match: "excludeGeneric", pattern: String(regex) });
38290             return;
38291           }
38292         }
38293       }
38294       function tryMatch(which, kv) {
38295         const branch = that.matchIndex.get(kv);
38296         if (!branch)
38297           return;
38298         if (which === "exclude") {
38299           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
38300           if (regex) {
38301             results.push({ match: "excludeNamed", pattern: String(regex), kv });
38302             return;
38303           }
38304           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
38305           if (regex) {
38306             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
38307             return;
38308           }
38309           return;
38310         }
38311         const leaf = branch[which].get(nsimple);
38312         if (!leaf || !leaf.size)
38313           return;
38314         let hits = Array.from(leaf).map((itemID) => {
38315           let area = Infinity;
38316           if (that.itemLocation && that.locationSets) {
38317             const location = that.locationSets.get(that.itemLocation.get(itemID));
38318             area = location && location.properties.area || Infinity;
38319           }
38320           return { match: which, itemID, area, kv, nsimple };
38321         });
38322         let sortFn = byAreaDescending;
38323         if (matchLocations) {
38324           hits = hits.filter(isValidLocation);
38325           sortFn = byAreaAscending;
38326         }
38327         if (!hits.length)
38328           return;
38329         hits.sort(sortFn).forEach((hit) => {
38330           if (seen.has(hit.itemID))
38331             return;
38332           seen.add(hit.itemID);
38333           results.push(hit);
38334         });
38335         return true;
38336         function isValidLocation(hit) {
38337           if (!that.itemLocation)
38338             return true;
38339           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
38340         }
38341         function byAreaAscending(hitA, hitB) {
38342           return hitA.area - hitB.area;
38343         }
38344         function byAreaDescending(hitA, hitB) {
38345           return hitB.area - hitA.area;
38346         }
38347       }
38348     }
38349     getWarnings() {
38350       return this.warnings;
38351     }
38352   };
38353
38354   // modules/services/nsi.js
38355   var import_vparse2 = __toESM(require_vparse());
38356
38357   // modules/core/difference.js
38358   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
38359   function coreDifference(base, head) {
38360     var _changes = {};
38361     var _didChange = {};
38362     var _diff = {};
38363     function checkEntityID(id2) {
38364       var h = head.entities[id2];
38365       var b = base.entities[id2];
38366       if (h === b)
38367         return;
38368       if (_changes[id2])
38369         return;
38370       if (!h && b) {
38371         _changes[id2] = { base: b, head: h };
38372         _didChange.deletion = true;
38373         return;
38374       }
38375       if (h && !b) {
38376         _changes[id2] = { base: b, head: h };
38377         _didChange.addition = true;
38378         return;
38379       }
38380       if (h && b) {
38381         if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
38382           _changes[id2] = { base: b, head: h };
38383           _didChange.geometry = true;
38384           _didChange.properties = true;
38385           return;
38386         }
38387         if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
38388           _changes[id2] = { base: b, head: h };
38389           _didChange.geometry = true;
38390         }
38391         if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
38392           _changes[id2] = { base: b, head: h };
38393           _didChange.geometry = true;
38394         }
38395         if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
38396           _changes[id2] = { base: b, head: h };
38397           _didChange.properties = true;
38398         }
38399       }
38400     }
38401     function load() {
38402       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
38403       for (var i2 = 0; i2 < ids.length; i2++) {
38404         checkEntityID(ids[i2]);
38405       }
38406     }
38407     load();
38408     _diff.length = function length() {
38409       return Object.keys(_changes).length;
38410     };
38411     _diff.changes = function changes() {
38412       return _changes;
38413     };
38414     _diff.didChange = _didChange;
38415     _diff.extantIDs = function extantIDs(includeRelMembers) {
38416       var result = /* @__PURE__ */ new Set();
38417       Object.keys(_changes).forEach(function(id2) {
38418         if (_changes[id2].head) {
38419           result.add(id2);
38420         }
38421         var h = _changes[id2].head;
38422         var b = _changes[id2].base;
38423         var entity = h || b;
38424         if (includeRelMembers && entity.type === "relation") {
38425           var mh = h ? h.members.map(function(m) {
38426             return m.id;
38427           }) : [];
38428           var mb = b ? b.members.map(function(m) {
38429             return m.id;
38430           }) : [];
38431           utilArrayUnion(mh, mb).forEach(function(memberID) {
38432             if (head.hasEntity(memberID)) {
38433               result.add(memberID);
38434             }
38435           });
38436         }
38437       });
38438       return Array.from(result);
38439     };
38440     _diff.modified = function modified() {
38441       var result = [];
38442       Object.values(_changes).forEach(function(change) {
38443         if (change.base && change.head) {
38444           result.push(change.head);
38445         }
38446       });
38447       return result;
38448     };
38449     _diff.created = function created() {
38450       var result = [];
38451       Object.values(_changes).forEach(function(change) {
38452         if (!change.base && change.head) {
38453           result.push(change.head);
38454         }
38455       });
38456       return result;
38457     };
38458     _diff.deleted = function deleted() {
38459       var result = [];
38460       Object.values(_changes).forEach(function(change) {
38461         if (change.base && !change.head) {
38462           result.push(change.base);
38463         }
38464       });
38465       return result;
38466     };
38467     _diff.summary = function summary() {
38468       var relevant = {};
38469       var keys = Object.keys(_changes);
38470       for (var i2 = 0; i2 < keys.length; i2++) {
38471         var change = _changes[keys[i2]];
38472         if (change.head && change.head.geometry(head) !== "vertex") {
38473           addEntity(change.head, head, change.base ? "modified" : "created");
38474         } else if (change.base && change.base.geometry(base) !== "vertex") {
38475           addEntity(change.base, base, "deleted");
38476         } else if (change.base && change.head) {
38477           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
38478           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
38479           if (moved) {
38480             addParents(change.head);
38481           }
38482           if (retagged || moved && change.head.hasInterestingTags()) {
38483             addEntity(change.head, head, "modified");
38484           }
38485         } else if (change.head && change.head.hasInterestingTags()) {
38486           addEntity(change.head, head, "created");
38487         } else if (change.base && change.base.hasInterestingTags()) {
38488           addEntity(change.base, base, "deleted");
38489         }
38490       }
38491       return Object.values(relevant);
38492       function addEntity(entity, graph, changeType) {
38493         relevant[entity.id] = {
38494           entity,
38495           graph,
38496           changeType
38497         };
38498       }
38499       function addParents(entity) {
38500         var parents = head.parentWays(entity);
38501         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
38502           var parent = parents[j2];
38503           if (!(parent.id in relevant)) {
38504             addEntity(parent, head, "modified");
38505           }
38506         }
38507       }
38508     };
38509     _diff.complete = function complete(extent) {
38510       var result = {};
38511       var id2, change;
38512       for (id2 in _changes) {
38513         change = _changes[id2];
38514         var h = change.head;
38515         var b = change.base;
38516         var entity = h || b;
38517         var i2;
38518         if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
38519           continue;
38520         }
38521         result[id2] = h;
38522         if (entity.type === "way") {
38523           var nh = h ? h.nodes : [];
38524           var nb = b ? b.nodes : [];
38525           var diff;
38526           diff = utilArrayDifference(nh, nb);
38527           for (i2 = 0; i2 < diff.length; i2++) {
38528             result[diff[i2]] = head.hasEntity(diff[i2]);
38529           }
38530           diff = utilArrayDifference(nb, nh);
38531           for (i2 = 0; i2 < diff.length; i2++) {
38532             result[diff[i2]] = head.hasEntity(diff[i2]);
38533           }
38534         }
38535         if (entity.type === "relation" && entity.isMultipolygon()) {
38536           var mh = h ? h.members.map(function(m) {
38537             return m.id;
38538           }) : [];
38539           var mb = b ? b.members.map(function(m) {
38540             return m.id;
38541           }) : [];
38542           var ids = utilArrayUnion(mh, mb);
38543           for (i2 = 0; i2 < ids.length; i2++) {
38544             var member = head.hasEntity(ids[i2]);
38545             if (!member)
38546               continue;
38547             if (extent && !member.intersects(extent, head))
38548               continue;
38549             result[ids[i2]] = member;
38550           }
38551         }
38552         addParents(head.parentWays(entity), result);
38553         addParents(head.parentRelations(entity), result);
38554       }
38555       return result;
38556       function addParents(parents, result2) {
38557         for (var i3 = 0; i3 < parents.length; i3++) {
38558           var parent = parents[i3];
38559           if (parent.id in result2)
38560             continue;
38561           result2[parent.id] = parent;
38562           addParents(head.parentRelations(parent), result2);
38563         }
38564       }
38565     };
38566     return _diff;
38567   }
38568
38569   // modules/core/tree.js
38570   var import_rbush6 = __toESM(require_rbush_min());
38571   function coreTree(head) {
38572     var _rtree = new import_rbush6.default();
38573     var _bboxes = {};
38574     var _segmentsRTree = new import_rbush6.default();
38575     var _segmentsBBoxes = {};
38576     var _segmentsByWayId = {};
38577     var tree = {};
38578     function entityBBox(entity) {
38579       var bbox = entity.extent(head).bbox();
38580       bbox.id = entity.id;
38581       _bboxes[entity.id] = bbox;
38582       return bbox;
38583     }
38584     function segmentBBox(segment) {
38585       var extent = segment.extent(head);
38586       if (!extent)
38587         return null;
38588       var bbox = extent.bbox();
38589       bbox.segment = segment;
38590       _segmentsBBoxes[segment.id] = bbox;
38591       return bbox;
38592     }
38593     function removeEntity(entity) {
38594       _rtree.remove(_bboxes[entity.id]);
38595       delete _bboxes[entity.id];
38596       if (_segmentsByWayId[entity.id]) {
38597         _segmentsByWayId[entity.id].forEach(function(segment) {
38598           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
38599           delete _segmentsBBoxes[segment.id];
38600         });
38601         delete _segmentsByWayId[entity.id];
38602       }
38603     }
38604     function loadEntities(entities) {
38605       _rtree.load(entities.map(entityBBox));
38606       var segments = [];
38607       entities.forEach(function(entity) {
38608         if (entity.segments) {
38609           var entitySegments = entity.segments(head);
38610           _segmentsByWayId[entity.id] = entitySegments;
38611           segments = segments.concat(entitySegments);
38612         }
38613       });
38614       if (segments.length)
38615         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
38616     }
38617     function updateParents(entity, insertions, memo) {
38618       head.parentWays(entity).forEach(function(way) {
38619         if (_bboxes[way.id]) {
38620           removeEntity(way);
38621           insertions[way.id] = way;
38622         }
38623         updateParents(way, insertions, memo);
38624       });
38625       head.parentRelations(entity).forEach(function(relation) {
38626         if (memo[entity.id])
38627           return;
38628         memo[entity.id] = true;
38629         if (_bboxes[relation.id]) {
38630           removeEntity(relation);
38631           insertions[relation.id] = relation;
38632         }
38633         updateParents(relation, insertions, memo);
38634       });
38635     }
38636     tree.rebase = function(entities, force) {
38637       var insertions = {};
38638       for (var i2 = 0; i2 < entities.length; i2++) {
38639         var entity = entities[i2];
38640         if (!entity.visible)
38641           continue;
38642         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
38643           if (!force) {
38644             continue;
38645           } else if (_bboxes[entity.id]) {
38646             removeEntity(entity);
38647           }
38648         }
38649         insertions[entity.id] = entity;
38650         updateParents(entity, insertions, {});
38651       }
38652       loadEntities(Object.values(insertions));
38653       return tree;
38654     };
38655     function updateToGraph(graph) {
38656       if (graph === head)
38657         return;
38658       var diff = coreDifference(head, graph);
38659       head = graph;
38660       var changed = diff.didChange;
38661       if (!changed.addition && !changed.deletion && !changed.geometry)
38662         return;
38663       var insertions = {};
38664       if (changed.deletion) {
38665         diff.deleted().forEach(function(entity) {
38666           removeEntity(entity);
38667         });
38668       }
38669       if (changed.geometry) {
38670         diff.modified().forEach(function(entity) {
38671           removeEntity(entity);
38672           insertions[entity.id] = entity;
38673           updateParents(entity, insertions, {});
38674         });
38675       }
38676       if (changed.addition) {
38677         diff.created().forEach(function(entity) {
38678           insertions[entity.id] = entity;
38679         });
38680       }
38681       loadEntities(Object.values(insertions));
38682     }
38683     tree.intersects = function(extent, graph) {
38684       updateToGraph(graph);
38685       return _rtree.search(extent.bbox()).map(function(bbox) {
38686         return graph.entity(bbox.id);
38687       });
38688     };
38689     tree.waySegments = function(extent, graph) {
38690       updateToGraph(graph);
38691       return _segmentsRTree.search(extent.bbox()).map(function(bbox) {
38692         return bbox.segment;
38693       });
38694     };
38695     return tree;
38696   }
38697
38698   // modules/svg/icon.js
38699   function svgIcon(name2, svgklass, useklass) {
38700     return function drawIcon(selection2) {
38701       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);
38702     };
38703   }
38704
38705   // modules/ui/modal.js
38706   function uiModal(selection2, blocking) {
38707     let keybinding = utilKeybinding("modal");
38708     let previous = selection2.select("div.modal");
38709     let animate = previous.empty();
38710     previous.transition().duration(200).style("opacity", 0).remove();
38711     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
38712     shaded.close = () => {
38713       shaded.transition().duration(200).style("opacity", 0).remove();
38714       modal.transition().duration(200).style("top", "0px");
38715       select_default2(document).call(keybinding.unbind);
38716     };
38717     let modal = shaded.append("div").attr("class", "modal fillL");
38718     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
38719     if (!blocking) {
38720       shaded.on("click.remove-modal", (d3_event) => {
38721         if (d3_event.target === this) {
38722           shaded.close();
38723         }
38724       });
38725       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
38726       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
38727       select_default2(document).call(keybinding);
38728     }
38729     modal.append("div").attr("class", "content");
38730     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
38731     if (animate) {
38732       shaded.transition().style("opacity", 1);
38733     } else {
38734       shaded.style("opacity", 1);
38735     }
38736     return shaded;
38737     function moveFocusToFirst() {
38738       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
38739       if (node) {
38740         node.focus();
38741       } else {
38742         select_default2(this).node().blur();
38743       }
38744     }
38745     function moveFocusToLast() {
38746       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
38747       if (nodes.length) {
38748         nodes[nodes.length - 1].focus();
38749       } else {
38750         select_default2(this).node().blur();
38751       }
38752     }
38753   }
38754
38755   // modules/ui/loading.js
38756   function uiLoading(context) {
38757     let _modalSelection = select_default2(null);
38758     let _message = "";
38759     let _blocking = false;
38760     let loading = (selection2) => {
38761       _modalSelection = uiModal(selection2, _blocking);
38762       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
38763       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
38764       loadertext.append("h3").html(_message);
38765       _modalSelection.select("button.close").attr("class", "hide");
38766       return loading;
38767     };
38768     loading.message = function(val) {
38769       if (!arguments.length)
38770         return _message;
38771       _message = val;
38772       return loading;
38773     };
38774     loading.blocking = function(val) {
38775       if (!arguments.length)
38776         return _blocking;
38777       _blocking = val;
38778       return loading;
38779     };
38780     loading.close = () => {
38781       _modalSelection.remove();
38782     };
38783     loading.isShown = () => {
38784       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
38785     };
38786     return loading;
38787   }
38788
38789   // modules/core/history.js
38790   function coreHistory(context) {
38791     var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
38792     var lock = utilSessionMutex("lock");
38793     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
38794     var duration = 150;
38795     var _imageryUsed = [];
38796     var _photoOverlaysUsed = [];
38797     var _checkpoints = {};
38798     var _pausedGraph;
38799     var _stack;
38800     var _index;
38801     var _tree;
38802     function _act(actions, t) {
38803       actions = Array.prototype.slice.call(actions);
38804       var annotation;
38805       if (typeof actions[actions.length - 1] !== "function") {
38806         annotation = actions.pop();
38807       }
38808       var graph = _stack[_index].graph;
38809       for (var i2 = 0; i2 < actions.length; i2++) {
38810         graph = actions[i2](graph, t);
38811       }
38812       return {
38813         graph,
38814         annotation,
38815         imageryUsed: _imageryUsed,
38816         photoOverlaysUsed: _photoOverlaysUsed,
38817         transform: context.projection.transform(),
38818         selectedIDs: context.selectedIDs()
38819       };
38820     }
38821     function _perform(args, t) {
38822       var previous = _stack[_index].graph;
38823       _stack = _stack.slice(0, _index + 1);
38824       var actionResult = _act(args, t);
38825       _stack.push(actionResult);
38826       _index++;
38827       return change(previous);
38828     }
38829     function _replace(args, t) {
38830       var previous = _stack[_index].graph;
38831       var actionResult = _act(args, t);
38832       _stack[_index] = actionResult;
38833       return change(previous);
38834     }
38835     function _overwrite(args, t) {
38836       var previous = _stack[_index].graph;
38837       if (_index > 0) {
38838         _index--;
38839         _stack.pop();
38840       }
38841       _stack = _stack.slice(0, _index + 1);
38842       var actionResult = _act(args, t);
38843       _stack.push(actionResult);
38844       _index++;
38845       return change(previous);
38846     }
38847     function change(previous) {
38848       var difference = coreDifference(previous, history.graph());
38849       if (!_pausedGraph) {
38850         dispatch10.call("change", this, difference);
38851       }
38852       return difference;
38853     }
38854     function getKey(n2) {
38855       return "iD_" + window.location.origin + "_" + n2;
38856     }
38857     var history = {
38858       graph: function() {
38859         return _stack[_index].graph;
38860       },
38861       tree: function() {
38862         return _tree;
38863       },
38864       base: function() {
38865         return _stack[0].graph;
38866       },
38867       merge: function(entities) {
38868         var stack = _stack.map(function(state) {
38869           return state.graph;
38870         });
38871         _stack[0].graph.rebase(entities, stack, false);
38872         _tree.rebase(entities, false);
38873         dispatch10.call("merge", this, entities);
38874       },
38875       perform: function() {
38876         select_default2(document).interrupt("history.perform");
38877         var transitionable = false;
38878         var action0 = arguments[0];
38879         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
38880           transitionable = !!action0.transitionable;
38881         }
38882         if (transitionable) {
38883           var origArguments = arguments;
38884           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
38885             return function(t) {
38886               if (t < 1)
38887                 _overwrite([action0], t);
38888             };
38889           }).on("start", function() {
38890             _perform([action0], 0);
38891           }).on("end interrupt", function() {
38892             _overwrite(origArguments, 1);
38893           });
38894         } else {
38895           return _perform(arguments);
38896         }
38897       },
38898       replace: function() {
38899         select_default2(document).interrupt("history.perform");
38900         return _replace(arguments, 1);
38901       },
38902       overwrite: function() {
38903         select_default2(document).interrupt("history.perform");
38904         return _overwrite(arguments, 1);
38905       },
38906       pop: function(n2) {
38907         select_default2(document).interrupt("history.perform");
38908         var previous = _stack[_index].graph;
38909         if (isNaN(+n2) || +n2 < 0) {
38910           n2 = 1;
38911         }
38912         while (n2-- > 0 && _index > 0) {
38913           _index--;
38914           _stack.pop();
38915         }
38916         return change(previous);
38917       },
38918       undo: function() {
38919         select_default2(document).interrupt("history.perform");
38920         var previousStack = _stack[_index];
38921         var previous = previousStack.graph;
38922         while (_index > 0) {
38923           _index--;
38924           if (_stack[_index].annotation)
38925             break;
38926         }
38927         dispatch10.call("undone", this, _stack[_index], previousStack);
38928         return change(previous);
38929       },
38930       redo: function() {
38931         select_default2(document).interrupt("history.perform");
38932         var previousStack = _stack[_index];
38933         var previous = previousStack.graph;
38934         var tryIndex = _index;
38935         while (tryIndex < _stack.length - 1) {
38936           tryIndex++;
38937           if (_stack[tryIndex].annotation) {
38938             _index = tryIndex;
38939             dispatch10.call("redone", this, _stack[_index], previousStack);
38940             break;
38941           }
38942         }
38943         return change(previous);
38944       },
38945       pauseChangeDispatch: function() {
38946         if (!_pausedGraph) {
38947           _pausedGraph = _stack[_index].graph;
38948         }
38949       },
38950       resumeChangeDispatch: function() {
38951         if (_pausedGraph) {
38952           var previous = _pausedGraph;
38953           _pausedGraph = null;
38954           return change(previous);
38955         }
38956       },
38957       undoAnnotation: function() {
38958         var i2 = _index;
38959         while (i2 >= 0) {
38960           if (_stack[i2].annotation)
38961             return _stack[i2].annotation;
38962           i2--;
38963         }
38964       },
38965       redoAnnotation: function() {
38966         var i2 = _index + 1;
38967         while (i2 <= _stack.length - 1) {
38968           if (_stack[i2].annotation)
38969             return _stack[i2].annotation;
38970           i2++;
38971         }
38972       },
38973       intersects: function(extent) {
38974         return _tree.intersects(extent, _stack[_index].graph);
38975       },
38976       difference: function() {
38977         var base = _stack[0].graph;
38978         var head = _stack[_index].graph;
38979         return coreDifference(base, head);
38980       },
38981       changes: function(action) {
38982         var base = _stack[0].graph;
38983         var head = _stack[_index].graph;
38984         if (action) {
38985           head = action(head);
38986         }
38987         var difference = coreDifference(base, head);
38988         return {
38989           modified: difference.modified(),
38990           created: difference.created(),
38991           deleted: difference.deleted()
38992         };
38993       },
38994       hasChanges: function() {
38995         return this.difference().length() > 0;
38996       },
38997       imageryUsed: function(sources) {
38998         if (sources) {
38999           _imageryUsed = sources;
39000           return history;
39001         } else {
39002           var s = /* @__PURE__ */ new Set();
39003           _stack.slice(1, _index + 1).forEach(function(state) {
39004             state.imageryUsed.forEach(function(source) {
39005               if (source !== "Custom") {
39006                 s.add(source);
39007               }
39008             });
39009           });
39010           return Array.from(s);
39011         }
39012       },
39013       photoOverlaysUsed: function(sources) {
39014         if (sources) {
39015           _photoOverlaysUsed = sources;
39016           return history;
39017         } else {
39018           var s = /* @__PURE__ */ new Set();
39019           _stack.slice(1, _index + 1).forEach(function(state) {
39020             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
39021               state.photoOverlaysUsed.forEach(function(photoOverlay) {
39022                 s.add(photoOverlay);
39023               });
39024             }
39025           });
39026           return Array.from(s);
39027         }
39028       },
39029       checkpoint: function(key) {
39030         _checkpoints[key] = {
39031           stack: _stack,
39032           index: _index
39033         };
39034         return history;
39035       },
39036       reset: function(key) {
39037         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
39038           _stack = _checkpoints[key].stack;
39039           _index = _checkpoints[key].index;
39040         } else {
39041           _stack = [{ graph: coreGraph() }];
39042           _index = 0;
39043           _tree = coreTree(_stack[0].graph);
39044           _checkpoints = {};
39045         }
39046         dispatch10.call("reset");
39047         dispatch10.call("change");
39048         return history;
39049       },
39050       toIntroGraph: function() {
39051         var nextID = { n: 0, r: 0, w: 0 };
39052         var permIDs = {};
39053         var graph = this.graph();
39054         var baseEntities = {};
39055         Object.values(graph.base().entities).forEach(function(entity) {
39056           var copy2 = copyIntroEntity(entity);
39057           baseEntities[copy2.id] = copy2;
39058         });
39059         Object.keys(graph.entities).forEach(function(id2) {
39060           var entity = graph.entities[id2];
39061           if (entity) {
39062             var copy2 = copyIntroEntity(entity);
39063             baseEntities[copy2.id] = copy2;
39064           } else {
39065             delete baseEntities[id2];
39066           }
39067         });
39068         Object.values(baseEntities).forEach(function(entity) {
39069           if (Array.isArray(entity.nodes)) {
39070             entity.nodes = entity.nodes.map(function(node) {
39071               return permIDs[node] || node;
39072             });
39073           }
39074           if (Array.isArray(entity.members)) {
39075             entity.members = entity.members.map(function(member) {
39076               member.id = permIDs[member.id] || member.id;
39077               return member;
39078             });
39079           }
39080         });
39081         return JSON.stringify({ dataIntroGraph: baseEntities });
39082         function copyIntroEntity(source) {
39083           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
39084           if (copy2.tags && !Object.keys(copy2.tags)) {
39085             delete copy2.tags;
39086           }
39087           if (Array.isArray(copy2.loc)) {
39088             copy2.loc[0] = +copy2.loc[0].toFixed(6);
39089             copy2.loc[1] = +copy2.loc[1].toFixed(6);
39090           }
39091           var match = source.id.match(/([nrw])-\d*/);
39092           if (match !== null) {
39093             var nrw = match[1];
39094             var permID;
39095             do {
39096               permID = nrw + ++nextID[nrw];
39097             } while (baseEntities.hasOwnProperty(permID));
39098             copy2.id = permIDs[source.id] = permID;
39099           }
39100           return copy2;
39101         }
39102       },
39103       toJSON: function() {
39104         if (!this.hasChanges())
39105           return;
39106         var allEntities = {};
39107         var baseEntities = {};
39108         var base = _stack[0];
39109         var s = _stack.map(function(i2) {
39110           var modified = [];
39111           var deleted = [];
39112           Object.keys(i2.graph.entities).forEach(function(id2) {
39113             var entity = i2.graph.entities[id2];
39114             if (entity) {
39115               var key = osmEntity.key(entity);
39116               allEntities[key] = entity;
39117               modified.push(key);
39118             } else {
39119               deleted.push(id2);
39120             }
39121             if (id2 in base.graph.entities) {
39122               baseEntities[id2] = base.graph.entities[id2];
39123             }
39124             if (entity && entity.nodes) {
39125               entity.nodes.forEach(function(nodeID) {
39126                 if (nodeID in base.graph.entities) {
39127                   baseEntities[nodeID] = base.graph.entities[nodeID];
39128                 }
39129               });
39130             }
39131             var baseParents = base.graph._parentWays[id2];
39132             if (baseParents) {
39133               baseParents.forEach(function(parentID) {
39134                 if (parentID in base.graph.entities) {
39135                   baseEntities[parentID] = base.graph.entities[parentID];
39136                 }
39137               });
39138             }
39139           });
39140           var x = {};
39141           if (modified.length)
39142             x.modified = modified;
39143           if (deleted.length)
39144             x.deleted = deleted;
39145           if (i2.imageryUsed)
39146             x.imageryUsed = i2.imageryUsed;
39147           if (i2.photoOverlaysUsed)
39148             x.photoOverlaysUsed = i2.photoOverlaysUsed;
39149           if (i2.annotation)
39150             x.annotation = i2.annotation;
39151           if (i2.transform)
39152             x.transform = i2.transform;
39153           if (i2.selectedIDs)
39154             x.selectedIDs = i2.selectedIDs;
39155           return x;
39156         });
39157         return JSON.stringify({
39158           version: 3,
39159           entities: Object.values(allEntities),
39160           baseEntities: Object.values(baseEntities),
39161           stack: s,
39162           nextIDs: osmEntity.id.next,
39163           index: _index,
39164           timestamp: new Date().getTime()
39165         });
39166       },
39167       fromJSON: function(json, loadChildNodes) {
39168         var h = JSON.parse(json);
39169         var loadComplete = true;
39170         osmEntity.id.next = h.nextIDs;
39171         _index = h.index;
39172         if (h.version === 2 || h.version === 3) {
39173           var allEntities = {};
39174           h.entities.forEach(function(entity) {
39175             allEntities[osmEntity.key(entity)] = osmEntity(entity);
39176           });
39177           if (h.version === 3) {
39178             var baseEntities = h.baseEntities.map(function(d) {
39179               return osmEntity(d);
39180             });
39181             var stack = _stack.map(function(state) {
39182               return state.graph;
39183             });
39184             _stack[0].graph.rebase(baseEntities, stack, true);
39185             _tree.rebase(baseEntities, true);
39186             if (loadChildNodes) {
39187               var osm = context.connection();
39188               var baseWays = baseEntities.filter(function(e) {
39189                 return e.type === "way";
39190               });
39191               var nodeIDs = baseWays.reduce(function(acc, way) {
39192                 return utilArrayUnion(acc, way.nodes);
39193               }, []);
39194               var missing = nodeIDs.filter(function(n2) {
39195                 return !_stack[0].graph.hasEntity(n2);
39196               });
39197               if (missing.length && osm) {
39198                 loadComplete = false;
39199                 context.map().redrawEnable(false);
39200                 var loading = uiLoading(context).blocking(true);
39201                 context.container().call(loading);
39202                 var childNodesLoaded = function(err, result) {
39203                   if (!err) {
39204                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
39205                     var visibles = visibleGroups.true || [];
39206                     var invisibles = visibleGroups.false || [];
39207                     if (visibles.length) {
39208                       var visibleIDs = visibles.map(function(entity) {
39209                         return entity.id;
39210                       });
39211                       var stack2 = _stack.map(function(state) {
39212                         return state.graph;
39213                       });
39214                       missing = utilArrayDifference(missing, visibleIDs);
39215                       _stack[0].graph.rebase(visibles, stack2, true);
39216                       _tree.rebase(visibles, true);
39217                     }
39218                     invisibles.forEach(function(entity) {
39219                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
39220                     });
39221                   }
39222                   if (err || !missing.length) {
39223                     loading.close();
39224                     context.map().redrawEnable(true);
39225                     dispatch10.call("change");
39226                     dispatch10.call("restore", this);
39227                   }
39228                 };
39229                 osm.loadMultiple(missing, childNodesLoaded);
39230               }
39231             }
39232           }
39233           _stack = h.stack.map(function(d) {
39234             var entities = {}, entity;
39235             if (d.modified) {
39236               d.modified.forEach(function(key) {
39237                 entity = allEntities[key];
39238                 entities[entity.id] = entity;
39239               });
39240             }
39241             if (d.deleted) {
39242               d.deleted.forEach(function(id2) {
39243                 entities[id2] = void 0;
39244               });
39245             }
39246             return {
39247               graph: coreGraph(_stack[0].graph).load(entities),
39248               annotation: d.annotation,
39249               imageryUsed: d.imageryUsed,
39250               photoOverlaysUsed: d.photoOverlaysUsed,
39251               transform: d.transform,
39252               selectedIDs: d.selectedIDs
39253             };
39254           });
39255         } else {
39256           _stack = h.stack.map(function(d) {
39257             var entities = {};
39258             for (var i2 in d.entities) {
39259               var entity = d.entities[i2];
39260               entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
39261             }
39262             d.graph = coreGraph(_stack[0].graph).load(entities);
39263             return d;
39264           });
39265         }
39266         var transform2 = _stack[_index].transform;
39267         if (transform2) {
39268           context.map().transformEase(transform2, 0);
39269         }
39270         if (loadComplete) {
39271           dispatch10.call("change");
39272           dispatch10.call("restore", this);
39273         }
39274         return history;
39275       },
39276       lock: function() {
39277         return lock.lock();
39278       },
39279       unlock: function() {
39280         lock.unlock();
39281       },
39282       save: function() {
39283         if (lock.locked() && !_hasUnresolvedRestorableChanges) {
39284           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
39285           if (!success)
39286             dispatch10.call("storage_error");
39287         }
39288         return history;
39289       },
39290       clearSaved: function() {
39291         context.debouncedSave.cancel();
39292         if (lock.locked()) {
39293           _hasUnresolvedRestorableChanges = false;
39294           corePreferences(getKey("saved_history"), null);
39295           corePreferences("comment", null);
39296           corePreferences("hashtags", null);
39297           corePreferences("source", null);
39298         }
39299         return history;
39300       },
39301       savedHistoryJSON: function() {
39302         return corePreferences(getKey("saved_history"));
39303       },
39304       hasRestorableChanges: function() {
39305         return _hasUnresolvedRestorableChanges;
39306       },
39307       restore: function() {
39308         if (lock.locked()) {
39309           _hasUnresolvedRestorableChanges = false;
39310           var json = this.savedHistoryJSON();
39311           if (json)
39312             history.fromJSON(json, true);
39313         }
39314       },
39315       _getKey: getKey
39316     };
39317     history.reset();
39318     return utilRebind(history, dispatch10, "on");
39319   }
39320
39321   // modules/validations/index.js
39322   var validations_exports = {};
39323   __export(validations_exports, {
39324     validationAlmostJunction: () => validationAlmostJunction,
39325     validationCloseNodes: () => validationCloseNodes,
39326     validationCrossingWays: () => validationCrossingWays,
39327     validationDisconnectedWay: () => validationDisconnectedWay,
39328     validationFormatting: () => validationFormatting,
39329     validationHelpRequest: () => validationHelpRequest,
39330     validationImpossibleOneway: () => validationImpossibleOneway,
39331     validationIncompatibleSource: () => validationIncompatibleSource,
39332     validationMaprules: () => validationMaprules,
39333     validationMismatchedGeometry: () => validationMismatchedGeometry,
39334     validationMissingRole: () => validationMissingRole,
39335     validationMissingTag: () => validationMissingTag,
39336     validationOutdatedTags: () => validationOutdatedTags,
39337     validationPrivateData: () => validationPrivateData,
39338     validationSuspiciousName: () => validationSuspiciousName,
39339     validationUnsquareWay: () => validationUnsquareWay
39340   });
39341
39342   // modules/validations/almost_junction.js
39343   function validationAlmostJunction(context) {
39344     const type3 = "almost_junction";
39345     const EXTEND_TH_METERS = 5;
39346     const WELD_TH_METERS = 0.75;
39347     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
39348     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
39349     function isHighway(entity) {
39350       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
39351     }
39352     function isTaggedAsNotContinuing(node) {
39353       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
39354     }
39355     const validation = function checkAlmostJunction(entity, graph) {
39356       if (!isHighway(entity))
39357         return [];
39358       if (entity.isDegenerate())
39359         return [];
39360       const tree = context.history().tree();
39361       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
39362       let issues = [];
39363       extendableNodeInfos.forEach((extendableNodeInfo) => {
39364         issues.push(new validationIssue({
39365           type: type3,
39366           subtype: "highway-highway",
39367           severity: "warning",
39368           message: function(context2) {
39369             const entity1 = context2.hasEntity(this.entityIds[0]);
39370             if (this.entityIds[0] === this.entityIds[2]) {
39371               return entity1 ? _t.html("issues.almost_junction.self.message", {
39372                 feature: utilDisplayLabel(entity1, context2.graph())
39373               }) : "";
39374             } else {
39375               const entity2 = context2.hasEntity(this.entityIds[2]);
39376               return entity1 && entity2 ? _t.html("issues.almost_junction.message", {
39377                 feature: utilDisplayLabel(entity1, context2.graph()),
39378                 feature2: utilDisplayLabel(entity2, context2.graph())
39379               }) : "";
39380             }
39381           },
39382           reference: showReference,
39383           entityIds: [
39384             entity.id,
39385             extendableNodeInfo.node.id,
39386             extendableNodeInfo.wid
39387           ],
39388           loc: extendableNodeInfo.node.loc,
39389           hash: JSON.stringify(extendableNodeInfo.node.loc),
39390           data: {
39391             midId: extendableNodeInfo.mid.id,
39392             edge: extendableNodeInfo.edge,
39393             cross_loc: extendableNodeInfo.cross_loc
39394           },
39395           dynamicFixes: makeFixes
39396         }));
39397       });
39398       return issues;
39399       function makeFixes(context2) {
39400         let fixes = [new validationIssueFix({
39401           icon: "iD-icon-abutment",
39402           title: _t.html("issues.fix.connect_features.title"),
39403           onClick: function(context3) {
39404             const annotation = _t("issues.fix.connect_almost_junction.annotation");
39405             const [, endNodeId, crossWayId] = this.issue.entityIds;
39406             const midNode = context3.entity(this.issue.data.midId);
39407             const endNode = context3.entity(endNodeId);
39408             const crossWay = context3.entity(crossWayId);
39409             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
39410             if (nearEndNodes.length > 0) {
39411               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
39412               if (collinear) {
39413                 context3.perform(actionMergeNodes([collinear.id, endNode.id], collinear.loc), annotation);
39414                 return;
39415               }
39416             }
39417             const targetEdge = this.issue.data.edge;
39418             const crossLoc = this.issue.data.cross_loc;
39419             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
39420             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
39421             if (closestNodeInfo.distance < WELD_TH_METERS) {
39422               context3.perform(actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc), annotation);
39423             } else {
39424               context3.perform(actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode), annotation);
39425             }
39426           }
39427         })];
39428         const node = context2.hasEntity(this.entityIds[1]);
39429         if (node && !node.hasInterestingTags()) {
39430           fixes.push(new validationIssueFix({
39431             icon: "maki-barrier",
39432             title: _t.html("issues.fix.tag_as_disconnected.title"),
39433             onClick: function(context3) {
39434               const nodeID = this.issue.entityIds[1];
39435               const tags = Object.assign({}, context3.entity(nodeID).tags);
39436               tags.noexit = "yes";
39437               context3.perform(actionChangeTags(nodeID, tags), _t("issues.fix.tag_as_disconnected.annotation"));
39438             }
39439           }));
39440         }
39441         return fixes;
39442       }
39443       function showReference(selection2) {
39444         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
39445       }
39446       function isExtendableCandidate(node, way) {
39447         const osm = services.osm;
39448         if (osm && !osm.isDataLoaded(node.loc)) {
39449           return false;
39450         }
39451         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
39452           return false;
39453         }
39454         let occurrences = 0;
39455         for (const index in way.nodes) {
39456           if (way.nodes[index] === node.id) {
39457             occurrences += 1;
39458             if (occurrences > 1) {
39459               return false;
39460             }
39461           }
39462         }
39463         return true;
39464       }
39465       function findConnectableEndNodesByExtension(way) {
39466         let results = [];
39467         if (way.isClosed())
39468           return results;
39469         let testNodes;
39470         const indices = [0, way.nodes.length - 1];
39471         indices.forEach((nodeIndex) => {
39472           const nodeID = way.nodes[nodeIndex];
39473           const node = graph.entity(nodeID);
39474           if (!isExtendableCandidate(node, way))
39475             return;
39476           const connectionInfo = canConnectByExtend(way, nodeIndex);
39477           if (!connectionInfo)
39478             return;
39479           testNodes = graph.childNodes(way).slice();
39480           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
39481           if (geoHasSelfIntersections(testNodes, nodeID))
39482             return;
39483           results.push(connectionInfo);
39484         });
39485         return results;
39486       }
39487       function findNearbyEndNodes(node, way) {
39488         return [
39489           way.nodes[0],
39490           way.nodes[way.nodes.length - 1]
39491         ].map((d) => graph.entity(d)).filter((d) => {
39492           return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
39493         });
39494       }
39495       function findSmallJoinAngle(midNode, tipNode, endNodes) {
39496         let joinTo;
39497         let minAngle = Infinity;
39498         endNodes.forEach((endNode) => {
39499           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
39500           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
39501           const diff = Math.max(a1, a2) - Math.min(a1, a2);
39502           if (diff < minAngle) {
39503             joinTo = endNode;
39504             minAngle = diff;
39505           }
39506         });
39507         if (minAngle <= SIG_ANGLE_TH)
39508           return joinTo;
39509         return null;
39510       }
39511       function hasTag(tags, key) {
39512         return tags[key] !== void 0 && tags[key] !== "no";
39513       }
39514       function canConnectWays(way, way2) {
39515         if (way.id === way2.id)
39516           return true;
39517         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
39518           return false;
39519         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
39520           return false;
39521         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
39522         if (layer1 !== layer2)
39523           return false;
39524         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
39525         if (level1 !== level2)
39526           return false;
39527         return true;
39528       }
39529       function canConnectByExtend(way, endNodeIdx) {
39530         const tipNid = way.nodes[endNodeIdx];
39531         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
39532         const tipNode = graph.entity(tipNid);
39533         const midNode = graph.entity(midNid);
39534         const lon = tipNode.loc[0];
39535         const lat = tipNode.loc[1];
39536         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
39537         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
39538         const queryExtent = geoExtent([
39539           [lon - lon_range, lat - lat_range],
39540           [lon + lon_range, lat + lat_range]
39541         ]);
39542         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
39543         const t = EXTEND_TH_METERS / edgeLen + 1;
39544         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
39545         const segmentInfos = tree.waySegments(queryExtent, graph);
39546         for (let i2 = 0; i2 < segmentInfos.length; i2++) {
39547           let segmentInfo = segmentInfos[i2];
39548           let way2 = graph.entity(segmentInfo.wayId);
39549           if (!isHighway(way2))
39550             continue;
39551           if (!canConnectWays(way, way2))
39552             continue;
39553           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
39554           if (nAid === tipNid || nBid === tipNid)
39555             continue;
39556           let nA = graph.entity(nAid), nB = graph.entity(nBid);
39557           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
39558           if (crossLoc) {
39559             return {
39560               mid: midNode,
39561               node: tipNode,
39562               wid: way2.id,
39563               edge: [nA.id, nB.id],
39564               cross_loc: crossLoc
39565             };
39566           }
39567         }
39568         return null;
39569       }
39570     };
39571     validation.type = type3;
39572     return validation;
39573   }
39574
39575   // modules/validations/close_nodes.js
39576   function validationCloseNodes(context) {
39577     var type3 = "close_nodes";
39578     var pointThresholdMeters = 0.2;
39579     var validation = function(entity, graph) {
39580       if (entity.type === "node") {
39581         return getIssuesForNode(entity);
39582       } else if (entity.type === "way") {
39583         return getIssuesForWay(entity);
39584       }
39585       return [];
39586       function getIssuesForNode(node) {
39587         var parentWays = graph.parentWays(node);
39588         if (parentWays.length) {
39589           return getIssuesForVertex(node, parentWays);
39590         } else {
39591           return getIssuesForDetachedPoint(node);
39592         }
39593       }
39594       function wayTypeFor(way) {
39595         if (way.tags.boundary && way.tags.boundary !== "no")
39596           return "boundary";
39597         if (way.tags.indoor && way.tags.indoor !== "no")
39598           return "indoor";
39599         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
39600           return "building";
39601         if (osmPathHighwayTagValues[way.tags.highway])
39602           return "path";
39603         var parentRelations = graph.parentRelations(way);
39604         for (var i2 in parentRelations) {
39605           var relation = parentRelations[i2];
39606           if (relation.tags.type === "boundary")
39607             return "boundary";
39608           if (relation.isMultipolygon()) {
39609             if (relation.tags.indoor && relation.tags.indoor !== "no")
39610               return "indoor";
39611             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
39612               return "building";
39613           }
39614         }
39615         return "other";
39616       }
39617       function shouldCheckWay(way) {
39618         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
39619           return false;
39620         var bbox = way.extent(graph).bbox();
39621         var hypotenuseMeters = geoSphericalDistance([bbox.minX, bbox.minY], [bbox.maxX, bbox.maxY]);
39622         if (hypotenuseMeters < 1.5)
39623           return false;
39624         return true;
39625       }
39626       function getIssuesForWay(way) {
39627         if (!shouldCheckWay(way))
39628           return [];
39629         var issues = [], nodes = graph.childNodes(way);
39630         for (var i2 = 0; i2 < nodes.length - 1; i2++) {
39631           var node1 = nodes[i2];
39632           var node2 = nodes[i2 + 1];
39633           var issue = getWayIssueIfAny(node1, node2, way);
39634           if (issue)
39635             issues.push(issue);
39636         }
39637         return issues;
39638       }
39639       function getIssuesForVertex(node, parentWays) {
39640         var issues = [];
39641         function checkForCloseness(node1, node2, way) {
39642           var issue = getWayIssueIfAny(node1, node2, way);
39643           if (issue)
39644             issues.push(issue);
39645         }
39646         for (var i2 = 0; i2 < parentWays.length; i2++) {
39647           var parentWay = parentWays[i2];
39648           if (!shouldCheckWay(parentWay))
39649             continue;
39650           var lastIndex = parentWay.nodes.length - 1;
39651           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
39652             if (j2 !== 0) {
39653               if (parentWay.nodes[j2 - 1] === node.id) {
39654                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
39655               }
39656             }
39657             if (j2 !== lastIndex) {
39658               if (parentWay.nodes[j2 + 1] === node.id) {
39659                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
39660               }
39661             }
39662           }
39663         }
39664         return issues;
39665       }
39666       function thresholdMetersForWay(way) {
39667         if (!shouldCheckWay(way))
39668           return 0;
39669         var wayType = wayTypeFor(way);
39670         if (wayType === "boundary")
39671           return 0;
39672         if (wayType === "indoor")
39673           return 0.01;
39674         if (wayType === "building")
39675           return 0.05;
39676         if (wayType === "path")
39677           return 0.1;
39678         return 0.2;
39679       }
39680       function getIssuesForDetachedPoint(node) {
39681         var issues = [];
39682         var lon = node.loc[0];
39683         var lat = node.loc[1];
39684         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
39685         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
39686         var queryExtent = geoExtent([
39687           [lon - lon_range, lat - lat_range],
39688           [lon + lon_range, lat + lat_range]
39689         ]);
39690         var intersected = context.history().tree().intersects(queryExtent, graph);
39691         for (var j2 = 0; j2 < intersected.length; j2++) {
39692           var nearby = intersected[j2];
39693           if (nearby.id === node.id)
39694             continue;
39695           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
39696             continue;
39697           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
39698             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
39699             var zAxisDifferentiates = false;
39700             for (var key in zAxisKeys) {
39701               var nodeValue = node.tags[key] || "0";
39702               var nearbyValue = nearby.tags[key] || "0";
39703               if (nodeValue !== nearbyValue) {
39704                 zAxisDifferentiates = true;
39705                 break;
39706               }
39707             }
39708             if (zAxisDifferentiates)
39709               continue;
39710             issues.push(new validationIssue({
39711               type: type3,
39712               subtype: "detached",
39713               severity: "warning",
39714               message: function(context2) {
39715                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
39716                 return entity2 && entity22 ? _t.html("issues.close_nodes.detached.message", {
39717                   feature: utilDisplayLabel(entity2, context2.graph()),
39718                   feature2: utilDisplayLabel(entity22, context2.graph())
39719                 }) : "";
39720               },
39721               reference: showReference,
39722               entityIds: [node.id, nearby.id],
39723               dynamicFixes: function() {
39724                 return [
39725                   new validationIssueFix({
39726                     icon: "iD-operation-disconnect",
39727                     title: _t.html("issues.fix.move_points_apart.title")
39728                   }),
39729                   new validationIssueFix({
39730                     icon: "iD-icon-layers",
39731                     title: _t.html("issues.fix.use_different_layers_or_levels.title")
39732                   })
39733                 ];
39734               }
39735             }));
39736           }
39737         }
39738         return issues;
39739         function showReference(selection2) {
39740           var referenceText = _t("issues.close_nodes.detached.reference");
39741           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
39742         }
39743       }
39744       function getWayIssueIfAny(node1, node2, way) {
39745         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
39746           return null;
39747         }
39748         if (node1.loc !== node2.loc) {
39749           var parentWays1 = graph.parentWays(node1);
39750           var parentWays2 = new Set(graph.parentWays(node2));
39751           var sharedWays = parentWays1.filter(function(parentWay) {
39752             return parentWays2.has(parentWay);
39753           });
39754           var thresholds = sharedWays.map(function(parentWay) {
39755             return thresholdMetersForWay(parentWay);
39756           });
39757           var threshold = Math.min(...thresholds);
39758           var distance = geoSphericalDistance(node1.loc, node2.loc);
39759           if (distance > threshold)
39760             return null;
39761         }
39762         return new validationIssue({
39763           type: type3,
39764           subtype: "vertices",
39765           severity: "warning",
39766           message: function(context2) {
39767             var entity2 = context2.hasEntity(this.entityIds[0]);
39768             return entity2 ? _t.html("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
39769           },
39770           reference: showReference,
39771           entityIds: [way.id, node1.id, node2.id],
39772           loc: node1.loc,
39773           dynamicFixes: function() {
39774             return [
39775               new validationIssueFix({
39776                 icon: "iD-icon-plus",
39777                 title: _t.html("issues.fix.merge_points.title"),
39778                 onClick: function(context2) {
39779                   var entityIds = this.issue.entityIds;
39780                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
39781                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
39782                 }
39783               }),
39784               new validationIssueFix({
39785                 icon: "iD-operation-disconnect",
39786                 title: _t.html("issues.fix.move_points_apart.title")
39787               })
39788             ];
39789           }
39790         });
39791         function showReference(selection2) {
39792           var referenceText = _t("issues.close_nodes.reference");
39793           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
39794         }
39795       }
39796     };
39797     validation.type = type3;
39798     return validation;
39799   }
39800
39801   // modules/validations/crossing_ways.js
39802   function validationCrossingWays(context) {
39803     var type3 = "crossing_ways";
39804     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
39805       if (getFeatureType(way, graph) === null) {
39806         var parentRels = graph.parentRelations(way);
39807         for (var i2 = 0; i2 < parentRels.length; i2++) {
39808           var rel = parentRels[i2];
39809           if (getFeatureType(rel, graph) !== null) {
39810             return rel;
39811           }
39812         }
39813       }
39814       return way;
39815     }
39816     function hasTag(tags, key) {
39817       return tags[key] !== void 0 && tags[key] !== "no";
39818     }
39819     function taggedAsIndoor(tags) {
39820       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
39821     }
39822     function allowsBridge(featureType) {
39823       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
39824     }
39825     function allowsTunnel(featureType) {
39826       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
39827     }
39828     var ignoredBuildings = {
39829       demolished: true,
39830       dismantled: true,
39831       proposed: true,
39832       razed: true
39833     };
39834     function getFeatureType(entity, graph) {
39835       var geometry = entity.geometry(graph);
39836       if (geometry !== "line" && geometry !== "area")
39837         return null;
39838       var tags = entity.tags;
39839       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
39840         return "building";
39841       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
39842         return "highway";
39843       if (geometry !== "line")
39844         return null;
39845       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
39846         return "railway";
39847       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
39848         return "waterway";
39849       return null;
39850     }
39851     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
39852       var level1 = tags1.level || "0";
39853       var level2 = tags2.level || "0";
39854       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
39855         return true;
39856       }
39857       var layer1 = tags1.layer || "0";
39858       var layer2 = tags2.layer || "0";
39859       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
39860         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
39861           return true;
39862         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
39863           return true;
39864         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
39865           return true;
39866       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
39867         return true;
39868       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
39869         return true;
39870       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
39871         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
39872           return true;
39873         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
39874           return true;
39875         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
39876           return true;
39877       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
39878         return true;
39879       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
39880         return true;
39881       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
39882         return true;
39883       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
39884         return true;
39885       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
39886         if (layer1 !== layer2)
39887           return true;
39888       }
39889       return false;
39890     }
39891     var highwaysDisallowingFords = {
39892       motorway: true,
39893       motorway_link: true,
39894       trunk: true,
39895       trunk_link: true,
39896       primary: true,
39897       primary_link: true,
39898       secondary: true,
39899       secondary_link: true
39900     };
39901     var nonCrossingHighways = { track: true };
39902     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) {
39903       var featureType1 = getFeatureType(entity1, graph);
39904       var featureType2 = getFeatureType(entity2, graph);
39905       var geometry1 = entity1.geometry(graph);
39906       var geometry2 = entity2.geometry(graph);
39907       var bothLines = geometry1 === "line" && geometry2 === "line";
39908       if (featureType1 === featureType2) {
39909         if (featureType1 === "highway") {
39910           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
39911           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
39912           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
39913             var roadFeature = entity1IsPath ? entity2 : entity1;
39914             if (nonCrossingHighways[roadFeature.tags.highway]) {
39915               return {};
39916             }
39917             var pathFeature = entity1IsPath ? entity1 : entity2;
39918             if (["marked", "unmarked"].indexOf(pathFeature.tags.crossing) !== -1) {
39919               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
39920             }
39921             return bothLines ? { highway: "crossing" } : {};
39922           }
39923           return {};
39924         }
39925         if (featureType1 === "waterway")
39926           return {};
39927         if (featureType1 === "railway")
39928           return {};
39929       } else {
39930         var featureTypes = [featureType1, featureType2];
39931         if (featureTypes.indexOf("highway") !== -1) {
39932           if (featureTypes.indexOf("railway") !== -1) {
39933             if (!bothLines)
39934               return {};
39935             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
39936             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
39937               if (isTram)
39938                 return { railway: "tram_crossing" };
39939               return { railway: "crossing" };
39940             } else {
39941               if (isTram)
39942                 return { railway: "tram_level_crossing" };
39943               return { railway: "level_crossing" };
39944             }
39945           }
39946           if (featureTypes.indexOf("waterway") !== -1) {
39947             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
39948               return null;
39949             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
39950               return null;
39951             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
39952               return null;
39953             }
39954             return bothLines ? { ford: "yes" } : {};
39955           }
39956         }
39957       }
39958       return null;
39959     }
39960     function findCrossingsByWay(way1, graph, tree) {
39961       var edgeCrossInfos = [];
39962       if (way1.type !== "way")
39963         return edgeCrossInfos;
39964       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
39965       var way1FeatureType = getFeatureType(taggedFeature1, graph);
39966       if (way1FeatureType === null)
39967         return edgeCrossInfos;
39968       var checkedSingleCrossingWays = {};
39969       var i2, j2;
39970       var extent;
39971       var n1, n2, nA, nB, nAId, nBId;
39972       var segment1, segment2;
39973       var oneOnly;
39974       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
39975       var way1Nodes = graph.childNodes(way1);
39976       var comparedWays = {};
39977       for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
39978         n1 = way1Nodes[i2];
39979         n2 = way1Nodes[i2 + 1];
39980         extent = geoExtent([
39981           [
39982             Math.min(n1.loc[0], n2.loc[0]),
39983             Math.min(n1.loc[1], n2.loc[1])
39984           ],
39985           [
39986             Math.max(n1.loc[0], n2.loc[0]),
39987             Math.max(n1.loc[1], n2.loc[1])
39988           ]
39989         ]);
39990         segmentInfos = tree.waySegments(extent, graph);
39991         for (j2 = 0; j2 < segmentInfos.length; j2++) {
39992           segment2Info = segmentInfos[j2];
39993           if (segment2Info.wayId === way1.id)
39994             continue;
39995           if (checkedSingleCrossingWays[segment2Info.wayId])
39996             continue;
39997           comparedWays[segment2Info.wayId] = true;
39998           way2 = graph.hasEntity(segment2Info.wayId);
39999           if (!way2)
40000             continue;
40001           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
40002           way2FeatureType = getFeatureType(taggedFeature2, graph);
40003           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
40004             continue;
40005           }
40006           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
40007           nAId = segment2Info.nodes[0];
40008           nBId = segment2Info.nodes[1];
40009           if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
40010             continue;
40011           }
40012           nA = graph.hasEntity(nAId);
40013           if (!nA)
40014             continue;
40015           nB = graph.hasEntity(nBId);
40016           if (!nB)
40017             continue;
40018           segment1 = [n1.loc, n2.loc];
40019           segment2 = [nA.loc, nB.loc];
40020           var point = geoLineIntersection(segment1, segment2);
40021           if (point) {
40022             edgeCrossInfos.push({
40023               wayInfos: [
40024                 {
40025                   way: way1,
40026                   featureType: way1FeatureType,
40027                   edge: [n1.id, n2.id]
40028                 },
40029                 {
40030                   way: way2,
40031                   featureType: way2FeatureType,
40032                   edge: [nA.id, nB.id]
40033                 }
40034               ],
40035               crossPoint: point
40036             });
40037             if (oneOnly) {
40038               checkedSingleCrossingWays[way2.id] = true;
40039               break;
40040             }
40041           }
40042         }
40043       }
40044       return edgeCrossInfos;
40045     }
40046     function waysToCheck(entity, graph) {
40047       var featureType = getFeatureType(entity, graph);
40048       if (!featureType)
40049         return [];
40050       if (entity.type === "way") {
40051         return [entity];
40052       } else if (entity.type === "relation") {
40053         return entity.members.reduce(function(array2, member) {
40054           if (member.type === "way" && (!member.role || member.role === "outer" || member.role === "inner")) {
40055             var entity2 = graph.hasEntity(member.id);
40056             if (entity2 && array2.indexOf(entity2) === -1) {
40057               array2.push(entity2);
40058             }
40059           }
40060           return array2;
40061         }, []);
40062       }
40063       return [];
40064     }
40065     var validation = function checkCrossingWays(entity, graph) {
40066       var tree = context.history().tree();
40067       var ways = waysToCheck(entity, graph);
40068       var issues = [];
40069       var wayIndex, crossingIndex, crossings;
40070       for (wayIndex in ways) {
40071         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
40072         for (crossingIndex in crossings) {
40073           issues.push(createIssue(crossings[crossingIndex], graph));
40074         }
40075       }
40076       return issues;
40077     };
40078     function createIssue(crossing, graph) {
40079       crossing.wayInfos.sort(function(way1Info, way2Info) {
40080         var type1 = way1Info.featureType;
40081         var type22 = way2Info.featureType;
40082         if (type1 === type22) {
40083           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
40084         } else if (type1 === "waterway") {
40085           return true;
40086         } else if (type22 === "waterway") {
40087           return false;
40088         }
40089         return type1 < type22;
40090       });
40091       var entities = crossing.wayInfos.map(function(wayInfo) {
40092         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
40093       });
40094       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
40095       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
40096       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
40097       var featureType1 = crossing.wayInfos[0].featureType;
40098       var featureType2 = crossing.wayInfos[1].featureType;
40099       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
40100       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
40101       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
40102       var subtype = [featureType1, featureType2].sort().join("-");
40103       var crossingTypeID = subtype;
40104       if (isCrossingIndoors) {
40105         crossingTypeID = "indoor-indoor";
40106       } else if (isCrossingTunnels) {
40107         crossingTypeID = "tunnel-tunnel";
40108       } else if (isCrossingBridges) {
40109         crossingTypeID = "bridge-bridge";
40110       }
40111       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
40112         crossingTypeID += "_connectable";
40113       }
40114       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
40115       return new validationIssue({
40116         type: type3,
40117         subtype,
40118         severity: "warning",
40119         message: function(context2) {
40120           var graph2 = context2.graph();
40121           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
40122           return entity1 && entity2 ? _t.html("issues.crossing_ways.message", {
40123             feature: utilDisplayLabel(entity1, graph2),
40124             feature2: utilDisplayLabel(entity2, graph2)
40125           }) : "";
40126         },
40127         reference: showReference,
40128         entityIds: entities.map(function(entity) {
40129           return entity.id;
40130         }),
40131         data: {
40132           edges,
40133           featureTypes,
40134           connectionTags
40135         },
40136         hash: uniqueID,
40137         loc: crossing.crossPoint,
40138         dynamicFixes: function(context2) {
40139           var mode = context2.mode();
40140           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
40141             return [];
40142           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
40143           var selectedFeatureType = this.data.featureTypes[selectedIndex];
40144           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
40145           var fixes = [];
40146           if (connectionTags) {
40147             fixes.push(makeConnectWaysFix(this.data.connectionTags));
40148           }
40149           if (isCrossingIndoors) {
40150             fixes.push(new validationIssueFix({
40151               icon: "iD-icon-layers",
40152               title: _t.html("issues.fix.use_different_levels.title")
40153             }));
40154           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
40155             fixes.push(makeChangeLayerFix("higher"));
40156             fixes.push(makeChangeLayerFix("lower"));
40157           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
40158             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
40159               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
40160             }
40161             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
40162             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
40163               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
40164             }
40165           }
40166           fixes.push(new validationIssueFix({
40167             icon: "iD-operation-move",
40168             title: _t.html("issues.fix.reposition_features.title")
40169           }));
40170           return fixes;
40171         }
40172       });
40173       function showReference(selection2) {
40174         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
40175       }
40176     }
40177     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
40178       return new validationIssueFix({
40179         icon: iconName,
40180         title: _t.html("issues.fix." + fixTitleID + ".title"),
40181         onClick: function(context2) {
40182           var mode = context2.mode();
40183           if (!mode || mode.id !== "select")
40184             return;
40185           var selectedIDs = mode.selectedIDs();
40186           if (selectedIDs.length !== 1)
40187             return;
40188           var selectedWayID = selectedIDs[0];
40189           if (!context2.hasEntity(selectedWayID))
40190             return;
40191           var resultWayIDs = [selectedWayID];
40192           var edge, crossedEdge, crossedWayID;
40193           if (this.issue.entityIds[0] === selectedWayID) {
40194             edge = this.issue.data.edges[0];
40195             crossedEdge = this.issue.data.edges[1];
40196             crossedWayID = this.issue.entityIds[1];
40197           } else {
40198             edge = this.issue.data.edges[1];
40199             crossedEdge = this.issue.data.edges[0];
40200             crossedWayID = this.issue.entityIds[0];
40201           }
40202           var crossingLoc = this.issue.loc;
40203           var projection2 = context2.projection;
40204           var action = function actionAddStructure(graph) {
40205             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40206             var crossedWay = graph.hasEntity(crossedWayID);
40207             var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
40208             if (!structLengthMeters) {
40209               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
40210             }
40211             if (structLengthMeters) {
40212               if (getFeatureType(crossedWay, graph) === "railway") {
40213                 structLengthMeters *= 2;
40214               }
40215             } else {
40216               structLengthMeters = 8;
40217             }
40218             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
40219             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
40220             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
40221             if (crossingAngle > Math.PI)
40222               crossingAngle -= Math.PI;
40223             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
40224             structLengthMeters += 4;
40225             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
40226             function geomToProj(geoPoint) {
40227               return [
40228                 geoLonToMeters(geoPoint[0], geoPoint[1]),
40229                 geoLatToMeters(geoPoint[1])
40230               ];
40231             }
40232             function projToGeom(projPoint) {
40233               var lat = geoMetersToLat(projPoint[1]);
40234               return [
40235                 geoMetersToLon(projPoint[0], lat),
40236                 lat
40237               ];
40238             }
40239             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
40240             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
40241             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
40242             var projectedCrossingLoc = geomToProj(crossingLoc);
40243             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
40244             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
40245               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
40246               return projToGeom([
40247                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
40248                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
40249               ]);
40250             }
40251             var endpointLocGetter1 = function(lengthMeters) {
40252               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
40253             };
40254             var endpointLocGetter2 = function(lengthMeters) {
40255               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
40256             };
40257             var minEdgeLengthMeters = 0.55;
40258             function determineEndpoint(edge2, endNode, locGetter) {
40259               var newNode;
40260               var idealLengthMeters = structLengthMeters / 2;
40261               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
40262               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
40263                 var idealNodeLoc = locGetter(idealLengthMeters);
40264                 newNode = osmNode();
40265                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
40266               } else {
40267                 var edgeCount = 0;
40268                 endNode.parentIntersectionWays(graph).forEach(function(way) {
40269                   way.nodes.forEach(function(nodeID) {
40270                     if (nodeID === endNode.id) {
40271                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
40272                         edgeCount += 1;
40273                       } else {
40274                         edgeCount += 2;
40275                       }
40276                     }
40277                   });
40278                 });
40279                 if (edgeCount >= 3) {
40280                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
40281                   if (insetLength > minEdgeLengthMeters) {
40282                     var insetNodeLoc = locGetter(insetLength);
40283                     newNode = osmNode();
40284                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
40285                   }
40286                 }
40287               }
40288               if (!newNode)
40289                 newNode = endNode;
40290               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
40291               graph = splitAction(graph);
40292               if (splitAction.getCreatedWayIDs().length) {
40293                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
40294               }
40295               return newNode;
40296             }
40297             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
40298             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
40299             var structureWay = resultWayIDs.map(function(id2) {
40300               return graph.entity(id2);
40301             }).find(function(way) {
40302               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
40303             });
40304             var tags = Object.assign({}, structureWay.tags);
40305             if (bridgeOrTunnel === "bridge") {
40306               tags.bridge = "yes";
40307               tags.layer = "1";
40308             } else {
40309               var tunnelValue = "yes";
40310               if (getFeatureType(structureWay, graph) === "waterway") {
40311                 tunnelValue = "culvert";
40312               }
40313               tags.tunnel = tunnelValue;
40314               tags.layer = "-1";
40315             }
40316             graph = actionChangeTags(structureWay.id, tags)(graph);
40317             return graph;
40318           };
40319           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
40320           context2.enter(modeSelect(context2, resultWayIDs));
40321         }
40322       });
40323     }
40324     function makeConnectWaysFix(connectionTags) {
40325       var fixTitleID = "connect_features";
40326       if (connectionTags.ford) {
40327         fixTitleID = "connect_using_ford";
40328       }
40329       return new validationIssueFix({
40330         icon: "iD-icon-crossing",
40331         title: _t.html("issues.fix." + fixTitleID + ".title"),
40332         onClick: function(context2) {
40333           var loc = this.issue.loc;
40334           var connectionTags2 = this.issue.data.connectionTags;
40335           var edges = this.issue.data.edges;
40336           context2.perform(function actionConnectCrossingWays(graph) {
40337             var node = osmNode({ loc, tags: connectionTags2 });
40338             graph = graph.replace(node);
40339             var nodesToMerge = [node.id];
40340             var mergeThresholdInMeters = 0.75;
40341             edges.forEach(function(edge) {
40342               var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40343               var nearby = geoSphericalClosestNode(edgeNodes, loc);
40344               if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
40345                 nodesToMerge.push(nearby.node.id);
40346               } else {
40347                 graph = actionAddMidpoint({ loc, edge }, node)(graph);
40348               }
40349             });
40350             if (nodesToMerge.length > 1) {
40351               graph = actionMergeNodes(nodesToMerge, loc)(graph);
40352             }
40353             return graph;
40354           }, _t("issues.fix.connect_crossing_features.annotation"));
40355         }
40356       });
40357     }
40358     function makeChangeLayerFix(higherOrLower) {
40359       return new validationIssueFix({
40360         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
40361         title: _t.html("issues.fix.tag_this_as_" + higherOrLower + ".title"),
40362         onClick: function(context2) {
40363           var mode = context2.mode();
40364           if (!mode || mode.id !== "select")
40365             return;
40366           var selectedIDs = mode.selectedIDs();
40367           if (selectedIDs.length !== 1)
40368             return;
40369           var selectedID = selectedIDs[0];
40370           if (!this.issue.entityIds.some(function(entityId) {
40371             return entityId === selectedID;
40372           }))
40373             return;
40374           var entity = context2.hasEntity(selectedID);
40375           if (!entity)
40376             return;
40377           var tags = Object.assign({}, entity.tags);
40378           var layer = tags.layer && Number(tags.layer);
40379           if (layer && !isNaN(layer)) {
40380             if (higherOrLower === "higher") {
40381               layer += 1;
40382             } else {
40383               layer -= 1;
40384             }
40385           } else {
40386             if (higherOrLower === "higher") {
40387               layer = 1;
40388             } else {
40389               layer = -1;
40390             }
40391           }
40392           tags.layer = layer.toString();
40393           context2.perform(actionChangeTags(entity.id, tags), _t("operations.change_tags.annotation"));
40394         }
40395       });
40396     }
40397     validation.type = type3;
40398     return validation;
40399   }
40400
40401   // modules/behavior/draw_way.js
40402   function behaviorDrawWay(context, wayID, mode, startGraph) {
40403     const keybinding = utilKeybinding("drawWay");
40404     var dispatch10 = dispatch_default("rejectedSelfIntersection");
40405     var behavior = behaviorDraw(context);
40406     var _nodeIndex;
40407     var _origWay;
40408     var _wayGeometry;
40409     var _headNodeID;
40410     var _annotation;
40411     var _pointerHasMoved = false;
40412     var _drawNode;
40413     var _didResolveTempEdit = false;
40414     function createDrawNode(loc) {
40415       _drawNode = osmNode({ loc });
40416       context.pauseChangeDispatch();
40417       context.replace(function actionAddDrawNode(graph) {
40418         var way = graph.entity(wayID);
40419         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
40420       }, _annotation);
40421       context.resumeChangeDispatch();
40422       setActiveElements();
40423     }
40424     function removeDrawNode() {
40425       context.pauseChangeDispatch();
40426       context.replace(function actionDeleteDrawNode(graph) {
40427         var way = graph.entity(wayID);
40428         return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
40429       }, _annotation);
40430       _drawNode = void 0;
40431       context.resumeChangeDispatch();
40432     }
40433     function keydown(d3_event) {
40434       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40435         if (context.surface().classed("nope")) {
40436           context.surface().classed("nope-suppressed", true);
40437         }
40438         context.surface().classed("nope", false).classed("nope-disabled", true);
40439       }
40440     }
40441     function keyup(d3_event) {
40442       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40443         if (context.surface().classed("nope-suppressed")) {
40444           context.surface().classed("nope", true);
40445         }
40446         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
40447       }
40448     }
40449     function allowsVertex(d) {
40450       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
40451     }
40452     function move(d3_event, datum2) {
40453       var loc = context.map().mouseCoordinates();
40454       if (!_drawNode)
40455         createDrawNode(loc);
40456       context.surface().classed("nope-disabled", d3_event.altKey);
40457       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
40458       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
40459       if (targetLoc) {
40460         loc = targetLoc;
40461       } else if (targetNodes) {
40462         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
40463         if (choice) {
40464           loc = choice.loc;
40465         }
40466       }
40467       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40468       _drawNode = context.entity(_drawNode.id);
40469       checkGeometry(true);
40470     }
40471     function checkGeometry(includeDrawNode) {
40472       var nopeDisabled = context.surface().classed("nope-disabled");
40473       var isInvalid = isInvalidGeometry(includeDrawNode);
40474       if (nopeDisabled) {
40475         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
40476       } else {
40477         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
40478       }
40479     }
40480     function isInvalidGeometry(includeDrawNode) {
40481       var testNode = _drawNode;
40482       var parentWay = context.graph().entity(wayID);
40483       var nodes = context.graph().childNodes(parentWay).slice();
40484       if (includeDrawNode) {
40485         if (parentWay.isClosed()) {
40486           nodes.pop();
40487         }
40488       } else {
40489         if (parentWay.isClosed()) {
40490           if (nodes.length < 3)
40491             return false;
40492           if (_drawNode)
40493             nodes.splice(-2, 1);
40494           testNode = nodes[nodes.length - 2];
40495         } else {
40496           return false;
40497         }
40498       }
40499       return testNode && geoHasSelfIntersections(nodes, testNode.id);
40500     }
40501     function undone() {
40502       _didResolveTempEdit = true;
40503       context.pauseChangeDispatch();
40504       var nextMode;
40505       if (context.graph() === startGraph) {
40506         nextMode = modeSelect(context, [wayID]);
40507       } else {
40508         context.pop(1);
40509         nextMode = mode;
40510       }
40511       context.perform(actionNoop());
40512       context.pop(1);
40513       context.resumeChangeDispatch();
40514       context.enter(nextMode);
40515     }
40516     function setActiveElements() {
40517       if (!_drawNode)
40518         return;
40519       context.surface().selectAll("." + _drawNode.id).classed("active", true);
40520     }
40521     function resetToStartGraph() {
40522       while (context.graph() !== startGraph) {
40523         context.pop();
40524       }
40525     }
40526     var drawWay = function(surface) {
40527       _drawNode = void 0;
40528       _didResolveTempEdit = false;
40529       _origWay = context.entity(wayID);
40530       if (typeof _nodeIndex === "number") {
40531         _headNodeID = _origWay.nodes[_nodeIndex];
40532       } else if (_origWay.isClosed()) {
40533         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
40534       } else {
40535         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
40536       }
40537       _wayGeometry = _origWay.geometry(context.graph());
40538       _annotation = _t((_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry);
40539       _pointerHasMoved = false;
40540       context.pauseChangeDispatch();
40541       context.perform(actionNoop(), _annotation);
40542       context.resumeChangeDispatch();
40543       behavior.hover().initialNodeID(_headNodeID);
40544       behavior.on("move", function() {
40545         _pointerHasMoved = true;
40546         move.apply(this, arguments);
40547       }).on("down", function() {
40548         move.apply(this, arguments);
40549       }).on("downcancel", function() {
40550         if (_drawNode)
40551           removeDrawNode();
40552       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
40553       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
40554       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
40555       setActiveElements();
40556       surface.call(behavior);
40557       context.history().on("undone.draw", undone);
40558     };
40559     drawWay.off = function(surface) {
40560       if (!_didResolveTempEdit) {
40561         context.pauseChangeDispatch();
40562         resetToStartGraph();
40563         context.resumeChangeDispatch();
40564       }
40565       _drawNode = void 0;
40566       _nodeIndex = void 0;
40567       context.map().on("drawn.draw", null);
40568       surface.call(behavior.off).selectAll(".active").classed("active", false);
40569       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
40570       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
40571       context.history().on("undone.draw", null);
40572     };
40573     function attemptAdd(d, loc, doAdd) {
40574       if (_drawNode) {
40575         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40576         _drawNode = context.entity(_drawNode.id);
40577       } else {
40578         createDrawNode(loc);
40579       }
40580       checkGeometry(true);
40581       if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
40582         if (!_pointerHasMoved) {
40583           removeDrawNode();
40584         }
40585         dispatch10.call("rejectedSelfIntersection", this);
40586         return;
40587       }
40588       context.pauseChangeDispatch();
40589       doAdd();
40590       _didResolveTempEdit = true;
40591       context.resumeChangeDispatch();
40592       context.enter(mode);
40593     }
40594     drawWay.add = function(loc, d) {
40595       attemptAdd(d, loc, function() {
40596       });
40597     };
40598     drawWay.addWay = function(loc, edge, d) {
40599       attemptAdd(d, loc, function() {
40600         context.replace(actionAddMidpoint({ loc, edge }, _drawNode), _annotation);
40601       });
40602     };
40603     drawWay.addNode = function(node, d) {
40604       if (node.id === _headNodeID || _origWay.isClosed() && node.id === _origWay.first()) {
40605         drawWay.finish();
40606         return;
40607       }
40608       attemptAdd(d, node.loc, function() {
40609         context.replace(function actionReplaceDrawNode(graph) {
40610           graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
40611           return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
40612         }, _annotation);
40613       });
40614     };
40615     function getFeatureType(ways) {
40616       if (ways.every((way) => way.isClosed()))
40617         return "area";
40618       if (ways.every((way) => !way.isClosed()))
40619         return "line";
40620       return "generic";
40621     }
40622     function followMode() {
40623       if (_didResolveTempEdit)
40624         return;
40625       try {
40626         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
40627         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
40628         const historyGraph = context.history().graph();
40629         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
40630           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.needs_more_initial_nodes"))();
40631           return;
40632         }
40633         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
40634         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
40635         const featureType = getFeatureType(lastNodesParents);
40636         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
40637           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
40638           return;
40639         }
40640         if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
40641           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
40642           return;
40643         }
40644         const way = lastNodesParents[0];
40645         const indexOfLast = way.nodes.indexOf(lastNodeId);
40646         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
40647         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
40648         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
40649         if (nextNodeIndex === -1)
40650           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
40651         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
40652         drawWay.addNode(nextNode, {
40653           geometry: { type: "Point", coordinates: nextNode.loc },
40654           id: nextNode.id,
40655           properties: { target: true, entity: nextNode }
40656         });
40657       } catch (ex) {
40658         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.unknown"))();
40659       }
40660     }
40661     keybinding.on(_t("operations.follow.key"), followMode);
40662     select_default2(document).call(keybinding);
40663     drawWay.finish = function() {
40664       checkGeometry(false);
40665       if (context.surface().classed("nope")) {
40666         dispatch10.call("rejectedSelfIntersection", this);
40667         return;
40668       }
40669       context.pauseChangeDispatch();
40670       context.pop(1);
40671       _didResolveTempEdit = true;
40672       context.resumeChangeDispatch();
40673       var way = context.hasEntity(wayID);
40674       if (!way || way.isDegenerate()) {
40675         drawWay.cancel();
40676         return;
40677       }
40678       window.setTimeout(function() {
40679         context.map().dblclickZoomEnable(true);
40680       }, 1e3);
40681       var isNewFeature = !mode.isContinuing;
40682       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
40683     };
40684     drawWay.cancel = function() {
40685       context.pauseChangeDispatch();
40686       resetToStartGraph();
40687       context.resumeChangeDispatch();
40688       window.setTimeout(function() {
40689         context.map().dblclickZoomEnable(true);
40690       }, 1e3);
40691       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
40692       context.enter(modeBrowse(context));
40693     };
40694     drawWay.nodeIndex = function(val) {
40695       if (!arguments.length)
40696         return _nodeIndex;
40697       _nodeIndex = val;
40698       return drawWay;
40699     };
40700     drawWay.activeID = function() {
40701       if (!arguments.length)
40702         return _drawNode && _drawNode.id;
40703       return drawWay;
40704     };
40705     return utilRebind(drawWay, dispatch10, "on");
40706   }
40707
40708   // modules/modes/draw_line.js
40709   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
40710     var mode = {
40711       button,
40712       id: "draw-line"
40713     };
40714     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
40715       context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.lines"))();
40716     });
40717     mode.wayID = wayID;
40718     mode.isContinuing = continuing;
40719     mode.enter = function() {
40720       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
40721       context.install(behavior);
40722     };
40723     mode.exit = function() {
40724       context.uninstall(behavior);
40725     };
40726     mode.selectedIDs = function() {
40727       return [wayID];
40728     };
40729     mode.activeID = function() {
40730       return behavior && behavior.activeID() || [];
40731     };
40732     return mode;
40733   }
40734
40735   // modules/validations/disconnected_way.js
40736   function validationDisconnectedWay() {
40737     var type3 = "disconnected_way";
40738     function isTaggedAsHighway(entity) {
40739       return osmRoutableHighwayTagValues[entity.tags.highway];
40740     }
40741     var validation = function checkDisconnectedWay(entity, graph) {
40742       var routingIslandWays = routingIslandForEntity(entity);
40743       if (!routingIslandWays)
40744         return [];
40745       return [new validationIssue({
40746         type: type3,
40747         subtype: "highway",
40748         severity: "warning",
40749         message: function(context) {
40750           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
40751           var label = entity2 && utilDisplayLabel(entity2, context.graph());
40752           return _t.html("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
40753         },
40754         reference: showReference,
40755         entityIds: Array.from(routingIslandWays).map(function(way) {
40756           return way.id;
40757         }),
40758         dynamicFixes: makeFixes
40759       })];
40760       function makeFixes(context) {
40761         var fixes = [];
40762         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
40763         if (singleEntity) {
40764           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
40765             var textDirection = _mainLocalizer.textDirection();
40766             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
40767             if (startFix)
40768               fixes.push(startFix);
40769             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
40770             if (endFix)
40771               fixes.push(endFix);
40772           }
40773           if (!fixes.length) {
40774             fixes.push(new validationIssueFix({
40775               title: _t.html("issues.fix.connect_feature.title")
40776             }));
40777           }
40778           fixes.push(new validationIssueFix({
40779             icon: "iD-operation-delete",
40780             title: _t.html("issues.fix.delete_feature.title"),
40781             entityIds: [singleEntity.id],
40782             onClick: function(context2) {
40783               var id2 = this.issue.entityIds[0];
40784               var operation = operationDelete(context2, [id2]);
40785               if (!operation.disabled()) {
40786                 operation();
40787               }
40788             }
40789           }));
40790         } else {
40791           fixes.push(new validationIssueFix({
40792             title: _t.html("issues.fix.connect_features.title")
40793           }));
40794         }
40795         return fixes;
40796       }
40797       function showReference(selection2) {
40798         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
40799       }
40800       function routingIslandForEntity(entity2) {
40801         var routingIsland = /* @__PURE__ */ new Set();
40802         var waysToCheck = [];
40803         function queueParentWays(node) {
40804           graph.parentWays(node).forEach(function(parentWay) {
40805             if (!routingIsland.has(parentWay) && isRoutableWay(parentWay, false)) {
40806               routingIsland.add(parentWay);
40807               waysToCheck.push(parentWay);
40808             }
40809           });
40810         }
40811         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
40812           routingIsland.add(entity2);
40813           waysToCheck.push(entity2);
40814         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
40815           routingIsland.add(entity2);
40816           queueParentWays(entity2);
40817         } else {
40818           return null;
40819         }
40820         while (waysToCheck.length) {
40821           var wayToCheck = waysToCheck.pop();
40822           var childNodes = graph.childNodes(wayToCheck);
40823           for (var i2 in childNodes) {
40824             var vertex = childNodes[i2];
40825             if (isConnectedVertex(vertex)) {
40826               return null;
40827             }
40828             if (isRoutableNode(vertex)) {
40829               routingIsland.add(vertex);
40830             }
40831             queueParentWays(vertex);
40832           }
40833         }
40834         return routingIsland;
40835       }
40836       function isConnectedVertex(vertex) {
40837         var osm = services.osm;
40838         if (osm && !osm.isDataLoaded(vertex.loc))
40839           return true;
40840         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
40841           return true;
40842         if (vertex.tags.amenity === "parking_entrance")
40843           return true;
40844         return false;
40845       }
40846       function isRoutableNode(node) {
40847         if (node.tags.highway === "elevator")
40848           return true;
40849         return false;
40850       }
40851       function isRoutableWay(way, ignoreInnerWays) {
40852         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
40853           return true;
40854         return graph.parentRelations(way).some(function(parentRelation) {
40855           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
40856             return true;
40857           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
40858             return true;
40859           return false;
40860         });
40861       }
40862       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
40863         var vertex = graph.hasEntity(vertexID);
40864         if (!vertex || vertex.tags.noexit === "yes")
40865           return null;
40866         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
40867         return new validationIssueFix({
40868           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
40869           title: _t.html("issues.fix.continue_from_" + whichEnd + ".title"),
40870           entityIds: [vertexID],
40871           onClick: function(context) {
40872             var wayId = this.issue.entityIds[0];
40873             var way = context.hasEntity(wayId);
40874             var vertexId = this.entityIds[0];
40875             var vertex2 = context.hasEntity(vertexId);
40876             if (!way || !vertex2)
40877               return;
40878             var map2 = context.map();
40879             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
40880               map2.zoomToEase(vertex2);
40881             }
40882             context.enter(modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true));
40883           }
40884         });
40885       }
40886     };
40887     validation.type = type3;
40888     return validation;
40889   }
40890
40891   // modules/validations/invalid_format.js
40892   function validationFormatting() {
40893     var type3 = "invalid_format";
40894     var validation = function(entity) {
40895       var issues = [];
40896       function isValidEmail(email) {
40897         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
40898         return !email || valid_email.test(email);
40899       }
40900       function showReferenceEmail(selection2) {
40901         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
40902       }
40903       if (entity.tags.email) {
40904         var emails = entity.tags.email.split(";").map(function(s) {
40905           return s.trim();
40906         }).filter(function(x) {
40907           return !isValidEmail(x);
40908         });
40909         if (emails.length) {
40910           issues.push(new validationIssue({
40911             type: type3,
40912             subtype: "email",
40913             severity: "warning",
40914             message: function(context) {
40915               var entity2 = context.hasEntity(this.entityIds[0]);
40916               return entity2 ? _t.html("issues.invalid_format.email.message" + this.data, { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }) : "";
40917             },
40918             reference: showReferenceEmail,
40919             entityIds: [entity.id],
40920             hash: emails.join(),
40921             data: emails.length > 1 ? "_multi" : ""
40922           }));
40923         }
40924       }
40925       return issues;
40926     };
40927     validation.type = type3;
40928     return validation;
40929   }
40930
40931   // modules/validations/help_request.js
40932   function validationHelpRequest(context) {
40933     var type3 = "help_request";
40934     var validation = function checkFixmeTag(entity) {
40935       if (!entity.tags.fixme)
40936         return [];
40937       if (entity.version === void 0)
40938         return [];
40939       if (entity.v !== void 0) {
40940         var baseEntity = context.history().base().hasEntity(entity.id);
40941         if (!baseEntity || !baseEntity.tags.fixme)
40942           return [];
40943       }
40944       return [new validationIssue({
40945         type: type3,
40946         subtype: "fixme_tag",
40947         severity: "warning",
40948         message: function(context2) {
40949           var entity2 = context2.hasEntity(this.entityIds[0]);
40950           return entity2 ? _t.html("issues.fixme_tag.message", {
40951             feature: utilDisplayLabel(entity2, context2.graph(), true)
40952           }) : "";
40953         },
40954         dynamicFixes: function() {
40955           return [
40956             new validationIssueFix({
40957               title: _t.html("issues.fix.address_the_concern.title")
40958             })
40959           ];
40960         },
40961         reference: showReference,
40962         entityIds: [entity.id]
40963       })];
40964       function showReference(selection2) {
40965         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
40966       }
40967     };
40968     validation.type = type3;
40969     return validation;
40970   }
40971
40972   // modules/validations/impossible_oneway.js
40973   function validationImpossibleOneway() {
40974     var type3 = "impossible_oneway";
40975     var validation = function checkImpossibleOneway(entity, graph) {
40976       if (entity.type !== "way" || entity.geometry(graph) !== "line")
40977         return [];
40978       if (entity.isClosed())
40979         return [];
40980       if (!typeForWay(entity))
40981         return [];
40982       if (!isOneway(entity))
40983         return [];
40984       var firstIssues = issuesForNode(entity, entity.first());
40985       var lastIssues = issuesForNode(entity, entity.last());
40986       return firstIssues.concat(lastIssues);
40987       function typeForWay(way) {
40988         if (way.geometry(graph) !== "line")
40989           return null;
40990         if (osmRoutableHighwayTagValues[way.tags.highway])
40991           return "highway";
40992         if (osmFlowingWaterwayTagValues[way.tags.waterway])
40993           return "waterway";
40994         return null;
40995       }
40996       function isOneway(way) {
40997         if (way.tags.oneway === "yes")
40998           return true;
40999         if (way.tags.oneway)
41000           return false;
41001         for (var key in way.tags) {
41002           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
41003             return true;
41004           }
41005         }
41006         return false;
41007       }
41008       function nodeOccursMoreThanOnce(way, nodeID) {
41009         var occurrences = 0;
41010         for (var index in way.nodes) {
41011           if (way.nodes[index] === nodeID) {
41012             occurrences += 1;
41013             if (occurrences > 1)
41014               return true;
41015           }
41016         }
41017         return false;
41018       }
41019       function isConnectedViaOtherTypes(way, node) {
41020         var wayType = typeForWay(way);
41021         if (wayType === "highway") {
41022           if (node.tags.entrance && node.tags.entrance !== "no")
41023             return true;
41024           if (node.tags.amenity === "parking_entrance")
41025             return true;
41026         } else if (wayType === "waterway") {
41027           if (node.id === way.first()) {
41028             if (node.tags.natural === "spring")
41029               return true;
41030           } else {
41031             if (node.tags.manhole === "drain")
41032               return true;
41033           }
41034         }
41035         return graph.parentWays(node).some(function(parentWay) {
41036           if (parentWay.id === way.id)
41037             return false;
41038           if (wayType === "highway") {
41039             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
41040               return true;
41041             if (parentWay.tags.route === "ferry")
41042               return true;
41043             return graph.parentRelations(parentWay).some(function(parentRelation) {
41044               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41045                 return true;
41046               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
41047             });
41048           } else if (wayType === "waterway") {
41049             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
41050               return true;
41051           }
41052           return false;
41053         });
41054       }
41055       function issuesForNode(way, nodeID) {
41056         var isFirst = nodeID === way.first();
41057         var wayType = typeForWay(way);
41058         if (nodeOccursMoreThanOnce(way, nodeID))
41059           return [];
41060         var osm = services.osm;
41061         if (!osm)
41062           return [];
41063         var node = graph.hasEntity(nodeID);
41064         if (!node || !osm.isDataLoaded(node.loc))
41065           return [];
41066         if (isConnectedViaOtherTypes(way, node))
41067           return [];
41068         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
41069           if (parentWay.id === way.id)
41070             return false;
41071           return typeForWay(parentWay) === wayType;
41072         });
41073         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
41074           return [];
41075         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
41076           return isOneway(attachedWay);
41077         });
41078         if (attachedOneways.length < attachedWaysOfSameType.length)
41079           return [];
41080         if (attachedOneways.length) {
41081           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
41082             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
41083               return true;
41084             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
41085               return true;
41086             return false;
41087           });
41088           if (connectedEndpointsOkay)
41089             return [];
41090         }
41091         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
41092         if (wayType === "waterway") {
41093           messageID += "connected." + placement;
41094           referenceID += "connected";
41095         } else {
41096           messageID += placement;
41097           referenceID += placement;
41098         }
41099         return [new validationIssue({
41100           type: type3,
41101           subtype: wayType,
41102           severity: "warning",
41103           message: function(context) {
41104             var entity2 = context.hasEntity(this.entityIds[0]);
41105             return entity2 ? _t.html("issues.impossible_oneway." + messageID + ".message", {
41106               feature: utilDisplayLabel(entity2, context.graph())
41107             }) : "";
41108           },
41109           reference: getReference(referenceID),
41110           entityIds: [way.id, node.id],
41111           dynamicFixes: function() {
41112             var fixes = [];
41113             if (attachedOneways.length) {
41114               fixes.push(new validationIssueFix({
41115                 icon: "iD-operation-reverse",
41116                 title: _t.html("issues.fix.reverse_feature.title"),
41117                 entityIds: [way.id],
41118                 onClick: function(context) {
41119                   var id2 = this.issue.entityIds[0];
41120                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
41121                 }
41122               }));
41123             }
41124             if (node.tags.noexit !== "yes") {
41125               var textDirection = _mainLocalizer.textDirection();
41126               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
41127               fixes.push(new validationIssueFix({
41128                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41129                 title: _t.html("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
41130                 onClick: function(context) {
41131                   var entityID = this.issue.entityIds[0];
41132                   var vertexID = this.issue.entityIds[1];
41133                   var way2 = context.entity(entityID);
41134                   var vertex = context.entity(vertexID);
41135                   continueDrawing(way2, vertex, context);
41136                 }
41137               }));
41138             }
41139             return fixes;
41140           },
41141           loc: node.loc
41142         })];
41143         function getReference(referenceID2) {
41144           return function showReference(selection2) {
41145             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
41146           };
41147         }
41148       }
41149     };
41150     function continueDrawing(way, vertex, context) {
41151       var map2 = context.map();
41152       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
41153         map2.zoomToEase(vertex);
41154       }
41155       context.enter(modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true));
41156     }
41157     validation.type = type3;
41158     return validation;
41159   }
41160
41161   // modules/validations/incompatible_source.js
41162   function validationIncompatibleSource() {
41163     const type3 = "incompatible_source";
41164     const incompatibleRules = [
41165       {
41166         id: "amap",
41167         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
41168       },
41169       {
41170         id: "baidu",
41171         regex: /(baidu|mapbar|百度)/i
41172       },
41173       {
41174         id: "google",
41175         regex: /google/i,
41176         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
41177       }
41178     ];
41179     const validation = function checkIncompatibleSource(entity) {
41180       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
41181       if (!entitySources)
41182         return [];
41183       const entityID = entity.id;
41184       return entitySources.map((source) => {
41185         const matchRule = incompatibleRules.find((rule) => {
41186           if (!rule.regex.test(source))
41187             return false;
41188           if (rule.exceptRegex && rule.exceptRegex.test(source))
41189             return false;
41190           return true;
41191         });
41192         if (!matchRule)
41193           return null;
41194         return new validationIssue({
41195           type: type3,
41196           severity: "warning",
41197           message: (context) => {
41198             const entity2 = context.hasEntity(entityID);
41199             return entity2 ? _t.html("issues.incompatible_source.feature.message", {
41200               feature: utilDisplayLabel(entity2, context.graph(), true),
41201               value: source
41202             }) : "";
41203           },
41204           reference: getReference(matchRule.id),
41205           entityIds: [entityID],
41206           hash: source,
41207           dynamicFixes: () => {
41208             return [
41209               new validationIssueFix({ title: _t.html("issues.fix.remove_proprietary_data.title") })
41210             ];
41211           }
41212         });
41213       }).filter(Boolean);
41214       function getReference(id2) {
41215         return function showReference(selection2) {
41216           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
41217         };
41218       }
41219     };
41220     validation.type = type3;
41221     return validation;
41222   }
41223
41224   // modules/validations/maprules.js
41225   function validationMaprules() {
41226     var type3 = "maprules";
41227     var validation = function checkMaprules(entity, graph) {
41228       if (!services.maprules)
41229         return [];
41230       var rules = services.maprules.validationRules();
41231       var issues = [];
41232       for (var i2 = 0; i2 < rules.length; i2++) {
41233         var rule = rules[i2];
41234         rule.findIssues(entity, graph, issues);
41235       }
41236       return issues;
41237     };
41238     validation.type = type3;
41239     return validation;
41240   }
41241
41242   // modules/validations/mismatched_geometry.js
41243   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
41244   function validationMismatchedGeometry() {
41245     var type3 = "mismatched_geometry";
41246     function tagSuggestingLineIsArea(entity) {
41247       if (entity.type !== "way" || entity.isClosed())
41248         return null;
41249       var tagSuggestingArea = entity.tagSuggestingArea();
41250       if (!tagSuggestingArea) {
41251         return null;
41252       }
41253       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
41254       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
41255       if (asLine && asArea && asLine === asArea) {
41256         return null;
41257       }
41258       return tagSuggestingArea;
41259     }
41260     function makeConnectEndpointsFixOnClick(way, graph) {
41261       if (way.nodes.length < 3)
41262         return null;
41263       var nodes = graph.childNodes(way), testNodes;
41264       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
41265       if (firstToLastDistanceMeters < 0.75) {
41266         testNodes = nodes.slice();
41267         testNodes.pop();
41268         testNodes.push(testNodes[0]);
41269         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41270           return function(context) {
41271             var way2 = context.entity(this.issue.entityIds[0]);
41272             context.perform(actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc), _t("issues.fix.connect_endpoints.annotation"));
41273           };
41274         }
41275       }
41276       testNodes = nodes.slice();
41277       testNodes.push(testNodes[0]);
41278       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41279         return function(context) {
41280           var wayId = this.issue.entityIds[0];
41281           var way2 = context.entity(wayId);
41282           var nodeId = way2.nodes[0];
41283           var index = way2.nodes.length;
41284           context.perform(actionAddVertex(wayId, nodeId, index), _t("issues.fix.connect_endpoints.annotation"));
41285         };
41286       }
41287     }
41288     function lineTaggedAsAreaIssue(entity) {
41289       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
41290       if (!tagSuggestingArea)
41291         return null;
41292       return new validationIssue({
41293         type: type3,
41294         subtype: "area_as_line",
41295         severity: "warning",
41296         message: function(context) {
41297           var entity2 = context.hasEntity(this.entityIds[0]);
41298           return entity2 ? _t.html("issues.tag_suggests_area.message", {
41299             feature: utilDisplayLabel(entity2, "area", true),
41300             tag: utilTagText({ tags: tagSuggestingArea })
41301           }) : "";
41302         },
41303         reference: showReference,
41304         entityIds: [entity.id],
41305         hash: JSON.stringify(tagSuggestingArea),
41306         dynamicFixes: function(context) {
41307           var fixes = [];
41308           var entity2 = context.entity(this.entityIds[0]);
41309           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
41310           fixes.push(new validationIssueFix({
41311             title: _t.html("issues.fix.connect_endpoints.title"),
41312             onClick: connectEndsOnClick
41313           }));
41314           fixes.push(new validationIssueFix({
41315             icon: "iD-operation-delete",
41316             title: _t.html("issues.fix.remove_tag.title"),
41317             onClick: function(context2) {
41318               var entityId = this.issue.entityIds[0];
41319               var entity3 = context2.entity(entityId);
41320               var tags = Object.assign({}, entity3.tags);
41321               for (var key in tagSuggestingArea) {
41322                 delete tags[key];
41323               }
41324               context2.perform(actionChangeTags(entityId, tags), _t("issues.fix.remove_tag.annotation"));
41325             }
41326           }));
41327           return fixes;
41328         }
41329       });
41330       function showReference(selection2) {
41331         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
41332       }
41333     }
41334     function vertexPointIssue(entity, graph) {
41335       if (entity.type !== "node")
41336         return null;
41337       if (Object.keys(entity.tags).length === 0)
41338         return null;
41339       if (entity.isOnAddressLine(graph))
41340         return null;
41341       var geometry = entity.geometry(graph);
41342       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
41343       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
41344         return new validationIssue({
41345           type: type3,
41346           subtype: "vertex_as_point",
41347           severity: "warning",
41348           message: function(context) {
41349             var entity2 = context.hasEntity(this.entityIds[0]);
41350             return entity2 ? _t.html("issues.vertex_as_point.message", {
41351               feature: utilDisplayLabel(entity2, "vertex", true)
41352             }) : "";
41353           },
41354           reference: function showReference(selection2) {
41355             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
41356           },
41357           entityIds: [entity.id]
41358         });
41359       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
41360         return new validationIssue({
41361           type: type3,
41362           subtype: "point_as_vertex",
41363           severity: "warning",
41364           message: function(context) {
41365             var entity2 = context.hasEntity(this.entityIds[0]);
41366             return entity2 ? _t.html("issues.point_as_vertex.message", {
41367               feature: utilDisplayLabel(entity2, "point", true)
41368             }) : "";
41369           },
41370           reference: function showReference(selection2) {
41371             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
41372           },
41373           entityIds: [entity.id],
41374           dynamicFixes: extractPointDynamicFixes
41375         });
41376       }
41377       return null;
41378     }
41379     function otherMismatchIssue(entity, graph) {
41380       if (!entity.hasInterestingTags())
41381         return null;
41382       if (entity.type !== "node" && entity.type !== "way")
41383         return null;
41384       if (entity.type === "node" && entity.isOnAddressLine(graph))
41385         return null;
41386       var sourceGeom = entity.geometry(graph);
41387       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
41388       if (sourceGeom === "area")
41389         targetGeoms.unshift("line");
41390       var asSource = _mainPresetIndex.match(entity, graph);
41391       var targetGeom = targetGeoms.find((nodeGeom) => {
41392         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
41393         if (!asSource || !asTarget || asSource === asTarget || (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
41394           return false;
41395         if (asTarget.isFallback())
41396           return false;
41397         var primaryKey = Object.keys(asTarget.tags)[0];
41398         if (primaryKey === "building")
41399           return false;
41400         if (asTarget.tags[primaryKey] === "*")
41401           return false;
41402         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
41403       });
41404       if (!targetGeom)
41405         return null;
41406       var subtype = targetGeom + "_as_" + sourceGeom;
41407       if (targetGeom === "vertex")
41408         targetGeom = "point";
41409       if (sourceGeom === "vertex")
41410         sourceGeom = "point";
41411       var referenceId = targetGeom + "_as_" + sourceGeom;
41412       var dynamicFixes;
41413       if (targetGeom === "point") {
41414         dynamicFixes = extractPointDynamicFixes;
41415       } else if (sourceGeom === "area" && targetGeom === "line") {
41416         dynamicFixes = lineToAreaDynamicFixes;
41417       }
41418       return new validationIssue({
41419         type: type3,
41420         subtype,
41421         severity: "warning",
41422         message: function(context) {
41423           var entity2 = context.hasEntity(this.entityIds[0]);
41424           return entity2 ? _t.html("issues." + referenceId + ".message", {
41425             feature: utilDisplayLabel(entity2, targetGeom, true)
41426           }) : "";
41427         },
41428         reference: function showReference(selection2) {
41429           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
41430         },
41431         entityIds: [entity.id],
41432         dynamicFixes
41433       });
41434     }
41435     function lineToAreaDynamicFixes(context) {
41436       var convertOnClick;
41437       var entityId = this.entityIds[0];
41438       var entity = context.entity(entityId);
41439       var tags = Object.assign({}, entity.tags);
41440       delete tags.area;
41441       if (!osmTagSuggestingArea(tags)) {
41442         convertOnClick = function(context2) {
41443           var entityId2 = this.issue.entityIds[0];
41444           var entity2 = context2.entity(entityId2);
41445           var tags2 = Object.assign({}, entity2.tags);
41446           if (tags2.area) {
41447             delete tags2.area;
41448           }
41449           context2.perform(actionChangeTags(entityId2, tags2), _t("issues.fix.convert_to_line.annotation"));
41450         };
41451       }
41452       return [
41453         new validationIssueFix({
41454           icon: "iD-icon-line",
41455           title: _t.html("issues.fix.convert_to_line.title"),
41456           onClick: convertOnClick
41457         })
41458       ];
41459     }
41460     function extractPointDynamicFixes(context) {
41461       var entityId = this.entityIds[0];
41462       var extractOnClick = null;
41463       if (!context.hasHiddenConnections(entityId)) {
41464         extractOnClick = function(context2) {
41465           var entityId2 = this.issue.entityIds[0];
41466           var action = actionExtract(entityId2, context2.projection);
41467           context2.perform(action, _t("operations.extract.annotation", { n: 1 }));
41468           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
41469         };
41470       }
41471       return [
41472         new validationIssueFix({
41473           icon: "iD-operation-extract",
41474           title: _t.html("issues.fix.extract_point.title"),
41475           onClick: extractOnClick
41476         })
41477       ];
41478     }
41479     function unclosedMultipolygonPartIssues(entity, graph) {
41480       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || !entity.isComplete(graph))
41481         return [];
41482       var sequences = osmJoinWays(entity.members, graph);
41483       var issues = [];
41484       for (var i2 in sequences) {
41485         var sequence = sequences[i2];
41486         if (!sequence.nodes)
41487           continue;
41488         var firstNode = sequence.nodes[0];
41489         var lastNode = sequence.nodes[sequence.nodes.length - 1];
41490         if (firstNode === lastNode)
41491           continue;
41492         var issue = new validationIssue({
41493           type: type3,
41494           subtype: "unclosed_multipolygon_part",
41495           severity: "warning",
41496           message: function(context) {
41497             var entity2 = context.hasEntity(this.entityIds[0]);
41498             return entity2 ? _t.html("issues.unclosed_multipolygon_part.message", {
41499               feature: utilDisplayLabel(entity2, context.graph(), true)
41500             }) : "";
41501           },
41502           reference: showReference,
41503           loc: sequence.nodes[0].loc,
41504           entityIds: [entity.id],
41505           hash: sequence.map(function(way) {
41506             return way.id;
41507           }).join()
41508         });
41509         issues.push(issue);
41510       }
41511       return issues;
41512       function showReference(selection2) {
41513         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
41514       }
41515     }
41516     var validation = function checkMismatchedGeometry(entity, graph) {
41517       var vertexPoint = vertexPointIssue(entity, graph);
41518       if (vertexPoint)
41519         return [vertexPoint];
41520       var lineAsArea = lineTaggedAsAreaIssue(entity);
41521       if (lineAsArea)
41522         return [lineAsArea];
41523       var mismatch = otherMismatchIssue(entity, graph);
41524       if (mismatch)
41525         return [mismatch];
41526       return unclosedMultipolygonPartIssues(entity, graph);
41527     };
41528     validation.type = type3;
41529     return validation;
41530   }
41531
41532   // modules/validations/missing_role.js
41533   function validationMissingRole() {
41534     var type3 = "missing_role";
41535     var validation = function checkMissingRole(entity, graph) {
41536       var issues = [];
41537       if (entity.type === "way") {
41538         graph.parentRelations(entity).forEach(function(relation) {
41539           if (!relation.isMultipolygon())
41540             return;
41541           var member = relation.memberById(entity.id);
41542           if (member && isMissingRole(member)) {
41543             issues.push(makeIssue(entity, relation, member));
41544           }
41545         });
41546       } else if (entity.type === "relation" && entity.isMultipolygon()) {
41547         entity.indexedMembers().forEach(function(member) {
41548           var way = graph.hasEntity(member.id);
41549           if (way && isMissingRole(member)) {
41550             issues.push(makeIssue(way, entity, member));
41551           }
41552         });
41553       }
41554       return issues;
41555     };
41556     function isMissingRole(member) {
41557       return !member.role || !member.role.trim().length;
41558     }
41559     function makeIssue(way, relation, member) {
41560       return new validationIssue({
41561         type: type3,
41562         severity: "warning",
41563         message: function(context) {
41564           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
41565           return member2 && relation2 ? _t.html("issues.missing_role.message", {
41566             member: utilDisplayLabel(member2, context.graph()),
41567             relation: utilDisplayLabel(relation2, context.graph())
41568           }) : "";
41569         },
41570         reference: showReference,
41571         entityIds: [relation.id, way.id],
41572         data: {
41573           member
41574         },
41575         hash: member.index.toString(),
41576         dynamicFixes: function() {
41577           return [
41578             makeAddRoleFix("inner"),
41579             makeAddRoleFix("outer"),
41580             new validationIssueFix({
41581               icon: "iD-operation-delete",
41582               title: _t.html("issues.fix.remove_from_relation.title"),
41583               onClick: function(context) {
41584                 context.perform(actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index), _t("operations.delete_member.annotation", {
41585                   n: 1
41586                 }));
41587               }
41588             })
41589           ];
41590         }
41591       });
41592       function showReference(selection2) {
41593         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
41594       }
41595     }
41596     function makeAddRoleFix(role) {
41597       return new validationIssueFix({
41598         title: _t.html("issues.fix.set_as_" + role + ".title"),
41599         onClick: function(context) {
41600           var oldMember = this.issue.data.member;
41601           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
41602           context.perform(actionChangeMember(this.issue.entityIds[0], member, oldMember.index), _t("operations.change_role.annotation", {
41603             n: 1
41604           }));
41605         }
41606       });
41607     }
41608     validation.type = type3;
41609     return validation;
41610   }
41611
41612   // modules/validations/missing_tag.js
41613   function validationMissingTag(context) {
41614     var type3 = "missing_tag";
41615     function hasDescriptiveTags(entity, graph) {
41616       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
41617       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
41618         if (k === "area" || !osmIsInterestingTag(k))
41619           return false;
41620         return !onlyAttributeKeys.some(function(attributeKey) {
41621           return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
41622         });
41623       });
41624       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
41625         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
41626       }
41627       return entityDescriptiveKeys.length > 0;
41628     }
41629     function isUnknownRoad(entity) {
41630       return entity.type === "way" && entity.tags.highway === "road";
41631     }
41632     function isUntypedRelation(entity) {
41633       return entity.type === "relation" && !entity.tags.type;
41634     }
41635     var validation = function checkMissingTag(entity, graph) {
41636       var subtype;
41637       var osm = context.connection();
41638       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
41639       if (!isUnloadedNode && entity.geometry(graph) !== "vertex" && !entity.hasParentRelations(graph)) {
41640         if (Object.keys(entity.tags).length === 0) {
41641           subtype = "any";
41642         } else if (!hasDescriptiveTags(entity, graph)) {
41643           subtype = "descriptive";
41644         } else if (isUntypedRelation(entity)) {
41645           subtype = "relation_type";
41646         }
41647       }
41648       if (!subtype && isUnknownRoad(entity)) {
41649         subtype = "highway_classification";
41650       }
41651       if (!subtype)
41652         return [];
41653       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
41654       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
41655       var canDelete = entity.version === void 0 || entity.v !== void 0;
41656       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
41657       return [new validationIssue({
41658         type: type3,
41659         subtype,
41660         severity,
41661         message: function(context2) {
41662           var entity2 = context2.hasEntity(this.entityIds[0]);
41663           return entity2 ? _t.html("issues." + messageID + ".message", {
41664             feature: utilDisplayLabel(entity2, context2.graph())
41665           }) : "";
41666         },
41667         reference: showReference,
41668         entityIds: [entity.id],
41669         dynamicFixes: function(context2) {
41670           var fixes = [];
41671           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
41672           fixes.push(new validationIssueFix({
41673             icon: "iD-icon-search",
41674             title: _t.html("issues.fix." + selectFixType + ".title"),
41675             onClick: function(context3) {
41676               context3.ui().sidebar.showPresetList();
41677             }
41678           }));
41679           var deleteOnClick;
41680           var id2 = this.entityIds[0];
41681           var operation = operationDelete(context2, [id2]);
41682           var disabledReasonID = operation.disabled();
41683           if (!disabledReasonID) {
41684             deleteOnClick = function(context3) {
41685               var id3 = this.issue.entityIds[0];
41686               var operation2 = operationDelete(context3, [id3]);
41687               if (!operation2.disabled()) {
41688                 operation2();
41689               }
41690             };
41691           }
41692           fixes.push(new validationIssueFix({
41693             icon: "iD-operation-delete",
41694             title: _t.html("issues.fix.delete_feature.title"),
41695             disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
41696             onClick: deleteOnClick
41697           }));
41698           return fixes;
41699         }
41700       })];
41701       function showReference(selection2) {
41702         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
41703       }
41704     };
41705     validation.type = type3;
41706     return validation;
41707   }
41708
41709   // modules/validations/outdated_tags.js
41710   function validationOutdatedTags() {
41711     const type3 = "outdated_tags";
41712     let _waitingForDeprecated = true;
41713     let _dataDeprecated;
41714     _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
41715     }).finally(() => _waitingForDeprecated = false);
41716     function oldTagIssues(entity, graph) {
41717       const oldTags = Object.assign({}, entity.tags);
41718       let preset = _mainPresetIndex.match(entity, graph);
41719       let subtype = "deprecated_tags";
41720       if (!preset)
41721         return [];
41722       if (!entity.hasInterestingTags())
41723         return [];
41724       if (preset.replacement) {
41725         const newPreset = _mainPresetIndex.item(preset.replacement);
41726         graph = actionChangePreset(entity.id, preset, newPreset, true)(graph);
41727         entity = graph.entity(entity.id);
41728         preset = newPreset;
41729       }
41730       if (_dataDeprecated) {
41731         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
41732         if (deprecatedTags.length) {
41733           deprecatedTags.forEach((tag) => {
41734             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
41735           });
41736           entity = graph.entity(entity.id);
41737         }
41738       }
41739       let newTags = Object.assign({}, entity.tags);
41740       if (preset.tags !== preset.addTags) {
41741         Object.keys(preset.addTags).forEach((k) => {
41742           if (!newTags[k]) {
41743             if (preset.addTags[k] === "*") {
41744               newTags[k] = "yes";
41745             } else {
41746               newTags[k] = preset.addTags[k];
41747             }
41748           }
41749         });
41750       }
41751       const nsi = services.nsi;
41752       let waitingForNsi = false;
41753       let nsiResult;
41754       if (nsi) {
41755         waitingForNsi = nsi.status() === "loading";
41756         if (!waitingForNsi) {
41757           const loc = entity.extent(graph).center();
41758           nsiResult = nsi.upgradeTags(newTags, loc);
41759           if (nsiResult) {
41760             newTags = nsiResult.newTags;
41761             subtype = "noncanonical_brand";
41762           }
41763         }
41764       }
41765       let issues = [];
41766       issues.provisional = _waitingForDeprecated || waitingForNsi;
41767       const tagDiff = utilTagDiff(oldTags, newTags);
41768       if (!tagDiff.length)
41769         return issues;
41770       const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
41771       let prefix = "";
41772       if (nsiResult) {
41773         prefix = "noncanonical_brand.";
41774       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
41775         subtype = "incomplete_tags";
41776         prefix = "incomplete.";
41777       }
41778       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
41779       issues.push(new validationIssue({
41780         type: type3,
41781         subtype,
41782         severity: "warning",
41783         message: showMessage,
41784         reference: showReference,
41785         entityIds: [entity.id],
41786         hash: utilHashcode(JSON.stringify(tagDiff)),
41787         dynamicFixes: () => {
41788           let fixes = [
41789             new validationIssueFix({
41790               autoArgs,
41791               title: _t.html("issues.fix.upgrade_tags.title"),
41792               onClick: (context) => {
41793                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
41794               }
41795             })
41796           ];
41797           const item = nsiResult && nsiResult.matched;
41798           if (item) {
41799             fixes.push(new validationIssueFix({
41800               title: _t.html("issues.fix.tag_as_not.title", { name: item.displayName }),
41801               onClick: (context) => {
41802                 context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
41803               }
41804             }));
41805           }
41806           return fixes;
41807         }
41808       }));
41809       return issues;
41810       function doUpgrade(graph2) {
41811         const currEntity = graph2.hasEntity(entity.id);
41812         if (!currEntity)
41813           return graph2;
41814         let newTags2 = Object.assign({}, currEntity.tags);
41815         tagDiff.forEach((diff) => {
41816           if (diff.type === "-") {
41817             delete newTags2[diff.key];
41818           } else if (diff.type === "+") {
41819             newTags2[diff.key] = diff.newVal;
41820           }
41821         });
41822         return actionChangeTags(currEntity.id, newTags2)(graph2);
41823       }
41824       function addNotTag(graph2) {
41825         const currEntity = graph2.hasEntity(entity.id);
41826         if (!currEntity)
41827           return graph2;
41828         const item = nsiResult && nsiResult.matched;
41829         if (!item)
41830           return graph2;
41831         let newTags2 = Object.assign({}, currEntity.tags);
41832         const wd = item.mainTag;
41833         const notwd = `not:${wd}`;
41834         const qid = item.tags[wd];
41835         newTags2[notwd] = qid;
41836         if (newTags2[wd] === qid) {
41837           const wp = item.mainTag.replace("wikidata", "wikipedia");
41838           delete newTags2[wd];
41839           delete newTags2[wp];
41840         }
41841         return actionChangeTags(currEntity.id, newTags2)(graph2);
41842       }
41843       function showMessage(context) {
41844         const currEntity = context.hasEntity(entity.id);
41845         if (!currEntity)
41846           return "";
41847         let messageID = `issues.outdated_tags.${prefix}message`;
41848         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
41849           messageID += "_incomplete";
41850         }
41851         return _t.html(messageID, {
41852           feature: utilDisplayLabel(currEntity, context.graph(), true)
41853         });
41854       }
41855       function showReference(selection2) {
41856         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
41857         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
41858         enter.append("strong").call(_t.append("issues.suggested"));
41859         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
41860           let klass = d.type === "+" ? "add" : "remove";
41861           return `tagDiff-cell tagDiff-cell-${klass}`;
41862         }).html((d) => d.display);
41863       }
41864     }
41865     function oldMultipolygonIssues(entity, graph) {
41866       let multipolygon, outerWay;
41867       if (entity.type === "relation") {
41868         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
41869         multipolygon = entity;
41870       } else if (entity.type === "way") {
41871         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
41872         outerWay = entity;
41873       } else {
41874         return [];
41875       }
41876       if (!multipolygon || !outerWay)
41877         return [];
41878       return [new validationIssue({
41879         type: type3,
41880         subtype: "old_multipolygon",
41881         severity: "warning",
41882         message: showMessage,
41883         reference: showReference,
41884         entityIds: [outerWay.id, multipolygon.id],
41885         dynamicFixes: () => {
41886           return [
41887             new validationIssueFix({
41888               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
41889               title: _t.html("issues.fix.move_tags.title"),
41890               onClick: (context) => {
41891                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
41892               }
41893             })
41894           ];
41895         }
41896       })];
41897       function doUpgrade(graph2) {
41898         let currMultipolygon = graph2.hasEntity(multipolygon.id);
41899         let currOuterWay = graph2.hasEntity(outerWay.id);
41900         if (!currMultipolygon || !currOuterWay)
41901           return graph2;
41902         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
41903         graph2 = graph2.replace(currMultipolygon);
41904         return actionChangeTags(currOuterWay.id, {})(graph2);
41905       }
41906       function showMessage(context) {
41907         let currMultipolygon = context.hasEntity(multipolygon.id);
41908         if (!currMultipolygon)
41909           return "";
41910         return _t.html("issues.old_multipolygon.message", { multipolygon: utilDisplayLabel(currMultipolygon, context.graph(), true) });
41911       }
41912       function showReference(selection2) {
41913         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
41914       }
41915     }
41916     let validation = function checkOutdatedTags(entity, graph) {
41917       let issues = oldMultipolygonIssues(entity, graph);
41918       if (!issues.length)
41919         issues = oldTagIssues(entity, graph);
41920       return issues;
41921     };
41922     validation.type = type3;
41923     return validation;
41924   }
41925
41926   // modules/validations/private_data.js
41927   function validationPrivateData() {
41928     var type3 = "private_data";
41929     var privateBuildingValues = {
41930       detached: true,
41931       farm: true,
41932       house: true,
41933       houseboat: true,
41934       residential: true,
41935       semidetached_house: true,
41936       static_caravan: true
41937     };
41938     var publicKeys = {
41939       amenity: true,
41940       craft: true,
41941       historic: true,
41942       leisure: true,
41943       office: true,
41944       shop: true,
41945       tourism: true
41946     };
41947     var personalTags = {
41948       "contact:email": true,
41949       "contact:fax": true,
41950       "contact:phone": true,
41951       email: true,
41952       fax: true,
41953       phone: true
41954     };
41955     var validation = function checkPrivateData(entity) {
41956       var tags = entity.tags;
41957       if (!tags.building || !privateBuildingValues[tags.building])
41958         return [];
41959       var keepTags = {};
41960       for (var k in tags) {
41961         if (publicKeys[k])
41962           return [];
41963         if (!personalTags[k]) {
41964           keepTags[k] = tags[k];
41965         }
41966       }
41967       var tagDiff = utilTagDiff(tags, keepTags);
41968       if (!tagDiff.length)
41969         return [];
41970       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
41971       return [new validationIssue({
41972         type: type3,
41973         severity: "warning",
41974         message: showMessage,
41975         reference: showReference,
41976         entityIds: [entity.id],
41977         dynamicFixes: function() {
41978           return [
41979             new validationIssueFix({
41980               icon: "iD-operation-delete",
41981               title: _t.html("issues.fix." + fixID + ".title"),
41982               onClick: function(context) {
41983                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
41984               }
41985             })
41986           ];
41987         }
41988       })];
41989       function doUpgrade(graph) {
41990         var currEntity = graph.hasEntity(entity.id);
41991         if (!currEntity)
41992           return graph;
41993         var newTags = Object.assign({}, currEntity.tags);
41994         tagDiff.forEach(function(diff) {
41995           if (diff.type === "-") {
41996             delete newTags[diff.key];
41997           } else if (diff.type === "+") {
41998             newTags[diff.key] = diff.newVal;
41999           }
42000         });
42001         return actionChangeTags(currEntity.id, newTags)(graph);
42002       }
42003       function showMessage(context) {
42004         var currEntity = context.hasEntity(this.entityIds[0]);
42005         if (!currEntity)
42006           return "";
42007         return _t.html("issues.private_data.contact.message", { feature: utilDisplayLabel(currEntity, context.graph()) });
42008       }
42009       function showReference(selection2) {
42010         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
42011         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
42012         enter.append("strong").call(_t.append("issues.suggested"));
42013         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) {
42014           var klass = d.type === "+" ? "add" : "remove";
42015           return "tagDiff-cell tagDiff-cell-" + klass;
42016         }).html(function(d) {
42017           return d.display;
42018         });
42019       }
42020     };
42021     validation.type = type3;
42022     return validation;
42023   }
42024
42025   // modules/validations/suspicious_name.js
42026   function validationSuspiciousName() {
42027     const type3 = "suspicious_name";
42028     const keysToTestForGenericValues = [
42029       "aerialway",
42030       "aeroway",
42031       "amenity",
42032       "building",
42033       "craft",
42034       "highway",
42035       "leisure",
42036       "railway",
42037       "man_made",
42038       "office",
42039       "shop",
42040       "tourism",
42041       "waterway"
42042     ];
42043     let _waitingForNsi = false;
42044     function isGenericMatchInNsi(tags) {
42045       const nsi = services.nsi;
42046       if (nsi) {
42047         _waitingForNsi = nsi.status() === "loading";
42048         if (!_waitingForNsi) {
42049           return nsi.isGenericName(tags);
42050         }
42051       }
42052       return false;
42053     }
42054     function nameMatchesRawTag(lowercaseName, tags) {
42055       for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
42056         let key = keysToTestForGenericValues[i2];
42057         let val = tags[key];
42058         if (val) {
42059           val = val.toLowerCase();
42060           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
42061             return true;
42062           }
42063         }
42064       }
42065       return false;
42066     }
42067     function isGenericName(name2, tags) {
42068       name2 = name2.toLowerCase();
42069       return nameMatchesRawTag(name2, tags) || isGenericMatchInNsi(tags);
42070     }
42071     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
42072       return new validationIssue({
42073         type: type3,
42074         subtype: "generic_name",
42075         severity: "warning",
42076         message: function(context) {
42077           let entity = context.hasEntity(this.entityIds[0]);
42078           if (!entity)
42079             return "";
42080           let preset = _mainPresetIndex.match(entity, context.graph());
42081           let langName = langCode && _mainLocalizer.languageName(langCode);
42082           return _t.html("issues.generic_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: genericName, language: langName });
42083         },
42084         reference: showReference,
42085         entityIds: [entityId],
42086         hash: `${nameKey}=${genericName}`,
42087         dynamicFixes: function() {
42088           return [
42089             new validationIssueFix({
42090               icon: "iD-operation-delete",
42091               title: _t.html("issues.fix.remove_the_name.title"),
42092               onClick: function(context) {
42093                 let entityId2 = this.issue.entityIds[0];
42094                 let entity = context.entity(entityId2);
42095                 let tags = Object.assign({}, entity.tags);
42096                 delete tags[nameKey];
42097                 context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_generic_name.annotation"));
42098               }
42099             })
42100           ];
42101         }
42102       });
42103       function showReference(selection2) {
42104         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42105       }
42106     }
42107     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
42108       return new validationIssue({
42109         type: type3,
42110         subtype: "not_name",
42111         severity: "warning",
42112         message: function(context) {
42113           const entity = context.hasEntity(this.entityIds[0]);
42114           if (!entity)
42115             return "";
42116           const preset = _mainPresetIndex.match(entity, context.graph());
42117           const langName = langCode && _mainLocalizer.languageName(langCode);
42118           return _t.html("issues.incorrect_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: incorrectName, language: langName });
42119         },
42120         reference: showReference,
42121         entityIds: [entityId],
42122         hash: `${nameKey}=${incorrectName}`,
42123         dynamicFixes: function() {
42124           return [
42125             new validationIssueFix({
42126               icon: "iD-operation-delete",
42127               title: _t.html("issues.fix.remove_the_name.title"),
42128               onClick: function(context) {
42129                 const entityId2 = this.issue.entityIds[0];
42130                 const entity = context.entity(entityId2);
42131                 let tags = Object.assign({}, entity.tags);
42132                 delete tags[nameKey];
42133                 context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_mistaken_name.annotation"));
42134               }
42135             })
42136           ];
42137         }
42138       });
42139       function showReference(selection2) {
42140         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42141       }
42142     }
42143     let validation = function checkGenericName(entity) {
42144       const tags = entity.tags;
42145       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
42146       if (hasWikidata)
42147         return [];
42148       let issues = [];
42149       const notNames2 = (tags["not:name"] || "").split(";");
42150       for (let key in tags) {
42151         const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
42152         if (!m)
42153           continue;
42154         const langCode = m.length >= 2 ? m[1] : null;
42155         const value = tags[key];
42156         if (notNames2.length) {
42157           for (let i2 in notNames2) {
42158             const notName = notNames2[i2];
42159             if (notName && value === notName) {
42160               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
42161               continue;
42162             }
42163           }
42164         }
42165         if (isGenericName(value, tags)) {
42166           issues.provisional = _waitingForNsi;
42167           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
42168         }
42169       }
42170       return issues;
42171     };
42172     validation.type = type3;
42173     return validation;
42174   }
42175
42176   // modules/validations/unsquare_way.js
42177   function validationUnsquareWay(context) {
42178     var type3 = "unsquare_way";
42179     var DEFAULT_DEG_THRESHOLD = 5;
42180     var epsilon3 = 0.05;
42181     var nodeThreshold = 10;
42182     function isBuilding(entity, graph) {
42183       if (entity.type !== "way" || entity.geometry(graph) !== "area")
42184         return false;
42185       return entity.tags.building && entity.tags.building !== "no";
42186     }
42187     var validation = function checkUnsquareWay(entity, graph) {
42188       if (!isBuilding(entity, graph))
42189         return [];
42190       if (entity.tags.nonsquare === "yes")
42191         return [];
42192       var isClosed = entity.isClosed();
42193       if (!isClosed)
42194         return [];
42195       var nodes = graph.childNodes(entity).slice();
42196       if (nodes.length > nodeThreshold + 1)
42197         return [];
42198       var osm = services.osm;
42199       if (!osm || nodes.some(function(node) {
42200         return !osm.isDataLoaded(node.loc);
42201       }))
42202         return [];
42203       var hasConnectedSquarableWays = nodes.some(function(node) {
42204         return graph.parentWays(node).some(function(way) {
42205           if (way.id === entity.id)
42206             return false;
42207           if (isBuilding(way, graph))
42208             return true;
42209           return graph.parentRelations(way).some(function(parentRelation) {
42210             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
42211           });
42212         });
42213       });
42214       if (hasConnectedSquarableWays)
42215         return [];
42216       var storedDegreeThreshold = corePreferences("validate-square-degrees");
42217       var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
42218       var points = nodes.map(function(node) {
42219         return context.projection(node.loc);
42220       });
42221       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
42222         return [];
42223       var autoArgs;
42224       if (!entity.tags.wikidata) {
42225         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
42226         autoAction.transitionable = false;
42227         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
42228       }
42229       return [new validationIssue({
42230         type: type3,
42231         subtype: "building",
42232         severity: "warning",
42233         message: function(context2) {
42234           var entity2 = context2.hasEntity(this.entityIds[0]);
42235           return entity2 ? _t.html("issues.unsquare_way.message", {
42236             feature: utilDisplayLabel(entity2, context2.graph())
42237           }) : "";
42238         },
42239         reference: showReference,
42240         entityIds: [entity.id],
42241         hash: degreeThreshold,
42242         dynamicFixes: function() {
42243           return [
42244             new validationIssueFix({
42245               icon: "iD-operation-orthogonalize",
42246               title: _t.html("issues.fix.square_feature.title"),
42247               autoArgs,
42248               onClick: function(context2, completionHandler) {
42249                 var entityId = this.issue.entityIds[0];
42250                 context2.perform(actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold), _t("operations.orthogonalize.annotation.feature", { n: 1 }));
42251                 window.setTimeout(function() {
42252                   completionHandler();
42253                 }, 175);
42254               }
42255             })
42256           ];
42257         }
42258       })];
42259       function showReference(selection2) {
42260         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
42261       }
42262     };
42263     validation.type = type3;
42264     return validation;
42265   }
42266
42267   // modules/core/validator.js
42268   function coreValidator(context) {
42269     let dispatch10 = dispatch_default("validated", "focusedIssue");
42270     let validator = utilRebind({}, dispatch10, "on");
42271     let _rules = {};
42272     let _disabledRules = {};
42273     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
42274     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
42275     let _baseCache = validationCache("base");
42276     let _headCache = validationCache("head");
42277     let _completeDiff = {};
42278     let _headIsCurrent = false;
42279     let _deferredRIC = {};
42280     let _deferredST = /* @__PURE__ */ new Set();
42281     let _headPromise;
42282     const RETRY = 5e3;
42283     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
42284     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
42285     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
42286     function parseHashParam(param) {
42287       let result = [];
42288       let rules = (param || "").split(",");
42289       rules.forEach((rule) => {
42290         rule = rule.trim();
42291         const parts = rule.split("/", 2);
42292         const type3 = parts[0];
42293         const subtype = parts[1] || "*";
42294         if (!type3 || !subtype)
42295           return;
42296         result.push({ type: makeRegExp(type3), subtype: makeRegExp(subtype) });
42297       });
42298       return result;
42299       function makeRegExp(str2) {
42300         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
42301         return new RegExp("^" + escaped + "$");
42302       }
42303     }
42304     validator.init = () => {
42305       Object.values(validations_exports).forEach((validation) => {
42306         if (typeof validation !== "function")
42307           return;
42308         const fn = validation(context);
42309         const key = fn.type;
42310         _rules[key] = fn;
42311       });
42312       let disabledRules = corePreferences("validate-disabledRules");
42313       if (disabledRules) {
42314         disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
42315       }
42316     };
42317     function reset(resetIgnored) {
42318       _baseCache.queue = [];
42319       _headCache.queue = [];
42320       Object.keys(_deferredRIC).forEach((key) => {
42321         window.cancelIdleCallback(key);
42322         _deferredRIC[key]();
42323       });
42324       _deferredRIC = {};
42325       _deferredST.forEach(window.clearTimeout);
42326       _deferredST.clear();
42327       if (resetIgnored)
42328         _ignoredIssueIDs.clear();
42329       _resolvedIssueIDs.clear();
42330       _baseCache = validationCache("base");
42331       _headCache = validationCache("head");
42332       _completeDiff = {};
42333       _headIsCurrent = false;
42334     }
42335     validator.reset = () => {
42336       reset(true);
42337     };
42338     validator.resetIgnoredIssues = () => {
42339       _ignoredIssueIDs.clear();
42340       dispatch10.call("validated");
42341     };
42342     validator.revalidateUnsquare = () => {
42343       revalidateUnsquare(_headCache);
42344       revalidateUnsquare(_baseCache);
42345       dispatch10.call("validated");
42346     };
42347     function revalidateUnsquare(cache) {
42348       const checkUnsquareWay = _rules.unsquare_way;
42349       if (!cache.graph || typeof checkUnsquareWay !== "function")
42350         return;
42351       cache.uncacheIssuesOfType("unsquare_way");
42352       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");
42353       buildings.forEach((entity) => {
42354         const detected = checkUnsquareWay(entity, cache.graph);
42355         if (!detected.length)
42356           return;
42357         cache.cacheIssues(detected);
42358       });
42359     }
42360     validator.getIssues = (options2) => {
42361       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
42362       const view = context.map().extent();
42363       let seen = /* @__PURE__ */ new Set();
42364       let results = [];
42365       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
42366         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
42367           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42368           if (opts.what === "edited" && !userModified)
42369             return;
42370           if (!filter2(issue))
42371             return;
42372           seen.add(issue.id);
42373           results.push(issue);
42374         });
42375       }
42376       if (opts.what === "all") {
42377         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
42378           if (!filter2(issue))
42379             return;
42380           seen.add(issue.id);
42381           results.push(issue);
42382         });
42383       }
42384       return results;
42385       function filter2(issue) {
42386         if (!issue)
42387           return false;
42388         if (seen.has(issue.id))
42389           return false;
42390         if (_resolvedIssueIDs.has(issue.id))
42391           return false;
42392         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
42393           return false;
42394         if (!opts.includeDisabledRules && _disabledRules[issue.type])
42395           return false;
42396         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
42397           return false;
42398         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
42399           return false;
42400         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
42401           return false;
42402         if (opts.where === "visible") {
42403           const extent = issue.extent(context.graph());
42404           if (!view.intersects(extent))
42405             return false;
42406         }
42407         return true;
42408       }
42409     };
42410     validator.getResolvedIssues = () => {
42411       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
42412     };
42413     validator.focusIssue = (issue) => {
42414       const graph = context.graph();
42415       let selectID;
42416       let focusCenter;
42417       const issueExtent = issue.extent(graph);
42418       if (issueExtent) {
42419         focusCenter = issueExtent.center();
42420       }
42421       if (issue.entityIds && issue.entityIds.length) {
42422         selectID = issue.entityIds[0];
42423         if (selectID && selectID.charAt(0) === "r") {
42424           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
42425           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
42426           if (!nodeID) {
42427             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
42428             if (wayID) {
42429               nodeID = graph.entity(wayID).first();
42430             }
42431           }
42432           if (nodeID) {
42433             focusCenter = graph.entity(nodeID).loc;
42434           }
42435         }
42436       }
42437       if (focusCenter) {
42438         const setZoom = Math.max(context.map().zoom(), 19);
42439         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
42440       }
42441       if (selectID) {
42442         window.setTimeout(() => {
42443           context.enter(modeSelect(context, [selectID]));
42444           dispatch10.call("focusedIssue", this, issue);
42445         }, 250);
42446       }
42447     };
42448     validator.getIssuesBySeverity = (options2) => {
42449       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
42450       groups.error = groups.error || [];
42451       groups.warning = groups.warning || [];
42452       return groups;
42453     };
42454     validator.getSharedEntityIssues = (entityIDs, options2) => {
42455       const orderedIssueTypes = [
42456         "missing_tag",
42457         "missing_role",
42458         "outdated_tags",
42459         "mismatched_geometry",
42460         "crossing_ways",
42461         "almost_junction",
42462         "disconnected_way",
42463         "impossible_oneway"
42464       ];
42465       const allIssues = validator.getIssues(options2);
42466       const forEntityIDs = new Set(entityIDs);
42467       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
42468         if (issue1.type === issue2.type) {
42469           return issue1.id < issue2.id ? -1 : 1;
42470         }
42471         const index1 = orderedIssueTypes.indexOf(issue1.type);
42472         const index2 = orderedIssueTypes.indexOf(issue2.type);
42473         if (index1 !== -1 && index2 !== -1) {
42474           return index1 - index2;
42475         } else if (index1 === -1 && index2 === -1) {
42476           return issue1.type < issue2.type ? -1 : 1;
42477         } else {
42478           return index1 !== -1 ? -1 : 1;
42479         }
42480       });
42481     };
42482     validator.getEntityIssues = (entityID, options2) => {
42483       return validator.getSharedEntityIssues([entityID], options2);
42484     };
42485     validator.getRuleKeys = () => {
42486       return Object.keys(_rules);
42487     };
42488     validator.isRuleEnabled = (key) => {
42489       return !_disabledRules[key];
42490     };
42491     validator.toggleRule = (key) => {
42492       if (_disabledRules[key]) {
42493         delete _disabledRules[key];
42494       } else {
42495         _disabledRules[key] = true;
42496       }
42497       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42498       validator.validate();
42499     };
42500     validator.disableRules = (keys) => {
42501       _disabledRules = {};
42502       keys.forEach((k) => _disabledRules[k] = true);
42503       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42504       validator.validate();
42505     };
42506     validator.ignoreIssue = (issueID) => {
42507       _ignoredIssueIDs.add(issueID);
42508     };
42509     validator.validate = () => {
42510       const baseGraph = context.history().base();
42511       if (!_headCache.graph)
42512         _headCache.graph = baseGraph;
42513       if (!_baseCache.graph)
42514         _baseCache.graph = baseGraph;
42515       const prevGraph = _headCache.graph;
42516       const currGraph = context.graph();
42517       if (currGraph === prevGraph) {
42518         _headIsCurrent = true;
42519         dispatch10.call("validated");
42520         return Promise.resolve();
42521       }
42522       if (_headPromise) {
42523         _headIsCurrent = false;
42524         return _headPromise;
42525       }
42526       _headCache.graph = currGraph;
42527       _completeDiff = context.history().difference().complete();
42528       const incrementalDiff = coreDifference(prevGraph, currGraph);
42529       let entityIDs = Object.keys(incrementalDiff.complete());
42530       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
42531       if (!entityIDs.size) {
42532         dispatch10.call("validated");
42533         return Promise.resolve();
42534       }
42535       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
42536       }).then(() => {
42537         _headPromise = null;
42538         if (!_headIsCurrent) {
42539           validator.validate();
42540         }
42541       });
42542       return _headPromise;
42543     };
42544     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
42545       reset(false);
42546       validator.validate();
42547     });
42548     context.on("exit.validator", validator.validate);
42549     context.history().on("merge.validator", (entities) => {
42550       if (!entities)
42551         return;
42552       const baseGraph = context.history().base();
42553       if (!_headCache.graph)
42554         _headCache.graph = baseGraph;
42555       if (!_baseCache.graph)
42556         _baseCache.graph = baseGraph;
42557       let entityIDs = entities.map((entity) => entity.id);
42558       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
42559       validateEntitiesAsync(entityIDs, _baseCache);
42560     });
42561     function validateEntity(entity, graph) {
42562       let result = { issues: [], provisional: false };
42563       Object.keys(_rules).forEach(runValidation);
42564       return result;
42565       function runValidation(key) {
42566         const fn = _rules[key];
42567         if (typeof fn !== "function") {
42568           console.error("no such validation rule = " + key);
42569           return;
42570         }
42571         let detected = fn(entity, graph);
42572         if (detected.provisional) {
42573           result.provisional = true;
42574         }
42575         detected = detected.filter(applySeverityOverrides);
42576         result.issues = result.issues.concat(detected);
42577         function applySeverityOverrides(issue) {
42578           const type3 = issue.type;
42579           const subtype = issue.subtype || "";
42580           let i2;
42581           for (i2 = 0; i2 < _errorOverrides.length; i2++) {
42582             if (_errorOverrides[i2].type.test(type3) && _errorOverrides[i2].subtype.test(subtype)) {
42583               issue.severity = "error";
42584               return true;
42585             }
42586           }
42587           for (i2 = 0; i2 < _warningOverrides.length; i2++) {
42588             if (_warningOverrides[i2].type.test(type3) && _warningOverrides[i2].subtype.test(subtype)) {
42589               issue.severity = "warning";
42590               return true;
42591             }
42592           }
42593           for (i2 = 0; i2 < _disableOverrides.length; i2++) {
42594             if (_disableOverrides[i2].type.test(type3) && _disableOverrides[i2].subtype.test(subtype)) {
42595               return false;
42596             }
42597           }
42598           return true;
42599         }
42600       }
42601     }
42602     function updateResolvedIssues(entityIDs) {
42603       entityIDs.forEach((entityID) => {
42604         const baseIssues = _baseCache.issuesByEntityID[entityID];
42605         if (!baseIssues)
42606           return;
42607         baseIssues.forEach((issueID) => {
42608           const issue = _baseCache.issuesByIssueID[issueID];
42609           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42610           if (userModified && !_headCache.issuesByIssueID[issueID]) {
42611             _resolvedIssueIDs.add(issueID);
42612           } else {
42613             _resolvedIssueIDs.delete(issueID);
42614           }
42615         });
42616       });
42617     }
42618     function validateEntitiesAsync(entityIDs, cache) {
42619       const jobs = Array.from(entityIDs).map((entityID) => {
42620         if (cache.queuedEntityIDs.has(entityID))
42621           return null;
42622         cache.queuedEntityIDs.add(entityID);
42623         cache.uncacheEntityID(entityID);
42624         return () => {
42625           cache.queuedEntityIDs.delete(entityID);
42626           const graph = cache.graph;
42627           if (!graph)
42628             return;
42629           const entity = graph.hasEntity(entityID);
42630           if (!entity)
42631             return;
42632           const result = validateEntity(entity, graph);
42633           if (result.provisional) {
42634             cache.provisionalEntityIDs.add(entityID);
42635           }
42636           cache.cacheIssues(result.issues);
42637         };
42638       }).filter(Boolean);
42639       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
42640       if (cache.queuePromise)
42641         return cache.queuePromise;
42642       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
42643       }).finally(() => cache.queuePromise = null);
42644       return cache.queuePromise;
42645     }
42646     function revalidateProvisionalEntities(cache) {
42647       if (!cache.provisionalEntityIDs.size)
42648         return;
42649       const handle = window.setTimeout(() => {
42650         _deferredST.delete(handle);
42651         if (!cache.provisionalEntityIDs.size)
42652           return;
42653         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
42654       }, RETRY);
42655       _deferredST.add(handle);
42656     }
42657     function processQueue(cache) {
42658       if (!cache.queue.length)
42659         return Promise.resolve();
42660       const chunk = cache.queue.pop();
42661       return new Promise((resolvePromise, rejectPromise) => {
42662         const handle = window.requestIdleCallback(() => {
42663           delete _deferredRIC[handle];
42664           chunk.forEach((job) => job());
42665           resolvePromise();
42666         });
42667         _deferredRIC[handle] = rejectPromise;
42668       }).then(() => {
42669         if (cache.queue.length % 25 === 0)
42670           dispatch10.call("validated");
42671       }).then(() => processQueue(cache));
42672     }
42673     return validator;
42674   }
42675   function validationCache(which) {
42676     let cache = {
42677       which,
42678       graph: null,
42679       queue: [],
42680       queuePromise: null,
42681       queuedEntityIDs: /* @__PURE__ */ new Set(),
42682       provisionalEntityIDs: /* @__PURE__ */ new Set(),
42683       issuesByIssueID: {},
42684       issuesByEntityID: {}
42685     };
42686     cache.cacheIssue = (issue) => {
42687       (issue.entityIds || []).forEach((entityID) => {
42688         if (!cache.issuesByEntityID[entityID]) {
42689           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
42690         }
42691         cache.issuesByEntityID[entityID].add(issue.id);
42692       });
42693       cache.issuesByIssueID[issue.id] = issue;
42694     };
42695     cache.uncacheIssue = (issue) => {
42696       (issue.entityIds || []).forEach((entityID) => {
42697         if (cache.issuesByEntityID[entityID]) {
42698           cache.issuesByEntityID[entityID].delete(issue.id);
42699         }
42700       });
42701       delete cache.issuesByIssueID[issue.id];
42702     };
42703     cache.cacheIssues = (issues) => {
42704       issues.forEach(cache.cacheIssue);
42705     };
42706     cache.uncacheIssues = (issues) => {
42707       issues.forEach(cache.uncacheIssue);
42708     };
42709     cache.uncacheIssuesOfType = (type3) => {
42710       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type3);
42711       cache.uncacheIssues(issuesOfType);
42712     };
42713     cache.uncacheEntityID = (entityID) => {
42714       const entityIssueIDs = cache.issuesByEntityID[entityID];
42715       if (entityIssueIDs) {
42716         entityIssueIDs.forEach((issueID) => {
42717           const issue = cache.issuesByIssueID[issueID];
42718           if (issue) {
42719             cache.uncacheIssue(issue);
42720           } else {
42721             delete cache.issuesByIssueID[issueID];
42722           }
42723         });
42724       }
42725       delete cache.issuesByEntityID[entityID];
42726       cache.provisionalEntityIDs.delete(entityID);
42727     };
42728     cache.withAllRelatedEntities = (entityIDs) => {
42729       let result = /* @__PURE__ */ new Set();
42730       (entityIDs || []).forEach((entityID) => {
42731         result.add(entityID);
42732         const entityIssueIDs = cache.issuesByEntityID[entityID];
42733         if (entityIssueIDs) {
42734           entityIssueIDs.forEach((issueID) => {
42735             const issue = cache.issuesByIssueID[issueID];
42736             if (issue) {
42737               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
42738             } else {
42739               delete cache.issuesByIssueID[issueID];
42740             }
42741           });
42742         }
42743       });
42744       return result;
42745     };
42746     return cache;
42747   }
42748
42749   // modules/core/uploader.js
42750   function coreUploader(context) {
42751     var dispatch10 = dispatch_default("saveStarted", "saveEnded", "willAttemptUpload", "progressChanged", "resultNoChanges", "resultErrors", "resultConflicts", "resultSuccess");
42752     var _isSaving = false;
42753     var _conflicts = [];
42754     var _errors = [];
42755     var _origChanges;
42756     var _discardTags = {};
42757     _mainFileFetcher.get("discarded").then(function(d) {
42758       _discardTags = d;
42759     }).catch(function() {
42760     });
42761     var uploader = utilRebind({}, dispatch10, "on");
42762     uploader.isSaving = function() {
42763       return _isSaving;
42764     };
42765     uploader.save = function(changeset, tryAgain, checkConflicts) {
42766       if (_isSaving && !tryAgain) {
42767         return;
42768       }
42769       var osm = context.connection();
42770       if (!osm)
42771         return;
42772       if (!osm.authenticated()) {
42773         osm.authenticate(function(err) {
42774           if (!err) {
42775             uploader.save(changeset, tryAgain, checkConflicts);
42776           }
42777         });
42778         return;
42779       }
42780       if (!_isSaving) {
42781         _isSaving = true;
42782         dispatch10.call("saveStarted", this);
42783       }
42784       var history = context.history();
42785       _conflicts = [];
42786       _errors = [];
42787       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
42788       if (!tryAgain) {
42789         history.perform(actionNoop());
42790       }
42791       if (!checkConflicts) {
42792         upload(changeset);
42793       } else {
42794         performFullConflictCheck(changeset);
42795       }
42796     };
42797     function performFullConflictCheck(changeset) {
42798       var osm = context.connection();
42799       if (!osm)
42800         return;
42801       var history = context.history();
42802       var localGraph = context.graph();
42803       var remoteGraph = coreGraph(history.base(), true);
42804       var summary = history.difference().summary();
42805       var _toCheck = [];
42806       for (var i2 = 0; i2 < summary.length; i2++) {
42807         var item = summary[i2];
42808         if (item.changeType === "modified") {
42809           _toCheck.push(item.entity.id);
42810         }
42811       }
42812       var _toLoad = withChildNodes(_toCheck, localGraph);
42813       var _loaded = {};
42814       var _toLoadCount = 0;
42815       var _toLoadTotal = _toLoad.length;
42816       if (_toCheck.length) {
42817         dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
42818         _toLoad.forEach(function(id2) {
42819           _loaded[id2] = false;
42820         });
42821         osm.loadMultiple(_toLoad, loaded);
42822       } else {
42823         upload(changeset);
42824       }
42825       return;
42826       function withChildNodes(ids, graph) {
42827         var s = new Set(ids);
42828         ids.forEach(function(id2) {
42829           var entity = graph.entity(id2);
42830           if (entity.type !== "way")
42831             return;
42832           graph.childNodes(entity).forEach(function(child) {
42833             if (child.version !== void 0) {
42834               s.add(child.id);
42835             }
42836           });
42837         });
42838         return Array.from(s);
42839       }
42840       function loaded(err, result) {
42841         if (_errors.length)
42842           return;
42843         if (err) {
42844           _errors.push({
42845             msg: err.message || err.responseText,
42846             details: [_t("save.status_code", { code: err.status })]
42847           });
42848           didResultInErrors();
42849         } else {
42850           var loadMore = [];
42851           result.data.forEach(function(entity) {
42852             remoteGraph.replace(entity);
42853             _loaded[entity.id] = true;
42854             _toLoad = _toLoad.filter(function(val) {
42855               return val !== entity.id;
42856             });
42857             if (!entity.visible)
42858               return;
42859             var i3, id2;
42860             if (entity.type === "way") {
42861               for (i3 = 0; i3 < entity.nodes.length; i3++) {
42862                 id2 = entity.nodes[i3];
42863                 if (_loaded[id2] === void 0) {
42864                   _loaded[id2] = false;
42865                   loadMore.push(id2);
42866                 }
42867               }
42868             } else if (entity.type === "relation" && entity.isMultipolygon()) {
42869               for (i3 = 0; i3 < entity.members.length; i3++) {
42870                 id2 = entity.members[i3].id;
42871                 if (_loaded[id2] === void 0) {
42872                   _loaded[id2] = false;
42873                   loadMore.push(id2);
42874                 }
42875               }
42876             }
42877           });
42878           _toLoadCount += result.data.length;
42879           _toLoadTotal += loadMore.length;
42880           dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
42881           if (loadMore.length) {
42882             _toLoad.push.apply(_toLoad, loadMore);
42883             osm.loadMultiple(loadMore, loaded);
42884           }
42885           if (!_toLoad.length) {
42886             detectConflicts();
42887             upload(changeset);
42888           }
42889         }
42890       }
42891       function detectConflicts() {
42892         function choice(id2, text2, action) {
42893           return {
42894             id: id2,
42895             text: text2,
42896             action: function() {
42897               history.replace(action);
42898             }
42899           };
42900         }
42901         function formatUser(d) {
42902           return '<a href="' + osm.userURL(d) + '" target="_blank">' + escape_default(d) + "</a>";
42903         }
42904         function entityName(entity) {
42905           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
42906         }
42907         function sameVersions(local, remote) {
42908           if (local.version !== remote.version)
42909             return false;
42910           if (local.type === "way") {
42911             var children2 = utilArrayUnion(local.nodes, remote.nodes);
42912             for (var i3 = 0; i3 < children2.length; i3++) {
42913               var a = localGraph.hasEntity(children2[i3]);
42914               var b = remoteGraph.hasEntity(children2[i3]);
42915               if (a && b && a.version !== b.version)
42916                 return false;
42917             }
42918           }
42919           return true;
42920         }
42921         _toCheck.forEach(function(id2) {
42922           var local = localGraph.entity(id2);
42923           var remote = remoteGraph.entity(id2);
42924           if (sameVersions(local, remote))
42925             return;
42926           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
42927           history.replace(merge3);
42928           var mergeConflicts = merge3.conflicts();
42929           if (!mergeConflicts.length)
42930             return;
42931           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
42932           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
42933           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
42934           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
42935           _conflicts.push({
42936             id: id2,
42937             name: entityName(local),
42938             details: mergeConflicts,
42939             chosen: 1,
42940             choices: [
42941               choice(id2, keepMine, forceLocal),
42942               choice(id2, keepTheirs, forceRemote)
42943             ]
42944           });
42945         });
42946       }
42947     }
42948     function upload(changeset) {
42949       var osm = context.connection();
42950       if (!osm) {
42951         _errors.push({ msg: "No OSM Service" });
42952       }
42953       if (_conflicts.length) {
42954         didResultInConflicts(changeset);
42955       } else if (_errors.length) {
42956         didResultInErrors();
42957       } else {
42958         var history = context.history();
42959         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
42960         if (changes.modified.length || changes.created.length || changes.deleted.length) {
42961           dispatch10.call("willAttemptUpload", this);
42962           osm.putChangeset(changeset, changes, uploadCallback);
42963         } else {
42964           didResultInNoChanges();
42965         }
42966       }
42967     }
42968     function uploadCallback(err, changeset) {
42969       if (err) {
42970         if (err.status === 409) {
42971           uploader.save(changeset, true, true);
42972         } else {
42973           _errors.push({
42974             msg: err.message || err.responseText,
42975             details: [_t("save.status_code", { code: err.status })]
42976           });
42977           didResultInErrors();
42978         }
42979       } else {
42980         didResultInSuccess(changeset);
42981       }
42982     }
42983     function didResultInNoChanges() {
42984       dispatch10.call("resultNoChanges", this);
42985       endSave();
42986       context.flush();
42987     }
42988     function didResultInErrors() {
42989       context.history().pop();
42990       dispatch10.call("resultErrors", this, _errors);
42991       endSave();
42992     }
42993     function didResultInConflicts(changeset) {
42994       _conflicts.sort(function(a, b) {
42995         return b.id.localeCompare(a.id);
42996       });
42997       dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
42998       endSave();
42999     }
43000     function didResultInSuccess(changeset) {
43001       context.history().clearSaved();
43002       dispatch10.call("resultSuccess", this, changeset);
43003       window.setTimeout(function() {
43004         endSave();
43005         context.flush();
43006       }, 2500);
43007     }
43008     function endSave() {
43009       _isSaving = false;
43010       dispatch10.call("saveEnded", this);
43011     }
43012     uploader.cancelConflictResolution = function() {
43013       context.history().pop();
43014     };
43015     uploader.processResolvedConflicts = function(changeset) {
43016       var history = context.history();
43017       for (var i2 = 0; i2 < _conflicts.length; i2++) {
43018         if (_conflicts[i2].chosen === 1) {
43019           var entity = context.hasEntity(_conflicts[i2].id);
43020           if (entity && entity.type === "way") {
43021             var children2 = utilArrayUniq(entity.nodes);
43022             for (var j2 = 0; j2 < children2.length; j2++) {
43023               history.replace(actionRevert(children2[j2]));
43024             }
43025           }
43026           history.replace(actionRevert(_conflicts[i2].id));
43027         }
43028       }
43029       uploader.save(changeset, true, false);
43030     };
43031     uploader.reset = function() {
43032     };
43033     return uploader;
43034   }
43035
43036   // modules/renderer/background_source.js
43037   var import_lodash2 = __toESM(require_lodash());
43038
43039   // modules/util/IntervalTasksQueue.js
43040   var IntervalTasksQueue = class {
43041     constructor(intervalInMs) {
43042       this.intervalInMs = intervalInMs;
43043       this.pendingHandles = [];
43044       this.time = 0;
43045     }
43046     enqueue(task) {
43047       let taskTimeout = this.time;
43048       this.time += this.intervalInMs;
43049       this.pendingHandles.push(setTimeout(() => {
43050         this.time -= this.intervalInMs;
43051         task();
43052       }, taskTimeout));
43053     }
43054     clear() {
43055       this.pendingHandles.forEach((timeoutHandle) => {
43056         clearTimeout(timeoutHandle);
43057       });
43058       this.pendingHandles = [];
43059       this.time = 0;
43060     }
43061   };
43062
43063   // modules/renderer/background_source.js
43064   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43065   window.matchMedia(`
43066         (-webkit-min-device-pixel-ratio: 2), /* Safari */
43067         (min-resolution: 2dppx),             /* standard */
43068         (min-resolution: 192dpi)             /* fallback */
43069     `).addListener(function() {
43070     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43071   });
43072   function localeDateString(s) {
43073     if (!s)
43074       return null;
43075     var options2 = { day: "numeric", month: "short", year: "numeric" };
43076     var d = new Date(s);
43077     if (isNaN(d.getTime()))
43078       return null;
43079     return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
43080   }
43081   function vintageRange(vintage) {
43082     var s;
43083     if (vintage.start || vintage.end) {
43084       s = vintage.start || "?";
43085       if (vintage.start !== vintage.end) {
43086         s += " - " + (vintage.end || "?");
43087       }
43088     }
43089     return s;
43090   }
43091   function rendererBackgroundSource(data) {
43092     var source = Object.assign({}, data);
43093     var _offset = [0, 0];
43094     var _name = source.name;
43095     var _description = source.description;
43096     var _best = !!source.best;
43097     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
43098     source.tileSize = data.tileSize || 256;
43099     source.zoomExtent = data.zoomExtent || [0, 22];
43100     source.overzoom = data.overzoom !== false;
43101     source.offset = function(val) {
43102       if (!arguments.length)
43103         return _offset;
43104       _offset = val;
43105       return source;
43106     };
43107     source.nudge = function(val, zoomlevel) {
43108       _offset[0] += val[0] / Math.pow(2, zoomlevel);
43109       _offset[1] += val[1] / Math.pow(2, zoomlevel);
43110       return source;
43111     };
43112     source.name = function() {
43113       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43114       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43115     };
43116     source.label = function() {
43117       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43118       return _t.html("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43119     };
43120     source.description = function() {
43121       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43122       return _t.html("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) });
43123     };
43124     source.best = function() {
43125       return _best;
43126     };
43127     source.area = function() {
43128       if (!data.polygon)
43129         return Number.MAX_VALUE;
43130       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
43131       return isNaN(area) ? 0 : area;
43132     };
43133     source.imageryUsed = function() {
43134       return _name || source.id;
43135     };
43136     source.template = function(val) {
43137       if (!arguments.length)
43138         return _template;
43139       if (source.id === "custom" || source.id === "Bing") {
43140         _template = val;
43141       }
43142       return source;
43143     };
43144     source.url = function(coord2) {
43145       var result = _template.replace(/#.*/su, "");
43146       if (result === "")
43147         return result;
43148       if (!source.type || source.id === "custom") {
43149         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
43150           source.type = "wms";
43151           source.projection = "EPSG:3857";
43152         } else if (/\{(x|y)\}/.test(result)) {
43153           source.type = "tms";
43154         } else if (/\{u\}/.test(result)) {
43155           source.type = "bing";
43156         }
43157       }
43158       if (source.type === "wms") {
43159         var tileToProjectedCoords = function(x, y, z) {
43160           var zoomSize = Math.pow(2, z);
43161           var lon = x / zoomSize * Math.PI * 2 - Math.PI;
43162           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
43163           switch (source.projection) {
43164             case "EPSG:4326":
43165               return {
43166                 x: lon * 180 / Math.PI,
43167                 y: lat * 180 / Math.PI
43168               };
43169             default:
43170               var mercCoords = mercatorRaw(lon, lat);
43171               return {
43172                 x: 2003750834e-2 / Math.PI * mercCoords[0],
43173                 y: 2003750834e-2 / Math.PI * mercCoords[1]
43174               };
43175           }
43176         };
43177         var tileSize = source.tileSize;
43178         var projection2 = source.projection;
43179         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
43180         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
43181         result = result.replace(/\{(\w+)\}/g, function(token, key) {
43182           switch (key) {
43183             case "width":
43184             case "height":
43185               return tileSize;
43186             case "proj":
43187               return projection2;
43188             case "wkid":
43189               return projection2.replace(/^EPSG:/, "");
43190             case "bbox":
43191               if (projection2 === "EPSG:4326" && /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
43192                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
43193               } else {
43194                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
43195               }
43196             case "w":
43197               return minXmaxY.x;
43198             case "s":
43199               return maxXminY.y;
43200             case "n":
43201               return maxXminY.x;
43202             case "e":
43203               return minXmaxY.y;
43204             default:
43205               return token;
43206           }
43207         });
43208       } else if (source.type === "tms") {
43209         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" : "");
43210       } else if (source.type === "bing") {
43211         result = result.replace("{u}", function() {
43212           var u = "";
43213           for (var zoom = coord2[2]; zoom > 0; zoom--) {
43214             var b = 0;
43215             var mask = 1 << zoom - 1;
43216             if ((coord2[0] & mask) !== 0)
43217               b++;
43218             if ((coord2[1] & mask) !== 0)
43219               b += 2;
43220             u += b.toString();
43221           }
43222           return u;
43223         });
43224       }
43225       result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
43226         var subdomains = r.split(",");
43227         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
43228       });
43229       return result;
43230     };
43231     source.validZoom = function(z) {
43232       return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
43233     };
43234     source.isLocatorOverlay = function() {
43235       return source.id === "mapbox_locator_overlay";
43236     };
43237     source.isHidden = function() {
43238       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
43239     };
43240     source.copyrightNotices = function() {
43241     };
43242     source.getMetadata = function(center, tileCoord, callback) {
43243       var vintage = {
43244         start: localeDateString(source.startDate),
43245         end: localeDateString(source.endDate)
43246       };
43247       vintage.range = vintageRange(vintage);
43248       var metadata = { vintage };
43249       callback(null, metadata);
43250     };
43251     return source;
43252   }
43253   rendererBackgroundSource.Bing = function(data, dispatch10) {
43254     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
43255     var bing = rendererBackgroundSource(data);
43256     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
43257     const strictParam = "n";
43258     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
43259     var cache = {};
43260     var inflight = {};
43261     var providers = [];
43262     var taskQueue = new IntervalTasksQueue(250);
43263     var metadataLastZoom = -1;
43264     json_default(url).then(function(json) {
43265       let imageryResource = json.resourceSets[0].resources[0];
43266       let template = imageryResource.imageUrl;
43267       let subDomains = imageryResource.imageUrlSubdomains;
43268       let subDomainNumbers = subDomains.map((subDomain) => {
43269         return subDomain.substring(1);
43270       }).join(",");
43271       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
43272       if (!new URLSearchParams(template).has(strictParam)) {
43273         template += `&${strictParam}=z`;
43274       }
43275       bing.template(template);
43276       providers = imageryResource.imageryProviders.map(function(provider) {
43277         return {
43278           attribution: provider.attribution,
43279           areas: provider.coverageAreas.map(function(area) {
43280             return {
43281               zoom: [area.zoomMin, area.zoomMax],
43282               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
43283             };
43284           })
43285         };
43286       });
43287       dispatch10.call("change");
43288     }).catch(function() {
43289     });
43290     bing.copyrightNotices = function(zoom, extent) {
43291       zoom = Math.min(zoom, 21);
43292       return providers.filter(function(provider) {
43293         return provider.areas.some(function(area) {
43294           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
43295         });
43296       }).map(function(provider) {
43297         return provider.attribution;
43298       }).join(", ");
43299     };
43300     bing.getMetadata = function(center, tileCoord, callback) {
43301       var tileID = tileCoord.slice(0, 3).join("/");
43302       var zoom = Math.min(tileCoord[2], 21);
43303       var centerPoint = center[1] + "," + center[0];
43304       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
43305       if (inflight[tileID])
43306         return;
43307       if (!cache[tileID]) {
43308         cache[tileID] = {};
43309       }
43310       if (cache[tileID] && cache[tileID].metadata) {
43311         return callback(null, cache[tileID].metadata);
43312       }
43313       inflight[tileID] = true;
43314       if (metadataLastZoom !== tileCoord[2]) {
43315         metadataLastZoom = tileCoord[2];
43316         taskQueue.clear();
43317       }
43318       taskQueue.enqueue(() => {
43319         json_default(url2).then(function(result) {
43320           delete inflight[tileID];
43321           if (!result) {
43322             throw new Error("Unknown Error");
43323           }
43324           var vintage = {
43325             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
43326             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
43327           };
43328           vintage.range = vintageRange(vintage);
43329           var metadata = { vintage };
43330           cache[tileID].metadata = metadata;
43331           if (callback)
43332             callback(null, metadata);
43333         }).catch(function(err) {
43334           delete inflight[tileID];
43335           if (callback)
43336             callback(err.message);
43337         });
43338       });
43339     };
43340     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
43341     return bing;
43342   };
43343   rendererBackgroundSource.Esri = function(data) {
43344     if (data.template.match(/blankTile/) === null) {
43345       data.template = data.template + "?blankTile=false";
43346     }
43347     var esri = rendererBackgroundSource(data);
43348     var cache = {};
43349     var inflight = {};
43350     var _prevCenter;
43351     esri.fetchTilemap = function(center) {
43352       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
43353         return;
43354       _prevCenter = center;
43355       var z = 20;
43356       var dummyUrl = esri.url([1, 2, 3]);
43357       var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
43358       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));
43359       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
43360       json_default(tilemapUrl).then(function(tilemap) {
43361         if (!tilemap) {
43362           throw new Error("Unknown Error");
43363         }
43364         var hasTiles = true;
43365         for (var i2 = 0; i2 < tilemap.data.length; i2++) {
43366           if (!tilemap.data[i2]) {
43367             hasTiles = false;
43368             break;
43369           }
43370         }
43371         esri.zoomExtent[1] = hasTiles ? 22 : 19;
43372       }).catch(function() {
43373       });
43374     };
43375     esri.getMetadata = function(center, tileCoord, callback) {
43376       if (esri.id !== "EsriWorldImagery") {
43377         return callback(null, {});
43378       }
43379       var tileID = tileCoord.slice(0, 3).join("/");
43380       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
43381       var centerPoint = center[0] + "," + center[1];
43382       var unknown = _t("info_panels.background.unknown");
43383       var vintage = {};
43384       var metadata = {};
43385       if (inflight[tileID])
43386         return;
43387       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
43388       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
43389       if (!cache[tileID]) {
43390         cache[tileID] = {};
43391       }
43392       if (cache[tileID] && cache[tileID].metadata) {
43393         return callback(null, cache[tileID].metadata);
43394       }
43395       inflight[tileID] = true;
43396       json_default(url).then(function(result) {
43397         delete inflight[tileID];
43398         result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
43399         if (!result) {
43400           throw new Error("Unknown Error");
43401         } else if (result.features && result.features.length < 1) {
43402           throw new Error("No Results");
43403         } else if (result.error && result.error.message) {
43404           throw new Error(result.error.message);
43405         }
43406         var captureDate = localeDateString(result.SRC_DATE2);
43407         vintage = {
43408           start: captureDate,
43409           end: captureDate,
43410           range: captureDate
43411         };
43412         metadata = {
43413           vintage,
43414           source: clean2(result.NICE_NAME),
43415           description: clean2(result.NICE_DESC),
43416           resolution: clean2(+parseFloat(result.SRC_RES).toFixed(4)),
43417           accuracy: clean2(+parseFloat(result.SRC_ACC).toFixed(4))
43418         };
43419         if (isFinite(metadata.resolution)) {
43420           metadata.resolution += " m";
43421         }
43422         if (isFinite(metadata.accuracy)) {
43423           metadata.accuracy += " m";
43424         }
43425         cache[tileID].metadata = metadata;
43426         if (callback)
43427           callback(null, metadata);
43428       }).catch(function(err) {
43429         delete inflight[tileID];
43430         if (callback)
43431           callback(err.message);
43432       });
43433       function clean2(val) {
43434         return String(val).trim() || unknown;
43435       }
43436     };
43437     return esri;
43438   };
43439   rendererBackgroundSource.None = function() {
43440     var source = rendererBackgroundSource({ id: "none", template: "" });
43441     source.name = function() {
43442       return _t("background.none");
43443     };
43444     source.label = function() {
43445       return _t.html("background.none");
43446     };
43447     source.imageryUsed = function() {
43448       return null;
43449     };
43450     source.area = function() {
43451       return -1;
43452     };
43453     return source;
43454   };
43455   rendererBackgroundSource.Custom = function(template) {
43456     var source = rendererBackgroundSource({ id: "custom", template });
43457     source.name = function() {
43458       return _t("background.custom");
43459     };
43460     source.label = function() {
43461       return _t.html("background.custom");
43462     };
43463     source.imageryUsed = function() {
43464       var cleaned = source.template();
43465       if (cleaned.indexOf("?") !== -1) {
43466         var parts = cleaned.split("?", 2);
43467         var qs = utilStringQs(parts[1]);
43468         ["access_token", "connectId", "token"].forEach(function(param) {
43469           if (qs[param]) {
43470             qs[param] = "{apikey}";
43471           }
43472         });
43473         cleaned = parts[0] + "?" + utilQsString(qs, true);
43474       }
43475       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
43476       return "Custom (" + cleaned + " )";
43477     };
43478     source.area = function() {
43479       return -2;
43480     };
43481     return source;
43482   };
43483
43484   // modules/renderer/background.js
43485   var import_which_polygon4 = __toESM(require_which_polygon());
43486
43487   // modules/renderer/tile_layer.js
43488   function rendererTileLayer(context) {
43489     var transformProp = utilPrefixCSSProperty("Transform");
43490     var tiler8 = utilTiler();
43491     var _tileSize = 256;
43492     var _projection;
43493     var _cache4 = {};
43494     var _tileOrigin;
43495     var _zoom;
43496     var _source;
43497     function tileSizeAtZoom(d, z) {
43498       var EPSILON = 2e-3;
43499       return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
43500     }
43501     function atZoom(t, distance) {
43502       var power = Math.pow(2, distance);
43503       return [
43504         Math.floor(t[0] * power),
43505         Math.floor(t[1] * power),
43506         t[2] + distance
43507       ];
43508     }
43509     function lookUp(d) {
43510       for (var up = -1; up > -d[2]; up--) {
43511         var tile = atZoom(d, up);
43512         if (_cache4[_source.url(tile)] !== false) {
43513           return tile;
43514         }
43515       }
43516     }
43517     function uniqueBy(a, n2) {
43518       var o = [];
43519       var seen = {};
43520       for (var i2 = 0; i2 < a.length; i2++) {
43521         if (seen[a[i2][n2]] === void 0) {
43522           o.push(a[i2]);
43523           seen[a[i2][n2]] = true;
43524         }
43525       }
43526       return o;
43527     }
43528     function addSource(d) {
43529       d.push(_source.url(d));
43530       return d;
43531     }
43532     function background(selection2) {
43533       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
43534       var pixelOffset;
43535       if (_source) {
43536         pixelOffset = [
43537           _source.offset()[0] * Math.pow(2, _zoom),
43538           _source.offset()[1] * Math.pow(2, _zoom)
43539         ];
43540       } else {
43541         pixelOffset = [0, 0];
43542       }
43543       var translate = [
43544         _projection.translate()[0] + pixelOffset[0],
43545         _projection.translate()[1] + pixelOffset[1]
43546       ];
43547       tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
43548       _tileOrigin = [
43549         _projection.scale() * Math.PI - translate[0],
43550         _projection.scale() * Math.PI - translate[1]
43551       ];
43552       render(selection2);
43553     }
43554     function render(selection2) {
43555       if (!_source)
43556         return;
43557       var requests = [];
43558       var showDebug = context.getDebug("tile") && !_source.overlay;
43559       if (_source.validZoom(_zoom)) {
43560         tiler8.skipNullIsland(!!_source.overlay);
43561         tiler8().forEach(function(d) {
43562           addSource(d);
43563           if (d[3] === "")
43564             return;
43565           if (typeof d[3] !== "string")
43566             return;
43567           requests.push(d);
43568           if (_cache4[d[3]] === false && lookUp(d)) {
43569             requests.push(addSource(lookUp(d)));
43570           }
43571         });
43572         requests = uniqueBy(requests, 3).filter(function(r) {
43573           return _cache4[r[3]] !== false;
43574         });
43575       }
43576       function load(d3_event, d) {
43577         _cache4[d[3]] = true;
43578         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
43579         render(selection2);
43580       }
43581       function error(d3_event, d) {
43582         _cache4[d[3]] = false;
43583         select_default2(this).on("error", null).on("load", null).remove();
43584         render(selection2);
43585       }
43586       function imageTransform(d) {
43587         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43588         var scale = tileSizeAtZoom(d, _zoom);
43589         return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
43590       }
43591       function tileCenter(d) {
43592         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43593         return [
43594           d[0] * ts - _tileOrigin[0] + ts / 2,
43595           d[1] * ts - _tileOrigin[1] + ts / 2
43596         ];
43597       }
43598       function debugTransform(d) {
43599         var coord2 = tileCenter(d);
43600         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
43601       }
43602       var dims = tiler8.size();
43603       var mapCenter = [dims[0] / 2, dims[1] / 2];
43604       var minDist = Math.max(dims[0], dims[1]);
43605       var nearCenter;
43606       requests.forEach(function(d) {
43607         var c = tileCenter(d);
43608         var dist = geoVecLength(c, mapCenter);
43609         if (dist < minDist) {
43610           minDist = dist;
43611           nearCenter = d;
43612         }
43613       });
43614       var image = selection2.selectAll("img").data(requests, function(d) {
43615         return d[3];
43616       });
43617       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
43618         var tile = select_default2(this);
43619         window.setTimeout(function() {
43620           if (tile.classed("tile-removing")) {
43621             tile.remove();
43622           }
43623         }, 300);
43624       });
43625       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
43626         return d[3];
43627       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
43628         return d === nearCenter;
43629       });
43630       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
43631         return d[3];
43632       });
43633       debug2.exit().remove();
43634       if (showDebug) {
43635         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
43636         debugEnter.append("div").attr("class", "tile-label-debug-coord");
43637         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
43638         debug2 = debug2.merge(debugEnter);
43639         debug2.style(transformProp, debugTransform);
43640         debug2.selectAll(".tile-label-debug-coord").text(function(d) {
43641           return d[2] + " / " + d[0] + " / " + d[1];
43642         });
43643         debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
43644           var span = select_default2(this);
43645           var center = context.projection.invert(tileCenter(d));
43646           _source.getMetadata(center, d, function(err, result) {
43647             if (result && result.vintage && result.vintage.range) {
43648               span.text(result.vintage.range);
43649             } else {
43650               span.html(_t.html("info_panels.background.vintage") + ": " + _t.html("info_panels.background.unknown"));
43651             }
43652           });
43653         });
43654       }
43655     }
43656     background.projection = function(val) {
43657       if (!arguments.length)
43658         return _projection;
43659       _projection = val;
43660       return background;
43661     };
43662     background.dimensions = function(val) {
43663       if (!arguments.length)
43664         return tiler8.size();
43665       tiler8.size(val);
43666       return background;
43667     };
43668     background.source = function(val) {
43669       if (!arguments.length)
43670         return _source;
43671       _source = val;
43672       _tileSize = _source.tileSize;
43673       _cache4 = {};
43674       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
43675       return background;
43676     };
43677     return background;
43678   }
43679
43680   // modules/renderer/background.js
43681   var _imageryIndex = null;
43682   function rendererBackground(context) {
43683     const dispatch10 = dispatch_default("change");
43684     const baseLayer = rendererTileLayer(context).projection(context.projection);
43685     let _checkedBlocklists = [];
43686     let _isValid = true;
43687     let _overlayLayers = [];
43688     let _brightness = 1;
43689     let _contrast = 1;
43690     let _saturation = 1;
43691     let _sharpness = 1;
43692     function ensureImageryIndex() {
43693       return _mainFileFetcher.get("imagery").then((sources) => {
43694         if (_imageryIndex)
43695           return _imageryIndex;
43696         _imageryIndex = {
43697           imagery: sources,
43698           features: {}
43699         };
43700         const features2 = sources.map((source) => {
43701           if (!source.polygon)
43702             return null;
43703           const rings = source.polygon.map((ring) => [ring]);
43704           const feature3 = {
43705             type: "Feature",
43706             properties: { id: source.id },
43707             geometry: { type: "MultiPolygon", coordinates: rings }
43708           };
43709           _imageryIndex.features[source.id] = feature3;
43710           return feature3;
43711         }).filter(Boolean);
43712         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: features2 });
43713         _imageryIndex.backgrounds = sources.map((source) => {
43714           if (source.type === "bing") {
43715             return rendererBackgroundSource.Bing(source, dispatch10);
43716           } else if (/^EsriWorldImagery/.test(source.id)) {
43717             return rendererBackgroundSource.Esri(source);
43718           } else {
43719             return rendererBackgroundSource(source);
43720           }
43721         });
43722         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
43723         let template = corePreferences("background-custom-template") || "";
43724         const custom = rendererBackgroundSource.Custom(template);
43725         _imageryIndex.backgrounds.unshift(custom);
43726         return _imageryIndex;
43727       });
43728     }
43729     function background(selection2) {
43730       const currSource = baseLayer.source();
43731       if (context.map().zoom() > 18) {
43732         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
43733           const center = context.map().center();
43734           currSource.fetchTilemap(center);
43735         }
43736       }
43737       const sources = background.sources(context.map().extent());
43738       const wasValid = _isValid;
43739       _isValid = !!sources.filter((d) => d === currSource).length;
43740       if (wasValid !== _isValid) {
43741         background.updateImagery();
43742       }
43743       let baseFilter = "";
43744       if (_brightness !== 1) {
43745         baseFilter += ` brightness(${_brightness})`;
43746       }
43747       if (_contrast !== 1) {
43748         baseFilter += ` contrast(${_contrast})`;
43749       }
43750       if (_saturation !== 1) {
43751         baseFilter += ` saturate(${_saturation})`;
43752       }
43753       if (_sharpness < 1) {
43754         const blur = number_default(0.5, 5)(1 - _sharpness);
43755         baseFilter += ` blur(${blur}px)`;
43756       }
43757       let base = selection2.selectAll(".layer-background").data([0]);
43758       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
43759       base.style("filter", baseFilter || null);
43760       let imagery = base.selectAll(".layer-imagery").data([0]);
43761       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
43762       let maskFilter = "";
43763       let mixBlendMode = "";
43764       if (_sharpness > 1) {
43765         mixBlendMode = "overlay";
43766         maskFilter = "saturate(0) blur(3px) invert(1)";
43767         let contrast = _sharpness - 1;
43768         maskFilter += ` contrast(${contrast})`;
43769         let brightness = number_default(1, 0.85)(_sharpness - 1);
43770         maskFilter += ` brightness(${brightness})`;
43771       }
43772       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
43773       mask.exit().remove();
43774       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);
43775       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
43776       overlays.exit().remove();
43777       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
43778     }
43779     background.updateImagery = function() {
43780       let currSource = baseLayer.source();
43781       if (context.inIntro() || !currSource)
43782         return;
43783       let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
43784       const meters = geoOffsetToMeters(currSource.offset());
43785       const EPSILON = 0.01;
43786       const x = +meters[0].toFixed(2);
43787       const y = +meters[1].toFixed(2);
43788       let hash = utilStringQs(window.location.hash);
43789       let id2 = currSource.id;
43790       if (id2 === "custom") {
43791         id2 = `custom:${currSource.template()}`;
43792       }
43793       if (id2) {
43794         hash.background = id2;
43795       } else {
43796         delete hash.background;
43797       }
43798       if (o) {
43799         hash.overlays = o;
43800       } else {
43801         delete hash.overlays;
43802       }
43803       if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
43804         hash.offset = `${x},${y}`;
43805       } else {
43806         delete hash.offset;
43807       }
43808       if (!window.mocha) {
43809         window.location.replace("#" + utilQsString(hash, true));
43810       }
43811       let imageryUsed = [];
43812       let photoOverlaysUsed = [];
43813       const currUsed = currSource.imageryUsed();
43814       if (currUsed && _isValid) {
43815         imageryUsed.push(currUsed);
43816       }
43817       _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
43818       const dataLayer = context.layers().layer("data");
43819       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
43820         imageryUsed.push(dataLayer.getSrc());
43821       }
43822       const photoOverlayLayers = {
43823         streetside: "Bing Streetside",
43824         mapillary: "Mapillary Images",
43825         "mapillary-map-features": "Mapillary Map Features",
43826         "mapillary-signs": "Mapillary Signs",
43827         kartaview: "KartaView Images"
43828       };
43829       for (let layerID in photoOverlayLayers) {
43830         const layer = context.layers().layer(layerID);
43831         if (layer && layer.enabled()) {
43832           photoOverlaysUsed.push(layerID);
43833           imageryUsed.push(photoOverlayLayers[layerID]);
43834         }
43835       }
43836       context.history().imageryUsed(imageryUsed);
43837       context.history().photoOverlaysUsed(photoOverlaysUsed);
43838     };
43839     background.sources = (extent, zoom, includeCurrent) => {
43840       if (!_imageryIndex)
43841         return [];
43842       let visible = {};
43843       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
43844       const currSource = baseLayer.source();
43845       const osm = context.connection();
43846       const blocklists = osm && osm.imageryBlocklists() || [];
43847       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
43848       if (blocklistChanged) {
43849         _imageryIndex.backgrounds.forEach((source) => {
43850           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
43851         });
43852         _checkedBlocklists = blocklists.map((regex) => String(regex));
43853       }
43854       return _imageryIndex.backgrounds.filter((source) => {
43855         if (includeCurrent && currSource === source)
43856           return true;
43857         if (source.isBlocked)
43858           return false;
43859         if (!source.polygon)
43860           return true;
43861         if (zoom && zoom < 6)
43862           return false;
43863         return visible[source.id];
43864       });
43865     };
43866     background.dimensions = (val) => {
43867       if (!val)
43868         return;
43869       baseLayer.dimensions(val);
43870       _overlayLayers.forEach((layer) => layer.dimensions(val));
43871     };
43872     background.baseLayerSource = function(d) {
43873       if (!arguments.length)
43874         return baseLayer.source();
43875       const osm = context.connection();
43876       if (!osm)
43877         return background;
43878       const blocklists = osm.imageryBlocklists();
43879       const template = d.template();
43880       let fail = false;
43881       let tested = 0;
43882       let regex;
43883       for (let i2 = 0; i2 < blocklists.length; i2++) {
43884         regex = blocklists[i2];
43885         fail = regex.test(template);
43886         tested++;
43887         if (fail)
43888           break;
43889       }
43890       if (!tested) {
43891         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
43892         fail = regex.test(template);
43893       }
43894       baseLayer.source(!fail ? d : background.findSource("none"));
43895       dispatch10.call("change");
43896       background.updateImagery();
43897       return background;
43898     };
43899     background.findSource = (id2) => {
43900       if (!id2 || !_imageryIndex)
43901         return null;
43902       return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
43903     };
43904     background.bing = () => {
43905       background.baseLayerSource(background.findSource("Bing"));
43906     };
43907     background.showsLayer = (d) => {
43908       const currSource = baseLayer.source();
43909       if (!d || !currSource)
43910         return false;
43911       return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
43912     };
43913     background.overlayLayerSources = () => {
43914       return _overlayLayers.map((layer) => layer.source());
43915     };
43916     background.toggleOverlayLayer = (d) => {
43917       let layer;
43918       for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
43919         layer = _overlayLayers[i2];
43920         if (layer.source() === d) {
43921           _overlayLayers.splice(i2, 1);
43922           dispatch10.call("change");
43923           background.updateImagery();
43924           return;
43925         }
43926       }
43927       layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(baseLayer.dimensions());
43928       _overlayLayers.push(layer);
43929       dispatch10.call("change");
43930       background.updateImagery();
43931     };
43932     background.nudge = (d, zoom) => {
43933       const currSource = baseLayer.source();
43934       if (currSource) {
43935         currSource.nudge(d, zoom);
43936         dispatch10.call("change");
43937         background.updateImagery();
43938       }
43939       return background;
43940     };
43941     background.offset = function(d) {
43942       const currSource = baseLayer.source();
43943       if (!arguments.length) {
43944         return currSource && currSource.offset() || [0, 0];
43945       }
43946       if (currSource) {
43947         currSource.offset(d);
43948         dispatch10.call("change");
43949         background.updateImagery();
43950       }
43951       return background;
43952     };
43953     background.brightness = function(d) {
43954       if (!arguments.length)
43955         return _brightness;
43956       _brightness = d;
43957       if (context.mode())
43958         dispatch10.call("change");
43959       return background;
43960     };
43961     background.contrast = function(d) {
43962       if (!arguments.length)
43963         return _contrast;
43964       _contrast = d;
43965       if (context.mode())
43966         dispatch10.call("change");
43967       return background;
43968     };
43969     background.saturation = function(d) {
43970       if (!arguments.length)
43971         return _saturation;
43972       _saturation = d;
43973       if (context.mode())
43974         dispatch10.call("change");
43975       return background;
43976     };
43977     background.sharpness = function(d) {
43978       if (!arguments.length)
43979         return _sharpness;
43980       _sharpness = d;
43981       if (context.mode())
43982         dispatch10.call("change");
43983       return background;
43984     };
43985     let _loadPromise;
43986     background.ensureLoaded = () => {
43987       if (_loadPromise)
43988         return _loadPromise;
43989       function parseMapParams(qmap) {
43990         if (!qmap)
43991           return false;
43992         const params = qmap.split("/").map(Number);
43993         if (params.length < 3 || params.some(isNaN))
43994           return false;
43995         return geoExtent([params[2], params[1]]);
43996       }
43997       const hash = utilStringQs(window.location.hash);
43998       const requested = hash.background || hash.layer;
43999       let extent = parseMapParams(hash.map);
44000       return _loadPromise = ensureImageryIndex().then((imageryIndex) => {
44001         const first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0];
44002         let best;
44003         if (!requested && extent) {
44004           best = background.sources(extent).find((s) => s.best());
44005         }
44006         if (requested && requested.indexOf("custom:") === 0) {
44007           const template = requested.replace(/^custom:/, "");
44008           const custom = background.findSource("custom");
44009           background.baseLayerSource(custom.template(template));
44010           corePreferences("background-custom-template", template);
44011         } else {
44012           background.baseLayerSource(background.findSource(requested) || best || background.findSource(corePreferences("background-last-used")) || background.findSource("Bing") || first || background.findSource("none"));
44013         }
44014         const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
44015         if (locator) {
44016           background.toggleOverlayLayer(locator);
44017         }
44018         const overlays = (hash.overlays || "").split(",");
44019         overlays.forEach((overlay) => {
44020           overlay = background.findSource(overlay);
44021           if (overlay) {
44022             background.toggleOverlayLayer(overlay);
44023           }
44024         });
44025         if (hash.gpx) {
44026           const gpx2 = context.layers().layer("data");
44027           if (gpx2) {
44028             gpx2.url(hash.gpx, ".gpx");
44029           }
44030         }
44031         if (hash.offset) {
44032           const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
44033           if (offset.length === 2) {
44034             background.offset(geoMetersToOffset(offset));
44035           }
44036         }
44037       }).catch(() => {
44038       });
44039     };
44040     return utilRebind(background, dispatch10, "on");
44041   }
44042
44043   // modules/renderer/features.js
44044   function rendererFeatures(context) {
44045     var dispatch10 = dispatch_default("change", "redraw");
44046     var features2 = utilRebind({}, dispatch10, "on");
44047     var _deferred2 = /* @__PURE__ */ new Set();
44048     var traffic_roads = {
44049       "motorway": true,
44050       "motorway_link": true,
44051       "trunk": true,
44052       "trunk_link": true,
44053       "primary": true,
44054       "primary_link": true,
44055       "secondary": true,
44056       "secondary_link": true,
44057       "tertiary": true,
44058       "tertiary_link": true,
44059       "residential": true,
44060       "unclassified": true,
44061       "living_street": true
44062     };
44063     var service_roads = {
44064       "service": true,
44065       "road": true,
44066       "track": true
44067     };
44068     var paths = {
44069       "path": true,
44070       "footway": true,
44071       "cycleway": true,
44072       "bridleway": true,
44073       "steps": true,
44074       "pedestrian": true
44075     };
44076     var past_futures = {
44077       "proposed": true,
44078       "construction": true,
44079       "abandoned": true,
44080       "dismantled": true,
44081       "disused": true,
44082       "razed": true,
44083       "demolished": true,
44084       "obliterated": true
44085     };
44086     var _cullFactor = 1;
44087     var _cache4 = {};
44088     var _rules = {};
44089     var _stats = {};
44090     var _keys = [];
44091     var _hidden = [];
44092     var _forceVisible = {};
44093     function update() {
44094       if (!window.mocha) {
44095         var hash = utilStringQs(window.location.hash);
44096         var disabled = features2.disabled();
44097         if (disabled.length) {
44098           hash.disable_features = disabled.join(",");
44099         } else {
44100           delete hash.disable_features;
44101         }
44102         window.location.replace("#" + utilQsString(hash, true));
44103         corePreferences("disabled-features", disabled.join(","));
44104       }
44105       _hidden = features2.hidden();
44106       dispatch10.call("change");
44107       dispatch10.call("redraw");
44108     }
44109     function defineRule(k, filter2, max3) {
44110       var isEnabled = true;
44111       _keys.push(k);
44112       _rules[k] = {
44113         filter: filter2,
44114         enabled: isEnabled,
44115         count: 0,
44116         currentMax: max3 || Infinity,
44117         defaultMax: max3 || Infinity,
44118         enable: function() {
44119           this.enabled = true;
44120           this.currentMax = this.defaultMax;
44121         },
44122         disable: function() {
44123           this.enabled = false;
44124           this.currentMax = 0;
44125         },
44126         hidden: function() {
44127           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
44128         },
44129         autoHidden: function() {
44130           return this.hidden() && this.currentMax > 0;
44131         }
44132       };
44133     }
44134     defineRule("points", function isPoint(tags, geometry) {
44135       return geometry === "point";
44136     }, 200);
44137     defineRule("traffic_roads", function isTrafficRoad(tags) {
44138       return traffic_roads[tags.highway];
44139     });
44140     defineRule("service_roads", function isServiceRoad(tags) {
44141       return service_roads[tags.highway];
44142     });
44143     defineRule("paths", function isPath(tags) {
44144       return paths[tags.highway];
44145     });
44146     defineRule("buildings", function isBuilding(tags) {
44147       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
44148     }, 250);
44149     defineRule("building_parts", function isBuildingPart(tags) {
44150       return tags["building:part"];
44151     });
44152     defineRule("indoor", function isIndoor(tags) {
44153       return tags.indoor;
44154     });
44155     defineRule("landuse", function isLanduse(tags, geometry) {
44156       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
44157     });
44158     defineRule("boundaries", function isBoundary(tags) {
44159       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);
44160     });
44161     defineRule("water", function isWater(tags) {
44162       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";
44163     });
44164     defineRule("rail", function isRail(tags) {
44165       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
44166     });
44167     defineRule("pistes", function isPiste(tags) {
44168       return tags["piste:type"];
44169     });
44170     defineRule("aerialways", function isPiste(tags) {
44171       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
44172     });
44173     defineRule("power", function isPower(tags) {
44174       return !!tags.power;
44175     });
44176     defineRule("past_future", function isPastFuture(tags) {
44177       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
44178         return false;
44179       }
44180       var strings = Object.keys(tags);
44181       for (var i2 = 0; i2 < strings.length; i2++) {
44182         var s = strings[i2];
44183         if (past_futures[s] || past_futures[tags[s]]) {
44184           return true;
44185         }
44186       }
44187       return false;
44188     });
44189     defineRule("others", function isOther(tags, geometry) {
44190       return geometry === "line" || geometry === "area";
44191     });
44192     features2.features = function() {
44193       return _rules;
44194     };
44195     features2.keys = function() {
44196       return _keys;
44197     };
44198     features2.enabled = function(k) {
44199       if (!arguments.length) {
44200         return _keys.filter(function(k2) {
44201           return _rules[k2].enabled;
44202         });
44203       }
44204       return _rules[k] && _rules[k].enabled;
44205     };
44206     features2.disabled = function(k) {
44207       if (!arguments.length) {
44208         return _keys.filter(function(k2) {
44209           return !_rules[k2].enabled;
44210         });
44211       }
44212       return _rules[k] && !_rules[k].enabled;
44213     };
44214     features2.hidden = function(k) {
44215       if (!arguments.length) {
44216         return _keys.filter(function(k2) {
44217           return _rules[k2].hidden();
44218         });
44219       }
44220       return _rules[k] && _rules[k].hidden();
44221     };
44222     features2.autoHidden = function(k) {
44223       if (!arguments.length) {
44224         return _keys.filter(function(k2) {
44225           return _rules[k2].autoHidden();
44226         });
44227       }
44228       return _rules[k] && _rules[k].autoHidden();
44229     };
44230     features2.enable = function(k) {
44231       if (_rules[k] && !_rules[k].enabled) {
44232         _rules[k].enable();
44233         update();
44234       }
44235     };
44236     features2.enableAll = function() {
44237       var didEnable = false;
44238       for (var k in _rules) {
44239         if (!_rules[k].enabled) {
44240           didEnable = true;
44241           _rules[k].enable();
44242         }
44243       }
44244       if (didEnable)
44245         update();
44246     };
44247     features2.disable = function(k) {
44248       if (_rules[k] && _rules[k].enabled) {
44249         _rules[k].disable();
44250         update();
44251       }
44252     };
44253     features2.disableAll = function() {
44254       var didDisable = false;
44255       for (var k in _rules) {
44256         if (_rules[k].enabled) {
44257           didDisable = true;
44258           _rules[k].disable();
44259         }
44260       }
44261       if (didDisable)
44262         update();
44263     };
44264     features2.toggle = function(k) {
44265       if (_rules[k]) {
44266         (function(f2) {
44267           return f2.enabled ? f2.disable() : f2.enable();
44268         })(_rules[k]);
44269         update();
44270       }
44271     };
44272     features2.resetStats = function() {
44273       for (var i2 = 0; i2 < _keys.length; i2++) {
44274         _rules[_keys[i2]].count = 0;
44275       }
44276       dispatch10.call("change");
44277     };
44278     features2.gatherStats = function(d, resolver, dimensions) {
44279       var needsRedraw = false;
44280       var types = utilArrayGroupBy(d, "type");
44281       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44282       var currHidden, geometry, matches, i2, j2;
44283       for (i2 = 0; i2 < _keys.length; i2++) {
44284         _rules[_keys[i2]].count = 0;
44285       }
44286       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
44287       for (i2 = 0; i2 < entities.length; i2++) {
44288         geometry = entities[i2].geometry(resolver);
44289         matches = Object.keys(features2.getMatches(entities[i2], resolver, geometry));
44290         for (j2 = 0; j2 < matches.length; j2++) {
44291           _rules[matches[j2]].count++;
44292         }
44293       }
44294       currHidden = features2.hidden();
44295       if (currHidden !== _hidden) {
44296         _hidden = currHidden;
44297         needsRedraw = true;
44298         dispatch10.call("change");
44299       }
44300       return needsRedraw;
44301     };
44302     features2.stats = function() {
44303       for (var i2 = 0; i2 < _keys.length; i2++) {
44304         _stats[_keys[i2]] = _rules[_keys[i2]].count;
44305       }
44306       return _stats;
44307     };
44308     features2.clear = function(d) {
44309       for (var i2 = 0; i2 < d.length; i2++) {
44310         features2.clearEntity(d[i2]);
44311       }
44312     };
44313     features2.clearEntity = function(entity) {
44314       delete _cache4[osmEntity.key(entity)];
44315     };
44316     features2.reset = function() {
44317       Array.from(_deferred2).forEach(function(handle) {
44318         window.cancelIdleCallback(handle);
44319         _deferred2.delete(handle);
44320       });
44321       _cache4 = {};
44322     };
44323     function relationShouldBeChecked(relation) {
44324       return relation.tags.type === "boundary";
44325     }
44326     features2.getMatches = function(entity, resolver, geometry) {
44327       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
44328         return {};
44329       var ent = osmEntity.key(entity);
44330       if (!_cache4[ent]) {
44331         _cache4[ent] = {};
44332       }
44333       if (!_cache4[ent].matches) {
44334         var matches = {};
44335         var hasMatch = false;
44336         for (var i2 = 0; i2 < _keys.length; i2++) {
44337           if (_keys[i2] === "others") {
44338             if (hasMatch)
44339               continue;
44340             if (entity.type === "way") {
44341               var parents = features2.getParents(entity, resolver, geometry);
44342               if (parents.length === 1 && parents[0].isMultipolygon() || parents.length > 0 && parents.every(function(parent) {
44343                 return parent.tags.type === "boundary";
44344               })) {
44345                 var pkey = osmEntity.key(parents[0]);
44346                 if (_cache4[pkey] && _cache4[pkey].matches) {
44347                   matches = Object.assign({}, _cache4[pkey].matches);
44348                   continue;
44349                 }
44350               }
44351             }
44352           }
44353           if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
44354             matches[_keys[i2]] = hasMatch = true;
44355           }
44356         }
44357         _cache4[ent].matches = matches;
44358       }
44359       return _cache4[ent].matches;
44360     };
44361     features2.getParents = function(entity, resolver, geometry) {
44362       if (geometry === "point")
44363         return [];
44364       var ent = osmEntity.key(entity);
44365       if (!_cache4[ent]) {
44366         _cache4[ent] = {};
44367       }
44368       if (!_cache4[ent].parents) {
44369         var parents = [];
44370         if (geometry === "vertex") {
44371           parents = resolver.parentWays(entity);
44372         } else {
44373           parents = resolver.parentRelations(entity);
44374         }
44375         _cache4[ent].parents = parents;
44376       }
44377       return _cache4[ent].parents;
44378     };
44379     features2.isHiddenPreset = function(preset, geometry) {
44380       if (!_hidden.length)
44381         return false;
44382       if (!preset.tags)
44383         return false;
44384       var test = preset.setTags({}, geometry);
44385       for (var key in _rules) {
44386         if (_rules[key].filter(test, geometry)) {
44387           if (_hidden.indexOf(key) !== -1) {
44388             return key;
44389           }
44390           return false;
44391         }
44392       }
44393       return false;
44394     };
44395     features2.isHiddenFeature = function(entity, resolver, geometry) {
44396       if (!_hidden.length)
44397         return false;
44398       if (!entity.version)
44399         return false;
44400       if (_forceVisible[entity.id])
44401         return false;
44402       var matches = Object.keys(features2.getMatches(entity, resolver, geometry));
44403       return matches.length && matches.every(function(k) {
44404         return features2.hidden(k);
44405       });
44406     };
44407     features2.isHiddenChild = function(entity, resolver, geometry) {
44408       if (!_hidden.length)
44409         return false;
44410       if (!entity.version || geometry === "point")
44411         return false;
44412       if (_forceVisible[entity.id])
44413         return false;
44414       var parents = features2.getParents(entity, resolver, geometry);
44415       if (!parents.length)
44416         return false;
44417       for (var i2 = 0; i2 < parents.length; i2++) {
44418         if (!features2.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
44419           return false;
44420         }
44421       }
44422       return true;
44423     };
44424     features2.hasHiddenConnections = function(entity, resolver) {
44425       if (!_hidden.length)
44426         return false;
44427       var childNodes, connections;
44428       if (entity.type === "midpoint") {
44429         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
44430         connections = [];
44431       } else {
44432         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
44433         connections = features2.getParents(entity, resolver, entity.geometry(resolver));
44434       }
44435       connections = childNodes.reduce(function(result, e) {
44436         return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
44437       }, connections);
44438       return connections.some(function(e) {
44439         return features2.isHidden(e, resolver, e.geometry(resolver));
44440       });
44441     };
44442     features2.isHidden = function(entity, resolver, geometry) {
44443       if (!_hidden.length)
44444         return false;
44445       if (!entity.version)
44446         return false;
44447       var fn = geometry === "vertex" ? features2.isHiddenChild : features2.isHiddenFeature;
44448       return fn(entity, resolver, geometry);
44449     };
44450     features2.filter = function(d, resolver) {
44451       if (!_hidden.length)
44452         return d;
44453       var result = [];
44454       for (var i2 = 0; i2 < d.length; i2++) {
44455         var entity = d[i2];
44456         if (!features2.isHidden(entity, resolver, entity.geometry(resolver))) {
44457           result.push(entity);
44458         }
44459       }
44460       return result;
44461     };
44462     features2.forceVisible = function(entityIDs) {
44463       if (!arguments.length)
44464         return Object.keys(_forceVisible);
44465       _forceVisible = {};
44466       for (var i2 = 0; i2 < entityIDs.length; i2++) {
44467         _forceVisible[entityIDs[i2]] = true;
44468         var entity = context.hasEntity(entityIDs[i2]);
44469         if (entity && entity.type === "relation") {
44470           for (var j2 in entity.members) {
44471             _forceVisible[entity.members[j2].id] = true;
44472           }
44473         }
44474       }
44475       return features2;
44476     };
44477     features2.init = function() {
44478       var storage = corePreferences("disabled-features");
44479       if (storage) {
44480         var storageDisabled = storage.replace(/;/g, ",").split(",");
44481         storageDisabled.forEach(features2.disable);
44482       }
44483       var hash = utilStringQs(window.location.hash);
44484       if (hash.disable_features) {
44485         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
44486         hashDisabled.forEach(features2.disable);
44487       }
44488     };
44489     context.history().on("merge.features", function(newEntities) {
44490       if (!newEntities)
44491         return;
44492       var handle = window.requestIdleCallback(function() {
44493         var graph = context.graph();
44494         var types = utilArrayGroupBy(newEntities, "type");
44495         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44496         for (var i2 = 0; i2 < entities.length; i2++) {
44497           var geometry = entities[i2].geometry(graph);
44498           features2.getMatches(entities[i2], graph, geometry);
44499         }
44500       });
44501       _deferred2.add(handle);
44502     });
44503     return features2;
44504   }
44505
44506   // modules/svg/areas.js
44507   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
44508
44509   // modules/svg/helpers.js
44510   function svgPassiveVertex(node, graph, activeID) {
44511     if (!activeID)
44512       return 1;
44513     if (activeID === node.id)
44514       return 0;
44515     var parents = graph.parentWays(node);
44516     var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
44517     for (i2 = 0; i2 < parents.length; i2++) {
44518       nodes = parents[i2].nodes;
44519       isClosed = parents[i2].isClosed();
44520       for (j2 = 0; j2 < nodes.length; j2++) {
44521         if (nodes[j2] === node.id) {
44522           ix1 = j2 - 2;
44523           ix2 = j2 - 1;
44524           ix3 = j2 + 1;
44525           ix4 = j2 + 2;
44526           if (isClosed) {
44527             max3 = nodes.length - 1;
44528             if (ix1 < 0)
44529               ix1 = max3 + ix1;
44530             if (ix2 < 0)
44531               ix2 = max3 + ix2;
44532             if (ix3 > max3)
44533               ix3 = ix3 - max3;
44534             if (ix4 > max3)
44535               ix4 = ix4 - max3;
44536           }
44537           if (nodes[ix1] === activeID)
44538             return 0;
44539           else if (nodes[ix2] === activeID)
44540             return 2;
44541           else if (nodes[ix3] === activeID)
44542             return 2;
44543           else if (nodes[ix4] === activeID)
44544             return 0;
44545           else if (isClosed && nodes.indexOf(activeID) !== -1)
44546             return 0;
44547         }
44548       }
44549     }
44550     return 1;
44551   }
44552   function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
44553     return function(entity) {
44554       var i2 = 0;
44555       var offset = dt;
44556       var segments = [];
44557       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
44558       var coordinates = graph.childNodes(entity).map(function(n2) {
44559         return n2.loc;
44560       });
44561       var a, b;
44562       if (shouldReverse(entity)) {
44563         coordinates.reverse();
44564       }
44565       stream_default({
44566         type: "LineString",
44567         coordinates
44568       }, projection2.stream(clip({
44569         lineStart: function() {
44570         },
44571         lineEnd: function() {
44572           a = null;
44573         },
44574         point: function(x, y) {
44575           b = [x, y];
44576           if (a) {
44577             var span = geoVecLength(a, b) - offset;
44578             if (span >= 0) {
44579               var heading = geoVecAngle(a, b);
44580               var dx = dt * Math.cos(heading);
44581               var dy = dt * Math.sin(heading);
44582               var p = [
44583                 a[0] + offset * Math.cos(heading),
44584                 a[1] + offset * Math.sin(heading)
44585               ];
44586               var coord2 = [a, p];
44587               for (span -= dt; span >= 0; span -= dt) {
44588                 p = geoVecAdd(p, [dx, dy]);
44589                 coord2.push(p);
44590               }
44591               coord2.push(b);
44592               var segment = "";
44593               var j2;
44594               for (j2 = 0; j2 < coord2.length; j2++) {
44595                 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44596               }
44597               segments.push({ id: entity.id, index: i2++, d: segment });
44598               if (bothDirections(entity)) {
44599                 segment = "";
44600                 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
44601                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44602                 }
44603                 segments.push({ id: entity.id, index: i2++, d: segment });
44604               }
44605             }
44606             offset = -span;
44607           }
44608           a = b;
44609         }
44610       })));
44611       return segments;
44612     };
44613   }
44614   function svgPath(projection2, graph, isArea) {
44615     var cache = {};
44616     var padding = isArea ? 65 : 5;
44617     var viewport = projection2.clipExtent();
44618     var paddedExtent = [
44619       [viewport[0][0] - padding, viewport[0][1] - padding],
44620       [viewport[1][0] + padding, viewport[1][1] + padding]
44621     ];
44622     var clip = identity_default2().clipExtent(paddedExtent).stream;
44623     var project = projection2.stream;
44624     var path = path_default().projection({ stream: function(output) {
44625       return project(clip(output));
44626     } });
44627     var svgpath = function(entity) {
44628       if (entity.id in cache) {
44629         return cache[entity.id];
44630       } else {
44631         return cache[entity.id] = path(entity.asGeoJSON(graph));
44632       }
44633     };
44634     svgpath.geojson = function(d) {
44635       if (d.__featurehash__ !== void 0) {
44636         if (d.__featurehash__ in cache) {
44637           return cache[d.__featurehash__];
44638         } else {
44639           return cache[d.__featurehash__] = path(d);
44640         }
44641       } else {
44642         return path(d);
44643       }
44644     };
44645     return svgpath;
44646   }
44647   function svgPointTransform(projection2) {
44648     var svgpoint = function(entity) {
44649       var pt = projection2(entity.loc);
44650       return "translate(" + pt[0] + "," + pt[1] + ")";
44651     };
44652     svgpoint.geojson = function(d) {
44653       return svgpoint(d.properties.entity);
44654     };
44655     return svgpoint;
44656   }
44657   function svgRelationMemberTags(graph) {
44658     return function(entity) {
44659       var tags = entity.tags;
44660       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
44661       graph.parentRelations(entity).forEach(function(relation) {
44662         var type3 = relation.tags.type;
44663         if (type3 === "multipolygon" && shouldCopyMultipolygonTags || type3 === "boundary") {
44664           tags = Object.assign({}, relation.tags, tags);
44665         }
44666       });
44667       return tags;
44668     };
44669   }
44670   function svgSegmentWay(way, graph, activeID) {
44671     if (activeID === void 0) {
44672       return graph.transient(way, "waySegments", getWaySegments);
44673     } else {
44674       return getWaySegments();
44675     }
44676     function getWaySegments() {
44677       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
44678       var features2 = { passive: [], active: [] };
44679       var start2 = {};
44680       var end = {};
44681       var node, type3;
44682       for (var i2 = 0; i2 < way.nodes.length; i2++) {
44683         node = graph.entity(way.nodes[i2]);
44684         type3 = svgPassiveVertex(node, graph, activeID);
44685         end = { node, type: type3 };
44686         if (start2.type !== void 0) {
44687           if (start2.node.id === activeID || end.node.id === activeID) {
44688           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
44689             pushActive(start2, end, i2);
44690           } else if (start2.type === 0 && end.type === 0) {
44691             pushActive(start2, end, i2);
44692           } else {
44693             pushPassive(start2, end, i2);
44694           }
44695         }
44696         start2 = end;
44697       }
44698       return features2;
44699       function pushActive(start3, end2, index) {
44700         features2.active.push({
44701           type: "Feature",
44702           id: way.id + "-" + index + "-nope",
44703           properties: {
44704             nope: true,
44705             target: true,
44706             entity: way,
44707             nodes: [start3.node, end2.node],
44708             index
44709           },
44710           geometry: {
44711             type: "LineString",
44712             coordinates: [start3.node.loc, end2.node.loc]
44713           }
44714         });
44715       }
44716       function pushPassive(start3, end2, index) {
44717         features2.passive.push({
44718           type: "Feature",
44719           id: way.id + "-" + index,
44720           properties: {
44721             target: true,
44722             entity: way,
44723             nodes: [start3.node, end2.node],
44724             index
44725           },
44726           geometry: {
44727             type: "LineString",
44728             coordinates: [start3.node.loc, end2.node.loc]
44729           }
44730         });
44731       }
44732     }
44733   }
44734
44735   // modules/svg/tag_classes.js
44736   function svgTagClasses() {
44737     var primaries = [
44738       "building",
44739       "highway",
44740       "railway",
44741       "waterway",
44742       "aeroway",
44743       "aerialway",
44744       "piste:type",
44745       "boundary",
44746       "power",
44747       "amenity",
44748       "natural",
44749       "landuse",
44750       "leisure",
44751       "military",
44752       "place",
44753       "man_made",
44754       "route",
44755       "attraction",
44756       "building:part",
44757       "indoor"
44758     ];
44759     var statuses = [
44760       "proposed",
44761       "planned",
44762       "construction",
44763       "disused",
44764       "abandoned",
44765       "dismantled",
44766       "razed",
44767       "demolished",
44768       "obliterated",
44769       "intermittent"
44770     ];
44771     var secondaries = [
44772       "oneway",
44773       "bridge",
44774       "tunnel",
44775       "embankment",
44776       "cutting",
44777       "barrier",
44778       "surface",
44779       "tracktype",
44780       "footway",
44781       "crossing",
44782       "service",
44783       "sport",
44784       "public_transport",
44785       "location",
44786       "parking",
44787       "golf",
44788       "type",
44789       "leisure",
44790       "man_made",
44791       "indoor",
44792       "construction",
44793       "proposed"
44794     ];
44795     var _tags = function(entity) {
44796       return entity.tags;
44797     };
44798     var tagClasses = function(selection2) {
44799       selection2.each(function tagClassesEach(entity) {
44800         var value = this.className;
44801         if (value.baseVal !== void 0) {
44802           value = value.baseVal;
44803         }
44804         var t = _tags(entity);
44805         var computed = tagClasses.getClassesString(t, value);
44806         if (computed !== value) {
44807           select_default2(this).attr("class", computed);
44808         }
44809       });
44810     };
44811     tagClasses.getClassesString = function(t, value) {
44812       var primary, status;
44813       var i2, j2, k, v;
44814       var overrideGeometry;
44815       if (/\bstroke\b/.test(value)) {
44816         if (!!t.barrier && t.barrier !== "no") {
44817           overrideGeometry = "line";
44818         }
44819       }
44820       var classes = value.trim().split(/\s+/).filter(function(klass) {
44821         return klass.length && !/^tag-/.test(klass);
44822       }).map(function(klass) {
44823         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
44824       });
44825       for (i2 = 0; i2 < primaries.length; i2++) {
44826         k = primaries[i2];
44827         v = t[k];
44828         if (!v || v === "no")
44829           continue;
44830         if (k === "piste:type") {
44831           k = "piste";
44832         } else if (k === "building:part") {
44833           k = "building_part";
44834         }
44835         primary = k;
44836         if (statuses.indexOf(v) !== -1) {
44837           status = v;
44838           classes.push("tag-" + k);
44839         } else {
44840           classes.push("tag-" + k);
44841           classes.push("tag-" + k + "-" + v);
44842         }
44843         break;
44844       }
44845       if (!primary) {
44846         for (i2 = 0; i2 < statuses.length; i2++) {
44847           for (j2 = 0; j2 < primaries.length; j2++) {
44848             k = statuses[i2] + ":" + primaries[j2];
44849             v = t[k];
44850             if (!v || v === "no")
44851               continue;
44852             status = statuses[i2];
44853             break;
44854           }
44855         }
44856       }
44857       if (!status) {
44858         for (i2 = 0; i2 < statuses.length; i2++) {
44859           k = statuses[i2];
44860           v = t[k];
44861           if (!v || v === "no")
44862             continue;
44863           if (v === "yes") {
44864             status = k;
44865           } else if (primary && primary === v) {
44866             status = k;
44867           } else if (!primary && primaries.indexOf(v) !== -1) {
44868             status = k;
44869             primary = v;
44870             classes.push("tag-" + v);
44871           }
44872           if (status)
44873             break;
44874         }
44875       }
44876       if (status) {
44877         classes.push("tag-status");
44878         classes.push("tag-status-" + status);
44879       }
44880       for (i2 = 0; i2 < secondaries.length; i2++) {
44881         k = secondaries[i2];
44882         v = t[k];
44883         if (!v || v === "no" || k === primary)
44884           continue;
44885         classes.push("tag-" + k);
44886         classes.push("tag-" + k + "-" + v);
44887       }
44888       if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
44889         var surface = t.highway === "track" ? "unpaved" : "paved";
44890         for (k in t) {
44891           v = t[k];
44892           if (k in osmPavedTags) {
44893             surface = osmPavedTags[k][v] ? "paved" : "unpaved";
44894           }
44895           if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
44896             surface = "semipaved";
44897           }
44898         }
44899         classes.push("tag-" + surface);
44900       }
44901       var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
44902       if (qid) {
44903         classes.push("tag-wikidata");
44904       }
44905       return classes.join(" ").trim();
44906     };
44907     tagClasses.tags = function(val) {
44908       if (!arguments.length)
44909         return _tags;
44910       _tags = val;
44911       return tagClasses;
44912     };
44913     return tagClasses;
44914   }
44915
44916   // modules/svg/tag_pattern.js
44917   var patterns = {
44918     amenity: {
44919       grave_yard: "cemetery",
44920       fountain: "water_standing"
44921     },
44922     landuse: {
44923       cemetery: [
44924         { religion: "christian", pattern: "cemetery_christian" },
44925         { religion: "buddhist", pattern: "cemetery_buddhist" },
44926         { religion: "muslim", pattern: "cemetery_muslim" },
44927         { religion: "jewish", pattern: "cemetery_jewish" },
44928         { pattern: "cemetery" }
44929       ],
44930       construction: "construction",
44931       farmland: "farmland",
44932       farmyard: "farmyard",
44933       forest: [
44934         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
44935         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
44936         { leaf_type: "leafless", pattern: "forest_leafless" },
44937         { pattern: "forest" }
44938       ],
44939       grave_yard: "cemetery",
44940       grass: "grass",
44941       landfill: "landfill",
44942       meadow: "meadow",
44943       military: "construction",
44944       orchard: "orchard",
44945       quarry: "quarry",
44946       vineyard: "vineyard"
44947     },
44948     leisure: {
44949       horse_riding: "farmyard"
44950     },
44951     natural: {
44952       beach: "beach",
44953       grassland: "grass",
44954       sand: "beach",
44955       scrub: "scrub",
44956       water: [
44957         { water: "pond", pattern: "pond" },
44958         { water: "reservoir", pattern: "water_standing" },
44959         { pattern: "waves" }
44960       ],
44961       wetland: [
44962         { wetland: "marsh", pattern: "wetland_marsh" },
44963         { wetland: "swamp", pattern: "wetland_swamp" },
44964         { wetland: "bog", pattern: "wetland_bog" },
44965         { wetland: "reedbed", pattern: "wetland_reedbed" },
44966         { pattern: "wetland" }
44967       ],
44968       wood: [
44969         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
44970         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
44971         { leaf_type: "leafless", pattern: "forest_leafless" },
44972         { pattern: "forest" }
44973       ]
44974     },
44975     golf: {
44976       green: "golf_green",
44977       tee: "grass",
44978       fairway: "grass",
44979       rough: "scrub"
44980     },
44981     surface: {
44982       grass: "grass",
44983       sand: "beach"
44984     }
44985   };
44986   function svgTagPattern(tags) {
44987     if (tags.building && tags.building !== "no") {
44988       return null;
44989     }
44990     for (var tag in patterns) {
44991       var entityValue = tags[tag];
44992       if (!entityValue)
44993         continue;
44994       if (typeof patterns[tag] === "string") {
44995         return "pattern-" + patterns[tag];
44996       } else {
44997         var values = patterns[tag];
44998         for (var value in values) {
44999           if (entityValue !== value)
45000             continue;
45001           var rules = values[value];
45002           if (typeof rules === "string") {
45003             return "pattern-" + rules;
45004           }
45005           for (var ruleKey in rules) {
45006             var rule = rules[ruleKey];
45007             var pass = true;
45008             for (var criterion in rule) {
45009               if (criterion !== "pattern") {
45010                 var v = tags[criterion];
45011                 if (!v || v !== rule[criterion]) {
45012                   pass = false;
45013                   break;
45014                 }
45015               }
45016             }
45017             if (pass) {
45018               return "pattern-" + rule.pattern;
45019             }
45020           }
45021         }
45022       }
45023     }
45024     return null;
45025   }
45026
45027   // modules/svg/areas.js
45028   function svgAreas(projection2, context) {
45029     function getPatternStyle(tags) {
45030       var imageID = svgTagPattern(tags);
45031       if (imageID) {
45032         return 'url("#ideditor-' + imageID + '")';
45033       }
45034       return "";
45035     }
45036     function drawTargets(selection2, graph, entities, filter2) {
45037       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
45038       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
45039       var getPath = svgPath(projection2).geojson;
45040       var activeID = context.activeID();
45041       var base = context.history().base();
45042       var data = { targets: [], nopes: [] };
45043       entities.forEach(function(way) {
45044         var features2 = svgSegmentWay(way, graph, activeID);
45045         data.targets.push.apply(data.targets, features2.passive);
45046         data.nopes.push.apply(data.nopes, features2.active);
45047       });
45048       var targetData = data.targets.filter(getPath);
45049       var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
45050         return filter2(d.properties.entity);
45051       }).data(targetData, function key(d) {
45052         return d.id;
45053       });
45054       targets.exit().remove();
45055       var segmentWasEdited = function(d) {
45056         var wayID = d.properties.entity.id;
45057         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
45058           return false;
45059         }
45060         return d.properties.nodes.some(function(n2) {
45061           return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
45062         });
45063       };
45064       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
45065         return "way area target target-allowed " + targetClass + d.id;
45066       }).classed("segment-edited", segmentWasEdited);
45067       var nopeData = data.nopes.filter(getPath);
45068       var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
45069         return filter2(d.properties.entity);
45070       }).data(nopeData, function key(d) {
45071         return d.id;
45072       });
45073       nopes.exit().remove();
45074       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
45075         return "way area target target-nope " + nopeClass + d.id;
45076       }).classed("segment-edited", segmentWasEdited);
45077     }
45078     function drawAreas(selection2, graph, entities, filter2) {
45079       var path = svgPath(projection2, graph, true);
45080       var areas = {};
45081       var multipolygon;
45082       var base = context.history().base();
45083       for (var i2 = 0; i2 < entities.length; i2++) {
45084         var entity = entities[i2];
45085         if (entity.geometry(graph) !== "area")
45086           continue;
45087         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
45088         if (multipolygon) {
45089           areas[multipolygon.id] = {
45090             entity: multipolygon.mergeTags(entity.tags),
45091             area: Math.abs(entity.area(graph))
45092           };
45093         } else if (!areas[entity.id]) {
45094           areas[entity.id] = {
45095             entity,
45096             area: Math.abs(entity.area(graph))
45097           };
45098         }
45099       }
45100       var fills = Object.values(areas).filter(function hasPath(a) {
45101         return path(a.entity);
45102       });
45103       fills.sort(function areaSort(a, b) {
45104         return b.area - a.area;
45105       });
45106       fills = fills.map(function(a) {
45107         return a.entity;
45108       });
45109       var strokes = fills.filter(function(area) {
45110         return area.type === "way";
45111       });
45112       var data = {
45113         clip: fills,
45114         shadow: strokes,
45115         stroke: strokes,
45116         fill: fills
45117       };
45118       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
45119       clipPaths.exit().remove();
45120       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
45121         return "ideditor-" + entity2.id + "-clippath";
45122       });
45123       clipPathsEnter.append("path");
45124       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
45125       var drawLayer = selection2.selectAll(".layer-osm.areas");
45126       var touchLayer = selection2.selectAll(".layer-touch.areas");
45127       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
45128       areagroup = areagroup.enter().append("g").attr("class", function(d) {
45129         return "areagroup area-" + d;
45130       }).merge(areagroup);
45131       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
45132         return data[layer];
45133       }, osmEntity.key);
45134       paths.exit().remove();
45135       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
45136       var bisect = bisector(function(node) {
45137         return -node.__data__.area(graph);
45138       }).left;
45139       function sortedByArea(entity2) {
45140         if (this._parent.__data__ === "fill") {
45141           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
45142         }
45143       }
45144       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
45145         var layer = this.parentNode.__data__;
45146         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
45147         if (layer === "fill") {
45148           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
45149           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
45150         }
45151       }).classed("added", function(d) {
45152         return !base.entities[d.id];
45153       }).classed("geometry-edited", function(d) {
45154         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);
45155       }).classed("retagged", function(d) {
45156         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);
45157       }).call(svgTagClasses()).attr("d", path);
45158       touchLayer.call(drawTargets, graph, data.stroke, filter2);
45159     }
45160     return drawAreas;
45161   }
45162
45163   // modules/svg/data.js
45164   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
45165
45166   // node_modules/@tmcw/togeojson/dist/togeojson.es.js
45167   function nodeVal(x) {
45168     if (x && x.normalize) {
45169       x.normalize();
45170     }
45171     return x && x.textContent || "";
45172   }
45173   function get1(x, y) {
45174     const n2 = x.getElementsByTagName(y);
45175     return n2.length ? n2[0] : null;
45176   }
45177   function getLineStyle(extensions) {
45178     const style = {};
45179     if (extensions) {
45180       const lineStyle = get1(extensions, "line");
45181       if (lineStyle) {
45182         const color2 = nodeVal(get1(lineStyle, "color")), opacity = parseFloat(nodeVal(get1(lineStyle, "opacity"))), width = parseFloat(nodeVal(get1(lineStyle, "width")));
45183         if (color2)
45184           style.stroke = color2;
45185         if (!isNaN(opacity))
45186           style["stroke-opacity"] = opacity;
45187         if (!isNaN(width))
45188           style["stroke-width"] = width * 96 / 25.4;
45189       }
45190     }
45191     return style;
45192   }
45193   function getExtensions(node) {
45194     let values = [];
45195     if (node !== null) {
45196       for (let i2 = 0; i2 < node.childNodes.length; i2++) {
45197         const child = node.childNodes[i2];
45198         if (child.nodeType !== 1)
45199           continue;
45200         const name2 = ["heart", "gpxtpx:hr", "hr"].includes(child.nodeName) ? "heart" : child.nodeName;
45201         if (name2 === "gpxtpx:TrackPointExtension") {
45202           values = values.concat(getExtensions(child));
45203         } else {
45204           const val = nodeVal(child);
45205           values.push([name2, isNaN(val) ? val : parseFloat(val)]);
45206         }
45207       }
45208     }
45209     return values;
45210   }
45211   function getMulti(x, ys) {
45212     const o = {};
45213     let n2;
45214     let k;
45215     for (k = 0; k < ys.length; k++) {
45216       n2 = get1(x, ys[k]);
45217       if (n2)
45218         o[ys[k]] = nodeVal(n2);
45219     }
45220     return o;
45221   }
45222   function getProperties$1(node) {
45223     const prop = getMulti(node, [
45224       "name",
45225       "cmt",
45226       "desc",
45227       "type",
45228       "time",
45229       "keywords"
45230     ]);
45231     const extensions = node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*");
45232     for (let i2 = 0; i2 < extensions.length; i2++) {
45233       const extension = extensions[i2];
45234       if (extension.parentNode.parentNode === node) {
45235         prop[extension.tagName.replace(":", "_")] = nodeVal(extension);
45236       }
45237     }
45238     const links = node.getElementsByTagName("link");
45239     if (links.length)
45240       prop.links = [];
45241     for (let i2 = 0; i2 < links.length; i2++) {
45242       prop.links.push(Object.assign({ href: links[i2].getAttribute("href") }, getMulti(links[i2], ["text", "type"])));
45243     }
45244     return prop;
45245   }
45246   function coordPair$1(x) {
45247     const ll = [
45248       parseFloat(x.getAttribute("lon")),
45249       parseFloat(x.getAttribute("lat"))
45250     ];
45251     const ele = get1(x, "ele");
45252     const time = get1(x, "time");
45253     if (ele) {
45254       const e = parseFloat(nodeVal(ele));
45255       if (!isNaN(e)) {
45256         ll.push(e);
45257       }
45258     }
45259     return {
45260       coordinates: ll,
45261       time: time ? nodeVal(time) : null,
45262       extendedValues: getExtensions(get1(x, "extensions"))
45263     };
45264   }
45265   function getRoute(node) {
45266     const line = getPoints$1(node, "rtept");
45267     if (!line)
45268       return;
45269     return {
45270       type: "Feature",
45271       properties: Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "rte" }),
45272       geometry: {
45273         type: "LineString",
45274         coordinates: line.line
45275       }
45276     };
45277   }
45278   function getPoints$1(node, pointname) {
45279     const pts = node.getElementsByTagName(pointname);
45280     if (pts.length < 2)
45281       return;
45282     const line = [];
45283     const times = [];
45284     const extendedValues = {};
45285     for (let i2 = 0; i2 < pts.length; i2++) {
45286       const c = coordPair$1(pts[i2]);
45287       line.push(c.coordinates);
45288       if (c.time)
45289         times.push(c.time);
45290       for (let j2 = 0; j2 < c.extendedValues.length; j2++) {
45291         const [name2, val] = c.extendedValues[j2];
45292         const plural = name2 === "heart" ? name2 : name2.replace("gpxtpx:", "") + "s";
45293         if (!extendedValues[plural]) {
45294           extendedValues[plural] = Array(pts.length).fill(null);
45295         }
45296         extendedValues[plural][i2] = val;
45297       }
45298     }
45299     return {
45300       line,
45301       times,
45302       extendedValues
45303     };
45304   }
45305   function getTrack(node) {
45306     const segments = node.getElementsByTagName("trkseg");
45307     const track = [];
45308     const times = [];
45309     const extractedLines = [];
45310     for (let i2 = 0; i2 < segments.length; i2++) {
45311       const line = getPoints$1(segments[i2], "trkpt");
45312       if (line) {
45313         extractedLines.push(line);
45314         if (line.times && line.times.length)
45315           times.push(line.times);
45316       }
45317     }
45318     if (extractedLines.length === 0)
45319       return;
45320     const multi = extractedLines.length > 1;
45321     const properties = Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "trk" }, times.length ? {
45322       coordinateProperties: {
45323         times: multi ? times : times[0]
45324       }
45325     } : {});
45326     for (let i2 = 0; i2 < extractedLines.length; i2++) {
45327       const line = extractedLines[i2];
45328       track.push(line.line);
45329       for (const [name2, val] of Object.entries(line.extendedValues)) {
45330         if (!properties.coordinateProperties) {
45331           properties.coordinateProperties = {};
45332         }
45333         const props = properties.coordinateProperties;
45334         if (multi) {
45335           if (!props[name2])
45336             props[name2] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
45337           props[name2][i2] = val;
45338         } else {
45339           props[name2] = val;
45340         }
45341       }
45342     }
45343     return {
45344       type: "Feature",
45345       properties,
45346       geometry: multi ? {
45347         type: "MultiLineString",
45348         coordinates: track
45349       } : {
45350         type: "LineString",
45351         coordinates: track[0]
45352       }
45353     };
45354   }
45355   function getPoint(node) {
45356     return {
45357       type: "Feature",
45358       properties: Object.assign(getProperties$1(node), getMulti(node, ["sym"])),
45359       geometry: {
45360         type: "Point",
45361         coordinates: coordPair$1(node).coordinates
45362       }
45363     };
45364   }
45365   function* gpxGen(doc) {
45366     const tracks = doc.getElementsByTagName("trk");
45367     const routes = doc.getElementsByTagName("rte");
45368     const waypoints = doc.getElementsByTagName("wpt");
45369     for (let i2 = 0; i2 < tracks.length; i2++) {
45370       const feature3 = getTrack(tracks[i2]);
45371       if (feature3)
45372         yield feature3;
45373     }
45374     for (let i2 = 0; i2 < routes.length; i2++) {
45375       const feature3 = getRoute(routes[i2]);
45376       if (feature3)
45377         yield feature3;
45378     }
45379     for (let i2 = 0; i2 < waypoints.length; i2++) {
45380       yield getPoint(waypoints[i2]);
45381     }
45382   }
45383   function gpx(doc) {
45384     return {
45385       type: "FeatureCollection",
45386       features: Array.from(gpxGen(doc))
45387     };
45388   }
45389   var removeSpace = /\s*/g;
45390   var trimSpace = /^\s*|\s*$/g;
45391   var splitSpace = /\s+/;
45392   function okhash(x) {
45393     if (!x || !x.length)
45394       return 0;
45395     let h = 0;
45396     for (let i2 = 0; i2 < x.length; i2++) {
45397       h = (h << 5) - h + x.charCodeAt(i2) | 0;
45398     }
45399     return h;
45400   }
45401   function coord1(v) {
45402     return v.replace(removeSpace, "").split(",").map(parseFloat);
45403   }
45404   function coord(v) {
45405     return v.replace(trimSpace, "").split(splitSpace).map(coord1);
45406   }
45407   function xml2str(node) {
45408     if (node.xml !== void 0)
45409       return node.xml;
45410     if (node.tagName) {
45411       let output = node.tagName;
45412       for (let i2 = 0; i2 < node.attributes.length; i2++) {
45413         output += node.attributes[i2].name + node.attributes[i2].value;
45414       }
45415       for (let i2 = 0; i2 < node.childNodes.length; i2++) {
45416         output += xml2str(node.childNodes[i2]);
45417       }
45418       return output;
45419     }
45420     if (node.nodeName === "#text") {
45421       return (node.nodeValue || node.value || "").trim();
45422     }
45423     if (node.nodeName === "#cdata-section") {
45424       return node.nodeValue;
45425     }
45426     return "";
45427   }
45428   var geotypes = ["Polygon", "LineString", "Point", "Track", "gx:Track"];
45429   function kmlColor(properties, elem, prefix) {
45430     let v = nodeVal(get1(elem, "color")) || "";
45431     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
45432     if (v.substr(0, 1) === "#") {
45433       v = v.substr(1);
45434     }
45435     if (v.length === 6 || v.length === 3) {
45436       properties[colorProp] = v;
45437     } else if (v.length === 8) {
45438       properties[prefix + "-opacity"] = parseInt(v.substr(0, 2), 16) / 255;
45439       properties[colorProp] = "#" + v.substr(6, 2) + v.substr(4, 2) + v.substr(2, 2);
45440     }
45441   }
45442   function numericProperty(properties, elem, source, target) {
45443     const val = parseFloat(nodeVal(get1(elem, source)));
45444     if (!isNaN(val))
45445       properties[target] = val;
45446   }
45447   function gxCoords(root3) {
45448     let elems = root3.getElementsByTagName("coord");
45449     const coords = [];
45450     const times = [];
45451     if (elems.length === 0)
45452       elems = root3.getElementsByTagName("gx:coord");
45453     for (let i2 = 0; i2 < elems.length; i2++) {
45454       coords.push(nodeVal(elems[i2]).split(" ").map(parseFloat));
45455     }
45456     const timeElems = root3.getElementsByTagName("when");
45457     for (let j2 = 0; j2 < timeElems.length; j2++)
45458       times.push(nodeVal(timeElems[j2]));
45459     return {
45460       coords,
45461       times
45462     };
45463   }
45464   function getGeometry(root3) {
45465     let geomNode;
45466     let geomNodes;
45467     let i2;
45468     let j2;
45469     let k;
45470     const geoms = [];
45471     const coordTimes = [];
45472     if (get1(root3, "MultiGeometry")) {
45473       return getGeometry(get1(root3, "MultiGeometry"));
45474     }
45475     if (get1(root3, "MultiTrack")) {
45476       return getGeometry(get1(root3, "MultiTrack"));
45477     }
45478     if (get1(root3, "gx:MultiTrack")) {
45479       return getGeometry(get1(root3, "gx:MultiTrack"));
45480     }
45481     for (i2 = 0; i2 < geotypes.length; i2++) {
45482       geomNodes = root3.getElementsByTagName(geotypes[i2]);
45483       if (geomNodes) {
45484         for (j2 = 0; j2 < geomNodes.length; j2++) {
45485           geomNode = geomNodes[j2];
45486           if (geotypes[i2] === "Point") {
45487             geoms.push({
45488               type: "Point",
45489               coordinates: coord1(nodeVal(get1(geomNode, "coordinates")))
45490             });
45491           } else if (geotypes[i2] === "LineString") {
45492             geoms.push({
45493               type: "LineString",
45494               coordinates: coord(nodeVal(get1(geomNode, "coordinates")))
45495             });
45496           } else if (geotypes[i2] === "Polygon") {
45497             const rings = geomNode.getElementsByTagName("LinearRing"), coords = [];
45498             for (k = 0; k < rings.length; k++) {
45499               coords.push(coord(nodeVal(get1(rings[k], "coordinates"))));
45500             }
45501             geoms.push({
45502               type: "Polygon",
45503               coordinates: coords
45504             });
45505           } else if (geotypes[i2] === "Track" || geotypes[i2] === "gx:Track") {
45506             const track = gxCoords(geomNode);
45507             geoms.push({
45508               type: "LineString",
45509               coordinates: track.coords
45510             });
45511             if (track.times.length)
45512               coordTimes.push(track.times);
45513           }
45514         }
45515       }
45516     }
45517     return {
45518       geoms,
45519       coordTimes
45520     };
45521   }
45522   function getPlacemark(root3, styleIndex, styleMapIndex, styleByHash) {
45523     const geomsAndTimes = getGeometry(root3);
45524     let i2;
45525     const properties = {};
45526     const name2 = nodeVal(get1(root3, "name"));
45527     const address = nodeVal(get1(root3, "address"));
45528     let styleUrl = nodeVal(get1(root3, "styleUrl"));
45529     const description2 = nodeVal(get1(root3, "description"));
45530     const timeSpan = get1(root3, "TimeSpan");
45531     const timeStamp = get1(root3, "TimeStamp");
45532     const extendedData = get1(root3, "ExtendedData");
45533     let iconStyle = get1(root3, "IconStyle");
45534     let labelStyle = get1(root3, "LabelStyle");
45535     let lineStyle = get1(root3, "LineStyle");
45536     let polyStyle = get1(root3, "PolyStyle");
45537     const visibility = get1(root3, "visibility");
45538     if (name2)
45539       properties.name = name2;
45540     if (address)
45541       properties.address = address;
45542     if (styleUrl) {
45543       if (styleUrl[0] !== "#") {
45544         styleUrl = "#" + styleUrl;
45545       }
45546       properties.styleUrl = styleUrl;
45547       if (styleIndex[styleUrl]) {
45548         properties.styleHash = styleIndex[styleUrl];
45549       }
45550       if (styleMapIndex[styleUrl]) {
45551         properties.styleMapHash = styleMapIndex[styleUrl];
45552         properties.styleHash = styleIndex[styleMapIndex[styleUrl].normal];
45553       }
45554       const style = styleByHash[properties.styleHash];
45555       if (style) {
45556         if (!iconStyle)
45557           iconStyle = get1(style, "IconStyle");
45558         if (!labelStyle)
45559           labelStyle = get1(style, "LabelStyle");
45560         if (!lineStyle)
45561           lineStyle = get1(style, "LineStyle");
45562         if (!polyStyle)
45563           polyStyle = get1(style, "PolyStyle");
45564       }
45565     }
45566     if (description2)
45567       properties.description = description2;
45568     if (timeSpan) {
45569       const begin = nodeVal(get1(timeSpan, "begin"));
45570       const end = nodeVal(get1(timeSpan, "end"));
45571       properties.timespan = { begin, end };
45572     }
45573     if (timeStamp) {
45574       properties.timestamp = nodeVal(get1(timeStamp, "when"));
45575     }
45576     if (iconStyle) {
45577       kmlColor(properties, iconStyle, "icon");
45578       numericProperty(properties, iconStyle, "scale", "icon-scale");
45579       numericProperty(properties, iconStyle, "heading", "icon-heading");
45580       const hotspot = get1(iconStyle, "hotSpot");
45581       if (hotspot) {
45582         const left = parseFloat(hotspot.getAttribute("x"));
45583         const top = parseFloat(hotspot.getAttribute("y"));
45584         if (!isNaN(left) && !isNaN(top))
45585           properties["icon-offset"] = [left, top];
45586       }
45587       const icon2 = get1(iconStyle, "Icon");
45588       if (icon2) {
45589         const href = nodeVal(get1(icon2, "href"));
45590         if (href)
45591           properties.icon = href;
45592       }
45593     }
45594     if (labelStyle) {
45595       kmlColor(properties, labelStyle, "label");
45596       numericProperty(properties, labelStyle, "scale", "label-scale");
45597     }
45598     if (lineStyle) {
45599       kmlColor(properties, lineStyle, "stroke");
45600       numericProperty(properties, lineStyle, "width", "stroke-width");
45601     }
45602     if (polyStyle) {
45603       kmlColor(properties, polyStyle, "fill");
45604       const fill = nodeVal(get1(polyStyle, "fill"));
45605       const outline = nodeVal(get1(polyStyle, "outline"));
45606       if (fill)
45607         properties["fill-opacity"] = fill === "1" ? properties["fill-opacity"] || 1 : 0;
45608       if (outline)
45609         properties["stroke-opacity"] = outline === "1" ? properties["stroke-opacity"] || 1 : 0;
45610     }
45611     if (extendedData) {
45612       const datas = extendedData.getElementsByTagName("Data"), simpleDatas = extendedData.getElementsByTagName("SimpleData");
45613       for (i2 = 0; i2 < datas.length; i2++) {
45614         properties[datas[i2].getAttribute("name")] = nodeVal(get1(datas[i2], "value"));
45615       }
45616       for (i2 = 0; i2 < simpleDatas.length; i2++) {
45617         properties[simpleDatas[i2].getAttribute("name")] = nodeVal(simpleDatas[i2]);
45618       }
45619     }
45620     if (visibility) {
45621       properties.visibility = nodeVal(visibility);
45622     }
45623     if (geomsAndTimes.coordTimes.length) {
45624       properties.coordinateProperties = {
45625         times: geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes
45626       };
45627     }
45628     const feature3 = {
45629       type: "Feature",
45630       geometry: geomsAndTimes.geoms.length === 0 ? null : geomsAndTimes.geoms.length === 1 ? geomsAndTimes.geoms[0] : {
45631         type: "GeometryCollection",
45632         geometries: geomsAndTimes.geoms
45633       },
45634       properties
45635     };
45636     if (root3.getAttribute("id"))
45637       feature3.id = root3.getAttribute("id");
45638     return feature3;
45639   }
45640   function* kmlGen(doc) {
45641     const styleIndex = {};
45642     const styleByHash = {};
45643     const styleMapIndex = {};
45644     const placemarks = doc.getElementsByTagName("Placemark");
45645     const styles = doc.getElementsByTagName("Style");
45646     const styleMaps = doc.getElementsByTagName("StyleMap");
45647     for (let k = 0; k < styles.length; k++) {
45648       const style = styles[k];
45649       const hash = okhash(xml2str(style)).toString(16);
45650       let id2 = style.getAttribute("id");
45651       if (!id2 && style.parentNode.tagName.replace("gx:", "") === "CascadingStyle") {
45652         id2 = style.parentNode.getAttribute("kml:id") || style.parentNode.getAttribute("id");
45653       }
45654       styleIndex["#" + id2] = hash;
45655       styleByHash[hash] = style;
45656     }
45657     for (let l = 0; l < styleMaps.length; l++) {
45658       styleIndex["#" + styleMaps[l].getAttribute("id")] = okhash(xml2str(styleMaps[l])).toString(16);
45659       const pairs = styleMaps[l].getElementsByTagName("Pair");
45660       const pairsMap = {};
45661       for (let m = 0; m < pairs.length; m++) {
45662         pairsMap[nodeVal(get1(pairs[m], "key"))] = nodeVal(get1(pairs[m], "styleUrl"));
45663       }
45664       styleMapIndex["#" + styleMaps[l].getAttribute("id")] = pairsMap;
45665     }
45666     for (let j2 = 0; j2 < placemarks.length; j2++) {
45667       const feature3 = getPlacemark(placemarks[j2], styleIndex, styleMapIndex, styleByHash);
45668       if (feature3)
45669         yield feature3;
45670     }
45671   }
45672   function kml(doc) {
45673     return {
45674       type: "FeatureCollection",
45675       features: Array.from(kmlGen(doc))
45676     };
45677   }
45678
45679   // modules/svg/data.js
45680   var _initialized = false;
45681   var _enabled = false;
45682   var _geojson;
45683   function svgData(projection2, context, dispatch10) {
45684     var throttledRedraw = throttle_default(function() {
45685       dispatch10.call("change");
45686     }, 1e3);
45687     var _showLabels = true;
45688     var detected = utilDetect();
45689     var layer = select_default2(null);
45690     var _vtService;
45691     var _fileList;
45692     var _template;
45693     var _src;
45694     function init2() {
45695       if (_initialized)
45696         return;
45697       _geojson = {};
45698       _enabled = true;
45699       function over(d3_event) {
45700         d3_event.stopPropagation();
45701         d3_event.preventDefault();
45702         d3_event.dataTransfer.dropEffect = "copy";
45703       }
45704       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
45705         d3_event.stopPropagation();
45706         d3_event.preventDefault();
45707         if (!detected.filedrop)
45708           return;
45709         drawData.fileList(d3_event.dataTransfer.files);
45710       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
45711       _initialized = true;
45712     }
45713     function getService() {
45714       if (services.vectorTile && !_vtService) {
45715         _vtService = services.vectorTile;
45716         _vtService.event.on("loadedData", throttledRedraw);
45717       } else if (!services.vectorTile && _vtService) {
45718         _vtService = null;
45719       }
45720       return _vtService;
45721     }
45722     function showLayer() {
45723       layerOn();
45724       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
45725         dispatch10.call("change");
45726       });
45727     }
45728     function hideLayer() {
45729       throttledRedraw.cancel();
45730       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
45731     }
45732     function layerOn() {
45733       layer.style("display", "block");
45734     }
45735     function layerOff() {
45736       layer.selectAll(".viewfield-group").remove();
45737       layer.style("display", "none");
45738     }
45739     function ensureIDs(gj) {
45740       if (!gj)
45741         return null;
45742       if (gj.type === "FeatureCollection") {
45743         for (var i2 = 0; i2 < gj.features.length; i2++) {
45744           ensureFeatureID(gj.features[i2]);
45745         }
45746       } else {
45747         ensureFeatureID(gj);
45748       }
45749       return gj;
45750     }
45751     function ensureFeatureID(feature3) {
45752       if (!feature3)
45753         return;
45754       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
45755       return feature3;
45756     }
45757     function getFeatures(gj) {
45758       if (!gj)
45759         return [];
45760       if (gj.type === "FeatureCollection") {
45761         return gj.features;
45762       } else {
45763         return [gj];
45764       }
45765     }
45766     function featureKey(d) {
45767       return d.__featurehash__;
45768     }
45769     function isPolygon(d) {
45770       return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
45771     }
45772     function clipPathID(d) {
45773       return "ideditor-data-" + d.__featurehash__ + "-clippath";
45774     }
45775     function featureClasses(d) {
45776       return [
45777         "data" + d.__featurehash__,
45778         d.geometry.type,
45779         isPolygon(d) ? "area" : "",
45780         d.__layerID__ || ""
45781       ].filter(Boolean).join(" ");
45782     }
45783     function drawData(selection2) {
45784       var vtService = getService();
45785       var getPath = svgPath(projection2).geojson;
45786       var getAreaPath = svgPath(projection2, null, true).geojson;
45787       var hasData = drawData.hasData();
45788       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
45789       layer.exit().remove();
45790       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
45791       var surface = context.surface();
45792       if (!surface || surface.empty())
45793         return;
45794       var geoData, polygonData;
45795       if (_template && vtService) {
45796         var sourceID = _template;
45797         vtService.loadTiles(sourceID, _template, projection2);
45798         geoData = vtService.data(sourceID, projection2);
45799       } else {
45800         geoData = getFeatures(_geojson);
45801       }
45802       geoData = geoData.filter(getPath);
45803       polygonData = geoData.filter(isPolygon);
45804       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
45805       clipPaths.exit().remove();
45806       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
45807       clipPathsEnter.append("path");
45808       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
45809       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
45810       datagroups = datagroups.enter().append("g").attr("class", function(d) {
45811         return "datagroup datagroup-" + d;
45812       }).merge(datagroups);
45813       var pathData = {
45814         fill: polygonData,
45815         shadow: geoData,
45816         stroke: geoData
45817       };
45818       var paths = datagroups.selectAll("path").data(function(layer2) {
45819         return pathData[layer2];
45820       }, featureKey);
45821       paths.exit().remove();
45822       paths = paths.enter().append("path").attr("class", function(d) {
45823         var datagroup = this.parentNode.__data__;
45824         return "pathdata " + datagroup + " " + featureClasses(d);
45825       }).attr("clip-path", function(d) {
45826         var datagroup = this.parentNode.__data__;
45827         return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
45828       }).merge(paths).attr("d", function(d) {
45829         var datagroup = this.parentNode.__data__;
45830         return datagroup === "fill" ? getAreaPath(d) : getPath(d);
45831       });
45832       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
45833       function drawLabels(selection3, textClass, data) {
45834         var labelPath = path_default(projection2);
45835         var labelData = data.filter(function(d) {
45836           return _showLabels && d.properties && (d.properties.desc || d.properties.name);
45837         });
45838         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
45839         labels.exit().remove();
45840         labels = labels.enter().append("text").attr("class", function(d) {
45841           return textClass + " " + featureClasses(d);
45842         }).merge(labels).text(function(d) {
45843           return d.properties.desc || d.properties.name;
45844         }).attr("x", function(d) {
45845           var centroid = labelPath.centroid(d);
45846           return centroid[0] + 11;
45847         }).attr("y", function(d) {
45848           var centroid = labelPath.centroid(d);
45849           return centroid[1];
45850         });
45851       }
45852     }
45853     function getExtension(fileName) {
45854       if (!fileName)
45855         return;
45856       var re2 = /\.(gpx|kml|(geo)?json)$/i;
45857       var match = fileName.toLowerCase().match(re2);
45858       return match && match.length && match[0];
45859     }
45860     function xmlToDom(textdata) {
45861       return new DOMParser().parseFromString(textdata, "text/xml");
45862     }
45863     function stringifyGeojsonProperties(feature3) {
45864       const properties = feature3.properties;
45865       for (const key in properties) {
45866         const property = properties[key];
45867         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
45868           properties[key] = property.toString();
45869         } else if (property === null) {
45870           properties[key] = "null";
45871         } else if (typeof property === "object") {
45872           properties[key] = JSON.stringify(property);
45873         }
45874       }
45875     }
45876     drawData.setFile = function(extension, data) {
45877       _template = null;
45878       _fileList = null;
45879       _geojson = null;
45880       _src = null;
45881       var gj;
45882       switch (extension) {
45883         case ".gpx":
45884           gj = gpx(xmlToDom(data));
45885           break;
45886         case ".kml":
45887           gj = kml(xmlToDom(data));
45888           break;
45889         case ".geojson":
45890         case ".json":
45891           gj = JSON.parse(data);
45892           if (gj.type === "FeatureCollection") {
45893             gj.features.forEach(stringifyGeojsonProperties);
45894           } else if (gj.type === "Feature") {
45895             stringifyGeojsonProperties(gj);
45896           }
45897           break;
45898       }
45899       gj = gj || {};
45900       if (Object.keys(gj).length) {
45901         _geojson = ensureIDs(gj);
45902         _src = extension + " data file";
45903         this.fitZoom();
45904       }
45905       dispatch10.call("change");
45906       return this;
45907     };
45908     drawData.showLabels = function(val) {
45909       if (!arguments.length)
45910         return _showLabels;
45911       _showLabels = val;
45912       return this;
45913     };
45914     drawData.enabled = function(val) {
45915       if (!arguments.length)
45916         return _enabled;
45917       _enabled = val;
45918       if (_enabled) {
45919         showLayer();
45920       } else {
45921         hideLayer();
45922       }
45923       dispatch10.call("change");
45924       return this;
45925     };
45926     drawData.hasData = function() {
45927       var gj = _geojson || {};
45928       return !!(_template || Object.keys(gj).length);
45929     };
45930     drawData.template = function(val, src) {
45931       if (!arguments.length)
45932         return _template;
45933       var osm = context.connection();
45934       if (osm) {
45935         var blocklists = osm.imageryBlocklists();
45936         var fail = false;
45937         var tested = 0;
45938         var regex;
45939         for (var i2 = 0; i2 < blocklists.length; i2++) {
45940           regex = blocklists[i2];
45941           fail = regex.test(val);
45942           tested++;
45943           if (fail)
45944             break;
45945         }
45946         if (!tested) {
45947           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
45948           fail = regex.test(val);
45949         }
45950       }
45951       _template = val;
45952       _fileList = null;
45953       _geojson = null;
45954       _src = src || "vectortile:" + val.split(/[?#]/)[0];
45955       dispatch10.call("change");
45956       return this;
45957     };
45958     drawData.geojson = function(gj, src) {
45959       if (!arguments.length)
45960         return _geojson;
45961       _template = null;
45962       _fileList = null;
45963       _geojson = null;
45964       _src = null;
45965       gj = gj || {};
45966       if (Object.keys(gj).length) {
45967         _geojson = ensureIDs(gj);
45968         _src = src || "unknown.geojson";
45969       }
45970       dispatch10.call("change");
45971       return this;
45972     };
45973     drawData.fileList = function(fileList) {
45974       if (!arguments.length)
45975         return _fileList;
45976       _template = null;
45977       _fileList = fileList;
45978       _geojson = null;
45979       _src = null;
45980       if (!fileList || !fileList.length)
45981         return this;
45982       var f2 = fileList[0];
45983       var extension = getExtension(f2.name);
45984       var reader = new FileReader();
45985       reader.onload = function() {
45986         return function(e) {
45987           drawData.setFile(extension, e.target.result);
45988         };
45989       }(f2);
45990       reader.readAsText(f2);
45991       return this;
45992     };
45993     drawData.url = function(url, defaultExtension) {
45994       _template = null;
45995       _fileList = null;
45996       _geojson = null;
45997       _src = null;
45998       var testUrl = url.split(/[?#]/)[0];
45999       var extension = getExtension(testUrl) || defaultExtension;
46000       if (extension) {
46001         _template = null;
46002         text_default3(url).then(function(data) {
46003           drawData.setFile(extension, data);
46004         }).catch(function() {
46005         });
46006       } else {
46007         drawData.template(url);
46008       }
46009       return this;
46010     };
46011     drawData.getSrc = function() {
46012       return _src || "";
46013     };
46014     drawData.fitZoom = function() {
46015       var features2 = getFeatures(_geojson);
46016       if (!features2.length)
46017         return;
46018       var map2 = context.map();
46019       var viewport = map2.trimmedExtent().polygon();
46020       var coords = features2.reduce(function(coords2, feature3) {
46021         var geom = feature3.geometry;
46022         if (!geom)
46023           return coords2;
46024         var c = geom.coordinates;
46025         switch (geom.type) {
46026           case "Point":
46027             c = [c];
46028           case "MultiPoint":
46029           case "LineString":
46030             break;
46031           case "MultiPolygon":
46032             c = utilArrayFlatten(c);
46033           case "Polygon":
46034           case "MultiLineString":
46035             c = utilArrayFlatten(c);
46036             break;
46037         }
46038         return utilArrayUnion(coords2, c);
46039       }, []);
46040       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
46041         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
46042         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
46043       }
46044       return this;
46045     };
46046     init2();
46047     return drawData;
46048   }
46049
46050   // modules/svg/debug.js
46051   function svgDebug(projection2, context) {
46052     function drawDebug(selection2) {
46053       const showTile = context.getDebug("tile");
46054       const showCollision = context.getDebug("collision");
46055       const showImagery = context.getDebug("imagery");
46056       const showTouchTargets = context.getDebug("target");
46057       const showDownloaded = context.getDebug("downloaded");
46058       let debugData = [];
46059       if (showTile) {
46060         debugData.push({ class: "red", label: "tile" });
46061       }
46062       if (showCollision) {
46063         debugData.push({ class: "yellow", label: "collision" });
46064       }
46065       if (showImagery) {
46066         debugData.push({ class: "orange", label: "imagery" });
46067       }
46068       if (showTouchTargets) {
46069         debugData.push({ class: "pink", label: "touchTargets" });
46070       }
46071       if (showDownloaded) {
46072         debugData.push({ class: "purple", label: "downloaded" });
46073       }
46074       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
46075       legend.exit().remove();
46076       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
46077       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
46078       legendItems.exit().remove();
46079       legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
46080       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
46081       layer.exit().remove();
46082       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
46083       const extent = context.map().extent();
46084       _mainFileFetcher.get("imagery").then((d) => {
46085         const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
46086         const features2 = hits.map((d2) => d2.features[d2.id]);
46087         let imagery = layer.selectAll("path.debug-imagery").data(features2);
46088         imagery.exit().remove();
46089         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
46090       }).catch(() => {
46091       });
46092       const osm = context.connection();
46093       let dataDownloaded = [];
46094       if (osm && showDownloaded) {
46095         const rtree = osm.caches("get").tile.rtree;
46096         dataDownloaded = rtree.all().map((bbox) => {
46097           return {
46098             type: "Feature",
46099             properties: { id: bbox.id },
46100             geometry: {
46101               type: "Polygon",
46102               coordinates: [[
46103                 [bbox.minX, bbox.minY],
46104                 [bbox.minX, bbox.maxY],
46105                 [bbox.maxX, bbox.maxY],
46106                 [bbox.maxX, bbox.minY],
46107                 [bbox.minX, bbox.minY]
46108               ]]
46109             }
46110           };
46111         });
46112       }
46113       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
46114       downloaded.exit().remove();
46115       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
46116       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
46117     }
46118     drawDebug.enabled = function() {
46119       if (!arguments.length) {
46120         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
46121       } else {
46122         return this;
46123       }
46124     };
46125     return drawDebug;
46126   }
46127
46128   // modules/svg/defs.js
46129   function svgDefs(context) {
46130     var _defsSelection = select_default2(null);
46131     var _spritesheetIds = [
46132       "iD-sprite",
46133       "maki-sprite",
46134       "temaki-sprite",
46135       "fa-sprite",
46136       "community-sprite"
46137     ];
46138     function drawDefs(selection2) {
46139       _defsSelection = selection2.append("defs");
46140       _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");
46141       function addSidedMarker(name2, color2, offset) {
46142         _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);
46143       }
46144       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
46145       addSidedMarker("coastline", "#77dede", 1);
46146       addSidedMarker("waterway", "#77dede", 1);
46147       addSidedMarker("barrier", "#ddd", 1);
46148       addSidedMarker("man_made", "#fff", 0);
46149       _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");
46150       _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");
46151       var patterns2 = _defsSelection.selectAll("pattern").data([
46152         ["beach", "dots"],
46153         ["construction", "construction"],
46154         ["cemetery", "cemetery"],
46155         ["cemetery_christian", "cemetery_christian"],
46156         ["cemetery_buddhist", "cemetery_buddhist"],
46157         ["cemetery_muslim", "cemetery_muslim"],
46158         ["cemetery_jewish", "cemetery_jewish"],
46159         ["farmland", "farmland"],
46160         ["farmyard", "farmyard"],
46161         ["forest", "forest"],
46162         ["forest_broadleaved", "forest_broadleaved"],
46163         ["forest_needleleaved", "forest_needleleaved"],
46164         ["forest_leafless", "forest_leafless"],
46165         ["golf_green", "grass"],
46166         ["grass", "grass"],
46167         ["landfill", "landfill"],
46168         ["meadow", "grass"],
46169         ["orchard", "orchard"],
46170         ["pond", "pond"],
46171         ["quarry", "quarry"],
46172         ["scrub", "bushes"],
46173         ["vineyard", "vineyard"],
46174         ["water_standing", "lines"],
46175         ["waves", "waves"],
46176         ["wetland", "wetland"],
46177         ["wetland_marsh", "wetland_marsh"],
46178         ["wetland_swamp", "wetland_swamp"],
46179         ["wetland_bog", "wetland_bog"],
46180         ["wetland_reedbed", "wetland_reedbed"]
46181       ]).enter().append("pattern").attr("id", function(d) {
46182         return "ideditor-pattern-" + d[0];
46183       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
46184       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
46185         return "pattern-color-" + d[0];
46186       });
46187       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
46188         return context.imagePath("pattern/" + d[1] + ".png");
46189       });
46190       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
46191         return "ideditor-clip-square-" + d;
46192       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
46193         return d;
46194       }).attr("height", function(d) {
46195         return d;
46196       });
46197       addSprites(_spritesheetIds, true);
46198     }
46199     function addSprites(ids, overrideColors) {
46200       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
46201       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
46202       spritesheets.enter().append("g").attr("class", function(d) {
46203         return "spritesheet spritesheet-" + d;
46204       }).each(function(d) {
46205         var url = context.imagePath(d + ".svg");
46206         var node = select_default2(this).node();
46207         svg(url).then(function(svg2) {
46208           node.appendChild(select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node());
46209           if (overrideColors && d !== "iD-sprite") {
46210             select_default2(node).selectAll("path").attr("fill", "currentColor");
46211           }
46212         }).catch(function() {
46213         });
46214       });
46215       spritesheets.exit().remove();
46216     }
46217     drawDefs.addSprites = addSprites;
46218     return drawDefs;
46219   }
46220
46221   // modules/svg/keepRight.js
46222   var _layerEnabled = false;
46223   var _qaService;
46224   function svgKeepRight(projection2, context, dispatch10) {
46225     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
46226     const minZoom3 = 12;
46227     let touchLayer = select_default2(null);
46228     let drawLayer = select_default2(null);
46229     let layerVisible = false;
46230     function markerPath(selection2, klass) {
46231       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");
46232     }
46233     function getService() {
46234       if (services.keepRight && !_qaService) {
46235         _qaService = services.keepRight;
46236         _qaService.on("loaded", throttledRedraw);
46237       } else if (!services.keepRight && _qaService) {
46238         _qaService = null;
46239       }
46240       return _qaService;
46241     }
46242     function editOn() {
46243       if (!layerVisible) {
46244         layerVisible = true;
46245         drawLayer.style("display", "block");
46246       }
46247     }
46248     function editOff() {
46249       if (layerVisible) {
46250         layerVisible = false;
46251         drawLayer.style("display", "none");
46252         drawLayer.selectAll(".qaItem.keepRight").remove();
46253         touchLayer.selectAll(".qaItem.keepRight").remove();
46254       }
46255     }
46256     function layerOn() {
46257       editOn();
46258       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
46259     }
46260     function layerOff() {
46261       throttledRedraw.cancel();
46262       drawLayer.interrupt();
46263       touchLayer.selectAll(".qaItem.keepRight").remove();
46264       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
46265         editOff();
46266         dispatch10.call("change");
46267       });
46268     }
46269     function updateMarkers() {
46270       if (!layerVisible || !_layerEnabled)
46271         return;
46272       const service = getService();
46273       const selectedID = context.selectedErrorID();
46274       const data = service ? service.getItems(projection2) : [];
46275       const getTransform = svgPointTransform(projection2);
46276       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46277       markers.exit().remove();
46278       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
46279       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
46280       markersEnter.append("path").call(markerPath, "shadow");
46281       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");
46282       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
46283       if (touchLayer.empty())
46284         return;
46285       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
46286       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46287       targets.exit().remove();
46288       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);
46289       function sortY(a, b) {
46290         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];
46291       }
46292     }
46293     function drawKeepRight(selection2) {
46294       const service = getService();
46295       const surface = context.surface();
46296       if (surface && !surface.empty()) {
46297         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
46298       }
46299       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
46300       drawLayer.exit().remove();
46301       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
46302       if (_layerEnabled) {
46303         if (service && ~~context.map().zoom() >= minZoom3) {
46304           editOn();
46305           service.loadIssues(projection2);
46306           updateMarkers();
46307         } else {
46308           editOff();
46309         }
46310       }
46311     }
46312     drawKeepRight.enabled = function(val) {
46313       if (!arguments.length)
46314         return _layerEnabled;
46315       _layerEnabled = val;
46316       if (_layerEnabled) {
46317         layerOn();
46318       } else {
46319         layerOff();
46320         if (context.selectedErrorID()) {
46321           context.enter(modeBrowse(context));
46322         }
46323       }
46324       dispatch10.call("change");
46325       return this;
46326     };
46327     drawKeepRight.supported = () => !!getService();
46328     return drawKeepRight;
46329   }
46330
46331   // modules/svg/geolocate.js
46332   function svgGeolocate(projection2) {
46333     var layer = select_default2(null);
46334     var _position;
46335     function init2() {
46336       if (svgGeolocate.initialized)
46337         return;
46338       svgGeolocate.enabled = false;
46339       svgGeolocate.initialized = true;
46340     }
46341     function showLayer() {
46342       layer.style("display", "block");
46343     }
46344     function hideLayer() {
46345       layer.transition().duration(250).style("opacity", 0);
46346     }
46347     function layerOn() {
46348       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
46349     }
46350     function layerOff() {
46351       layer.style("display", "none");
46352     }
46353     function transform2(d) {
46354       return svgPointTransform(projection2)(d);
46355     }
46356     function accuracy(accuracy2, loc) {
46357       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
46358       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
46359     }
46360     function update() {
46361       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
46362       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
46363       groups.exit().remove();
46364       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
46365       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");
46366       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");
46367       groups.merge(pointsEnter).attr("transform", transform2);
46368       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
46369     }
46370     function drawLocation(selection2) {
46371       var enabled = svgGeolocate.enabled;
46372       layer = selection2.selectAll(".layer-geolocate").data([0]);
46373       layer.exit().remove();
46374       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
46375       layerEnter.append("g").attr("class", "geolocations");
46376       layer = layerEnter.merge(layer);
46377       if (enabled) {
46378         update();
46379       } else {
46380         layerOff();
46381       }
46382     }
46383     drawLocation.enabled = function(position, enabled) {
46384       if (!arguments.length)
46385         return svgGeolocate.enabled;
46386       _position = position;
46387       svgGeolocate.enabled = enabled;
46388       if (svgGeolocate.enabled) {
46389         showLayer();
46390         layerOn();
46391       } else {
46392         hideLayer();
46393       }
46394       return this;
46395     };
46396     init2();
46397     return drawLocation;
46398   }
46399
46400   // modules/svg/labels.js
46401   var import_rbush7 = __toESM(require_rbush_min());
46402   function svgLabels(projection2, context) {
46403     var path = path_default(projection2);
46404     var detected = utilDetect();
46405     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
46406     var _rdrawn = new import_rbush7.default();
46407     var _rskipped = new import_rbush7.default();
46408     var _textWidthCache = {};
46409     var _entitybboxes = {};
46410     var labelStack = [
46411       ["line", "aeroway", "*", 12],
46412       ["line", "highway", "motorway", 12],
46413       ["line", "highway", "trunk", 12],
46414       ["line", "highway", "primary", 12],
46415       ["line", "highway", "secondary", 12],
46416       ["line", "highway", "tertiary", 12],
46417       ["line", "highway", "*", 12],
46418       ["line", "railway", "*", 12],
46419       ["line", "waterway", "*", 12],
46420       ["area", "aeroway", "*", 12],
46421       ["area", "amenity", "*", 12],
46422       ["area", "building", "*", 12],
46423       ["area", "historic", "*", 12],
46424       ["area", "leisure", "*", 12],
46425       ["area", "man_made", "*", 12],
46426       ["area", "natural", "*", 12],
46427       ["area", "shop", "*", 12],
46428       ["area", "tourism", "*", 12],
46429       ["area", "camp_site", "*", 12],
46430       ["point", "aeroway", "*", 10],
46431       ["point", "amenity", "*", 10],
46432       ["point", "building", "*", 10],
46433       ["point", "historic", "*", 10],
46434       ["point", "leisure", "*", 10],
46435       ["point", "man_made", "*", 10],
46436       ["point", "natural", "*", 10],
46437       ["point", "shop", "*", 10],
46438       ["point", "tourism", "*", 10],
46439       ["point", "camp_site", "*", 10],
46440       ["line", "name", "*", 12],
46441       ["area", "name", "*", 12],
46442       ["point", "name", "*", 10]
46443     ];
46444     function shouldSkipIcon(preset) {
46445       var noIcons = ["building", "landuse", "natural"];
46446       return noIcons.some(function(s) {
46447         return preset.id.indexOf(s) >= 0;
46448       });
46449     }
46450     function get3(array2, prop) {
46451       return function(d, i2) {
46452         return array2[i2][prop];
46453       };
46454     }
46455     function textWidth(text2, size, elem) {
46456       var c = _textWidthCache[size];
46457       if (!c)
46458         c = _textWidthCache[size] = {};
46459       if (c[text2]) {
46460         return c[text2];
46461       } else if (elem) {
46462         c[text2] = elem.getComputedTextLength();
46463         return c[text2];
46464       } else {
46465         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
46466         if (str2 === null) {
46467           return size / 3 * 2 * text2.length;
46468         } else {
46469           return size / 3 * (2 * text2.length + str2.length);
46470         }
46471       }
46472     }
46473     function drawLinePaths(selection2, entities, filter2, classes, labels) {
46474       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
46475       paths.exit().remove();
46476       paths.enter().append("path").style("stroke-width", get3(labels, "font-size")).attr("id", function(d) {
46477         return "ideditor-labelpath-" + d.id;
46478       }).attr("class", classes).merge(paths).attr("d", get3(labels, "lineString"));
46479     }
46480     function drawLineLabels(selection2, entities, filter2, classes, labels) {
46481       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46482       texts.exit().remove();
46483       texts.enter().append("text").attr("class", function(d, i2) {
46484         return classes + " " + labels[i2].classes + " " + d.id;
46485       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
46486       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
46487         return "#ideditor-labelpath-" + d.id;
46488       }).text(utilDisplayNameForPath);
46489     }
46490     function drawPointLabels(selection2, entities, filter2, classes, labels) {
46491       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46492       texts.exit().remove();
46493       texts.enter().append("text").attr("class", function(d, i2) {
46494         return classes + " " + labels[i2].classes + " " + d.id;
46495       }).merge(texts).attr("x", get3(labels, "x")).attr("y", get3(labels, "y")).style("text-anchor", get3(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
46496         textWidth(utilDisplayName(d), labels[i2].height, this);
46497       });
46498     }
46499     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
46500       entities = entities.filter(hasText);
46501       labels = labels.filter(hasText);
46502       drawPointLabels(selection2, entities, filter2, classes, labels);
46503       function hasText(d, i2) {
46504         return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
46505       }
46506     }
46507     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
46508       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
46509       icons.exit().remove();
46510       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) {
46511         var preset = _mainPresetIndex.match(d, context.graph());
46512         var picon = preset && preset.icon;
46513         return picon ? "#" + picon : "";
46514       });
46515     }
46516     function drawCollisionBoxes(selection2, rtree, which) {
46517       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
46518       var gj = [];
46519       if (context.getDebug("collision")) {
46520         gj = rtree.all().map(function(d) {
46521           return { type: "Polygon", coordinates: [[
46522             [d.minX, d.minY],
46523             [d.maxX, d.minY],
46524             [d.maxX, d.maxY],
46525             [d.minX, d.maxY],
46526             [d.minX, d.minY]
46527           ]] };
46528         });
46529       }
46530       var boxes = selection2.selectAll("." + which).data(gj);
46531       boxes.exit().remove();
46532       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
46533     }
46534     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
46535       var wireframe = context.surface().classed("fill-wireframe");
46536       var zoom = geoScaleToZoom(projection2.scale());
46537       var labelable = [];
46538       var renderNodeAs = {};
46539       var i2, j2, k, entity, geometry;
46540       for (i2 = 0; i2 < labelStack.length; i2++) {
46541         labelable.push([]);
46542       }
46543       if (fullRedraw) {
46544         _rdrawn.clear();
46545         _rskipped.clear();
46546         _entitybboxes = {};
46547       } else {
46548         for (i2 = 0; i2 < entities.length; i2++) {
46549           entity = entities[i2];
46550           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
46551           for (j2 = 0; j2 < toRemove.length; j2++) {
46552             _rdrawn.remove(toRemove[j2]);
46553             _rskipped.remove(toRemove[j2]);
46554           }
46555         }
46556       }
46557       for (i2 = 0; i2 < entities.length; i2++) {
46558         entity = entities[i2];
46559         geometry = entity.geometry(graph);
46560         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
46561           var hasDirections = entity.directions(graph, projection2).length;
46562           var markerPadding;
46563           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
46564             renderNodeAs[entity.id] = "point";
46565             markerPadding = 20;
46566           } else {
46567             renderNodeAs[entity.id] = "vertex";
46568             markerPadding = 0;
46569           }
46570           var coord2 = projection2(entity.loc);
46571           var nodePadding = 10;
46572           var bbox = {
46573             minX: coord2[0] - nodePadding,
46574             minY: coord2[1] - nodePadding - markerPadding,
46575             maxX: coord2[0] + nodePadding,
46576             maxY: coord2[1] + nodePadding
46577           };
46578           doInsert(bbox, entity.id + "P");
46579         }
46580         if (geometry === "vertex") {
46581           geometry = "point";
46582         }
46583         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
46584         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
46585         if (!icon2 && !utilDisplayName(entity))
46586           continue;
46587         for (k = 0; k < labelStack.length; k++) {
46588           var matchGeom = labelStack[k][0];
46589           var matchKey = labelStack[k][1];
46590           var matchVal = labelStack[k][2];
46591           var hasVal = entity.tags[matchKey];
46592           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
46593             labelable[k].push(entity);
46594             break;
46595           }
46596         }
46597       }
46598       var positions = {
46599         point: [],
46600         line: [],
46601         area: []
46602       };
46603       var labelled = {
46604         point: [],
46605         line: [],
46606         area: []
46607       };
46608       for (k = 0; k < labelable.length; k++) {
46609         var fontSize = labelStack[k][3];
46610         for (i2 = 0; i2 < labelable[k].length; i2++) {
46611           entity = labelable[k][i2];
46612           geometry = entity.geometry(graph);
46613           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
46614           var name2 = getName(entity);
46615           var width = name2 && textWidth(name2, fontSize);
46616           var p = null;
46617           if (geometry === "point" || geometry === "vertex") {
46618             if (wireframe)
46619               continue;
46620             var renderAs = renderNodeAs[entity.id];
46621             if (renderAs === "vertex" && zoom < 17)
46622               continue;
46623             p = getPointLabel(entity, width, fontSize, renderAs);
46624           } else if (geometry === "line") {
46625             p = getLineLabel(entity, width, fontSize);
46626           } else if (geometry === "area") {
46627             p = getAreaLabel(entity, width, fontSize);
46628           }
46629           if (p) {
46630             if (geometry === "vertex") {
46631               geometry = "point";
46632             }
46633             p.classes = geometry + " tag-" + labelStack[k][1];
46634             positions[geometry].push(p);
46635             labelled[geometry].push(entity);
46636           }
46637         }
46638       }
46639       function isInterestingVertex(entity2) {
46640         var selectedIDs = context.selectedIDs();
46641         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
46642           return selectedIDs.indexOf(parent.id) !== -1;
46643         });
46644       }
46645       function getPointLabel(entity2, width2, height, geometry2) {
46646         var y = geometry2 === "point" ? -12 : 0;
46647         var pointOffsets = {
46648           ltr: [15, y, "start"],
46649           rtl: [-15, y, "end"]
46650         };
46651         var textDirection = _mainLocalizer.textDirection();
46652         var coord3 = projection2(entity2.loc);
46653         var textPadding = 2;
46654         var offset = pointOffsets[textDirection];
46655         var p2 = {
46656           height,
46657           width: width2,
46658           x: coord3[0] + offset[0],
46659           y: coord3[1] + offset[1],
46660           textAnchor: offset[2]
46661         };
46662         var bbox2;
46663         if (textDirection === "rtl") {
46664           bbox2 = {
46665             minX: p2.x - width2 - textPadding,
46666             minY: p2.y - height / 2 - textPadding,
46667             maxX: p2.x + textPadding,
46668             maxY: p2.y + height / 2 + textPadding
46669           };
46670         } else {
46671           bbox2 = {
46672             minX: p2.x - textPadding,
46673             minY: p2.y - height / 2 - textPadding,
46674             maxX: p2.x + width2 + textPadding,
46675             maxY: p2.y + height / 2 + textPadding
46676           };
46677         }
46678         if (tryInsert([bbox2], entity2.id, true)) {
46679           return p2;
46680         }
46681       }
46682       function getLineLabel(entity2, width2, height) {
46683         var viewport = geoExtent(context.projection.clipExtent()).polygon();
46684         var points = graph.childNodes(entity2).map(function(node) {
46685           return projection2(node.loc);
46686         });
46687         var length = geoPathLength(points);
46688         if (length < width2 + 20)
46689           return;
46690         var lineOffsets = [
46691           50,
46692           45,
46693           55,
46694           40,
46695           60,
46696           35,
46697           65,
46698           30,
46699           70,
46700           25,
46701           75,
46702           20,
46703           80,
46704           15,
46705           95,
46706           10,
46707           90,
46708           5,
46709           95
46710         ];
46711         var padding = 3;
46712         for (var i3 = 0; i3 < lineOffsets.length; i3++) {
46713           var offset = lineOffsets[i3];
46714           var middle = offset / 100 * length;
46715           var start2 = middle - width2 / 2;
46716           if (start2 < 0 || start2 + width2 > length)
46717             continue;
46718           var sub = subpath(points, start2, start2 + width2);
46719           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
46720             continue;
46721           }
46722           var isReverse = reverse(sub);
46723           if (isReverse) {
46724             sub = sub.reverse();
46725           }
46726           var bboxes = [];
46727           var boxsize = (height + 2) / 2;
46728           for (var j3 = 0; j3 < sub.length - 1; j3++) {
46729             var a = sub[j3];
46730             var b = sub[j3 + 1];
46731             var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
46732             for (var box = 0; box < num; box++) {
46733               var p2 = geoVecInterp(a, b, box / num);
46734               var x05 = p2[0] - boxsize - padding;
46735               var y05 = p2[1] - boxsize - padding;
46736               var x12 = p2[0] + boxsize + padding;
46737               var y12 = p2[1] + boxsize + padding;
46738               bboxes.push({
46739                 minX: Math.min(x05, x12),
46740                 minY: Math.min(y05, y12),
46741                 maxX: Math.max(x05, x12),
46742                 maxY: Math.max(y05, y12)
46743               });
46744             }
46745           }
46746           if (tryInsert(bboxes, entity2.id, false)) {
46747             return {
46748               "font-size": height + 2,
46749               lineString: lineString2(sub),
46750               startOffset: offset + "%"
46751             };
46752           }
46753         }
46754         function reverse(p3) {
46755           var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
46756           return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
46757         }
46758         function lineString2(points2) {
46759           return "M" + points2.join("L");
46760         }
46761         function subpath(points2, from, to) {
46762           var sofar = 0;
46763           var start3, end, i0, i1;
46764           for (var i4 = 0; i4 < points2.length - 1; i4++) {
46765             var a2 = points2[i4];
46766             var b2 = points2[i4 + 1];
46767             var current = geoVecLength(a2, b2);
46768             var portion;
46769             if (!start3 && sofar + current >= from) {
46770               portion = (from - sofar) / current;
46771               start3 = [
46772                 a2[0] + portion * (b2[0] - a2[0]),
46773                 a2[1] + portion * (b2[1] - a2[1])
46774               ];
46775               i0 = i4 + 1;
46776             }
46777             if (!end && sofar + current >= to) {
46778               portion = (to - sofar) / current;
46779               end = [
46780                 a2[0] + portion * (b2[0] - a2[0]),
46781                 a2[1] + portion * (b2[1] - a2[1])
46782               ];
46783               i1 = i4 + 1;
46784             }
46785             sofar += current;
46786           }
46787           var result = points2.slice(i0, i1);
46788           result.unshift(start3);
46789           result.push(end);
46790           return result;
46791         }
46792       }
46793       function getAreaLabel(entity2, width2, height) {
46794         var centroid = path.centroid(entity2.asGeoJSON(graph));
46795         var extent = entity2.extent(graph);
46796         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
46797         if (isNaN(centroid[0]) || areaWidth < 20)
46798           return;
46799         var preset2 = _mainPresetIndex.match(entity2, context.graph());
46800         var picon = preset2 && preset2.icon;
46801         var iconSize = 17;
46802         var padding = 2;
46803         var p2 = {};
46804         if (picon) {
46805           if (addIcon()) {
46806             addLabel(iconSize + padding);
46807             return p2;
46808           }
46809         } else {
46810           if (addLabel(0)) {
46811             return p2;
46812           }
46813         }
46814         function addIcon() {
46815           var iconX = centroid[0] - iconSize / 2;
46816           var iconY = centroid[1] - iconSize / 2;
46817           var bbox2 = {
46818             minX: iconX,
46819             minY: iconY,
46820             maxX: iconX + iconSize,
46821             maxY: iconY + iconSize
46822           };
46823           if (tryInsert([bbox2], entity2.id + "I", true)) {
46824             p2.transform = "translate(" + iconX + "," + iconY + ")";
46825             return true;
46826           }
46827           return false;
46828         }
46829         function addLabel(yOffset) {
46830           if (width2 && areaWidth >= width2 + 20) {
46831             var labelX = centroid[0];
46832             var labelY = centroid[1] + yOffset;
46833             var bbox2 = {
46834               minX: labelX - width2 / 2 - padding,
46835               minY: labelY - height / 2 - padding,
46836               maxX: labelX + width2 / 2 + padding,
46837               maxY: labelY + height / 2 + padding
46838             };
46839             if (tryInsert([bbox2], entity2.id, true)) {
46840               p2.x = labelX;
46841               p2.y = labelY;
46842               p2.textAnchor = "middle";
46843               p2.height = height;
46844               return true;
46845             }
46846           }
46847           return false;
46848         }
46849       }
46850       function doInsert(bbox2, id2) {
46851         bbox2.id = id2;
46852         var oldbox = _entitybboxes[id2];
46853         if (oldbox) {
46854           _rdrawn.remove(oldbox);
46855         }
46856         _entitybboxes[id2] = bbox2;
46857         _rdrawn.insert(bbox2);
46858       }
46859       function tryInsert(bboxes, id2, saveSkipped) {
46860         var skipped = false;
46861         for (var i3 = 0; i3 < bboxes.length; i3++) {
46862           var bbox2 = bboxes[i3];
46863           bbox2.id = id2;
46864           if (bbox2.minX < 0 || bbox2.minY < 0 || bbox2.maxX > dimensions[0] || bbox2.maxY > dimensions[1]) {
46865             skipped = true;
46866             break;
46867           }
46868           if (_rdrawn.collides(bbox2)) {
46869             skipped = true;
46870             break;
46871           }
46872         }
46873         _entitybboxes[id2] = bboxes;
46874         if (skipped) {
46875           if (saveSkipped) {
46876             _rskipped.load(bboxes);
46877           }
46878         } else {
46879           _rdrawn.load(bboxes);
46880         }
46881         return !skipped;
46882       }
46883       var layer = selection2.selectAll(".layer-osm.labels");
46884       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
46885         return "labels-group " + d;
46886       });
46887       var halo = layer.selectAll(".labels-group.halo");
46888       var label = layer.selectAll(".labels-group.label");
46889       var debug2 = layer.selectAll(".labels-group.debug");
46890       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
46891       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
46892       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
46893       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
46894       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
46895       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
46896       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
46897       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
46898       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
46899       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
46900       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
46901       layer.call(filterLabels);
46902     }
46903     function filterLabels(selection2) {
46904       var drawLayer = selection2.selectAll(".layer-osm.labels");
46905       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
46906       layers.selectAll(".nolabel").classed("nolabel", false);
46907       var mouse = context.map().mouse();
46908       var graph = context.graph();
46909       var selectedIDs = context.selectedIDs();
46910       var ids = [];
46911       var pad2, bbox;
46912       if (mouse) {
46913         pad2 = 20;
46914         bbox = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
46915         var nearMouse = _rdrawn.search(bbox).map(function(entity2) {
46916           return entity2.id;
46917         });
46918         ids.push.apply(ids, nearMouse);
46919       }
46920       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
46921         var entity = graph.hasEntity(selectedIDs[i2]);
46922         if (entity && entity.type === "node") {
46923           ids.push(selectedIDs[i2]);
46924         }
46925       }
46926       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
46927       var debug2 = selection2.selectAll(".labels-group.debug");
46928       var gj = [];
46929       if (context.getDebug("collision")) {
46930         gj = bbox ? [{
46931           type: "Polygon",
46932           coordinates: [[
46933             [bbox.minX, bbox.minY],
46934             [bbox.maxX, bbox.minY],
46935             [bbox.maxX, bbox.maxY],
46936             [bbox.minX, bbox.maxY],
46937             [bbox.minX, bbox.minY]
46938           ]]
46939         }] : [];
46940       }
46941       var box = debug2.selectAll(".debug-mouse").data(gj);
46942       box.exit().remove();
46943       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
46944     }
46945     var throttleFilterLabels = throttle_default(filterLabels, 100);
46946     drawLabels.observe = function(selection2) {
46947       var listener = function() {
46948         throttleFilterLabels(selection2);
46949       };
46950       selection2.on("mousemove.hidelabels", listener);
46951       context.on("enter.hidelabels", listener);
46952     };
46953     drawLabels.off = function(selection2) {
46954       throttleFilterLabels.cancel();
46955       selection2.on("mousemove.hidelabels", null);
46956       context.on("enter.hidelabels", null);
46957     };
46958     return drawLabels;
46959   }
46960
46961   // modules/svg/improveOSM.js
46962   var _layerEnabled2 = false;
46963   var _qaService2;
46964   function svgImproveOSM(projection2, context, dispatch10) {
46965     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
46966     const minZoom3 = 12;
46967     let touchLayer = select_default2(null);
46968     let drawLayer = select_default2(null);
46969     let layerVisible = false;
46970     function markerPath(selection2, klass) {
46971       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");
46972     }
46973     function getService() {
46974       if (services.improveOSM && !_qaService2) {
46975         _qaService2 = services.improveOSM;
46976         _qaService2.on("loaded", throttledRedraw);
46977       } else if (!services.improveOSM && _qaService2) {
46978         _qaService2 = null;
46979       }
46980       return _qaService2;
46981     }
46982     function editOn() {
46983       if (!layerVisible) {
46984         layerVisible = true;
46985         drawLayer.style("display", "block");
46986       }
46987     }
46988     function editOff() {
46989       if (layerVisible) {
46990         layerVisible = false;
46991         drawLayer.style("display", "none");
46992         drawLayer.selectAll(".qaItem.improveOSM").remove();
46993         touchLayer.selectAll(".qaItem.improveOSM").remove();
46994       }
46995     }
46996     function layerOn() {
46997       editOn();
46998       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
46999     }
47000     function layerOff() {
47001       throttledRedraw.cancel();
47002       drawLayer.interrupt();
47003       touchLayer.selectAll(".qaItem.improveOSM").remove();
47004       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47005         editOff();
47006         dispatch10.call("change");
47007       });
47008     }
47009     function updateMarkers() {
47010       if (!layerVisible || !_layerEnabled2)
47011         return;
47012       const service = getService();
47013       const selectedID = context.selectedErrorID();
47014       const data = service ? service.getItems(projection2) : [];
47015       const getTransform = svgPointTransform(projection2);
47016       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47017       markers.exit().remove();
47018       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47019       markersEnter.append("polygon").call(markerPath, "shadow");
47020       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47021       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
47022       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 : "");
47023       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47024       if (touchLayer.empty())
47025         return;
47026       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
47027       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47028       targets.exit().remove();
47029       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);
47030       function sortY(a, b) {
47031         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47032       }
47033     }
47034     function drawImproveOSM(selection2) {
47035       const service = getService();
47036       const surface = context.surface();
47037       if (surface && !surface.empty()) {
47038         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47039       }
47040       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
47041       drawLayer.exit().remove();
47042       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
47043       if (_layerEnabled2) {
47044         if (service && ~~context.map().zoom() >= minZoom3) {
47045           editOn();
47046           service.loadIssues(projection2);
47047           updateMarkers();
47048         } else {
47049           editOff();
47050         }
47051       }
47052     }
47053     drawImproveOSM.enabled = function(val) {
47054       if (!arguments.length)
47055         return _layerEnabled2;
47056       _layerEnabled2 = val;
47057       if (_layerEnabled2) {
47058         layerOn();
47059       } else {
47060         layerOff();
47061         if (context.selectedErrorID()) {
47062           context.enter(modeBrowse(context));
47063         }
47064       }
47065       dispatch10.call("change");
47066       return this;
47067     };
47068     drawImproveOSM.supported = () => !!getService();
47069     return drawImproveOSM;
47070   }
47071
47072   // modules/svg/osmose.js
47073   var _layerEnabled3 = false;
47074   var _qaService3;
47075   function svgOsmose(projection2, context, dispatch10) {
47076     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47077     const minZoom3 = 12;
47078     let touchLayer = select_default2(null);
47079     let drawLayer = select_default2(null);
47080     let layerVisible = false;
47081     function markerPath(selection2, klass) {
47082       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");
47083     }
47084     function getService() {
47085       if (services.osmose && !_qaService3) {
47086         _qaService3 = services.osmose;
47087         _qaService3.on("loaded", throttledRedraw);
47088       } else if (!services.osmose && _qaService3) {
47089         _qaService3 = null;
47090       }
47091       return _qaService3;
47092     }
47093     function editOn() {
47094       if (!layerVisible) {
47095         layerVisible = true;
47096         drawLayer.style("display", "block");
47097       }
47098     }
47099     function editOff() {
47100       if (layerVisible) {
47101         layerVisible = false;
47102         drawLayer.style("display", "none");
47103         drawLayer.selectAll(".qaItem.osmose").remove();
47104         touchLayer.selectAll(".qaItem.osmose").remove();
47105       }
47106     }
47107     function layerOn() {
47108       editOn();
47109       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47110     }
47111     function layerOff() {
47112       throttledRedraw.cancel();
47113       drawLayer.interrupt();
47114       touchLayer.selectAll(".qaItem.osmose").remove();
47115       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47116         editOff();
47117         dispatch10.call("change");
47118       });
47119     }
47120     function updateMarkers() {
47121       if (!layerVisible || !_layerEnabled3)
47122         return;
47123       const service = getService();
47124       const selectedID = context.selectedErrorID();
47125       const data = service ? service.getItems(projection2) : [];
47126       const getTransform = svgPointTransform(projection2);
47127       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47128       markers.exit().remove();
47129       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47130       markersEnter.append("polygon").call(markerPath, "shadow");
47131       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47132       markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
47133       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 : "");
47134       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47135       if (touchLayer.empty())
47136         return;
47137       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
47138       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47139       targets.exit().remove();
47140       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);
47141       function sortY(a, b) {
47142         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47143       }
47144     }
47145     function drawOsmose(selection2) {
47146       const service = getService();
47147       const surface = context.surface();
47148       if (surface && !surface.empty()) {
47149         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47150       }
47151       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
47152       drawLayer.exit().remove();
47153       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
47154       if (_layerEnabled3) {
47155         if (service && ~~context.map().zoom() >= minZoom3) {
47156           editOn();
47157           service.loadIssues(projection2);
47158           updateMarkers();
47159         } else {
47160           editOff();
47161         }
47162       }
47163     }
47164     drawOsmose.enabled = function(val) {
47165       if (!arguments.length)
47166         return _layerEnabled3;
47167       _layerEnabled3 = val;
47168       if (_layerEnabled3) {
47169         getService().loadStrings().then(layerOn).catch((err) => {
47170           console.log(err);
47171         });
47172       } else {
47173         layerOff();
47174         if (context.selectedErrorID()) {
47175           context.enter(modeBrowse(context));
47176         }
47177       }
47178       dispatch10.call("change");
47179       return this;
47180     };
47181     drawOsmose.supported = () => !!getService();
47182     return drawOsmose;
47183   }
47184
47185   // modules/svg/streetside.js
47186   function svgStreetside(projection2, context, dispatch10) {
47187     var throttledRedraw = throttle_default(function() {
47188       dispatch10.call("change");
47189     }, 1e3);
47190     var minZoom3 = 14;
47191     var minMarkerZoom = 16;
47192     var minViewfieldZoom = 18;
47193     var layer = select_default2(null);
47194     var _viewerYaw = 0;
47195     var _selectedSequence = null;
47196     var _streetside;
47197     function init2() {
47198       if (svgStreetside.initialized)
47199         return;
47200       svgStreetside.enabled = false;
47201       svgStreetside.initialized = true;
47202     }
47203     function getService() {
47204       if (services.streetside && !_streetside) {
47205         _streetside = services.streetside;
47206         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
47207       } else if (!services.streetside && _streetside) {
47208         _streetside = null;
47209       }
47210       return _streetside;
47211     }
47212     function showLayer() {
47213       var service = getService();
47214       if (!service)
47215         return;
47216       editOn();
47217       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47218         dispatch10.call("change");
47219       });
47220     }
47221     function hideLayer() {
47222       throttledRedraw.cancel();
47223       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47224     }
47225     function editOn() {
47226       layer.style("display", "block");
47227     }
47228     function editOff() {
47229       layer.selectAll(".viewfield-group").remove();
47230       layer.style("display", "none");
47231     }
47232     function click(d3_event, d) {
47233       var service = getService();
47234       if (!service)
47235         return;
47236       if (d.sequenceKey !== _selectedSequence) {
47237         _viewerYaw = 0;
47238       }
47239       _selectedSequence = d.sequenceKey;
47240       service.ensureViewerLoaded(context).then(function() {
47241         service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
47242       });
47243       context.map().centerEase(d.loc);
47244     }
47245     function mouseover(d3_event, d) {
47246       var service = getService();
47247       if (service)
47248         service.setStyles(context, d);
47249     }
47250     function mouseout() {
47251       var service = getService();
47252       if (service)
47253         service.setStyles(context, null);
47254     }
47255     function transform2(d) {
47256       var t = svgPointTransform(projection2)(d);
47257       var rot = d.ca + _viewerYaw;
47258       if (rot) {
47259         t += " rotate(" + Math.floor(rot) + ",0,0)";
47260       }
47261       return t;
47262     }
47263     function viewerChanged() {
47264       var service = getService();
47265       if (!service)
47266         return;
47267       var viewer = service.viewer();
47268       if (!viewer)
47269         return;
47270       _viewerYaw = viewer.getYaw();
47271       if (context.map().isTransformed())
47272         return;
47273       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
47274     }
47275     function filterBubbles(bubbles) {
47276       var fromDate = context.photos().fromDate();
47277       var toDate = context.photos().toDate();
47278       var usernames = context.photos().usernames();
47279       if (fromDate) {
47280         var fromTimestamp = new Date(fromDate).getTime();
47281         bubbles = bubbles.filter(function(bubble) {
47282           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
47283         });
47284       }
47285       if (toDate) {
47286         var toTimestamp = new Date(toDate).getTime();
47287         bubbles = bubbles.filter(function(bubble) {
47288           return new Date(bubble.captured_at).getTime() <= toTimestamp;
47289         });
47290       }
47291       if (usernames) {
47292         bubbles = bubbles.filter(function(bubble) {
47293           return usernames.indexOf(bubble.captured_by) !== -1;
47294         });
47295       }
47296       return bubbles;
47297     }
47298     function filterSequences(sequences) {
47299       var fromDate = context.photos().fromDate();
47300       var toDate = context.photos().toDate();
47301       var usernames = context.photos().usernames();
47302       if (fromDate) {
47303         var fromTimestamp = new Date(fromDate).getTime();
47304         sequences = sequences.filter(function(sequences2) {
47305           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
47306         });
47307       }
47308       if (toDate) {
47309         var toTimestamp = new Date(toDate).getTime();
47310         sequences = sequences.filter(function(sequences2) {
47311           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
47312         });
47313       }
47314       if (usernames) {
47315         sequences = sequences.filter(function(sequences2) {
47316           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
47317         });
47318       }
47319       return sequences;
47320     }
47321     function update() {
47322       var viewer = context.container().select(".photoviewer");
47323       var selected = viewer.empty() ? void 0 : viewer.datum();
47324       var z = ~~context.map().zoom();
47325       var showMarkers = z >= minMarkerZoom;
47326       var showViewfields = z >= minViewfieldZoom;
47327       var service = getService();
47328       var sequences = [];
47329       var bubbles = [];
47330       if (context.photos().showsPanoramic()) {
47331         sequences = service ? service.sequences(projection2) : [];
47332         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
47333         sequences = filterSequences(sequences);
47334         bubbles = filterBubbles(bubbles);
47335       }
47336       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47337         return d.properties.key;
47338       });
47339       traces.exit().remove();
47340       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47341       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
47342         return d.key + (d.sequenceKey ? "v1" : "v0");
47343       });
47344       groups.exit().remove();
47345       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47346       groupsEnter.append("g").attr("class", "viewfield-scale");
47347       var markers = groups.merge(groupsEnter).sort(function(a, b) {
47348         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
47349       }).attr("transform", transform2).select(".viewfield-scale");
47350       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47351       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47352       viewfields.exit().remove();
47353       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
47354       function viewfieldPath() {
47355         var d = this.parentNode.__data__;
47356         if (d.pano) {
47357           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
47358         } else {
47359           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
47360         }
47361       }
47362     }
47363     function drawImages(selection2) {
47364       var enabled = svgStreetside.enabled;
47365       var service = getService();
47366       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
47367       layer.exit().remove();
47368       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
47369       layerEnter.append("g").attr("class", "sequences");
47370       layerEnter.append("g").attr("class", "markers");
47371       layer = layerEnter.merge(layer);
47372       if (enabled) {
47373         if (service && ~~context.map().zoom() >= minZoom3) {
47374           editOn();
47375           update();
47376           service.loadBubbles(projection2);
47377         } else {
47378           editOff();
47379         }
47380       }
47381     }
47382     drawImages.enabled = function(_) {
47383       if (!arguments.length)
47384         return svgStreetside.enabled;
47385       svgStreetside.enabled = _;
47386       if (svgStreetside.enabled) {
47387         showLayer();
47388         context.photos().on("change.streetside", update);
47389       } else {
47390         hideLayer();
47391         context.photos().on("change.streetside", null);
47392       }
47393       dispatch10.call("change");
47394       return this;
47395     };
47396     drawImages.supported = function() {
47397       return !!getService();
47398     };
47399     init2();
47400     return drawImages;
47401   }
47402
47403   // modules/svg/mapillary_images.js
47404   function svgMapillaryImages(projection2, context, dispatch10) {
47405     const throttledRedraw = throttle_default(function() {
47406       dispatch10.call("change");
47407     }, 1e3);
47408     const minZoom3 = 12;
47409     const minMarkerZoom = 16;
47410     const minViewfieldZoom = 18;
47411     let layer = select_default2(null);
47412     let _mapillary;
47413     function init2() {
47414       if (svgMapillaryImages.initialized)
47415         return;
47416       svgMapillaryImages.enabled = false;
47417       svgMapillaryImages.initialized = true;
47418     }
47419     function getService() {
47420       if (services.mapillary && !_mapillary) {
47421         _mapillary = services.mapillary;
47422         _mapillary.event.on("loadedImages", throttledRedraw);
47423       } else if (!services.mapillary && _mapillary) {
47424         _mapillary = null;
47425       }
47426       return _mapillary;
47427     }
47428     function showLayer() {
47429       const service = getService();
47430       if (!service)
47431         return;
47432       editOn();
47433       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47434         dispatch10.call("change");
47435       });
47436     }
47437     function hideLayer() {
47438       throttledRedraw.cancel();
47439       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47440     }
47441     function editOn() {
47442       layer.style("display", "block");
47443     }
47444     function editOff() {
47445       layer.selectAll(".viewfield-group").remove();
47446       layer.style("display", "none");
47447     }
47448     function click(d3_event, image) {
47449       const service = getService();
47450       if (!service)
47451         return;
47452       service.ensureViewerLoaded(context).then(function() {
47453         service.selectImage(context, image.id).showViewer(context);
47454       });
47455       context.map().centerEase(image.loc);
47456     }
47457     function mouseover(d3_event, image) {
47458       const service = getService();
47459       if (service)
47460         service.setStyles(context, image);
47461     }
47462     function mouseout() {
47463       const service = getService();
47464       if (service)
47465         service.setStyles(context, null);
47466     }
47467     function transform2(d) {
47468       let t = svgPointTransform(projection2)(d);
47469       if (d.ca) {
47470         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
47471       }
47472       return t;
47473     }
47474     function filterImages(images) {
47475       const showsPano = context.photos().showsPanoramic();
47476       const showsFlat = context.photos().showsFlat();
47477       const fromDate = context.photos().fromDate();
47478       const toDate = context.photos().toDate();
47479       if (!showsPano || !showsFlat) {
47480         images = images.filter(function(image) {
47481           if (image.is_pano)
47482             return showsPano;
47483           return showsFlat;
47484         });
47485       }
47486       if (fromDate) {
47487         images = images.filter(function(image) {
47488           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
47489         });
47490       }
47491       if (toDate) {
47492         images = images.filter(function(image) {
47493           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
47494         });
47495       }
47496       return images;
47497     }
47498     function filterSequences(sequences) {
47499       const showsPano = context.photos().showsPanoramic();
47500       const showsFlat = context.photos().showsFlat();
47501       const fromDate = context.photos().fromDate();
47502       const toDate = context.photos().toDate();
47503       if (!showsPano || !showsFlat) {
47504         sequences = sequences.filter(function(sequence) {
47505           if (sequence.properties.hasOwnProperty("is_pano")) {
47506             if (sequence.properties.is_pano)
47507               return showsPano;
47508             return showsFlat;
47509           }
47510           return false;
47511         });
47512       }
47513       if (fromDate) {
47514         sequences = sequences.filter(function(sequence) {
47515           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
47516         });
47517       }
47518       if (toDate) {
47519         sequences = sequences.filter(function(sequence) {
47520           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
47521         });
47522       }
47523       return sequences;
47524     }
47525     function update() {
47526       const z = ~~context.map().zoom();
47527       const showMarkers = z >= minMarkerZoom;
47528       const showViewfields = z >= minViewfieldZoom;
47529       const service = getService();
47530       let sequences = service ? service.sequences(projection2) : [];
47531       let images = service && showMarkers ? service.images(projection2) : [];
47532       images = filterImages(images);
47533       sequences = filterSequences(sequences, service);
47534       service.filterViewer(context);
47535       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47536         return d.properties.id;
47537       });
47538       traces.exit().remove();
47539       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47540       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
47541         return d.id;
47542       });
47543       groups.exit().remove();
47544       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47545       groupsEnter.append("g").attr("class", "viewfield-scale");
47546       const markers = groups.merge(groupsEnter).sort(function(a, b) {
47547         return b.loc[1] - a.loc[1];
47548       }).attr("transform", transform2).select(".viewfield-scale");
47549       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47550       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47551       viewfields.exit().remove();
47552       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
47553         return this.parentNode.__data__.is_pano;
47554       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
47555       function viewfieldPath() {
47556         if (this.parentNode.__data__.is_pano) {
47557           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
47558         } else {
47559           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
47560         }
47561       }
47562     }
47563     function drawImages(selection2) {
47564       const enabled = svgMapillaryImages.enabled;
47565       const service = getService();
47566       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
47567       layer.exit().remove();
47568       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
47569       layerEnter.append("g").attr("class", "sequences");
47570       layerEnter.append("g").attr("class", "markers");
47571       layer = layerEnter.merge(layer);
47572       if (enabled) {
47573         if (service && ~~context.map().zoom() >= minZoom3) {
47574           editOn();
47575           update();
47576           service.loadImages(projection2);
47577         } else {
47578           editOff();
47579         }
47580       }
47581     }
47582     drawImages.enabled = function(_) {
47583       if (!arguments.length)
47584         return svgMapillaryImages.enabled;
47585       svgMapillaryImages.enabled = _;
47586       if (svgMapillaryImages.enabled) {
47587         showLayer();
47588         context.photos().on("change.mapillary_images", update);
47589       } else {
47590         hideLayer();
47591         context.photos().on("change.mapillary_images", null);
47592       }
47593       dispatch10.call("change");
47594       return this;
47595     };
47596     drawImages.supported = function() {
47597       return !!getService();
47598     };
47599     init2();
47600     return drawImages;
47601   }
47602
47603   // modules/svg/mapillary_position.js
47604   function svgMapillaryPosition(projection2, context) {
47605     const throttledRedraw = throttle_default(function() {
47606       update();
47607     }, 1e3);
47608     const minZoom3 = 12;
47609     const minViewfieldZoom = 18;
47610     let layer = select_default2(null);
47611     let _mapillary;
47612     let viewerCompassAngle;
47613     function init2() {
47614       if (svgMapillaryPosition.initialized)
47615         return;
47616       svgMapillaryPosition.initialized = true;
47617     }
47618     function getService() {
47619       if (services.mapillary && !_mapillary) {
47620         _mapillary = services.mapillary;
47621         _mapillary.event.on("imageChanged", throttledRedraw);
47622         _mapillary.event.on("bearingChanged", function(e) {
47623           viewerCompassAngle = e.bearing;
47624           if (context.map().isTransformed())
47625             return;
47626           layer.selectAll(".viewfield-group.currentView").filter(function(d) {
47627             return d.is_pano;
47628           }).attr("transform", transform2);
47629         });
47630       } else if (!services.mapillary && _mapillary) {
47631         _mapillary = null;
47632       }
47633       return _mapillary;
47634     }
47635     function editOn() {
47636       layer.style("display", "block");
47637     }
47638     function editOff() {
47639       layer.selectAll(".viewfield-group").remove();
47640       layer.style("display", "none");
47641     }
47642     function transform2(d) {
47643       let t = svgPointTransform(projection2)(d);
47644       if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
47645         t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
47646       } else if (d.ca) {
47647         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
47648       }
47649       return t;
47650     }
47651     function update() {
47652       const z = ~~context.map().zoom();
47653       const showViewfields = z >= minViewfieldZoom;
47654       const service = getService();
47655       const image = service && service.getActiveImage();
47656       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
47657         return d.id;
47658       });
47659       groups.exit().remove();
47660       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
47661       groupsEnter.append("g").attr("class", "viewfield-scale");
47662       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
47663       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47664       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47665       viewfields.exit().remove();
47666       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");
47667     }
47668     function drawImages(selection2) {
47669       const service = getService();
47670       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
47671       layer.exit().remove();
47672       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
47673       layerEnter.append("g").attr("class", "markers");
47674       layer = layerEnter.merge(layer);
47675       if (service && ~~context.map().zoom() >= minZoom3) {
47676         editOn();
47677         update();
47678       } else {
47679         editOff();
47680       }
47681     }
47682     drawImages.enabled = function() {
47683       update();
47684       return this;
47685     };
47686     drawImages.supported = function() {
47687       return !!getService();
47688     };
47689     init2();
47690     return drawImages;
47691   }
47692
47693   // modules/svg/mapillary_signs.js
47694   function svgMapillarySigns(projection2, context, dispatch10) {
47695     const throttledRedraw = throttle_default(function() {
47696       dispatch10.call("change");
47697     }, 1e3);
47698     const minZoom3 = 12;
47699     let layer = select_default2(null);
47700     let _mapillary;
47701     function init2() {
47702       if (svgMapillarySigns.initialized)
47703         return;
47704       svgMapillarySigns.enabled = false;
47705       svgMapillarySigns.initialized = true;
47706     }
47707     function getService() {
47708       if (services.mapillary && !_mapillary) {
47709         _mapillary = services.mapillary;
47710         _mapillary.event.on("loadedSigns", throttledRedraw);
47711       } else if (!services.mapillary && _mapillary) {
47712         _mapillary = null;
47713       }
47714       return _mapillary;
47715     }
47716     function showLayer() {
47717       const service = getService();
47718       if (!service)
47719         return;
47720       service.loadSignResources(context);
47721       editOn();
47722     }
47723     function hideLayer() {
47724       throttledRedraw.cancel();
47725       editOff();
47726     }
47727     function editOn() {
47728       layer.style("display", "block");
47729     }
47730     function editOff() {
47731       layer.selectAll(".icon-sign").remove();
47732       layer.style("display", "none");
47733     }
47734     function click(d3_event, d) {
47735       const service = getService();
47736       if (!service)
47737         return;
47738       context.map().centerEase(d.loc);
47739       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
47740       service.getDetections(d.id).then((detections) => {
47741         if (detections.length) {
47742           const imageId = detections[0].image.id;
47743           if (imageId === selectedImageId) {
47744             service.highlightDetection(detections[0]).selectImage(context, imageId);
47745           } else {
47746             service.ensureViewerLoaded(context).then(function() {
47747               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
47748             });
47749           }
47750         }
47751       });
47752     }
47753     function filterData(detectedFeatures) {
47754       var fromDate = context.photos().fromDate();
47755       var toDate = context.photos().toDate();
47756       if (fromDate) {
47757         var fromTimestamp = new Date(fromDate).getTime();
47758         detectedFeatures = detectedFeatures.filter(function(feature3) {
47759           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
47760         });
47761       }
47762       if (toDate) {
47763         var toTimestamp = new Date(toDate).getTime();
47764         detectedFeatures = detectedFeatures.filter(function(feature3) {
47765           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
47766         });
47767       }
47768       return detectedFeatures;
47769     }
47770     function update() {
47771       const service = getService();
47772       let data = service ? service.signs(projection2) : [];
47773       data = filterData(data);
47774       const transform2 = svgPointTransform(projection2);
47775       const signs = layer.selectAll(".icon-sign").data(data, function(d) {
47776         return d.id;
47777       });
47778       signs.exit().remove();
47779       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
47780       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
47781         return "#" + d.value;
47782       });
47783       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
47784       signs.merge(enter).attr("transform", transform2);
47785     }
47786     function drawSigns(selection2) {
47787       const enabled = svgMapillarySigns.enabled;
47788       const service = getService();
47789       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
47790       layer.exit().remove();
47791       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
47792       if (enabled) {
47793         if (service && ~~context.map().zoom() >= minZoom3) {
47794           editOn();
47795           update();
47796           service.loadSigns(projection2);
47797           service.showSignDetections(true);
47798         } else {
47799           editOff();
47800         }
47801       } else if (service) {
47802         service.showSignDetections(false);
47803       }
47804     }
47805     drawSigns.enabled = function(_) {
47806       if (!arguments.length)
47807         return svgMapillarySigns.enabled;
47808       svgMapillarySigns.enabled = _;
47809       if (svgMapillarySigns.enabled) {
47810         showLayer();
47811         context.photos().on("change.mapillary_signs", update);
47812       } else {
47813         hideLayer();
47814         context.photos().on("change.mapillary_signs", null);
47815       }
47816       dispatch10.call("change");
47817       return this;
47818     };
47819     drawSigns.supported = function() {
47820       return !!getService();
47821     };
47822     init2();
47823     return drawSigns;
47824   }
47825
47826   // modules/svg/mapillary_map_features.js
47827   function svgMapillaryMapFeatures(projection2, context, dispatch10) {
47828     const throttledRedraw = throttle_default(function() {
47829       dispatch10.call("change");
47830     }, 1e3);
47831     const minZoom3 = 12;
47832     let layer = select_default2(null);
47833     let _mapillary;
47834     function init2() {
47835       if (svgMapillaryMapFeatures.initialized)
47836         return;
47837       svgMapillaryMapFeatures.enabled = false;
47838       svgMapillaryMapFeatures.initialized = true;
47839     }
47840     function getService() {
47841       if (services.mapillary && !_mapillary) {
47842         _mapillary = services.mapillary;
47843         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
47844       } else if (!services.mapillary && _mapillary) {
47845         _mapillary = null;
47846       }
47847       return _mapillary;
47848     }
47849     function showLayer() {
47850       const service = getService();
47851       if (!service)
47852         return;
47853       service.loadObjectResources(context);
47854       editOn();
47855     }
47856     function hideLayer() {
47857       throttledRedraw.cancel();
47858       editOff();
47859     }
47860     function editOn() {
47861       layer.style("display", "block");
47862     }
47863     function editOff() {
47864       layer.selectAll(".icon-map-feature").remove();
47865       layer.style("display", "none");
47866     }
47867     function click(d3_event, d) {
47868       const service = getService();
47869       if (!service)
47870         return;
47871       context.map().centerEase(d.loc);
47872       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
47873       service.getDetections(d.id).then((detections) => {
47874         if (detections.length) {
47875           const imageId = detections[0].image.id;
47876           if (imageId === selectedImageId) {
47877             service.highlightDetection(detections[0]).selectImage(context, imageId);
47878           } else {
47879             service.ensureViewerLoaded(context).then(function() {
47880               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
47881             });
47882           }
47883         }
47884       });
47885     }
47886     function filterData(detectedFeatures) {
47887       const fromDate = context.photos().fromDate();
47888       const toDate = context.photos().toDate();
47889       if (fromDate) {
47890         detectedFeatures = detectedFeatures.filter(function(feature3) {
47891           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
47892         });
47893       }
47894       if (toDate) {
47895         detectedFeatures = detectedFeatures.filter(function(feature3) {
47896           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
47897         });
47898       }
47899       return detectedFeatures;
47900     }
47901     function update() {
47902       const service = getService();
47903       let data = service ? service.mapFeatures(projection2) : [];
47904       data = filterData(data);
47905       const transform2 = svgPointTransform(projection2);
47906       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
47907         return d.id;
47908       });
47909       mapFeatures.exit().remove();
47910       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
47911       enter.append("title").text(function(d) {
47912         var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
47913         return _t("mapillary_map_features." + id2);
47914       });
47915       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
47916         if (d.value === "object--billboard") {
47917           return "#object--sign--advertisement";
47918         }
47919         return "#" + d.value;
47920       });
47921       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
47922       mapFeatures.merge(enter).attr("transform", transform2);
47923     }
47924     function drawMapFeatures(selection2) {
47925       const enabled = svgMapillaryMapFeatures.enabled;
47926       const service = getService();
47927       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
47928       layer.exit().remove();
47929       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
47930       if (enabled) {
47931         if (service && ~~context.map().zoom() >= minZoom3) {
47932           editOn();
47933           update();
47934           service.loadMapFeatures(projection2);
47935           service.showFeatureDetections(true);
47936         } else {
47937           editOff();
47938         }
47939       } else if (service) {
47940         service.showFeatureDetections(false);
47941       }
47942     }
47943     drawMapFeatures.enabled = function(_) {
47944       if (!arguments.length)
47945         return svgMapillaryMapFeatures.enabled;
47946       svgMapillaryMapFeatures.enabled = _;
47947       if (svgMapillaryMapFeatures.enabled) {
47948         showLayer();
47949         context.photos().on("change.mapillary_map_features", update);
47950       } else {
47951         hideLayer();
47952         context.photos().on("change.mapillary_map_features", null);
47953       }
47954       dispatch10.call("change");
47955       return this;
47956     };
47957     drawMapFeatures.supported = function() {
47958       return !!getService();
47959     };
47960     init2();
47961     return drawMapFeatures;
47962   }
47963
47964   // modules/svg/kartaview_images.js
47965   function svgKartaviewImages(projection2, context, dispatch10) {
47966     var throttledRedraw = throttle_default(function() {
47967       dispatch10.call("change");
47968     }, 1e3);
47969     var minZoom3 = 12;
47970     var minMarkerZoom = 16;
47971     var minViewfieldZoom = 18;
47972     var layer = select_default2(null);
47973     var _kartaview;
47974     function init2() {
47975       if (svgKartaviewImages.initialized)
47976         return;
47977       svgKartaviewImages.enabled = false;
47978       svgKartaviewImages.initialized = true;
47979     }
47980     function getService() {
47981       if (services.kartaview && !_kartaview) {
47982         _kartaview = services.kartaview;
47983         _kartaview.event.on("loadedImages", throttledRedraw);
47984       } else if (!services.kartaview && _kartaview) {
47985         _kartaview = null;
47986       }
47987       return _kartaview;
47988     }
47989     function showLayer() {
47990       var service = getService();
47991       if (!service)
47992         return;
47993       editOn();
47994       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47995         dispatch10.call("change");
47996       });
47997     }
47998     function hideLayer() {
47999       throttledRedraw.cancel();
48000       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
48001     }
48002     function editOn() {
48003       layer.style("display", "block");
48004     }
48005     function editOff() {
48006       layer.selectAll(".viewfield-group").remove();
48007       layer.style("display", "none");
48008     }
48009     function click(d3_event, d) {
48010       var service = getService();
48011       if (!service)
48012         return;
48013       service.ensureViewerLoaded(context).then(function() {
48014         service.selectImage(context, d.key).showViewer(context);
48015       });
48016       context.map().centerEase(d.loc);
48017     }
48018     function mouseover(d3_event, d) {
48019       var service = getService();
48020       if (service)
48021         service.setStyles(context, d);
48022     }
48023     function mouseout() {
48024       var service = getService();
48025       if (service)
48026         service.setStyles(context, null);
48027     }
48028     function transform2(d) {
48029       var t = svgPointTransform(projection2)(d);
48030       if (d.ca) {
48031         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48032       }
48033       return t;
48034     }
48035     function filterImages(images) {
48036       var fromDate = context.photos().fromDate();
48037       var toDate = context.photos().toDate();
48038       var usernames = context.photos().usernames();
48039       if (fromDate) {
48040         var fromTimestamp = new Date(fromDate).getTime();
48041         images = images.filter(function(item) {
48042           return new Date(item.captured_at).getTime() >= fromTimestamp;
48043         });
48044       }
48045       if (toDate) {
48046         var toTimestamp = new Date(toDate).getTime();
48047         images = images.filter(function(item) {
48048           return new Date(item.captured_at).getTime() <= toTimestamp;
48049         });
48050       }
48051       if (usernames) {
48052         images = images.filter(function(item) {
48053           return usernames.indexOf(item.captured_by) !== -1;
48054         });
48055       }
48056       return images;
48057     }
48058     function filterSequences(sequences) {
48059       var fromDate = context.photos().fromDate();
48060       var toDate = context.photos().toDate();
48061       var usernames = context.photos().usernames();
48062       if (fromDate) {
48063         var fromTimestamp = new Date(fromDate).getTime();
48064         sequences = sequences.filter(function(image) {
48065           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
48066         });
48067       }
48068       if (toDate) {
48069         var toTimestamp = new Date(toDate).getTime();
48070         sequences = sequences.filter(function(image) {
48071           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
48072         });
48073       }
48074       if (usernames) {
48075         sequences = sequences.filter(function(image) {
48076           return usernames.indexOf(image.properties.captured_by) !== -1;
48077         });
48078       }
48079       return sequences;
48080     }
48081     function update() {
48082       var viewer = context.container().select(".photoviewer");
48083       var selected = viewer.empty() ? void 0 : viewer.datum();
48084       var z = ~~context.map().zoom();
48085       var showMarkers = z >= minMarkerZoom;
48086       var showViewfields = z >= minViewfieldZoom;
48087       var service = getService();
48088       var sequences = [];
48089       var images = [];
48090       if (context.photos().showsFlat()) {
48091         sequences = service ? service.sequences(projection2) : [];
48092         images = service && showMarkers ? service.images(projection2) : [];
48093         sequences = filterSequences(sequences);
48094         images = filterImages(images);
48095       }
48096       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
48097         return d.properties.key;
48098       });
48099       traces.exit().remove();
48100       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
48101       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
48102         return d.key;
48103       });
48104       groups.exit().remove();
48105       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
48106       groupsEnter.append("g").attr("class", "viewfield-scale");
48107       var markers = groups.merge(groupsEnter).sort(function(a, b) {
48108         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
48109       }).attr("transform", transform2).select(".viewfield-scale");
48110       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48111       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48112       viewfields.exit().remove();
48113       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");
48114     }
48115     function drawImages(selection2) {
48116       var enabled = svgKartaviewImages.enabled, service = getService();
48117       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
48118       layer.exit().remove();
48119       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
48120       layerEnter.append("g").attr("class", "sequences");
48121       layerEnter.append("g").attr("class", "markers");
48122       layer = layerEnter.merge(layer);
48123       if (enabled) {
48124         if (service && ~~context.map().zoom() >= minZoom3) {
48125           editOn();
48126           update();
48127           service.loadImages(projection2);
48128         } else {
48129           editOff();
48130         }
48131       }
48132     }
48133     drawImages.enabled = function(_) {
48134       if (!arguments.length)
48135         return svgKartaviewImages.enabled;
48136       svgKartaviewImages.enabled = _;
48137       if (svgKartaviewImages.enabled) {
48138         showLayer();
48139         context.photos().on("change.kartaview_images", update);
48140       } else {
48141         hideLayer();
48142         context.photos().on("change.kartaview_images", null);
48143       }
48144       dispatch10.call("change");
48145       return this;
48146     };
48147     drawImages.supported = function() {
48148       return !!getService();
48149     };
48150     init2();
48151     return drawImages;
48152   }
48153
48154   // modules/svg/osm.js
48155   function svgOsm(projection2, context, dispatch10) {
48156     var enabled = true;
48157     function drawOsm(selection2) {
48158       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
48159         return "layer-osm " + d;
48160       });
48161       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
48162         return "points-group " + d;
48163       });
48164     }
48165     function showLayer() {
48166       var layer = context.surface().selectAll(".data-layer.osm");
48167       layer.interrupt();
48168       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48169         dispatch10.call("change");
48170       });
48171     }
48172     function hideLayer() {
48173       var layer = context.surface().selectAll(".data-layer.osm");
48174       layer.interrupt();
48175       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48176         layer.classed("disabled", true);
48177         dispatch10.call("change");
48178       });
48179     }
48180     drawOsm.enabled = function(val) {
48181       if (!arguments.length)
48182         return enabled;
48183       enabled = val;
48184       if (enabled) {
48185         showLayer();
48186       } else {
48187         hideLayer();
48188       }
48189       dispatch10.call("change");
48190       return this;
48191     };
48192     return drawOsm;
48193   }
48194
48195   // modules/svg/notes.js
48196   var _notesEnabled = false;
48197   var _osmService;
48198   function svgNotes(projection2, context, dispatch10) {
48199     if (!dispatch10) {
48200       dispatch10 = dispatch_default("change");
48201     }
48202     var throttledRedraw = throttle_default(function() {
48203       dispatch10.call("change");
48204     }, 1e3);
48205     var minZoom3 = 12;
48206     var touchLayer = select_default2(null);
48207     var drawLayer = select_default2(null);
48208     var _notesVisible = false;
48209     function markerPath(selection2, klass) {
48210       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");
48211     }
48212     function getService() {
48213       if (services.osm && !_osmService) {
48214         _osmService = services.osm;
48215         _osmService.on("loadedNotes", throttledRedraw);
48216       } else if (!services.osm && _osmService) {
48217         _osmService = null;
48218       }
48219       return _osmService;
48220     }
48221     function editOn() {
48222       if (!_notesVisible) {
48223         _notesVisible = true;
48224         drawLayer.style("display", "block");
48225       }
48226     }
48227     function editOff() {
48228       if (_notesVisible) {
48229         _notesVisible = false;
48230         drawLayer.style("display", "none");
48231         drawLayer.selectAll(".note").remove();
48232         touchLayer.selectAll(".note").remove();
48233       }
48234     }
48235     function layerOn() {
48236       editOn();
48237       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48238         dispatch10.call("change");
48239       });
48240     }
48241     function layerOff() {
48242       throttledRedraw.cancel();
48243       drawLayer.interrupt();
48244       touchLayer.selectAll(".note").remove();
48245       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48246         editOff();
48247         dispatch10.call("change");
48248       });
48249     }
48250     function updateMarkers() {
48251       if (!_notesVisible || !_notesEnabled)
48252         return;
48253       var service = getService();
48254       var selectedID = context.selectedNoteID();
48255       var data = service ? service.notes(projection2) : [];
48256       var getTransform = svgPointTransform(projection2);
48257       var notes = drawLayer.selectAll(".note").data(data, function(d) {
48258         return d.status + d.id;
48259       });
48260       notes.exit().remove();
48261       var notesEnter = notes.enter().append("g").attr("class", function(d) {
48262         return "note note-" + d.id + " " + d.status;
48263       }).classed("new", function(d) {
48264         return d.id < 0;
48265       });
48266       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48267       notesEnter.append("path").call(markerPath, "shadow");
48268       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");
48269       notesEnter.selectAll(".icon-annotation").data(function(d) {
48270         return [d];
48271       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
48272         if (d.id < 0)
48273           return "#iD-icon-plus";
48274         if (d.status === "open")
48275           return "#iD-icon-close";
48276         return "#iD-icon-apply";
48277       });
48278       notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
48279         var mode = context.mode();
48280         var isMoving = mode && mode.id === "drag-note";
48281         return !isMoving && d.id === selectedID;
48282       }).attr("transform", getTransform);
48283       if (touchLayer.empty())
48284         return;
48285       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48286       var targets = touchLayer.selectAll(".note").data(data, function(d) {
48287         return d.id;
48288       });
48289       targets.exit().remove();
48290       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
48291         var newClass = d.id < 0 ? "new" : "";
48292         return "note target note-" + d.id + " " + fillClass + newClass;
48293       }).attr("transform", getTransform);
48294       function sortY(a, b) {
48295         if (a.id === selectedID)
48296           return 1;
48297         if (b.id === selectedID)
48298           return -1;
48299         return b.loc[1] - a.loc[1];
48300       }
48301     }
48302     function drawNotes(selection2) {
48303       var service = getService();
48304       var surface = context.surface();
48305       if (surface && !surface.empty()) {
48306         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48307       }
48308       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
48309       drawLayer.exit().remove();
48310       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
48311       if (_notesEnabled) {
48312         if (service && ~~context.map().zoom() >= minZoom3) {
48313           editOn();
48314           service.loadNotes(projection2);
48315           updateMarkers();
48316         } else {
48317           editOff();
48318         }
48319       }
48320     }
48321     drawNotes.enabled = function(val) {
48322       if (!arguments.length)
48323         return _notesEnabled;
48324       _notesEnabled = val;
48325       if (_notesEnabled) {
48326         layerOn();
48327       } else {
48328         layerOff();
48329         if (context.selectedNoteID()) {
48330           context.enter(modeBrowse(context));
48331         }
48332       }
48333       dispatch10.call("change");
48334       return this;
48335     };
48336     return drawNotes;
48337   }
48338
48339   // modules/svg/touch.js
48340   function svgTouch() {
48341     function drawTouch(selection2) {
48342       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
48343         return "layer-touch " + d;
48344       });
48345     }
48346     return drawTouch;
48347   }
48348
48349   // modules/util/dimensions.js
48350   function refresh(selection2, node) {
48351     var cr = node.getBoundingClientRect();
48352     var prop = [cr.width, cr.height];
48353     selection2.property("__dimensions__", prop);
48354     return prop;
48355   }
48356   function utilGetDimensions(selection2, force) {
48357     if (!selection2 || selection2.empty()) {
48358       return [0, 0];
48359     }
48360     var node = selection2.node(), cached = selection2.property("__dimensions__");
48361     return !cached || force ? refresh(selection2, node) : cached;
48362   }
48363   function utilSetDimensions(selection2, dimensions) {
48364     if (!selection2 || selection2.empty()) {
48365       return selection2;
48366     }
48367     var node = selection2.node();
48368     if (dimensions === null) {
48369       refresh(selection2, node);
48370       return selection2;
48371     }
48372     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
48373   }
48374
48375   // modules/svg/layers.js
48376   function svgLayers(projection2, context) {
48377     var dispatch10 = dispatch_default("change");
48378     var svg2 = select_default2(null);
48379     var _layers = [
48380       { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
48381       { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
48382       { id: "data", layer: svgData(projection2, context, dispatch10) },
48383       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
48384       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
48385       { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
48386       { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
48387       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
48388       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
48389       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
48390       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
48391       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
48392       { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
48393       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
48394       { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
48395     ];
48396     function drawLayers(selection2) {
48397       svg2 = selection2.selectAll(".surface").data([0]);
48398       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
48399       var defs = svg2.selectAll(".surface-defs").data([0]);
48400       defs.enter().append("defs").attr("class", "surface-defs");
48401       var groups = svg2.selectAll(".data-layer").data(_layers);
48402       groups.exit().remove();
48403       groups.enter().append("g").attr("class", function(d) {
48404         return "data-layer " + d.id;
48405       }).merge(groups).each(function(d) {
48406         select_default2(this).call(d.layer);
48407       });
48408     }
48409     drawLayers.all = function() {
48410       return _layers;
48411     };
48412     drawLayers.layer = function(id2) {
48413       var obj = _layers.find(function(o) {
48414         return o.id === id2;
48415       });
48416       return obj && obj.layer;
48417     };
48418     drawLayers.only = function(what) {
48419       var arr = [].concat(what);
48420       var all = _layers.map(function(layer) {
48421         return layer.id;
48422       });
48423       return drawLayers.remove(utilArrayDifference(all, arr));
48424     };
48425     drawLayers.remove = function(what) {
48426       var arr = [].concat(what);
48427       arr.forEach(function(id2) {
48428         _layers = _layers.filter(function(o) {
48429           return o.id !== id2;
48430         });
48431       });
48432       dispatch10.call("change");
48433       return this;
48434     };
48435     drawLayers.add = function(what) {
48436       var arr = [].concat(what);
48437       arr.forEach(function(obj) {
48438         if ("id" in obj && "layer" in obj) {
48439           _layers.push(obj);
48440         }
48441       });
48442       dispatch10.call("change");
48443       return this;
48444     };
48445     drawLayers.dimensions = function(val) {
48446       if (!arguments.length)
48447         return utilGetDimensions(svg2);
48448       utilSetDimensions(svg2, val);
48449       return this;
48450     };
48451     return utilRebind(drawLayers, dispatch10, "on");
48452   }
48453
48454   // modules/svg/lines.js
48455   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
48456   function svgLines(projection2, context) {
48457     var detected = utilDetect();
48458     var highway_stack = {
48459       motorway: 0,
48460       motorway_link: 1,
48461       trunk: 2,
48462       trunk_link: 3,
48463       primary: 4,
48464       primary_link: 5,
48465       secondary: 6,
48466       tertiary: 7,
48467       unclassified: 8,
48468       residential: 9,
48469       service: 10,
48470       footway: 11
48471     };
48472     function drawTargets(selection2, graph, entities, filter2) {
48473       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
48474       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
48475       var getPath = svgPath(projection2).geojson;
48476       var activeID = context.activeID();
48477       var base = context.history().base();
48478       var data = { targets: [], nopes: [] };
48479       entities.forEach(function(way) {
48480         var features2 = svgSegmentWay(way, graph, activeID);
48481         data.targets.push.apply(data.targets, features2.passive);
48482         data.nopes.push.apply(data.nopes, features2.active);
48483       });
48484       var targetData = data.targets.filter(getPath);
48485       var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
48486         return filter2(d.properties.entity);
48487       }).data(targetData, function key(d) {
48488         return d.id;
48489       });
48490       targets.exit().remove();
48491       var segmentWasEdited = function(d) {
48492         var wayID = d.properties.entity.id;
48493         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
48494           return false;
48495         }
48496         return d.properties.nodes.some(function(n2) {
48497           return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
48498         });
48499       };
48500       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
48501         return "way line target target-allowed " + targetClass + d.id;
48502       }).classed("segment-edited", segmentWasEdited);
48503       var nopeData = data.nopes.filter(getPath);
48504       var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
48505         return filter2(d.properties.entity);
48506       }).data(nopeData, function key(d) {
48507         return d.id;
48508       });
48509       nopes.exit().remove();
48510       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
48511         return "way line target target-nope " + nopeClass + d.id;
48512       }).classed("segment-edited", segmentWasEdited);
48513     }
48514     function drawLines(selection2, graph, entities, filter2) {
48515       var base = context.history().base();
48516       function waystack(a, b) {
48517         var selected = context.selectedIDs();
48518         var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
48519         var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
48520         if (a.tags.highway) {
48521           scoreA -= highway_stack[a.tags.highway];
48522         }
48523         if (b.tags.highway) {
48524           scoreB -= highway_stack[b.tags.highway];
48525         }
48526         return scoreA - scoreB;
48527       }
48528       function drawLineGroup(selection3, klass, isSelected) {
48529         var mode = context.mode();
48530         var isDrawing = mode && /^draw/.test(mode.id);
48531         var selectedClass = !isDrawing && isSelected ? "selected " : "";
48532         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
48533         lines.exit().remove();
48534         lines.enter().append("path").attr("class", function(d) {
48535           var prefix = "way line";
48536           if (!d.hasInterestingTags()) {
48537             var parentRelations = graph.parentRelations(d);
48538             var parentMultipolygons = parentRelations.filter(function(relation) {
48539               return relation.isMultipolygon();
48540             });
48541             if (parentMultipolygons.length > 0 && parentRelations.length === parentMultipolygons.length) {
48542               prefix = "relation area";
48543             }
48544           }
48545           var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
48546           return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
48547         }).classed("added", function(d) {
48548           return !base.entities[d.id];
48549         }).classed("geometry-edited", function(d) {
48550           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);
48551         }).classed("retagged", function(d) {
48552           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);
48553         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
48554         return selection3;
48555       }
48556       function getPathData(isSelected) {
48557         return function() {
48558           var layer = this.parentNode.__data__;
48559           var data = pathdata[layer] || [];
48560           return data.filter(function(d) {
48561             if (isSelected) {
48562               return context.selectedIDs().indexOf(d.id) !== -1;
48563             } else {
48564               return context.selectedIDs().indexOf(d.id) === -1;
48565             }
48566           });
48567         };
48568       }
48569       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
48570         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
48571         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
48572         var markers = markergroup.selectAll("path").filter(filter2).data(function data() {
48573           return groupdata[this.parentNode.__data__] || [];
48574         }, function key(d) {
48575           return [d.id, d.index];
48576         });
48577         markers.exit().remove();
48578         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
48579           return d.d;
48580         });
48581         if (detected.ie) {
48582           markers.each(function() {
48583             this.parentNode.insertBefore(this, this);
48584           });
48585         }
48586       }
48587       var getPath = svgPath(projection2, graph);
48588       var ways = [];
48589       var onewaydata = {};
48590       var sideddata = {};
48591       var oldMultiPolygonOuters = {};
48592       for (var i2 = 0; i2 < entities.length; i2++) {
48593         var entity = entities[i2];
48594         var outer = osmOldMultipolygonOuterMember(entity, graph);
48595         if (outer) {
48596           ways.push(entity.mergeTags(outer.tags));
48597           oldMultiPolygonOuters[outer.id] = true;
48598         } else if (entity.geometry(graph) === "line") {
48599           ways.push(entity);
48600         }
48601       }
48602       ways = ways.filter(getPath);
48603       var pathdata = utilArrayGroupBy(ways, function(way) {
48604         return way.layer();
48605       });
48606       Object.keys(pathdata).forEach(function(k) {
48607         var v = pathdata[k];
48608         var onewayArr = v.filter(function(d) {
48609           return d.isOneWay();
48610         });
48611         var onewaySegments = svgMarkerSegments(projection2, graph, 35, function shouldReverse(entity2) {
48612           return entity2.tags.oneway === "-1";
48613         }, function bothDirections(entity2) {
48614           return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
48615         });
48616         onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
48617         var sidedArr = v.filter(function(d) {
48618           return d.isSided();
48619         });
48620         var sidedSegments = svgMarkerSegments(projection2, graph, 30, function shouldReverse() {
48621           return false;
48622         }, function bothDirections() {
48623           return false;
48624         });
48625         sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
48626       });
48627       var covered = selection2.selectAll(".layer-osm.covered");
48628       var uncovered = selection2.selectAll(".layer-osm.lines");
48629       var touchLayer = selection2.selectAll(".layer-touch.lines");
48630       [covered, uncovered].forEach(function(selection3) {
48631         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
48632         var layergroup = selection3.selectAll("g.layergroup").data(range3);
48633         layergroup = layergroup.enter().append("g").attr("class", function(d) {
48634           return "layergroup layer" + String(d);
48635         }).merge(layergroup);
48636         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
48637           return "linegroup line-" + d;
48638         });
48639         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
48640         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
48641         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
48642         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
48643         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
48644         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
48645         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
48646         addMarkers(layergroup, "sided", "sidedgroup", sideddata, function marker(d) {
48647           var category = graph.entity(d.id).sidednessIdentifier();
48648           return "url(#ideditor-sided-marker-" + category + ")";
48649         });
48650       });
48651       touchLayer.call(drawTargets, graph, ways, filter2);
48652     }
48653     return drawLines;
48654   }
48655
48656   // modules/svg/midpoints.js
48657   function svgMidpoints(projection2, context) {
48658     var targetRadius = 8;
48659     function drawTargets(selection2, graph, entities, filter2) {
48660       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48661       var getTransform = svgPointTransform(projection2).geojson;
48662       var data = entities.map(function(midpoint) {
48663         return {
48664           type: "Feature",
48665           id: midpoint.id,
48666           properties: {
48667             target: true,
48668             entity: midpoint
48669           },
48670           geometry: {
48671             type: "Point",
48672             coordinates: midpoint.loc
48673           }
48674         };
48675       });
48676       var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
48677         return filter2(d.properties.entity);
48678       }).data(data, function key(d) {
48679         return d.id;
48680       });
48681       targets.exit().remove();
48682       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
48683         return "node midpoint target " + fillClass + d.id;
48684       }).attr("transform", getTransform);
48685     }
48686     function drawMidpoints(selection2, graph, entities, filter2, extent) {
48687       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
48688       var touchLayer = selection2.selectAll(".layer-touch.points");
48689       var mode = context.mode();
48690       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
48691         drawLayer.selectAll(".midpoint").remove();
48692         touchLayer.selectAll(".midpoint.target").remove();
48693         return;
48694       }
48695       var poly = extent.polygon();
48696       var midpoints = {};
48697       for (var i2 = 0; i2 < entities.length; i2++) {
48698         var entity = entities[i2];
48699         if (entity.type !== "way")
48700           continue;
48701         if (!filter2(entity))
48702           continue;
48703         if (context.selectedIDs().indexOf(entity.id) < 0)
48704           continue;
48705         var nodes = graph.childNodes(entity);
48706         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
48707           var a = nodes[j2];
48708           var b = nodes[j2 + 1];
48709           var id2 = [a.id, b.id].sort().join("-");
48710           if (midpoints[id2]) {
48711             midpoints[id2].parents.push(entity);
48712           } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
48713             var point = geoVecInterp(a.loc, b.loc, 0.5);
48714             var loc = null;
48715             if (extent.intersects(point)) {
48716               loc = point;
48717             } else {
48718               for (var k = 0; k < 4; k++) {
48719                 point = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
48720                 if (point && geoVecLength(projection2(a.loc), projection2(point)) > 20 && geoVecLength(projection2(b.loc), projection2(point)) > 20) {
48721                   loc = point;
48722                   break;
48723                 }
48724               }
48725             }
48726             if (loc) {
48727               midpoints[id2] = {
48728                 type: "midpoint",
48729                 id: id2,
48730                 loc,
48731                 edge: [a.id, b.id],
48732                 parents: [entity]
48733               };
48734             }
48735           }
48736         }
48737       }
48738       function midpointFilter(d) {
48739         if (midpoints[d.id])
48740           return true;
48741         for (var i3 = 0; i3 < d.parents.length; i3++) {
48742           if (filter2(d.parents[i3])) {
48743             return true;
48744           }
48745         }
48746         return false;
48747       }
48748       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
48749         return d.id;
48750       });
48751       groups.exit().remove();
48752       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
48753       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
48754       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
48755       groups = groups.merge(enter).attr("transform", function(d) {
48756         var translate = svgPointTransform(projection2);
48757         var a2 = graph.entity(d.edge[0]);
48758         var b2 = graph.entity(d.edge[1]);
48759         var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
48760         return translate(d) + " rotate(" + angle2 + ")";
48761       }).call(svgTagClasses().tags(function(d) {
48762         return d.parents[0].tags;
48763       }));
48764       groups.select("polygon.shadow");
48765       groups.select("polygon.fill");
48766       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
48767     }
48768     return drawMidpoints;
48769   }
48770
48771   // modules/svg/points.js
48772   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
48773   function svgPoints(projection2, context) {
48774     function markerPath(selection2, klass) {
48775       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");
48776     }
48777     function sortY(a, b) {
48778       return b.loc[1] - a.loc[1];
48779     }
48780     function fastEntityKey(d) {
48781       var mode = context.mode();
48782       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
48783       return isMoving ? d.id : osmEntity.key(d);
48784     }
48785     function drawTargets(selection2, graph, entities, filter2) {
48786       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48787       var getTransform = svgPointTransform(projection2).geojson;
48788       var activeID = context.activeID();
48789       var data = [];
48790       entities.forEach(function(node) {
48791         if (activeID === node.id)
48792           return;
48793         data.push({
48794           type: "Feature",
48795           id: node.id,
48796           properties: {
48797             target: true,
48798             entity: node
48799           },
48800           geometry: node.asGeoJSON()
48801         });
48802       });
48803       var targets = selection2.selectAll(".point.target").filter(function(d) {
48804         return filter2(d.properties.entity);
48805       }).data(data, function key(d) {
48806         return d.id;
48807       });
48808       targets.exit().remove();
48809       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
48810         return "node point target " + fillClass + d.id;
48811       }).attr("transform", getTransform);
48812     }
48813     function drawPoints(selection2, graph, entities, filter2) {
48814       var wireframe = context.surface().classed("fill-wireframe");
48815       var zoom = geoScaleToZoom(projection2.scale());
48816       var base = context.history().base();
48817       function renderAsPoint(entity) {
48818         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
48819       }
48820       var points = wireframe ? [] : entities.filter(renderAsPoint);
48821       points.sort(sortY);
48822       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
48823       var touchLayer = selection2.selectAll(".layer-touch.points");
48824       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
48825       groups.exit().remove();
48826       var enter = groups.enter().append("g").attr("class", function(d) {
48827         return "node point " + d.id;
48828       }).order();
48829       enter.append("path").call(markerPath, "shadow");
48830       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48831       enter.append("path").call(markerPath, "stroke");
48832       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
48833       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
48834         return !base.entities[d.id];
48835       }).classed("moved", function(d) {
48836         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
48837       }).classed("retagged", function(d) {
48838         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
48839       }).call(svgTagClasses());
48840       groups.select(".shadow");
48841       groups.select(".stroke");
48842       groups.select(".icon").attr("xlink:href", function(entity) {
48843         var preset = _mainPresetIndex.match(entity, graph);
48844         var picon = preset && preset.icon;
48845         return picon ? "#" + picon : "";
48846       });
48847       touchLayer.call(drawTargets, graph, points, filter2);
48848     }
48849     return drawPoints;
48850   }
48851
48852   // modules/svg/turns.js
48853   function svgTurns(projection2, context) {
48854     function icon2(turn) {
48855       var u = turn.u ? "-u" : "";
48856       if (turn.no)
48857         return "#iD-turn-no" + u;
48858       if (turn.only)
48859         return "#iD-turn-only" + u;
48860       return "#iD-turn-yes" + u;
48861     }
48862     function drawTurns(selection2, graph, turns) {
48863       function turnTransform(d) {
48864         var pxRadius = 50;
48865         var toWay = graph.entity(d.to.way);
48866         var toPoints = graph.childNodes(toWay).map(function(n2) {
48867           return n2.loc;
48868         }).map(projection2);
48869         var toLength = geoPathLength(toPoints);
48870         var mid = toLength / 2;
48871         var toNode = graph.entity(d.to.node);
48872         var toVertex = graph.entity(d.to.vertex);
48873         var a = geoAngle(toVertex, toNode, projection2);
48874         var o = projection2(toVertex.loc);
48875         var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
48876         return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
48877       }
48878       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
48879       var touchLayer = selection2.selectAll(".layer-touch.turns");
48880       var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
48881         return d.key;
48882       });
48883       groups.exit().remove();
48884       var groupsEnter = groups.enter().append("g").attr("class", function(d) {
48885         return "turn " + d.key;
48886       });
48887       var turnsEnter = groupsEnter.filter(function(d) {
48888         return !d.u;
48889       });
48890       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48891       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48892       var uEnter = groupsEnter.filter(function(d) {
48893         return d.u;
48894       });
48895       uEnter.append("circle").attr("r", "16");
48896       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
48897       groups = groups.merge(groupsEnter).attr("opacity", function(d) {
48898         return d.direct === false ? "0.7" : null;
48899       }).attr("transform", turnTransform);
48900       groups.select("use").attr("xlink:href", icon2);
48901       groups.select("rect");
48902       groups.select("circle");
48903       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48904       groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
48905         return d.key;
48906       });
48907       groups.exit().remove();
48908       groupsEnter = groups.enter().append("g").attr("class", function(d) {
48909         return "turn " + d.key;
48910       });
48911       turnsEnter = groupsEnter.filter(function(d) {
48912         return !d.u;
48913       });
48914       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
48915       uEnter = groupsEnter.filter(function(d) {
48916         return d.u;
48917       });
48918       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
48919       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
48920       groups.select("rect");
48921       groups.select("circle");
48922       return this;
48923     }
48924     return drawTurns;
48925   }
48926
48927   // modules/svg/vertices.js
48928   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
48929   function svgVertices(projection2, context) {
48930     var radiuses = {
48931       shadow: [6, 7.5, 7.5, 12],
48932       stroke: [2.5, 3.5, 3.5, 8],
48933       fill: [1, 1.5, 1.5, 1.5]
48934     };
48935     var _currHoverTarget;
48936     var _currPersistent = {};
48937     var _currHover = {};
48938     var _prevHover = {};
48939     var _currSelected = {};
48940     var _prevSelected = {};
48941     var _radii = {};
48942     function sortY(a, b) {
48943       return b.loc[1] - a.loc[1];
48944     }
48945     function fastEntityKey(d) {
48946       var mode = context.mode();
48947       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
48948       return isMoving ? d.id : osmEntity.key(d);
48949     }
48950     function draw(selection2, graph, vertices, sets2, filter2) {
48951       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
48952       var icons = {};
48953       var directions = {};
48954       var wireframe = context.surface().classed("fill-wireframe");
48955       var zoom = geoScaleToZoom(projection2.scale());
48956       var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
48957       var activeID = context.activeID();
48958       var base = context.history().base();
48959       function getIcon(d) {
48960         var entity = graph.entity(d.id);
48961         if (entity.id in icons)
48962           return icons[entity.id];
48963         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
48964         return icons[entity.id];
48965       }
48966       function getDirections(entity) {
48967         if (entity.id in directions)
48968           return directions[entity.id];
48969         var angles = entity.directions(graph, projection2);
48970         directions[entity.id] = angles.length ? angles : false;
48971         return angles;
48972       }
48973       function updateAttributes(selection3) {
48974         ["shadow", "stroke", "fill"].forEach(function(klass) {
48975           var rads = radiuses[klass];
48976           selection3.selectAll("." + klass).each(function(entity) {
48977             var i2 = z && getIcon(entity);
48978             var r = rads[i2 ? 3 : z];
48979             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
48980               r += 1.5;
48981             }
48982             if (klass === "shadow") {
48983               _radii[entity.id] = r;
48984             }
48985             select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
48986           });
48987         });
48988       }
48989       vertices.sort(sortY);
48990       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
48991       groups.exit().remove();
48992       var enter = groups.enter().append("g").attr("class", function(d) {
48993         return "node vertex " + d.id;
48994       }).order();
48995       enter.append("circle").attr("class", "shadow");
48996       enter.append("circle").attr("class", "stroke");
48997       enter.filter(function(d) {
48998         return d.hasInterestingTags();
48999       }).append("circle").attr("class", "fill");
49000       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
49001         return d.id in sets2.selected;
49002       }).classed("shared", function(d) {
49003         return graph.isShared(d);
49004       }).classed("endpoint", function(d) {
49005         return d.isEndpoint(graph);
49006       }).classed("added", function(d) {
49007         return !base.entities[d.id];
49008       }).classed("moved", function(d) {
49009         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
49010       }).classed("retagged", function(d) {
49011         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49012       }).call(updateAttributes);
49013       var iconUse = groups.selectAll(".icon").data(function data(d) {
49014         return zoom >= 17 && getIcon(d) ? [d] : [];
49015       }, fastEntityKey);
49016       iconUse.exit().remove();
49017       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
49018         var picon = getIcon(d);
49019         return picon ? "#" + picon : "";
49020       });
49021       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
49022         return zoom >= 18 && getDirections(d) ? [d] : [];
49023       }, fastEntityKey);
49024       dgroups.exit().remove();
49025       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
49026       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
49027         return osmEntity.key(d);
49028       });
49029       viewfields.exit().remove();
49030       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) {
49031         return "rotate(" + d + ")";
49032       });
49033     }
49034     function drawTargets(selection2, graph, entities, filter2) {
49035       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
49036       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
49037       var getTransform = svgPointTransform(projection2).geojson;
49038       var activeID = context.activeID();
49039       var data = { targets: [], nopes: [] };
49040       entities.forEach(function(node) {
49041         if (activeID === node.id)
49042           return;
49043         var vertexType = svgPassiveVertex(node, graph, activeID);
49044         if (vertexType !== 0) {
49045           data.targets.push({
49046             type: "Feature",
49047             id: node.id,
49048             properties: {
49049               target: true,
49050               entity: node
49051             },
49052             geometry: node.asGeoJSON()
49053           });
49054         } else {
49055           data.nopes.push({
49056             type: "Feature",
49057             id: node.id + "-nope",
49058             properties: {
49059               nope: true,
49060               target: true,
49061               entity: node
49062             },
49063             geometry: node.asGeoJSON()
49064           });
49065         }
49066       });
49067       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
49068         return filter2(d.properties.entity);
49069       }).data(data.targets, function key(d) {
49070         return d.id;
49071       });
49072       targets.exit().remove();
49073       targets.enter().append("circle").attr("r", function(d) {
49074         return _radii[d.id] || radiuses.shadow[3];
49075       }).merge(targets).attr("class", function(d) {
49076         return "node vertex target target-allowed " + targetClass + d.id;
49077       }).attr("transform", getTransform);
49078       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
49079         return filter2(d.properties.entity);
49080       }).data(data.nopes, function key(d) {
49081         return d.id;
49082       });
49083       nopes.exit().remove();
49084       nopes.enter().append("circle").attr("r", function(d) {
49085         return _radii[d.properties.entity.id] || radiuses.shadow[3];
49086       }).merge(nopes).attr("class", function(d) {
49087         return "node vertex target target-nope " + nopeClass + d.id;
49088       }).attr("transform", getTransform);
49089     }
49090     function renderAsVertex(entity, graph, wireframe, zoom) {
49091       var geometry = entity.geometry(graph);
49092       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
49093     }
49094     function isEditedNode(node, base, head) {
49095       var baseNode = base.entities[node.id];
49096       var headNode = head.entities[node.id];
49097       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
49098     }
49099     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
49100       var results = {};
49101       var seenIds = {};
49102       function addChildVertices(entity) {
49103         if (seenIds[entity.id])
49104           return;
49105         seenIds[entity.id] = true;
49106         var geometry = entity.geometry(graph);
49107         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
49108           var i2;
49109           if (entity.type === "way") {
49110             for (i2 = 0; i2 < entity.nodes.length; i2++) {
49111               var child = graph.hasEntity(entity.nodes[i2]);
49112               if (child) {
49113                 addChildVertices(child);
49114               }
49115             }
49116           } else if (entity.type === "relation") {
49117             for (i2 = 0; i2 < entity.members.length; i2++) {
49118               var member = graph.hasEntity(entity.members[i2].id);
49119               if (member) {
49120                 addChildVertices(member);
49121               }
49122             }
49123           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
49124             results[entity.id] = entity;
49125           }
49126         }
49127       }
49128       ids.forEach(function(id2) {
49129         var entity = graph.hasEntity(id2);
49130         if (!entity)
49131           return;
49132         if (entity.type === "node") {
49133           if (renderAsVertex(entity, graph, wireframe, zoom)) {
49134             results[entity.id] = entity;
49135             graph.parentWays(entity).forEach(function(entity2) {
49136               addChildVertices(entity2);
49137             });
49138           }
49139         } else {
49140           addChildVertices(entity);
49141         }
49142       });
49143       return results;
49144     }
49145     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
49146       var wireframe = context.surface().classed("fill-wireframe");
49147       var visualDiff = context.surface().classed("highlight-edited");
49148       var zoom = geoScaleToZoom(projection2.scale());
49149       var mode = context.mode();
49150       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49151       var base = context.history().base();
49152       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
49153       var touchLayer = selection2.selectAll(".layer-touch.points");
49154       if (fullRedraw) {
49155         _currPersistent = {};
49156         _radii = {};
49157       }
49158       for (var i2 = 0; i2 < entities.length; i2++) {
49159         var entity = entities[i2];
49160         var geometry = entity.geometry(graph);
49161         var keep = false;
49162         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
49163           _currPersistent[entity.id] = entity;
49164           keep = true;
49165         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
49166           _currPersistent[entity.id] = entity;
49167           keep = true;
49168         }
49169         if (!keep && !fullRedraw) {
49170           delete _currPersistent[entity.id];
49171         }
49172       }
49173       var sets2 = {
49174         persistent: _currPersistent,
49175         selected: _currSelected,
49176         hovered: _currHover
49177       };
49178       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
49179       var filterRendered = function(d) {
49180         return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
49181       };
49182       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
49183       var filterTouch = function(d) {
49184         return isMoving ? true : filterRendered(d);
49185       };
49186       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
49187       function currentVisible(which) {
49188         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
49189           return entity2 && entity2.intersects(extent, graph);
49190         });
49191       }
49192     }
49193     drawVertices.drawSelected = function(selection2, graph, extent) {
49194       var wireframe = context.surface().classed("fill-wireframe");
49195       var zoom = geoScaleToZoom(projection2.scale());
49196       _prevSelected = _currSelected || {};
49197       if (context.map().isInWideSelection()) {
49198         _currSelected = {};
49199         context.selectedIDs().forEach(function(id2) {
49200           var entity = graph.hasEntity(id2);
49201           if (!entity)
49202             return;
49203           if (entity.type === "node") {
49204             if (renderAsVertex(entity, graph, wireframe, zoom)) {
49205               _currSelected[entity.id] = entity;
49206             }
49207           }
49208         });
49209       } else {
49210         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
49211       }
49212       var filter2 = function(d) {
49213         return d.id in _prevSelected;
49214       };
49215       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
49216     };
49217     drawVertices.drawHover = function(selection2, graph, target, extent) {
49218       if (target === _currHoverTarget)
49219         return;
49220       var wireframe = context.surface().classed("fill-wireframe");
49221       var zoom = geoScaleToZoom(projection2.scale());
49222       _prevHover = _currHover || {};
49223       _currHoverTarget = target;
49224       var entity = target && target.properties && target.properties.entity;
49225       if (entity) {
49226         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
49227       } else {
49228         _currHover = {};
49229       }
49230       var filter2 = function(d) {
49231         return d.id in _prevHover;
49232       };
49233       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
49234     };
49235     return drawVertices;
49236   }
49237
49238   // modules/util/bind_once.js
49239   function utilBindOnce(target, type3, listener, capture) {
49240     var typeOnce = type3 + ".once";
49241     function one2() {
49242       target.on(typeOnce, null);
49243       listener.apply(this, arguments);
49244     }
49245     target.on(typeOnce, one2, capture);
49246     return this;
49247   }
49248
49249   // modules/util/zoom_pan.js
49250   function defaultFilter3(d3_event) {
49251     return !d3_event.ctrlKey && !d3_event.button;
49252   }
49253   function defaultExtent2() {
49254     var e = this;
49255     if (e instanceof SVGElement) {
49256       e = e.ownerSVGElement || e;
49257       if (e.hasAttribute("viewBox")) {
49258         e = e.viewBox.baseVal;
49259         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
49260       }
49261       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
49262     }
49263     return [[0, 0], [e.clientWidth, e.clientHeight]];
49264   }
49265   function defaultWheelDelta2(d3_event) {
49266     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
49267   }
49268   function defaultConstrain2(transform2, extent, translateExtent) {
49269     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];
49270     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));
49271   }
49272   function utilZoomPan() {
49273     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;
49274     function zoom(selection2) {
49275       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
49276       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
49277     }
49278     zoom.transform = function(collection, transform2, point) {
49279       var selection2 = collection.selection ? collection.selection() : collection;
49280       if (collection !== selection2) {
49281         schedule(collection, transform2, point);
49282       } else {
49283         selection2.interrupt().each(function() {
49284           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
49285         });
49286       }
49287     };
49288     zoom.scaleBy = function(selection2, k, p) {
49289       zoom.scaleTo(selection2, function() {
49290         var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
49291         return k0 * k1;
49292       }, p);
49293     };
49294     zoom.scaleTo = function(selection2, k, p) {
49295       zoom.transform(selection2, function() {
49296         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;
49297         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
49298       }, p);
49299     };
49300     zoom.translateBy = function(selection2, x, y) {
49301       zoom.transform(selection2, function() {
49302         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);
49303       });
49304     };
49305     zoom.translateTo = function(selection2, x, y, p) {
49306       zoom.transform(selection2, function() {
49307         var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
49308         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);
49309       }, p);
49310     };
49311     function scale(transform2, k) {
49312       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
49313       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
49314     }
49315     function translate(transform2, p02, p1) {
49316       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
49317       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
49318     }
49319     function centroid(extent2) {
49320       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
49321     }
49322     function schedule(transition2, transform2, point) {
49323       transition2.on("start.zoom", function() {
49324         gesture(this, arguments).start(null);
49325       }).on("interrupt.zoom end.zoom", function() {
49326         gesture(this, arguments).end(null);
49327       }).tween("zoom", function() {
49328         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));
49329         return function(t) {
49330           if (t === 1) {
49331             t = b;
49332           } else {
49333             var l = i2(t);
49334             var k = w / l[2];
49335             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
49336           }
49337           g.zoom(null, null, t);
49338         };
49339       });
49340     }
49341     function gesture(that, args, clean2) {
49342       return !clean2 && _activeGesture || new Gesture(that, args);
49343     }
49344     function Gesture(that, args) {
49345       this.that = that;
49346       this.args = args;
49347       this.active = 0;
49348       this.extent = extent.apply(that, args);
49349     }
49350     Gesture.prototype = {
49351       start: function(d3_event) {
49352         if (++this.active === 1) {
49353           _activeGesture = this;
49354           dispatch10.call("start", this, d3_event);
49355         }
49356         return this;
49357       },
49358       zoom: function(d3_event, key, transform2) {
49359         if (this.mouse && key !== "mouse")
49360           this.mouse[1] = transform2.invert(this.mouse[0]);
49361         if (this.pointer0 && key !== "touch")
49362           this.pointer0[1] = transform2.invert(this.pointer0[0]);
49363         if (this.pointer1 && key !== "touch")
49364           this.pointer1[1] = transform2.invert(this.pointer1[0]);
49365         _transform = transform2;
49366         dispatch10.call("zoom", this, d3_event, key, transform2);
49367         return this;
49368       },
49369       end: function(d3_event) {
49370         if (--this.active === 0) {
49371           _activeGesture = null;
49372           dispatch10.call("end", this, d3_event);
49373         }
49374         return this;
49375       }
49376     };
49377     function wheeled(d3_event) {
49378       if (!filter2.apply(this, arguments))
49379         return;
49380       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);
49381       if (g.wheel) {
49382         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
49383           g.mouse[1] = t.invert(g.mouse[0] = p);
49384         }
49385         clearTimeout(g.wheel);
49386       } else {
49387         g.mouse = [p, t.invert(p)];
49388         interrupt_default(this);
49389         g.start(d3_event);
49390       }
49391       d3_event.preventDefault();
49392       d3_event.stopImmediatePropagation();
49393       g.wheel = setTimeout(wheelidled, _wheelDelay);
49394       g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
49395       function wheelidled() {
49396         g.wheel = null;
49397         g.end(d3_event);
49398       }
49399     }
49400     var _downPointerIDs = /* @__PURE__ */ new Set();
49401     var _pointerLocGetter;
49402     function pointerdown(d3_event) {
49403       _downPointerIDs.add(d3_event.pointerId);
49404       if (!filter2.apply(this, arguments))
49405         return;
49406       var g = gesture(this, arguments, _downPointerIDs.size === 1);
49407       var started;
49408       d3_event.stopImmediatePropagation();
49409       _pointerLocGetter = utilFastMouse(this);
49410       var loc = _pointerLocGetter(d3_event);
49411       var p = [loc, _transform.invert(loc), d3_event.pointerId];
49412       if (!g.pointer0) {
49413         g.pointer0 = p;
49414         started = true;
49415       } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
49416         g.pointer1 = p;
49417       }
49418       if (started) {
49419         interrupt_default(this);
49420         g.start(d3_event);
49421       }
49422     }
49423     function pointermove(d3_event) {
49424       if (!_downPointerIDs.has(d3_event.pointerId))
49425         return;
49426       if (!_activeGesture || !_pointerLocGetter)
49427         return;
49428       var g = gesture(this, arguments);
49429       var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
49430       var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
49431       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
49432         if (g.pointer0)
49433           _downPointerIDs.delete(g.pointer0[2]);
49434         if (g.pointer1)
49435           _downPointerIDs.delete(g.pointer1[2]);
49436         g.end(d3_event);
49437         return;
49438       }
49439       d3_event.preventDefault();
49440       d3_event.stopImmediatePropagation();
49441       var loc = _pointerLocGetter(d3_event);
49442       var t, p, l;
49443       if (isPointer0)
49444         g.pointer0[0] = loc;
49445       else if (isPointer1)
49446         g.pointer1[0] = loc;
49447       t = _transform;
49448       if (g.pointer1) {
49449         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;
49450         t = scale(t, Math.sqrt(dp / dl));
49451         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
49452         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
49453       } else if (g.pointer0) {
49454         p = g.pointer0[0];
49455         l = g.pointer0[1];
49456       } else {
49457         return;
49458       }
49459       g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
49460     }
49461     function pointerup(d3_event) {
49462       if (!_downPointerIDs.has(d3_event.pointerId))
49463         return;
49464       _downPointerIDs.delete(d3_event.pointerId);
49465       if (!_activeGesture)
49466         return;
49467       var g = gesture(this, arguments);
49468       d3_event.stopImmediatePropagation();
49469       if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
49470         delete g.pointer0;
49471       else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
49472         delete g.pointer1;
49473       if (g.pointer1 && !g.pointer0) {
49474         g.pointer0 = g.pointer1;
49475         delete g.pointer1;
49476       }
49477       if (g.pointer0) {
49478         g.pointer0[1] = _transform.invert(g.pointer0[0]);
49479       } else {
49480         g.end(d3_event);
49481       }
49482     }
49483     zoom.wheelDelta = function(_) {
49484       return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
49485     };
49486     zoom.filter = function(_) {
49487       return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
49488     };
49489     zoom.extent = function(_) {
49490       return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
49491     };
49492     zoom.scaleExtent = function(_) {
49493       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
49494     };
49495     zoom.translateExtent = function(_) {
49496       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]]];
49497     };
49498     zoom.constrain = function(_) {
49499       return arguments.length ? (constrain = _, zoom) : constrain;
49500     };
49501     zoom.interpolate = function(_) {
49502       return arguments.length ? (interpolate = _, zoom) : interpolate;
49503     };
49504     zoom._transform = function(_) {
49505       return arguments.length ? (_transform = _, zoom) : _transform;
49506     };
49507     return utilRebind(zoom, dispatch10, "on");
49508   }
49509
49510   // modules/util/double_up.js
49511   function utilDoubleUp() {
49512     var dispatch10 = dispatch_default("doubleUp");
49513     var _maxTimespan = 500;
49514     var _maxDistance = 20;
49515     var _pointer;
49516     function pointerIsValidFor(loc) {
49517       return new Date().getTime() - _pointer.startTime <= _maxTimespan && geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
49518     }
49519     function pointerdown(d3_event) {
49520       if (d3_event.ctrlKey || d3_event.button === 2)
49521         return;
49522       var loc = [d3_event.clientX, d3_event.clientY];
49523       if (_pointer && !pointerIsValidFor(loc)) {
49524         _pointer = void 0;
49525       }
49526       if (!_pointer) {
49527         _pointer = {
49528           startLoc: loc,
49529           startTime: new Date().getTime(),
49530           upCount: 0,
49531           pointerId: d3_event.pointerId
49532         };
49533       } else {
49534         _pointer.pointerId = d3_event.pointerId;
49535       }
49536     }
49537     function pointerup(d3_event) {
49538       if (d3_event.ctrlKey || d3_event.button === 2)
49539         return;
49540       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
49541         return;
49542       _pointer.upCount += 1;
49543       if (_pointer.upCount === 2) {
49544         var loc = [d3_event.clientX, d3_event.clientY];
49545         if (pointerIsValidFor(loc)) {
49546           var locInThis = utilFastMouse(this)(d3_event);
49547           dispatch10.call("doubleUp", this, d3_event, locInThis);
49548         }
49549         _pointer = void 0;
49550       }
49551     }
49552     function doubleUp(selection2) {
49553       if ("PointerEvent" in window) {
49554         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
49555       } else {
49556         selection2.on("dblclick.doubleUp", function(d3_event) {
49557           dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
49558         });
49559       }
49560     }
49561     doubleUp.off = function(selection2) {
49562       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
49563     };
49564     return utilRebind(doubleUp, dispatch10, "on");
49565   }
49566
49567   // modules/renderer/map.js
49568   var TILESIZE = 256;
49569   var minZoom2 = 2;
49570   var maxZoom = 24;
49571   var kMin = geoZoomToScale(minZoom2, TILESIZE);
49572   var kMax = geoZoomToScale(maxZoom, TILESIZE);
49573   function clamp(num, min3, max3) {
49574     return Math.max(min3, Math.min(num, max3));
49575   }
49576   function rendererMap(context) {
49577     var dispatch10 = dispatch_default("move", "drawn", "crossEditableZoom", "hitMinZoom", "changeHighlighting", "changeAreaFill");
49578     var projection2 = context.projection;
49579     var curtainProjection = context.curtainProjection;
49580     var drawLayers;
49581     var drawPoints;
49582     var drawVertices;
49583     var drawLines;
49584     var drawAreas;
49585     var drawMidpoints;
49586     var drawLabels;
49587     var _selection = select_default2(null);
49588     var supersurface = select_default2(null);
49589     var wrapper = select_default2(null);
49590     var surface = select_default2(null);
49591     var _dimensions = [1, 1];
49592     var _dblClickZoomEnabled = true;
49593     var _redrawEnabled = true;
49594     var _gestureTransformStart;
49595     var _transformStart = projection2.transform();
49596     var _transformLast;
49597     var _isTransformed = false;
49598     var _minzoom = 0;
49599     var _getMouseCoords;
49600     var _lastPointerEvent;
49601     var _lastWithinEditableZoom;
49602     var _pointerDown = false;
49603     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
49604     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
49605     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
49606       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
49607     }).on("end.map", function() {
49608       _pointerDown = false;
49609     });
49610     var _doubleUpHandler = utilDoubleUp();
49611     var scheduleRedraw = throttle_default(redraw, 750);
49612     function cancelPendingRedraw() {
49613       scheduleRedraw.cancel();
49614     }
49615     function map2(selection2) {
49616       _selection = selection2;
49617       context.on("change.map", immediateRedraw);
49618       var osm = context.connection();
49619       if (osm) {
49620         osm.on("change.map", immediateRedraw);
49621       }
49622       function didUndoOrRedo(targetTransform) {
49623         var mode = context.mode().id;
49624         if (mode !== "browse" && mode !== "select")
49625           return;
49626         if (targetTransform) {
49627           map2.transformEase(targetTransform);
49628         }
49629       }
49630       context.history().on("merge.map", function() {
49631         scheduleRedraw();
49632       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
49633         didUndoOrRedo(fromStack.transform);
49634       }).on("redone.map", function(stack) {
49635         didUndoOrRedo(stack.transform);
49636       });
49637       context.background().on("change.map", immediateRedraw);
49638       context.features().on("redraw.map", immediateRedraw);
49639       drawLayers.on("change.map", function() {
49640         context.background().updateImagery();
49641         immediateRedraw();
49642       });
49643       selection2.on("wheel.map mousewheel.map", function(d3_event) {
49644         d3_event.preventDefault();
49645       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
49646       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
49647       wrapper = supersurface.append("div").attr("class", "layer layer-data");
49648       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
49649       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
49650         _lastPointerEvent = d3_event;
49651         if (d3_event.button === 2) {
49652           d3_event.stopPropagation();
49653         }
49654       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
49655         _lastPointerEvent = d3_event;
49656         if (resetTransform()) {
49657           immediateRedraw();
49658         }
49659       }).on(_pointerPrefix + "move.map", function(d3_event) {
49660         _lastPointerEvent = d3_event;
49661       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
49662         if (map2.editableDataEnabled() && !_isTransformed) {
49663           var hover = d3_event.target.__data__;
49664           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
49665           dispatch10.call("drawn", this, { full: false });
49666         }
49667       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
49668         if (map2.editableDataEnabled() && !_isTransformed) {
49669           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
49670           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
49671           dispatch10.call("drawn", this, { full: false });
49672         }
49673       });
49674       var detected = utilDetect();
49675       if ("GestureEvent" in window && !detected.isMobileWebKit) {
49676         surface.on("gesturestart.surface", function(d3_event) {
49677           d3_event.preventDefault();
49678           _gestureTransformStart = projection2.transform();
49679         }).on("gesturechange.surface", gestureChange);
49680       }
49681       updateAreaFill();
49682       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
49683         if (!_dblClickZoomEnabled)
49684           return;
49685         if (typeof d3_event.target.__data__ === "object" && !select_default2(d3_event.target).classed("fill"))
49686           return;
49687         var zoomOut2 = d3_event.shiftKey;
49688         var t = projection2.transform();
49689         var p1 = t.invert(p02);
49690         t = t.scale(zoomOut2 ? 0.5 : 2);
49691         t.x = p02[0] - p1[0] * t.k;
49692         t.y = p02[1] - p1[1] * t.k;
49693         map2.transformEase(t);
49694       });
49695       context.on("enter.map", function() {
49696         if (!map2.editableDataEnabled(true))
49697           return;
49698         if (_isTransformed)
49699           return;
49700         var graph = context.graph();
49701         var selectedAndParents = {};
49702         context.selectedIDs().forEach(function(id2) {
49703           var entity = graph.hasEntity(id2);
49704           if (entity) {
49705             selectedAndParents[entity.id] = entity;
49706             if (entity.type === "node") {
49707               graph.parentWays(entity).forEach(function(parent) {
49708                 selectedAndParents[parent.id] = parent;
49709               });
49710             }
49711           }
49712         });
49713         var data = Object.values(selectedAndParents);
49714         var filter2 = function(d) {
49715           return d.id in selectedAndParents;
49716         };
49717         data = context.features().filter(data, graph);
49718         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
49719         dispatch10.call("drawn", this, { full: false });
49720         scheduleRedraw();
49721       });
49722       map2.dimensions(utilGetDimensions(selection2));
49723     }
49724     function zoomEventFilter(d3_event) {
49725       if (d3_event.type === "mousedown") {
49726         var hasOrphan = false;
49727         var listeners = window.__on;
49728         for (var i2 = 0; i2 < listeners.length; i2++) {
49729           var listener = listeners[i2];
49730           if (listener.name === "zoom" && listener.type === "mouseup") {
49731             hasOrphan = true;
49732             break;
49733           }
49734         }
49735         if (hasOrphan) {
49736           var event = window.CustomEvent;
49737           if (event) {
49738             event = new event("mouseup");
49739           } else {
49740             event = window.document.createEvent("Event");
49741             event.initEvent("mouseup", false, false);
49742           }
49743           event.view = window;
49744           window.dispatchEvent(event);
49745         }
49746       }
49747       return d3_event.button !== 2;
49748     }
49749     function pxCenter() {
49750       return [_dimensions[0] / 2, _dimensions[1] / 2];
49751     }
49752     function drawEditable(difference, extent) {
49753       var mode = context.mode();
49754       var graph = context.graph();
49755       var features2 = context.features();
49756       var all = context.history().intersects(map2.extent());
49757       var fullRedraw = false;
49758       var data;
49759       var set3;
49760       var filter2;
49761       var applyFeatureLayerFilters = true;
49762       if (map2.isInWideSelection()) {
49763         data = [];
49764         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
49765           var entity = context.hasEntity(id2);
49766           if (entity)
49767             data.push(entity);
49768         });
49769         fullRedraw = true;
49770         filter2 = utilFunctor(true);
49771         applyFeatureLayerFilters = false;
49772       } else if (difference) {
49773         var complete = difference.complete(map2.extent());
49774         data = Object.values(complete).filter(Boolean);
49775         set3 = new Set(Object.keys(complete));
49776         filter2 = function(d) {
49777           return set3.has(d.id);
49778         };
49779         features2.clear(data);
49780       } else {
49781         if (features2.gatherStats(all, graph, _dimensions)) {
49782           extent = void 0;
49783         }
49784         if (extent) {
49785           data = context.history().intersects(map2.extent().intersection(extent));
49786           set3 = new Set(data.map(function(entity) {
49787             return entity.id;
49788           }));
49789           filter2 = function(d) {
49790             return set3.has(d.id);
49791           };
49792         } else {
49793           data = all;
49794           fullRedraw = true;
49795           filter2 = utilFunctor(true);
49796         }
49797       }
49798       if (applyFeatureLayerFilters) {
49799         data = features2.filter(data, graph);
49800       } else {
49801         context.features().resetStats();
49802       }
49803       if (mode && mode.id === "select") {
49804         surface.call(drawVertices.drawSelected, graph, map2.extent());
49805       }
49806       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);
49807       dispatch10.call("drawn", this, { full: true });
49808     }
49809     map2.init = function() {
49810       drawLayers = svgLayers(projection2, context);
49811       drawPoints = svgPoints(projection2, context);
49812       drawVertices = svgVertices(projection2, context);
49813       drawLines = svgLines(projection2, context);
49814       drawAreas = svgAreas(projection2, context);
49815       drawMidpoints = svgMidpoints(projection2, context);
49816       drawLabels = svgLabels(projection2, context);
49817     };
49818     function editOff() {
49819       context.features().resetStats();
49820       surface.selectAll(".layer-osm *").remove();
49821       surface.selectAll(".layer-touch:not(.markers) *").remove();
49822       var allowed = {
49823         "browse": true,
49824         "save": true,
49825         "select-note": true,
49826         "select-data": true,
49827         "select-error": true
49828       };
49829       var mode = context.mode();
49830       if (mode && !allowed[mode.id]) {
49831         context.enter(modeBrowse(context));
49832       }
49833       dispatch10.call("drawn", this, { full: true });
49834     }
49835     function gestureChange(d3_event) {
49836       var e = d3_event;
49837       e.preventDefault();
49838       var props = {
49839         deltaMode: 0,
49840         deltaY: 1,
49841         clientX: e.clientX,
49842         clientY: e.clientY,
49843         screenX: e.screenX,
49844         screenY: e.screenY,
49845         x: e.x,
49846         y: e.y
49847       };
49848       var e22 = new WheelEvent("wheel", props);
49849       e22._scale = e.scale;
49850       e22._rotation = e.rotation;
49851       _selection.node().dispatchEvent(e22);
49852     }
49853     function zoomPan(event, key, transform2) {
49854       var source = event && event.sourceEvent || event;
49855       var eventTransform = transform2 || event && event.transform;
49856       var x = eventTransform.x;
49857       var y = eventTransform.y;
49858       var k = eventTransform.k;
49859       if (source && source.type === "wheel") {
49860         if (_pointerDown)
49861           return;
49862         var detected = utilDetect();
49863         var dX = source.deltaX;
49864         var dY = source.deltaY;
49865         var x2 = x;
49866         var y2 = y;
49867         var k2 = k;
49868         var t0, p02, p1;
49869         if (source.deltaMode === 1) {
49870           var lines = Math.abs(source.deltaY);
49871           var sign2 = source.deltaY > 0 ? 1 : -1;
49872           dY = sign2 * clamp(Math.exp((lines - 1) * 0.75) * 4.000244140625, 4.000244140625, 350.000244140625);
49873           if (detected.os !== "mac") {
49874             dY *= 5;
49875           }
49876           t0 = _isTransformed ? _transformLast : _transformStart;
49877           p02 = _getMouseCoords(source);
49878           p1 = t0.invert(p02);
49879           k2 = t0.k * Math.pow(2, -dY / 500);
49880           k2 = clamp(k2, kMin, kMax);
49881           x2 = p02[0] - p1[0] * k2;
49882           y2 = p02[1] - p1[1] * k2;
49883         } else if (source._scale) {
49884           t0 = _gestureTransformStart;
49885           p02 = _getMouseCoords(source);
49886           p1 = t0.invert(p02);
49887           k2 = t0.k * source._scale;
49888           k2 = clamp(k2, kMin, kMax);
49889           x2 = p02[0] - p1[0] * k2;
49890           y2 = p02[1] - p1[1] * k2;
49891         } else if (source.ctrlKey && !isInteger(dY)) {
49892           dY *= 6;
49893           t0 = _isTransformed ? _transformLast : _transformStart;
49894           p02 = _getMouseCoords(source);
49895           p1 = t0.invert(p02);
49896           k2 = t0.k * Math.pow(2, -dY / 500);
49897           k2 = clamp(k2, kMin, kMax);
49898           x2 = p02[0] - p1[0] * k2;
49899           y2 = p02[1] - p1[1] * k2;
49900         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
49901           t0 = _isTransformed ? _transformLast : _transformStart;
49902           p02 = _getMouseCoords(source);
49903           p1 = t0.invert(p02);
49904           k2 = t0.k * Math.pow(2, -dY / 500);
49905           k2 = clamp(k2, kMin, kMax);
49906           x2 = p02[0] - p1[0] * k2;
49907           y2 = p02[1] - p1[1] * k2;
49908         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
49909           p1 = projection2.translate();
49910           x2 = p1[0] - dX;
49911           y2 = p1[1] - dY;
49912           k2 = projection2.scale();
49913           k2 = clamp(k2, kMin, kMax);
49914         }
49915         if (x2 !== x || y2 !== y || k2 !== k) {
49916           x = x2;
49917           y = y2;
49918           k = k2;
49919           eventTransform = identity2.translate(x2, y2).scale(k2);
49920           if (_zoomerPanner._transform) {
49921             _zoomerPanner._transform(eventTransform);
49922           } else {
49923             _selection.node().__zoom = eventTransform;
49924           }
49925         }
49926       }
49927       if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
49928         return;
49929       }
49930       if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
49931         surface.interrupt();
49932         dispatch10.call("hitMinZoom", this, map2);
49933         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
49934         scheduleRedraw();
49935         dispatch10.call("move", this, map2);
49936         return;
49937       }
49938       projection2.transform(eventTransform);
49939       var withinEditableZoom = map2.withinEditableZoom();
49940       if (_lastWithinEditableZoom !== withinEditableZoom) {
49941         if (_lastWithinEditableZoom !== void 0) {
49942           dispatch10.call("crossEditableZoom", this, withinEditableZoom);
49943         }
49944         _lastWithinEditableZoom = withinEditableZoom;
49945       }
49946       var scale = k / _transformStart.k;
49947       var tX = (x / scale - _transformStart.x) * scale;
49948       var tY = (y / scale - _transformStart.y) * scale;
49949       if (context.inIntro()) {
49950         curtainProjection.transform({
49951           x: x - tX,
49952           y: y - tY,
49953           k
49954         });
49955       }
49956       if (source) {
49957         _lastPointerEvent = event;
49958       }
49959       _isTransformed = true;
49960       _transformLast = eventTransform;
49961       utilSetTransform(supersurface, tX, tY, scale);
49962       scheduleRedraw();
49963       dispatch10.call("move", this, map2);
49964       function isInteger(val) {
49965         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
49966       }
49967     }
49968     function resetTransform() {
49969       if (!_isTransformed)
49970         return false;
49971       utilSetTransform(supersurface, 0, 0);
49972       _isTransformed = false;
49973       if (context.inIntro()) {
49974         curtainProjection.transform(projection2.transform());
49975       }
49976       return true;
49977     }
49978     function redraw(difference, extent) {
49979       if (surface.empty() || !_redrawEnabled)
49980         return;
49981       if (resetTransform()) {
49982         difference = extent = void 0;
49983       }
49984       var zoom = map2.zoom();
49985       var z = String(~~zoom);
49986       if (surface.attr("data-zoom") !== z) {
49987         surface.attr("data-zoom", z);
49988       }
49989       var lat = map2.center()[1];
49990       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
49991       surface.classed("low-zoom", zoom <= lowzoom(lat));
49992       if (!difference) {
49993         supersurface.call(context.background());
49994         wrapper.call(drawLayers);
49995       }
49996       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
49997         context.loadTiles(projection2);
49998         drawEditable(difference, extent);
49999       } else {
50000         editOff();
50001       }
50002       _transformStart = projection2.transform();
50003       return map2;
50004     }
50005     var immediateRedraw = function(difference, extent) {
50006       if (!difference && !extent)
50007         cancelPendingRedraw();
50008       redraw(difference, extent);
50009     };
50010     map2.lastPointerEvent = function() {
50011       return _lastPointerEvent;
50012     };
50013     map2.mouse = function(d3_event) {
50014       var event = d3_event || _lastPointerEvent;
50015       if (event) {
50016         var s;
50017         while (s = event.sourceEvent) {
50018           event = s;
50019         }
50020         return _getMouseCoords(event);
50021       }
50022       return null;
50023     };
50024     map2.mouseCoordinates = function() {
50025       var coord2 = map2.mouse() || pxCenter();
50026       return projection2.invert(coord2);
50027     };
50028     map2.dblclickZoomEnable = function(val) {
50029       if (!arguments.length)
50030         return _dblClickZoomEnabled;
50031       _dblClickZoomEnabled = val;
50032       return map2;
50033     };
50034     map2.redrawEnable = function(val) {
50035       if (!arguments.length)
50036         return _redrawEnabled;
50037       _redrawEnabled = val;
50038       return map2;
50039     };
50040     map2.isTransformed = function() {
50041       return _isTransformed;
50042     };
50043     function setTransform(t2, duration, force) {
50044       var t = projection2.transform();
50045       if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
50046         return false;
50047       if (duration) {
50048         _selection.transition().duration(duration).on("start", function() {
50049           map2.startEase();
50050         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
50051       } else {
50052         projection2.transform(t2);
50053         _transformStart = t2;
50054         _selection.call(_zoomerPanner.transform, _transformStart);
50055       }
50056       return true;
50057     }
50058     function setCenterZoom(loc2, z2, duration, force) {
50059       var c = map2.center();
50060       var z = map2.zoom();
50061       if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
50062         return false;
50063       var proj = geoRawMercator().transform(projection2.transform());
50064       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
50065       proj.scale(k2);
50066       var t = proj.translate();
50067       var point = proj(loc2);
50068       var center = pxCenter();
50069       t[0] += center[0] - point[0];
50070       t[1] += center[1] - point[1];
50071       return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
50072     }
50073     map2.pan = function(delta, duration) {
50074       var t = projection2.translate();
50075       var k = projection2.scale();
50076       t[0] += delta[0];
50077       t[1] += delta[1];
50078       if (duration) {
50079         _selection.transition().duration(duration).on("start", function() {
50080           map2.startEase();
50081         }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
50082       } else {
50083         projection2.translate(t);
50084         _transformStart = projection2.transform();
50085         _selection.call(_zoomerPanner.transform, _transformStart);
50086         dispatch10.call("move", this, map2);
50087         immediateRedraw();
50088       }
50089       return map2;
50090     };
50091     map2.dimensions = function(val) {
50092       if (!arguments.length)
50093         return _dimensions;
50094       _dimensions = val;
50095       drawLayers.dimensions(_dimensions);
50096       context.background().dimensions(_dimensions);
50097       projection2.clipExtent([[0, 0], _dimensions]);
50098       _getMouseCoords = utilFastMouse(supersurface.node());
50099       scheduleRedraw();
50100       return map2;
50101     };
50102     function zoomIn(delta) {
50103       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
50104     }
50105     function zoomOut(delta) {
50106       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
50107     }
50108     map2.zoomIn = function() {
50109       zoomIn(1);
50110     };
50111     map2.zoomInFurther = function() {
50112       zoomIn(4);
50113     };
50114     map2.canZoomIn = function() {
50115       return map2.zoom() < maxZoom;
50116     };
50117     map2.zoomOut = function() {
50118       zoomOut(1);
50119     };
50120     map2.zoomOutFurther = function() {
50121       zoomOut(4);
50122     };
50123     map2.canZoomOut = function() {
50124       return map2.zoom() > minZoom2;
50125     };
50126     map2.center = function(loc2) {
50127       if (!arguments.length) {
50128         return projection2.invert(pxCenter());
50129       }
50130       if (setCenterZoom(loc2, map2.zoom())) {
50131         dispatch10.call("move", this, map2);
50132       }
50133       scheduleRedraw();
50134       return map2;
50135     };
50136     map2.unobscuredCenterZoomEase = function(loc, zoom) {
50137       var offset = map2.unobscuredOffsetPx();
50138       var proj = geoRawMercator().transform(projection2.transform());
50139       proj.scale(geoZoomToScale(zoom, TILESIZE));
50140       var locPx = proj(loc);
50141       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
50142       var offsetLoc = proj.invert(offsetLocPx);
50143       map2.centerZoomEase(offsetLoc, zoom);
50144     };
50145     map2.unobscuredOffsetPx = function() {
50146       var openPane = context.container().select(".map-panes .map-pane.shown");
50147       if (!openPane.empty()) {
50148         return [openPane.node().offsetWidth / 2, 0];
50149       }
50150       return [0, 0];
50151     };
50152     map2.zoom = function(z2) {
50153       if (!arguments.length) {
50154         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
50155       }
50156       if (z2 < _minzoom) {
50157         surface.interrupt();
50158         dispatch10.call("hitMinZoom", this, map2);
50159         z2 = context.minEditableZoom();
50160       }
50161       if (setCenterZoom(map2.center(), z2)) {
50162         dispatch10.call("move", this, map2);
50163       }
50164       scheduleRedraw();
50165       return map2;
50166     };
50167     map2.centerZoom = function(loc2, z2) {
50168       if (setCenterZoom(loc2, z2)) {
50169         dispatch10.call("move", this, map2);
50170       }
50171       scheduleRedraw();
50172       return map2;
50173     };
50174     map2.zoomTo = function(entity) {
50175       var extent = entity.extent(context.graph());
50176       if (!isFinite(extent.area()))
50177         return map2;
50178       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50179       return map2.centerZoom(extent.center(), z2);
50180     };
50181     map2.centerEase = function(loc2, duration) {
50182       duration = duration || 250;
50183       setCenterZoom(loc2, map2.zoom(), duration);
50184       return map2;
50185     };
50186     map2.zoomEase = function(z2, duration) {
50187       duration = duration || 250;
50188       setCenterZoom(map2.center(), z2, duration, false);
50189       return map2;
50190     };
50191     map2.centerZoomEase = function(loc2, z2, duration) {
50192       duration = duration || 250;
50193       setCenterZoom(loc2, z2, duration, false);
50194       return map2;
50195     };
50196     map2.transformEase = function(t2, duration) {
50197       duration = duration || 250;
50198       setTransform(t2, duration, false);
50199       return map2;
50200     };
50201     map2.zoomToEase = function(obj, duration) {
50202       var extent;
50203       if (Array.isArray(obj)) {
50204         obj.forEach(function(entity) {
50205           var entityExtent = entity.extent(context.graph());
50206           if (!extent) {
50207             extent = entityExtent;
50208           } else {
50209             extent = extent.extend(entityExtent);
50210           }
50211         });
50212       } else {
50213         extent = obj.extent(context.graph());
50214       }
50215       if (!isFinite(extent.area()))
50216         return map2;
50217       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50218       return map2.centerZoomEase(extent.center(), z2, duration);
50219     };
50220     map2.startEase = function() {
50221       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
50222         map2.cancelEase();
50223       });
50224       return map2;
50225     };
50226     map2.cancelEase = function() {
50227       _selection.interrupt();
50228       return map2;
50229     };
50230     map2.extent = function(val) {
50231       if (!arguments.length) {
50232         return new geoExtent(projection2.invert([0, _dimensions[1]]), projection2.invert([_dimensions[0], 0]));
50233       } else {
50234         var extent = geoExtent(val);
50235         map2.centerZoom(extent.center(), map2.extentZoom(extent));
50236       }
50237     };
50238     map2.trimmedExtent = function(val) {
50239       if (!arguments.length) {
50240         var headerY = 71;
50241         var footerY = 30;
50242         var pad2 = 10;
50243         return new geoExtent(projection2.invert([pad2, _dimensions[1] - footerY - pad2]), projection2.invert([_dimensions[0] - pad2, headerY + pad2]));
50244       } else {
50245         var extent = geoExtent(val);
50246         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
50247       }
50248     };
50249     function calcExtentZoom(extent, dim) {
50250       var tl = projection2([extent[0][0], extent[1][1]]);
50251       var br = projection2([extent[1][0], extent[0][1]]);
50252       var hFactor = (br[0] - tl[0]) / dim[0];
50253       var vFactor = (br[1] - tl[1]) / dim[1];
50254       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
50255       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
50256       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
50257       return newZoom;
50258     }
50259     map2.extentZoom = function(val) {
50260       return calcExtentZoom(geoExtent(val), _dimensions);
50261     };
50262     map2.trimmedExtentZoom = function(val) {
50263       var trimY = 120;
50264       var trimX = 40;
50265       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
50266       return calcExtentZoom(geoExtent(val), trimmed);
50267     };
50268     map2.withinEditableZoom = function() {
50269       return map2.zoom() >= context.minEditableZoom();
50270     };
50271     map2.isInWideSelection = function() {
50272       return !map2.withinEditableZoom() && context.selectedIDs().length;
50273     };
50274     map2.editableDataEnabled = function(skipZoomCheck) {
50275       var layer = context.layers().layer("osm");
50276       if (!layer || !layer.enabled())
50277         return false;
50278       return skipZoomCheck || map2.withinEditableZoom();
50279     };
50280     map2.notesEditable = function() {
50281       var layer = context.layers().layer("notes");
50282       if (!layer || !layer.enabled())
50283         return false;
50284       return map2.withinEditableZoom();
50285     };
50286     map2.minzoom = function(val) {
50287       if (!arguments.length)
50288         return _minzoom;
50289       _minzoom = val;
50290       return map2;
50291     };
50292     map2.toggleHighlightEdited = function() {
50293       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
50294       map2.pan([0, 0]);
50295       dispatch10.call("changeHighlighting", this);
50296     };
50297     map2.areaFillOptions = ["wireframe", "partial", "full"];
50298     map2.activeAreaFill = function(val) {
50299       if (!arguments.length)
50300         return corePreferences("area-fill") || "partial";
50301       corePreferences("area-fill", val);
50302       if (val !== "wireframe") {
50303         corePreferences("area-fill-toggle", val);
50304       }
50305       updateAreaFill();
50306       map2.pan([0, 0]);
50307       dispatch10.call("changeAreaFill", this);
50308       return map2;
50309     };
50310     map2.toggleWireframe = function() {
50311       var activeFill = map2.activeAreaFill();
50312       if (activeFill === "wireframe") {
50313         activeFill = corePreferences("area-fill-toggle") || "partial";
50314       } else {
50315         activeFill = "wireframe";
50316       }
50317       map2.activeAreaFill(activeFill);
50318     };
50319     function updateAreaFill() {
50320       var activeFill = map2.activeAreaFill();
50321       map2.areaFillOptions.forEach(function(opt) {
50322         surface.classed("fill-" + opt, Boolean(opt === activeFill));
50323       });
50324     }
50325     map2.layers = () => drawLayers;
50326     map2.doubleUpHandler = function() {
50327       return _doubleUpHandler;
50328     };
50329     return utilRebind(map2, dispatch10, "on");
50330   }
50331
50332   // modules/renderer/photos.js
50333   function rendererPhotos(context) {
50334     var dispatch10 = dispatch_default("change");
50335     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
50336     var _allPhotoTypes = ["flat", "panoramic"];
50337     var _shownPhotoTypes = _allPhotoTypes.slice();
50338     var _dateFilters = ["fromDate", "toDate"];
50339     var _fromDate;
50340     var _toDate;
50341     var _usernames;
50342     function photos() {
50343     }
50344     function updateStorage() {
50345       if (window.mocha)
50346         return;
50347       var hash = utilStringQs(window.location.hash);
50348       var enabled = context.layers().all().filter(function(d) {
50349         return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
50350       }).map(function(d) {
50351         return d.id;
50352       });
50353       if (enabled.length) {
50354         hash.photo_overlay = enabled.join(",");
50355       } else {
50356         delete hash.photo_overlay;
50357       }
50358       window.location.replace("#" + utilQsString(hash, true));
50359     }
50360     photos.overlayLayerIDs = function() {
50361       return _layerIDs;
50362     };
50363     photos.allPhotoTypes = function() {
50364       return _allPhotoTypes;
50365     };
50366     photos.dateFilters = function() {
50367       return _dateFilters;
50368     };
50369     photos.dateFilterValue = function(val) {
50370       return val === _dateFilters[0] ? _fromDate : _toDate;
50371     };
50372     photos.setDateFilter = function(type3, val, updateUrl) {
50373       var date = val && new Date(val);
50374       if (date && !isNaN(date)) {
50375         val = date.toISOString().substr(0, 10);
50376       } else {
50377         val = null;
50378       }
50379       if (type3 === _dateFilters[0]) {
50380         _fromDate = val;
50381         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50382           _toDate = _fromDate;
50383         }
50384       }
50385       if (type3 === _dateFilters[1]) {
50386         _toDate = val;
50387         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50388           _fromDate = _toDate;
50389         }
50390       }
50391       dispatch10.call("change", this);
50392       if (updateUrl) {
50393         var rangeString;
50394         if (_fromDate || _toDate) {
50395           rangeString = (_fromDate || "") + "_" + (_toDate || "");
50396         }
50397         setUrlFilterValue("photo_dates", rangeString);
50398       }
50399     };
50400     photos.setUsernameFilter = function(val, updateUrl) {
50401       if (val && typeof val === "string")
50402         val = val.replace(/;/g, ",").split(",");
50403       if (val) {
50404         val = val.map((d) => d.trim()).filter(Boolean);
50405         if (!val.length) {
50406           val = null;
50407         }
50408       }
50409       _usernames = val;
50410       dispatch10.call("change", this);
50411       if (updateUrl) {
50412         var hashString;
50413         if (_usernames) {
50414           hashString = _usernames.join(",");
50415         }
50416         setUrlFilterValue("photo_username", hashString);
50417       }
50418     };
50419     function setUrlFilterValue(property, val) {
50420       if (!window.mocha) {
50421         var hash = utilStringQs(window.location.hash);
50422         if (val) {
50423           if (hash[property] === val)
50424             return;
50425           hash[property] = val;
50426         } else {
50427           if (!(property in hash))
50428             return;
50429           delete hash[property];
50430         }
50431         window.location.replace("#" + utilQsString(hash, true));
50432       }
50433     }
50434     function showsLayer(id2) {
50435       var layer = context.layers().layer(id2);
50436       return layer && layer.supported() && layer.enabled();
50437     }
50438     photos.shouldFilterByDate = function() {
50439       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
50440     };
50441     photos.shouldFilterByPhotoType = function() {
50442       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
50443     };
50444     photos.shouldFilterByUsername = function() {
50445       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
50446     };
50447     photos.showsPhotoType = function(val) {
50448       if (!photos.shouldFilterByPhotoType())
50449         return true;
50450       return _shownPhotoTypes.indexOf(val) !== -1;
50451     };
50452     photos.showsFlat = function() {
50453       return photos.showsPhotoType("flat");
50454     };
50455     photos.showsPanoramic = function() {
50456       return photos.showsPhotoType("panoramic");
50457     };
50458     photos.fromDate = function() {
50459       return _fromDate;
50460     };
50461     photos.toDate = function() {
50462       return _toDate;
50463     };
50464     photos.togglePhotoType = function(val) {
50465       var index = _shownPhotoTypes.indexOf(val);
50466       if (index !== -1) {
50467         _shownPhotoTypes.splice(index, 1);
50468       } else {
50469         _shownPhotoTypes.push(val);
50470       }
50471       dispatch10.call("change", this);
50472       return photos;
50473     };
50474     photos.usernames = function() {
50475       return _usernames;
50476     };
50477     photos.init = function() {
50478       var hash = utilStringQs(window.location.hash);
50479       if (hash.photo_dates) {
50480         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
50481         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
50482         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
50483       }
50484       if (hash.photo_username) {
50485         this.setUsernameFilter(hash.photo_username, false);
50486       }
50487       if (hash.photo_overlay) {
50488         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
50489         hashOverlayIDs.forEach(function(id2) {
50490           if (id2 === "openstreetcam")
50491             id2 = "kartaview";
50492           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
50493           if (layer2 && !layer2.enabled())
50494             layer2.enabled(true);
50495         });
50496       }
50497       if (hash.photo) {
50498         var photoIds = hash.photo.replace(/;/g, ",").split(",");
50499         var photoId = photoIds.length && photoIds[0].trim();
50500         var results = /(.*)\/(.*)/g.exec(photoId);
50501         if (results && results.length >= 3) {
50502           var serviceId = results[1];
50503           if (serviceId === "openstreetcam")
50504             serviceId = "kartaview";
50505           var photoKey = results[2];
50506           var service = services[serviceId];
50507           if (service && service.ensureViewerLoaded) {
50508             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
50509             if (layer && !layer.enabled())
50510               layer.enabled(true);
50511             var baselineTime = Date.now();
50512             service.on("loadedImages.rendererPhotos", function() {
50513               if (Date.now() - baselineTime > 45e3) {
50514                 service.on("loadedImages.rendererPhotos", null);
50515                 return;
50516               }
50517               if (!service.cachedImage(photoKey))
50518                 return;
50519               service.on("loadedImages.rendererPhotos", null);
50520               service.ensureViewerLoaded(context).then(function() {
50521                 service.selectImage(context, photoKey).showViewer(context);
50522               });
50523             });
50524           }
50525         }
50526       }
50527       context.layers().on("change.rendererPhotos", updateStorage);
50528     };
50529     return utilRebind(photos, dispatch10, "on");
50530   }
50531
50532   // modules/ui/account.js
50533   function uiAccount(context) {
50534     const osm = context.connection();
50535     function updateUserDetails(selection2) {
50536       if (!osm)
50537         return;
50538       if (!osm.authenticated()) {
50539         render(selection2, null);
50540       } else {
50541         osm.userDetails((err, user) => render(selection2, user));
50542       }
50543     }
50544     function render(selection2, user) {
50545       let userInfo = selection2.select(".userInfo");
50546       let loginLogout = selection2.select(".loginLogout");
50547       if (user) {
50548         userInfo.html("").classed("hide", false);
50549         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
50550         if (user.image_url) {
50551           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
50552         } else {
50553           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
50554         }
50555         userLink.append("span").attr("class", "label").html(user.display_name);
50556         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
50557           e.preventDefault();
50558           osm.logout();
50559           tryLogout();
50560         });
50561       } else {
50562         userInfo.html("").classed("hide", true);
50563         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
50564           e.preventDefault();
50565           osm.authenticate();
50566         });
50567       }
50568     }
50569     function tryLogout() {
50570       if (!osm)
50571         return;
50572       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
50573       const w = 600;
50574       const h = 550;
50575       const settings = [
50576         ["width", w],
50577         ["height", h],
50578         ["left", window.screen.width / 2 - w / 2],
50579         ["top", window.screen.height / 2 - h / 2]
50580       ].map((x) => x.join("=")).join(",");
50581       window.open(url, "_blank", settings);
50582     }
50583     return function(selection2) {
50584       if (!osm)
50585         return;
50586       selection2.append("li").attr("class", "userInfo").classed("hide", true);
50587       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
50588       osm.on("change.account", () => updateUserDetails(selection2));
50589       updateUserDetails(selection2);
50590     };
50591   }
50592
50593   // modules/ui/attribution.js
50594   function uiAttribution(context) {
50595     let _selection = select_default2(null);
50596     function render(selection2, data, klass) {
50597       let div = selection2.selectAll(`.${klass}`).data([0]);
50598       div = div.enter().append("div").attr("class", klass).merge(div);
50599       let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
50600       attributions.exit().remove();
50601       attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
50602         let attribution = select_default2(nodes[i2]);
50603         if (d.terms_html) {
50604           attribution.html(d.terms_html);
50605           return;
50606         }
50607         if (d.terms_url) {
50608           attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
50609         }
50610         const sourceID = d.id.replace(/\./g, "<TX_DOT>");
50611         const terms_text = _t(`imagery.${sourceID}.attribution.text`, { default: d.terms_text || d.id || d.name() });
50612         if (d.icon && !d.overlay) {
50613           attribution.append("img").attr("class", "source-image").attr("src", d.icon);
50614         }
50615         attribution.append("span").attr("class", "attribution-text").text(terms_text);
50616       }).merge(attributions);
50617       let copyright = attributions.selectAll(".copyright-notice").data((d) => {
50618         let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
50619         return notice ? [notice] : [];
50620       });
50621       copyright.exit().remove();
50622       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
50623       copyright.text(String);
50624     }
50625     function update() {
50626       let baselayer = context.background().baseLayerSource();
50627       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
50628       const z = context.map().zoom();
50629       let overlays = context.background().overlayLayerSources() || [];
50630       _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
50631     }
50632     return function(selection2) {
50633       _selection = selection2;
50634       context.background().on("change.attribution", update);
50635       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
50636       update();
50637     };
50638   }
50639
50640   // modules/ui/contributors.js
50641   function uiContributors(context) {
50642     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
50643       update();
50644     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
50645     function update() {
50646       if (!osm)
50647         return;
50648       var users = {}, entities = context.history().intersects(context.map().extent());
50649       entities.forEach(function(entity) {
50650         if (entity && entity.user)
50651           users[entity.user] = true;
50652       });
50653       var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
50654       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
50655       var userList = select_default2(document.createElement("span"));
50656       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
50657         return osm.userURL(d);
50658       }).attr("target", "_blank").text(String);
50659       if (u.length > limit) {
50660         var count = select_default2(document.createElement("span"));
50661         var othersNum = u.length - limit + 1;
50662         count.append("a").attr("target", "_blank").attr("href", function() {
50663           return osm.changesetsURL(context.map().center(), context.map().zoom());
50664         }).text(othersNum);
50665         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
50666       } else {
50667         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
50668       }
50669       if (!u.length) {
50670         hidden = true;
50671         wrap2.transition().style("opacity", 0);
50672       } else if (hidden) {
50673         wrap2.transition().style("opacity", 1);
50674       }
50675     }
50676     return function(selection2) {
50677       if (!osm)
50678         return;
50679       wrap2 = selection2;
50680       update();
50681       osm.on("loaded.contributors", debouncedUpdate);
50682       context.map().on("move.contributors", debouncedUpdate);
50683     };
50684   }
50685
50686   // modules/ui/popover.js
50687   var _popoverID = 0;
50688   function uiPopover(klass) {
50689     var _id = _popoverID++;
50690     var _anchorSelection = select_default2(null);
50691     var popover = function(selection2) {
50692       _anchorSelection = selection2;
50693       selection2.each(setup);
50694     };
50695     var _animation = utilFunctor(false);
50696     var _placement = utilFunctor("top");
50697     var _alignment = utilFunctor("center");
50698     var _scrollContainer = utilFunctor(select_default2(null));
50699     var _content;
50700     var _displayType = utilFunctor("");
50701     var _hasArrow = utilFunctor(true);
50702     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50703     popover.displayType = function(val) {
50704       if (arguments.length) {
50705         _displayType = utilFunctor(val);
50706         return popover;
50707       } else {
50708         return _displayType;
50709       }
50710     };
50711     popover.hasArrow = function(val) {
50712       if (arguments.length) {
50713         _hasArrow = utilFunctor(val);
50714         return popover;
50715       } else {
50716         return _hasArrow;
50717       }
50718     };
50719     popover.placement = function(val) {
50720       if (arguments.length) {
50721         _placement = utilFunctor(val);
50722         return popover;
50723       } else {
50724         return _placement;
50725       }
50726     };
50727     popover.alignment = function(val) {
50728       if (arguments.length) {
50729         _alignment = utilFunctor(val);
50730         return popover;
50731       } else {
50732         return _alignment;
50733       }
50734     };
50735     popover.scrollContainer = function(val) {
50736       if (arguments.length) {
50737         _scrollContainer = utilFunctor(val);
50738         return popover;
50739       } else {
50740         return _scrollContainer;
50741       }
50742     };
50743     popover.content = function(val) {
50744       if (arguments.length) {
50745         _content = val;
50746         return popover;
50747       } else {
50748         return _content;
50749       }
50750     };
50751     popover.isShown = function() {
50752       var popoverSelection = _anchorSelection.select(".popover-" + _id);
50753       return !popoverSelection.empty() && popoverSelection.classed("in");
50754     };
50755     popover.show = function() {
50756       _anchorSelection.each(show);
50757     };
50758     popover.updateContent = function() {
50759       _anchorSelection.each(updateContent);
50760     };
50761     popover.hide = function() {
50762       _anchorSelection.each(hide);
50763     };
50764     popover.toggle = function() {
50765       _anchorSelection.each(toggle);
50766     };
50767     popover.destroy = function(selection2, selector) {
50768       selector = selector || ".popover-" + _id;
50769       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() {
50770         return this.getAttribute("data-original-title") || this.getAttribute("title");
50771       }).attr("data-original-title", null).selectAll(selector).remove();
50772     };
50773     popover.destroyAny = function(selection2) {
50774       selection2.call(popover.destroy, ".popover");
50775     };
50776     function setup() {
50777       var anchor = select_default2(this);
50778       var animate = _animation.apply(this, arguments);
50779       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
50780       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
50781       enter.append("div").attr("class", "popover-arrow");
50782       enter.append("div").attr("class", "popover-inner");
50783       popoverSelection = enter.merge(popoverSelection);
50784       if (animate) {
50785         popoverSelection.classed("fade", true);
50786       }
50787       var display = _displayType.apply(this, arguments);
50788       if (display === "hover") {
50789         var _lastNonMouseEnterTime;
50790         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
50791           if (d3_event.pointerType) {
50792             if (d3_event.pointerType !== "mouse") {
50793               _lastNonMouseEnterTime = d3_event.timeStamp;
50794               return;
50795             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
50796               return;
50797             }
50798           }
50799           if (d3_event.buttons !== 0)
50800             return;
50801           show.apply(this, arguments);
50802         }).on(_pointerPrefix + "leave.popover", function() {
50803           hide.apply(this, arguments);
50804         }).on("focus.popover", function() {
50805           show.apply(this, arguments);
50806         }).on("blur.popover", function() {
50807           hide.apply(this, arguments);
50808         });
50809       } else if (display === "clickFocus") {
50810         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
50811           d3_event.preventDefault();
50812           d3_event.stopPropagation();
50813         }).on(_pointerPrefix + "up.popover", function(d3_event) {
50814           d3_event.preventDefault();
50815           d3_event.stopPropagation();
50816         }).on("click.popover", toggle);
50817         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
50818           anchor.each(function() {
50819             hide.apply(this, arguments);
50820           });
50821         });
50822       }
50823     }
50824     function show() {
50825       var anchor = select_default2(this);
50826       var popoverSelection = anchor.selectAll(".popover-" + _id);
50827       if (popoverSelection.empty()) {
50828         anchor.call(popover.destroy);
50829         anchor.each(setup);
50830         popoverSelection = anchor.selectAll(".popover-" + _id);
50831       }
50832       popoverSelection.classed("in", true);
50833       var displayType = _displayType.apply(this, arguments);
50834       if (displayType === "clickFocus") {
50835         anchor.classed("active", true);
50836         popoverSelection.node().focus();
50837       }
50838       anchor.each(updateContent);
50839     }
50840     function updateContent() {
50841       var anchor = select_default2(this);
50842       if (_content) {
50843         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
50844       }
50845       updatePosition.apply(this, arguments);
50846       updatePosition.apply(this, arguments);
50847       updatePosition.apply(this, arguments);
50848     }
50849     function updatePosition() {
50850       var anchor = select_default2(this);
50851       var popoverSelection = anchor.selectAll(".popover-" + _id);
50852       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
50853       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
50854       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
50855       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
50856       var placement = _placement.apply(this, arguments);
50857       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
50858       var alignment = _alignment.apply(this, arguments);
50859       var alignFactor = 0.5;
50860       if (alignment === "leading") {
50861         alignFactor = 0;
50862       } else if (alignment === "trailing") {
50863         alignFactor = 1;
50864       }
50865       var anchorFrame = getFrame(anchor.node());
50866       var popoverFrame = getFrame(popoverSelection.node());
50867       var position;
50868       switch (placement) {
50869         case "top":
50870           position = {
50871             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
50872             y: anchorFrame.y - popoverFrame.h
50873           };
50874           break;
50875         case "bottom":
50876           position = {
50877             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
50878             y: anchorFrame.y + anchorFrame.h
50879           };
50880           break;
50881         case "left":
50882           position = {
50883             x: anchorFrame.x - popoverFrame.w,
50884             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
50885           };
50886           break;
50887         case "right":
50888           position = {
50889             x: anchorFrame.x + anchorFrame.w,
50890             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
50891           };
50892           break;
50893       }
50894       if (position) {
50895         if (scrollNode && (placement === "top" || placement === "bottom")) {
50896           var initialPosX = position.x;
50897           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
50898             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
50899           } else if (position.x < 10) {
50900             position.x = 10;
50901           }
50902           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
50903           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
50904           arrow.style("left", ~~arrowPosX + "px");
50905         }
50906         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
50907       } else {
50908         popoverSelection.style("left", null).style("top", null);
50909       }
50910       function getFrame(node) {
50911         var positionStyle = select_default2(node).style("position");
50912         if (positionStyle === "absolute" || positionStyle === "static") {
50913           return {
50914             x: node.offsetLeft - scrollLeft,
50915             y: node.offsetTop - scrollTop,
50916             w: node.offsetWidth,
50917             h: node.offsetHeight
50918           };
50919         } else {
50920           return {
50921             x: 0,
50922             y: 0,
50923             w: node.offsetWidth,
50924             h: node.offsetHeight
50925           };
50926         }
50927       }
50928     }
50929     function hide() {
50930       var anchor = select_default2(this);
50931       if (_displayType.apply(this, arguments) === "clickFocus") {
50932         anchor.classed("active", false);
50933       }
50934       anchor.selectAll(".popover-" + _id).classed("in", false);
50935     }
50936     function toggle() {
50937       if (select_default2(this).select(".popover-" + _id).classed("in")) {
50938         hide.apply(this, arguments);
50939       } else {
50940         show.apply(this, arguments);
50941       }
50942     }
50943     return popover;
50944   }
50945
50946   // modules/ui/tooltip.js
50947   function uiTooltip(klass) {
50948     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
50949     var _title = function() {
50950       var title = this.getAttribute("data-original-title");
50951       if (title) {
50952         return title;
50953       } else {
50954         title = this.getAttribute("title");
50955         this.removeAttribute("title");
50956         this.setAttribute("data-original-title", title);
50957       }
50958       return title;
50959     };
50960     var _heading = utilFunctor(null);
50961     var _keys = utilFunctor(null);
50962     tooltip.title = function(val) {
50963       if (!arguments.length)
50964         return _title;
50965       _title = utilFunctor(val);
50966       return tooltip;
50967     };
50968     tooltip.heading = function(val) {
50969       if (!arguments.length)
50970         return _heading;
50971       _heading = utilFunctor(val);
50972       return tooltip;
50973     };
50974     tooltip.keys = function(val) {
50975       if (!arguments.length)
50976         return _keys;
50977       _keys = utilFunctor(val);
50978       return tooltip;
50979     };
50980     tooltip.content(function() {
50981       var heading = _heading.apply(this, arguments);
50982       var text2 = _title.apply(this, arguments);
50983       var keys = _keys.apply(this, arguments);
50984       return function(selection2) {
50985         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
50986         headingSelect.exit().remove();
50987         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).html(heading);
50988         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
50989         textSelect.exit().remove();
50990         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).html(text2);
50991         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []);
50992         keyhintWrap.exit().remove();
50993         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
50994         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
50995         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
50996         keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").html(function(d) {
50997           return d;
50998         });
50999       };
51000     });
51001     return tooltip;
51002   }
51003
51004   // modules/ui/edit_menu.js
51005   function uiEditMenu(context) {
51006     var dispatch10 = dispatch_default("toggled");
51007     var _menu = select_default2(null);
51008     var _operations = [];
51009     var _anchorLoc = [0, 0];
51010     var _anchorLocLonLat = [0, 0];
51011     var _triggerType = "";
51012     var _vpTopMargin = 85;
51013     var _vpBottomMargin = 45;
51014     var _vpSideMargin = 35;
51015     var _menuTop = false;
51016     var _menuHeight;
51017     var _menuWidth;
51018     var _verticalPadding = 4;
51019     var _tooltipWidth = 210;
51020     var _menuSideMargin = 10;
51021     var _tooltips = [];
51022     var editMenu = function(selection2) {
51023       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
51024       var ops = _operations.filter(function(op) {
51025         return !isTouchMenu || !op.mouseOnly;
51026       });
51027       if (!ops.length)
51028         return;
51029       _tooltips = [];
51030       _menuTop = isTouchMenu;
51031       var showLabels = isTouchMenu;
51032       var buttonHeight = showLabels ? 32 : 34;
51033       if (showLabels) {
51034         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
51035           return op.title.length;
51036         })));
51037       } else {
51038         _menuWidth = 44;
51039       }
51040       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
51041       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
51042       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
51043       var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
51044         return "edit-menu-item edit-menu-item-" + d.id;
51045       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
51046         d3_event.stopPropagation();
51047       }).on("mouseenter.highlight", function(d3_event, d) {
51048         if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
51049           return;
51050         utilHighlightEntities(d.relatedEntityIds(), true, context);
51051       }).on("mouseleave.highlight", function(d3_event, d) {
51052         if (!d.relatedEntityIds)
51053           return;
51054         utilHighlightEntities(d.relatedEntityIds(), false, context);
51055       });
51056       buttonsEnter.each(function(d) {
51057         var tooltip = uiTooltip().heading(d.title).title(d.tooltip()).keys([d.keys[0]]);
51058         _tooltips.push(tooltip);
51059         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
51060       });
51061       if (showLabels) {
51062         buttonsEnter.append("span").attr("class", "label").html(function(d) {
51063           return d.title;
51064         });
51065       }
51066       buttonsEnter.merge(buttons).classed("disabled", function(d) {
51067         return d.disabled();
51068       });
51069       updatePosition();
51070       var initialScale = context.projection.scale();
51071       context.map().on("move.edit-menu", function() {
51072         if (initialScale !== context.projection.scale()) {
51073           editMenu.close();
51074         }
51075       }).on("drawn.edit-menu", function(info) {
51076         if (info.full)
51077           updatePosition();
51078       });
51079       var lastPointerUpType;
51080       function pointerup(d3_event) {
51081         lastPointerUpType = d3_event.pointerType;
51082       }
51083       function click(d3_event, operation) {
51084         d3_event.stopPropagation();
51085         if (operation.relatedEntityIds) {
51086           utilHighlightEntities(operation.relatedEntityIds(), false, context);
51087         }
51088         if (operation.disabled()) {
51089           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51090             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip)();
51091           }
51092         } else {
51093           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51094             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
51095           }
51096           operation();
51097           editMenu.close();
51098         }
51099         lastPointerUpType = null;
51100       }
51101       dispatch10.call("toggled", this, true);
51102     };
51103     function updatePosition() {
51104       if (!_menu || _menu.empty())
51105         return;
51106       var anchorLoc = context.projection(_anchorLocLonLat);
51107       var viewport = context.surfaceRect();
51108       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
51109         editMenu.close();
51110         return;
51111       }
51112       var menuLeft = displayOnLeft(viewport);
51113       var offset = [0, 0];
51114       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
51115       if (_menuTop) {
51116         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
51117           offset[1] = -anchorLoc[1] + _vpTopMargin;
51118         } else {
51119           offset[1] = -_menuHeight;
51120         }
51121       } else {
51122         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
51123           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
51124         } else {
51125           offset[1] = 0;
51126         }
51127       }
51128       var origin = geoVecAdd(anchorLoc, offset);
51129       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
51130       var tooltipSide = tooltipPosition(viewport, menuLeft);
51131       _tooltips.forEach(function(tooltip) {
51132         tooltip.placement(tooltipSide);
51133       });
51134       function displayOnLeft(viewport2) {
51135         if (_mainLocalizer.textDirection() === "ltr") {
51136           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
51137             return true;
51138           }
51139           return false;
51140         } else {
51141           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
51142             return false;
51143           }
51144           return true;
51145         }
51146       }
51147       function tooltipPosition(viewport2, menuLeft2) {
51148         if (_mainLocalizer.textDirection() === "ltr") {
51149           if (menuLeft2) {
51150             return "left";
51151           }
51152           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
51153             return "left";
51154           }
51155           return "right";
51156         } else {
51157           if (!menuLeft2) {
51158             return "right";
51159           }
51160           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
51161             return "right";
51162           }
51163           return "left";
51164         }
51165       }
51166     }
51167     editMenu.close = function() {
51168       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
51169       _menu.remove();
51170       _tooltips = [];
51171       dispatch10.call("toggled", this, false);
51172     };
51173     editMenu.anchorLoc = function(val) {
51174       if (!arguments.length)
51175         return _anchorLoc;
51176       _anchorLoc = val;
51177       _anchorLocLonLat = context.projection.invert(_anchorLoc);
51178       return editMenu;
51179     };
51180     editMenu.triggerType = function(val) {
51181       if (!arguments.length)
51182         return _triggerType;
51183       _triggerType = val;
51184       return editMenu;
51185     };
51186     editMenu.operations = function(val) {
51187       if (!arguments.length)
51188         return _operations;
51189       _operations = val;
51190       return editMenu;
51191     };
51192     return utilRebind(editMenu, dispatch10, "on");
51193   }
51194
51195   // modules/ui/feature_info.js
51196   function uiFeatureInfo(context) {
51197     function update(selection2) {
51198       var features2 = context.features();
51199       var stats = features2.stats();
51200       var count = 0;
51201       var hiddenList = features2.hidden().map(function(k) {
51202         if (stats[k]) {
51203           count += stats[k];
51204           return _t.html("inspector.title_count", { title: { html: _t.html("feature." + k + ".description") }, count: stats[k] });
51205         }
51206         return null;
51207       }).filter(Boolean);
51208       selection2.html("");
51209       if (hiddenList.length) {
51210         var tooltipBehavior = uiTooltip().placement("top").title(function() {
51211           return hiddenList.join("<br/>");
51212         });
51213         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
51214           tooltipBehavior.hide();
51215           d3_event.preventDefault();
51216           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
51217         });
51218       }
51219       selection2.classed("hide", !hiddenList.length);
51220     }
51221     return function(selection2) {
51222       update(selection2);
51223       context.features().on("change.feature_info", function() {
51224         update(selection2);
51225       });
51226     };
51227   }
51228
51229   // modules/ui/flash.js
51230   function uiFlash(context) {
51231     var _flashTimer;
51232     var _duration = 2e3;
51233     var _iconName = "#iD-icon-no";
51234     var _iconClass = "disabled";
51235     var _label = "";
51236     function flash() {
51237       if (_flashTimer) {
51238         _flashTimer.stop();
51239       }
51240       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
51241       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
51242       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
51243       var contentEnter = content.enter().append("div").attr("class", "flash-content");
51244       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
51245       iconEnter.append("circle").attr("r", 9);
51246       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
51247       contentEnter.append("div").attr("class", "flash-text");
51248       content = content.merge(contentEnter);
51249       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
51250       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
51251       content.selectAll(".flash-text").attr("class", "flash-text").html(_label);
51252       _flashTimer = timeout_default(function() {
51253         _flashTimer = null;
51254         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
51255         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
51256       }, _duration);
51257       return content;
51258     }
51259     flash.duration = function(_) {
51260       if (!arguments.length)
51261         return _duration;
51262       _duration = _;
51263       return flash;
51264     };
51265     flash.label = function(_) {
51266       if (!arguments.length)
51267         return _label;
51268       _label = _;
51269       return flash;
51270     };
51271     flash.iconName = function(_) {
51272       if (!arguments.length)
51273         return _iconName;
51274       _iconName = _;
51275       return flash;
51276     };
51277     flash.iconClass = function(_) {
51278       if (!arguments.length)
51279         return _iconClass;
51280       _iconClass = _;
51281       return flash;
51282     };
51283     return flash;
51284   }
51285
51286   // modules/ui/full_screen.js
51287   function uiFullScreen(context) {
51288     var element = context.container().node();
51289     function getFullScreenFn() {
51290       if (element.requestFullscreen) {
51291         return element.requestFullscreen;
51292       } else if (element.msRequestFullscreen) {
51293         return element.msRequestFullscreen;
51294       } else if (element.mozRequestFullScreen) {
51295         return element.mozRequestFullScreen;
51296       } else if (element.webkitRequestFullscreen) {
51297         return element.webkitRequestFullscreen;
51298       }
51299     }
51300     function getExitFullScreenFn() {
51301       if (document.exitFullscreen) {
51302         return document.exitFullscreen;
51303       } else if (document.msExitFullscreen) {
51304         return document.msExitFullscreen;
51305       } else if (document.mozCancelFullScreen) {
51306         return document.mozCancelFullScreen;
51307       } else if (document.webkitExitFullscreen) {
51308         return document.webkitExitFullscreen;
51309       }
51310     }
51311     function isFullScreen() {
51312       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
51313     }
51314     function isSupported() {
51315       return !!getFullScreenFn();
51316     }
51317     function fullScreen(d3_event) {
51318       d3_event.preventDefault();
51319       if (!isFullScreen()) {
51320         getFullScreenFn().apply(element);
51321       } else {
51322         getExitFullScreenFn().apply(document);
51323       }
51324     }
51325     return function() {
51326       if (!isSupported())
51327         return;
51328       var detected = utilDetect();
51329       var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
51330       context.keybinding().on(keys, fullScreen);
51331     };
51332   }
51333
51334   // modules/ui/geolocate.js
51335   function uiGeolocate(context) {
51336     var _geolocationOptions = {
51337       enableHighAccuracy: false,
51338       timeout: 6e3
51339     };
51340     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
51341     var _layer = context.layers().layer("geolocate");
51342     var _position;
51343     var _extent;
51344     var _timeoutID;
51345     var _button = select_default2(null);
51346     function click() {
51347       if (context.inIntro())
51348         return;
51349       if (!_layer.enabled() && !_locating.isShown()) {
51350         _timeoutID = setTimeout(error, 1e4);
51351         context.container().call(_locating);
51352         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
51353       } else {
51354         _locating.close();
51355         _layer.enabled(null, false);
51356         updateButtonState();
51357       }
51358     }
51359     function zoomTo() {
51360       context.enter(modeBrowse(context));
51361       var map2 = context.map();
51362       _layer.enabled(_position, true);
51363       updateButtonState();
51364       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
51365     }
51366     function success(geolocation) {
51367       _position = geolocation;
51368       var coords = _position.coords;
51369       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
51370       zoomTo();
51371       finish();
51372     }
51373     function error() {
51374       if (_position) {
51375         zoomTo();
51376       } else {
51377         context.ui().flash.label(_t.html("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
51378       }
51379       finish();
51380     }
51381     function finish() {
51382       _locating.close();
51383       if (_timeoutID) {
51384         clearTimeout(_timeoutID);
51385       }
51386       _timeoutID = void 0;
51387     }
51388     function updateButtonState() {
51389       _button.classed("active", _layer.enabled());
51390       _button.attr("aria-pressed", _layer.enabled());
51391     }
51392     return function(selection2) {
51393       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
51394         return;
51395       _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")]));
51396       context.keybinding().on(_t("geolocate.key"), click);
51397     };
51398   }
51399
51400   // modules/ui/panels/background.js
51401   function uiPanelBackground(context) {
51402     var background = context.background();
51403     var _currSourceName = null;
51404     var _metadata = {};
51405     var _metadataKeys = [
51406       "zoom",
51407       "vintage",
51408       "source",
51409       "description",
51410       "resolution",
51411       "accuracy"
51412     ];
51413     var debouncedRedraw = debounce_default(redraw, 250);
51414     function redraw(selection2) {
51415       var source = background.baseLayerSource();
51416       if (!source)
51417         return;
51418       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
51419       var sourceLabel = source.label();
51420       if (_currSourceName !== sourceLabel) {
51421         _currSourceName = sourceLabel;
51422         _metadata = {};
51423       }
51424       selection2.html("");
51425       var list = selection2.append("ul").attr("class", "background-info");
51426       list.append("li").html(_currSourceName);
51427       _metadataKeys.forEach(function(k) {
51428         if (isDG && k === "vintage")
51429           return;
51430         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]);
51431       });
51432       debouncedGetMetadata(selection2);
51433       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
51434       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
51435         d3_event.preventDefault();
51436         context.setDebug("tile", !context.getDebug("tile"));
51437         selection2.call(redraw);
51438       });
51439       if (isDG) {
51440         var key = source.id + "-vintage";
51441         var sourceVintage = context.background().findSource(key);
51442         var showsVintage = context.background().showsLayer(sourceVintage);
51443         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
51444         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
51445           d3_event.preventDefault();
51446           context.background().toggleOverlayLayer(sourceVintage);
51447           selection2.call(redraw);
51448         });
51449       }
51450       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
51451         if (source.id !== layerId) {
51452           var key2 = layerId + "-vintage";
51453           var sourceVintage2 = context.background().findSource(key2);
51454           if (context.background().showsLayer(sourceVintage2)) {
51455             context.background().toggleOverlayLayer(sourceVintage2);
51456           }
51457         }
51458       });
51459     }
51460     var debouncedGetMetadata = debounce_default(getMetadata, 250);
51461     function getMetadata(selection2) {
51462       var tile = context.container().select(".layer-background img.tile-center");
51463       if (tile.empty())
51464         return;
51465       var sourceName = _currSourceName;
51466       var d = tile.datum();
51467       var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
51468       var center = context.map().center();
51469       _metadata.zoom = String(zoom);
51470       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
51471       if (!d || !d.length >= 3)
51472         return;
51473       background.baseLayerSource().getMetadata(center, d, function(err, result) {
51474         if (err || _currSourceName !== sourceName)
51475           return;
51476         var vintage = result.vintage;
51477         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
51478         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
51479         _metadataKeys.forEach(function(k) {
51480           if (k === "zoom" || k === "vintage")
51481             return;
51482           var val = result[k];
51483           _metadata[k] = val;
51484           selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
51485         });
51486       });
51487     }
51488     var panel = function(selection2) {
51489       selection2.call(redraw);
51490       context.map().on("drawn.info-background", function() {
51491         selection2.call(debouncedRedraw);
51492       }).on("move.info-background", function() {
51493         selection2.call(debouncedGetMetadata);
51494       });
51495     };
51496     panel.off = function() {
51497       context.map().on("drawn.info-background", null).on("move.info-background", null);
51498     };
51499     panel.id = "background";
51500     panel.label = _t.html("info_panels.background.title");
51501     panel.key = _t("info_panels.background.key");
51502     return panel;
51503   }
51504
51505   // modules/ui/panels/history.js
51506   function uiPanelHistory(context) {
51507     var osm;
51508     function displayTimestamp(timestamp) {
51509       if (!timestamp)
51510         return _t("info_panels.history.unknown");
51511       var options2 = {
51512         day: "numeric",
51513         month: "short",
51514         year: "numeric",
51515         hour: "numeric",
51516         minute: "numeric",
51517         second: "numeric"
51518       };
51519       var d = new Date(timestamp);
51520       if (isNaN(d.getTime()))
51521         return _t("info_panels.history.unknown");
51522       return d.toLocaleString(_mainLocalizer.localeCode(), options2);
51523     }
51524     function displayUser(selection2, userName) {
51525       if (!userName) {
51526         selection2.append("span").call(_t.append("info_panels.history.unknown"));
51527         return;
51528       }
51529       selection2.append("span").attr("class", "user-name").text(userName);
51530       var links = selection2.append("div").attr("class", "links");
51531       if (osm) {
51532         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
51533       }
51534       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
51535     }
51536     function displayChangeset(selection2, changeset) {
51537       if (!changeset) {
51538         selection2.append("span").call(_t.append("info_panels.history.unknown"));
51539         return;
51540       }
51541       selection2.append("span").attr("class", "changeset-id").text(changeset);
51542       var links = selection2.append("div").attr("class", "links");
51543       if (osm) {
51544         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
51545       }
51546       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
51547       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
51548     }
51549     function redraw(selection2) {
51550       var selectedNoteID = context.selectedNoteID();
51551       osm = context.connection();
51552       var selected, note, entity;
51553       if (selectedNoteID && osm) {
51554         selected = [_t.html("note.note") + " " + selectedNoteID];
51555         note = osm.getNote(selectedNoteID);
51556       } else {
51557         selected = context.selectedIDs().filter(function(e) {
51558           return context.hasEntity(e);
51559         });
51560         if (selected.length) {
51561           entity = context.entity(selected[0]);
51562         }
51563       }
51564       var singular = selected.length === 1 ? selected[0] : null;
51565       selection2.html("");
51566       if (singular) {
51567         selection2.append("h4").attr("class", "history-heading").html(singular);
51568       } else {
51569         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
51570       }
51571       if (!singular)
51572         return;
51573       if (entity) {
51574         selection2.call(redrawEntity, entity);
51575       } else if (note) {
51576         selection2.call(redrawNote, note);
51577       }
51578     }
51579     function redrawNote(selection2, note) {
51580       if (!note || note.isNew()) {
51581         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
51582         return;
51583       }
51584       var list = selection2.append("ul");
51585       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
51586       if (note.comments.length) {
51587         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
51588         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
51589       }
51590       if (osm) {
51591         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"));
51592       }
51593     }
51594     function redrawEntity(selection2, entity) {
51595       if (!entity || entity.isNew()) {
51596         selection2.append("div").call(_t.append("info_panels.history.no_history"));
51597         return;
51598       }
51599       var links = selection2.append("div").attr("class", "links");
51600       if (osm) {
51601         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"));
51602       }
51603       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");
51604       var list = selection2.append("ul");
51605       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
51606       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
51607       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
51608       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
51609     }
51610     var panel = function(selection2) {
51611       selection2.call(redraw);
51612       context.map().on("drawn.info-history", function() {
51613         selection2.call(redraw);
51614       });
51615       context.on("enter.info-history", function() {
51616         selection2.call(redraw);
51617       });
51618     };
51619     panel.off = function() {
51620       context.map().on("drawn.info-history", null);
51621       context.on("enter.info-history", null);
51622     };
51623     panel.id = "history";
51624     panel.label = _t.html("info_panels.history.title");
51625     panel.key = _t("info_panels.history.key");
51626     return panel;
51627   }
51628
51629   // modules/util/units.js
51630   var OSM_PRECISION = 7;
51631   function displayLength(m, isImperial) {
51632     var d = m * (isImperial ? 3.28084 : 1);
51633     var unit2;
51634     if (isImperial) {
51635       if (d >= 5280) {
51636         d /= 5280;
51637         unit2 = "miles";
51638       } else {
51639         unit2 = "feet";
51640       }
51641     } else {
51642       if (d >= 1e3) {
51643         d /= 1e3;
51644         unit2 = "kilometers";
51645       } else {
51646         unit2 = "meters";
51647       }
51648     }
51649     return _t("units." + unit2, {
51650       quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
51651         maximumSignificantDigits: 4
51652       })
51653     });
51654   }
51655   function displayArea(m2, isImperial) {
51656     var locale2 = _mainLocalizer.localeCode();
51657     var d = m2 * (isImperial ? 10.7639111056 : 1);
51658     var d1, d2, area;
51659     var unit1 = "";
51660     var unit2 = "";
51661     if (isImperial) {
51662       if (d >= 6969600) {
51663         d1 = d / 27878400;
51664         unit1 = "square_miles";
51665       } else {
51666         d1 = d;
51667         unit1 = "square_feet";
51668       }
51669       if (d > 4356 && d < 4356e4) {
51670         d2 = d / 43560;
51671         unit2 = "acres";
51672       }
51673     } else {
51674       if (d >= 25e4) {
51675         d1 = d / 1e6;
51676         unit1 = "square_kilometers";
51677       } else {
51678         d1 = d;
51679         unit1 = "square_meters";
51680       }
51681       if (d > 1e3 && d < 1e7) {
51682         d2 = d / 1e4;
51683         unit2 = "hectares";
51684       }
51685     }
51686     area = _t("units." + unit1, {
51687       quantity: d1.toLocaleString(locale2, {
51688         maximumSignificantDigits: 4
51689       })
51690     });
51691     if (d2) {
51692       return _t("units.area_pair", {
51693         area1: area,
51694         area2: _t("units." + unit2, {
51695           quantity: d2.toLocaleString(locale2, {
51696             maximumSignificantDigits: 2
51697           })
51698         })
51699       });
51700     } else {
51701       return area;
51702     }
51703   }
51704   function wrap(x, min3, max3) {
51705     var d = max3 - min3;
51706     return ((x - min3) % d + d) % d + min3;
51707   }
51708   function clamp2(x, min3, max3) {
51709     return Math.max(min3, Math.min(x, max3));
51710   }
51711   function displayCoordinate(deg, pos, neg) {
51712     var locale2 = _mainLocalizer.localeCode();
51713     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
51714     var sec = (min3 - Math.floor(min3)) * 60;
51715     var displayDegrees = _t("units.arcdegrees", {
51716       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
51717     });
51718     var displayCoordinate2;
51719     if (Math.floor(sec) > 0) {
51720       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
51721         quantity: Math.floor(min3).toLocaleString(locale2)
51722       }) + _t("units.arcseconds", {
51723         quantity: Math.round(sec).toLocaleString(locale2)
51724       });
51725     } else if (Math.floor(min3) > 0) {
51726       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
51727         quantity: Math.round(min3).toLocaleString(locale2)
51728       });
51729     } else {
51730       displayCoordinate2 = _t("units.arcdegrees", {
51731         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
51732       });
51733     }
51734     if (deg === 0) {
51735       return displayCoordinate2;
51736     } else {
51737       return _t("units.coordinate", {
51738         coordinate: displayCoordinate2,
51739         direction: _t("units." + (deg > 0 ? pos : neg))
51740       });
51741     }
51742   }
51743   function dmsCoordinatePair(coord2) {
51744     return _t("units.coordinate_pair", {
51745       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
51746       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
51747     });
51748   }
51749   function decimalCoordinatePair(coord2) {
51750     return _t("units.coordinate_pair", {
51751       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
51752       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
51753     });
51754   }
51755
51756   // modules/ui/panels/location.js
51757   function uiPanelLocation(context) {
51758     var currLocation = "";
51759     function redraw(selection2) {
51760       selection2.html("");
51761       var list = selection2.append("ul");
51762       var coord2 = context.map().mouseCoordinates();
51763       if (coord2.some(isNaN)) {
51764         coord2 = context.map().center();
51765       }
51766       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
51767       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
51768       debouncedGetLocation(selection2, coord2);
51769     }
51770     var debouncedGetLocation = debounce_default(getLocation, 250);
51771     function getLocation(selection2, coord2) {
51772       if (!services.geocoder) {
51773         currLocation = _t("info_panels.location.unknown_location");
51774         selection2.selectAll(".location-info").text(currLocation);
51775       } else {
51776         services.geocoder.reverse(coord2, function(err, result) {
51777           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
51778           selection2.selectAll(".location-info").text(currLocation);
51779         });
51780       }
51781     }
51782     var panel = function(selection2) {
51783       selection2.call(redraw);
51784       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
51785         selection2.call(redraw);
51786       });
51787     };
51788     panel.off = function() {
51789       context.surface().on(".info-location", null);
51790     };
51791     panel.id = "location";
51792     panel.label = _t.html("info_panels.location.title");
51793     panel.key = _t("info_panels.location.key");
51794     return panel;
51795   }
51796
51797   // modules/ui/panels/measurement.js
51798   function uiPanelMeasurement(context) {
51799     function radiansToMeters(r) {
51800       return r * 63710071809e-4;
51801     }
51802     function steradiansToSqmeters(r) {
51803       return r / (4 * Math.PI) * 510065621724e3;
51804     }
51805     function toLineString(feature3) {
51806       if (feature3.type === "LineString")
51807         return feature3;
51808       var result = { type: "LineString", coordinates: [] };
51809       if (feature3.type === "Polygon") {
51810         result.coordinates = feature3.coordinates[0];
51811       } else if (feature3.type === "MultiPolygon") {
51812         result.coordinates = feature3.coordinates[0][0];
51813       }
51814       return result;
51815     }
51816     var _isImperial = !_mainLocalizer.usesMetric();
51817     function redraw(selection2) {
51818       var graph = context.graph();
51819       var selectedNoteID = context.selectedNoteID();
51820       var osm = services.osm;
51821       var localeCode = _mainLocalizer.localeCode();
51822       var heading;
51823       var center, location, centroid;
51824       var closed, geometry;
51825       var totalNodeCount, length = 0, area = 0, distance;
51826       if (selectedNoteID && osm) {
51827         var note = osm.getNote(selectedNoteID);
51828         heading = _t.html("note.note") + " " + selectedNoteID;
51829         location = note.loc;
51830         geometry = "note";
51831       } else {
51832         var selectedIDs = context.selectedIDs().filter(function(id2) {
51833           return context.hasEntity(id2);
51834         });
51835         var selected = selectedIDs.map(function(id2) {
51836           return context.entity(id2);
51837         });
51838         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
51839         if (selected.length) {
51840           var extent = geoExtent();
51841           for (var i2 in selected) {
51842             var entity = selected[i2];
51843             extent._extend(entity.extent(graph));
51844             geometry = entity.geometry(graph);
51845             if (geometry === "line" || geometry === "area") {
51846               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
51847               var feature3 = entity.asGeoJSON(graph);
51848               length += radiansToMeters(length_default(toLineString(feature3)));
51849               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
51850               centroid = centroid && context.projection.invert(centroid);
51851               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
51852                 centroid = entity.extent(graph).center();
51853               }
51854               if (closed) {
51855                 area += steradiansToSqmeters(entity.area(graph));
51856               }
51857             }
51858           }
51859           if (selected.length > 1) {
51860             geometry = null;
51861             closed = null;
51862             centroid = null;
51863           }
51864           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
51865             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
51866           }
51867           if (selected.length === 1 && selected[0].type === "node") {
51868             location = selected[0].loc;
51869           } else {
51870             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
51871           }
51872           if (!location && !centroid) {
51873             center = extent.center();
51874           }
51875         }
51876       }
51877       selection2.html("");
51878       if (heading) {
51879         selection2.append("h4").attr("class", "measurement-heading").html(heading);
51880       }
51881       var list = selection2.append("ul");
51882       var coordItem;
51883       if (geometry) {
51884         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));
51885       }
51886       if (totalNodeCount) {
51887         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
51888       }
51889       if (area) {
51890         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
51891       }
51892       if (length) {
51893         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
51894       }
51895       if (typeof distance === "number") {
51896         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
51897       }
51898       if (location) {
51899         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
51900         coordItem.append("span").text(dmsCoordinatePair(location));
51901         coordItem.append("span").text(decimalCoordinatePair(location));
51902       }
51903       if (centroid) {
51904         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
51905         coordItem.append("span").text(dmsCoordinatePair(centroid));
51906         coordItem.append("span").text(decimalCoordinatePair(centroid));
51907       }
51908       if (center) {
51909         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
51910         coordItem.append("span").text(dmsCoordinatePair(center));
51911         coordItem.append("span").text(decimalCoordinatePair(center));
51912       }
51913       if (length || area || typeof distance === "number") {
51914         var toggle = _isImperial ? "imperial" : "metric";
51915         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
51916           d3_event.preventDefault();
51917           _isImperial = !_isImperial;
51918           selection2.call(redraw);
51919         });
51920       }
51921     }
51922     var panel = function(selection2) {
51923       selection2.call(redraw);
51924       context.map().on("drawn.info-measurement", function() {
51925         selection2.call(redraw);
51926       });
51927       context.on("enter.info-measurement", function() {
51928         selection2.call(redraw);
51929       });
51930     };
51931     panel.off = function() {
51932       context.map().on("drawn.info-measurement", null);
51933       context.on("enter.info-measurement", null);
51934     };
51935     panel.id = "measurement";
51936     panel.label = _t.html("info_panels.measurement.title");
51937     panel.key = _t("info_panels.measurement.key");
51938     return panel;
51939   }
51940
51941   // modules/ui/panels/index.js
51942   var uiInfoPanels = {
51943     background: uiPanelBackground,
51944     history: uiPanelHistory,
51945     location: uiPanelLocation,
51946     measurement: uiPanelMeasurement
51947   };
51948
51949   // modules/ui/info.js
51950   function uiInfo(context) {
51951     var ids = Object.keys(uiInfoPanels);
51952     var wasActive = ["measurement"];
51953     var panels = {};
51954     var active = {};
51955     ids.forEach(function(k) {
51956       if (!panels[k]) {
51957         panels[k] = uiInfoPanels[k](context);
51958         active[k] = false;
51959       }
51960     });
51961     function info(selection2) {
51962       function redraw() {
51963         var activeids = ids.filter(function(k) {
51964           return active[k];
51965         }).sort();
51966         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
51967           return k;
51968         });
51969         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
51970           select_default2(this).call(panels[d].off).remove();
51971         });
51972         var enter = containers.enter().append("div").attr("class", function(d) {
51973           return "fillD2 panel-container panel-container-" + d;
51974         });
51975         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
51976         var title = enter.append("div").attr("class", "panel-title fillD2");
51977         title.append("h3").html(function(d) {
51978           return panels[d].label;
51979         });
51980         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
51981           d3_event.stopImmediatePropagation();
51982           d3_event.preventDefault();
51983           info.toggle(d);
51984         }).call(svgIcon("#iD-icon-close"));
51985         enter.append("div").attr("class", function(d) {
51986           return "panel-content panel-content-" + d;
51987         });
51988         infoPanels.selectAll(".panel-content").each(function(d) {
51989           select_default2(this).call(panels[d]);
51990         });
51991       }
51992       info.toggle = function(which) {
51993         var activeids = ids.filter(function(k) {
51994           return active[k];
51995         });
51996         if (which) {
51997           active[which] = !active[which];
51998           if (activeids.length === 1 && activeids[0] === which) {
51999             wasActive = [which];
52000           }
52001           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
52002         } else {
52003           if (activeids.length) {
52004             wasActive = activeids;
52005             activeids.forEach(function(k) {
52006               active[k] = false;
52007             });
52008           } else {
52009             wasActive.forEach(function(k) {
52010               active[k] = true;
52011             });
52012           }
52013         }
52014         redraw();
52015       };
52016       var infoPanels = selection2.selectAll(".info-panels").data([0]);
52017       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
52018       redraw();
52019       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
52020         d3_event.stopImmediatePropagation();
52021         d3_event.preventDefault();
52022         info.toggle();
52023       });
52024       ids.forEach(function(k) {
52025         var key = _t("info_panels." + k + ".key", { default: null });
52026         if (!key)
52027           return;
52028         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
52029           d3_event.stopImmediatePropagation();
52030           d3_event.preventDefault();
52031           info.toggle(k);
52032         });
52033       });
52034     }
52035     return info;
52036   }
52037
52038   // modules/ui/intro/helper.js
52039   function pointBox(loc, context) {
52040     var rect = context.surfaceRect();
52041     var point = context.curtainProjection(loc);
52042     return {
52043       left: point[0] + rect.left - 40,
52044       top: point[1] + rect.top - 60,
52045       width: 80,
52046       height: 90
52047     };
52048   }
52049   function pad(locOrBox, padding, context) {
52050     var box;
52051     if (locOrBox instanceof Array) {
52052       var rect = context.surfaceRect();
52053       var point = context.curtainProjection(locOrBox);
52054       box = {
52055         left: point[0] + rect.left,
52056         top: point[1] + rect.top
52057       };
52058     } else {
52059       box = locOrBox;
52060     }
52061     return {
52062       left: box.left - padding,
52063       top: box.top - padding,
52064       width: (box.width || 0) + 2 * padding,
52065       height: (box.width || 0) + 2 * padding
52066     };
52067   }
52068   function icon(name2, svgklass, useklass) {
52069     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name2 + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
52070   }
52071   var helpStringReplacements;
52072   function helpHtml(id2, replacements) {
52073     if (!helpStringReplacements) {
52074       helpStringReplacements = {
52075         point_icon: icon("#iD-icon-point", "inline"),
52076         line_icon: icon("#iD-icon-line", "inline"),
52077         area_icon: icon("#iD-icon-area", "inline"),
52078         note_icon: icon("#iD-icon-note", "inline add-note"),
52079         plus: icon("#iD-icon-plus", "inline"),
52080         minus: icon("#iD-icon-minus", "inline"),
52081         layers_icon: icon("#iD-icon-layers", "inline"),
52082         data_icon: icon("#iD-icon-data", "inline"),
52083         inspect: icon("#iD-icon-inspect", "inline"),
52084         help_icon: icon("#iD-icon-help", "inline"),
52085         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
52086         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
52087         save_icon: icon("#iD-icon-save", "inline"),
52088         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
52089         continue_icon: icon("#iD-operation-continue", "inline operation"),
52090         copy_icon: icon("#iD-operation-copy", "inline operation"),
52091         delete_icon: icon("#iD-operation-delete", "inline operation"),
52092         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
52093         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
52094         extract_icon: icon("#iD-operation-extract", "inline operation"),
52095         merge_icon: icon("#iD-operation-merge", "inline operation"),
52096         move_icon: icon("#iD-operation-move", "inline operation"),
52097         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
52098         paste_icon: icon("#iD-operation-paste", "inline operation"),
52099         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
52100         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
52101         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
52102         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
52103         split_icon: icon("#iD-operation-split", "inline operation"),
52104         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
52105         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
52106         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
52107         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
52108         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
52109         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
52110         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
52111         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
52112         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
52113         shift: uiCmd.display("\u21E7"),
52114         alt: uiCmd.display("\u2325"),
52115         return: uiCmd.display("\u21B5"),
52116         esc: _t.html("shortcuts.key.esc"),
52117         space: _t.html("shortcuts.key.space"),
52118         add_note_key: _t.html("modes.add_note.key"),
52119         help_key: _t.html("help.key"),
52120         shortcuts_key: _t.html("shortcuts.toggle.key"),
52121         save: _t.html("save.title"),
52122         undo: _t.html("undo.title"),
52123         redo: _t.html("redo.title"),
52124         upload: _t.html("commit.save"),
52125         point: _t.html("modes.add_point.title"),
52126         line: _t.html("modes.add_line.title"),
52127         area: _t.html("modes.add_area.title"),
52128         note: _t.html("modes.add_note.label"),
52129         circularize: _t.html("operations.circularize.title"),
52130         continue: _t.html("operations.continue.title"),
52131         copy: _t.html("operations.copy.title"),
52132         delete: _t.html("operations.delete.title"),
52133         disconnect: _t.html("operations.disconnect.title"),
52134         downgrade: _t.html("operations.downgrade.title"),
52135         extract: _t.html("operations.extract.title"),
52136         merge: _t.html("operations.merge.title"),
52137         move: _t.html("operations.move.title"),
52138         orthogonalize: _t.html("operations.orthogonalize.title"),
52139         paste: _t.html("operations.paste.title"),
52140         reflect_long: _t.html("operations.reflect.title.long"),
52141         reflect_short: _t.html("operations.reflect.title.short"),
52142         reverse: _t.html("operations.reverse.title"),
52143         rotate: _t.html("operations.rotate.title"),
52144         split: _t.html("operations.split.title"),
52145         straighten: _t.html("operations.straighten.title"),
52146         map_data: _t.html("map_data.title"),
52147         osm_notes: _t.html("map_data.layers.notes.title"),
52148         fields: _t.html("inspector.fields"),
52149         tags: _t.html("inspector.tags"),
52150         relations: _t.html("inspector.relations"),
52151         new_relation: _t.html("inspector.new_relation"),
52152         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
52153         background_settings: _t.html("background.description"),
52154         imagery_offset: _t.html("background.fix_misalignment"),
52155         start_the_walkthrough: _t.html("splash.walkthrough"),
52156         help: _t.html("help.title"),
52157         ok: _t.html("intro.ok")
52158       };
52159       for (var key in helpStringReplacements) {
52160         helpStringReplacements[key] = { html: helpStringReplacements[key] };
52161       }
52162     }
52163     var reps;
52164     if (replacements) {
52165       reps = Object.assign(replacements, helpStringReplacements);
52166     } else {
52167       reps = helpStringReplacements;
52168     }
52169     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
52170   }
52171   function slugify(text2) {
52172     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
52173   }
52174   var missingStrings = {};
52175   function checkKey(key, text2) {
52176     if (_t(key, { default: void 0 }) === void 0) {
52177       if (missingStrings.hasOwnProperty(key))
52178         return;
52179       missingStrings[key] = text2;
52180       var missing = key + ": " + text2;
52181       if (typeof console !== "undefined")
52182         console.log(missing);
52183     }
52184   }
52185   function localize(obj) {
52186     var key;
52187     var name2 = obj.tags && obj.tags.name;
52188     if (name2) {
52189       key = "intro.graph.name." + slugify(name2);
52190       obj.tags.name = _t(key, { default: name2 });
52191       checkKey(key, name2);
52192     }
52193     var street = obj.tags && obj.tags["addr:street"];
52194     if (street) {
52195       key = "intro.graph.name." + slugify(street);
52196       obj.tags["addr:street"] = _t(key, { default: street });
52197       checkKey(key, street);
52198       var addrTags = [
52199         "block_number",
52200         "city",
52201         "county",
52202         "district",
52203         "hamlet",
52204         "neighbourhood",
52205         "postcode",
52206         "province",
52207         "quarter",
52208         "state",
52209         "subdistrict",
52210         "suburb"
52211       ];
52212       addrTags.forEach(function(k) {
52213         var key2 = "intro.graph." + k;
52214         var tag = "addr:" + k;
52215         var val = obj.tags && obj.tags[tag];
52216         var str2 = _t(key2, { default: val });
52217         if (str2) {
52218           if (str2.match(/^<.*>$/) !== null) {
52219             delete obj.tags[tag];
52220           } else {
52221             obj.tags[tag] = str2;
52222           }
52223         }
52224       });
52225     }
52226     return obj;
52227   }
52228   function isMostlySquare(points) {
52229     var threshold = 15;
52230     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
52231     var upperBound = Math.cos(threshold * Math.PI / 180);
52232     for (var i2 = 0; i2 < points.length; i2++) {
52233       var a = points[(i2 - 1 + points.length) % points.length];
52234       var origin = points[i2];
52235       var b = points[(i2 + 1) % points.length];
52236       var dotp = geoVecNormalizedDot(a, b, origin);
52237       var mag = Math.abs(dotp);
52238       if (mag > lowerBound && mag < upperBound) {
52239         return false;
52240       }
52241     }
52242     return true;
52243   }
52244   function selectMenuItem(context, operation) {
52245     return context.container().select(".edit-menu .edit-menu-item-" + operation);
52246   }
52247   function transitionTime(point1, point2) {
52248     var distance = geoSphericalDistance(point1, point2);
52249     if (distance === 0) {
52250       return 0;
52251     } else if (distance < 80) {
52252       return 500;
52253     } else {
52254       return 1e3;
52255     }
52256   }
52257
52258   // modules/ui/toggle.js
52259   function uiToggle(show, callback) {
52260     return function(selection2) {
52261       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
52262         select_default2(this).classed("hide", !show).style("opacity", null);
52263         if (callback)
52264           callback.apply(this);
52265       });
52266     };
52267   }
52268
52269   // modules/ui/curtain.js
52270   function uiCurtain(containerNode) {
52271     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
52272     function curtain(selection2) {
52273       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
52274       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
52275       select_default2(window).on("resize.curtain", resize);
52276       tooltip = selection2.append("div").attr("class", "tooltip");
52277       tooltip.append("div").attr("class", "popover-arrow");
52278       tooltip.append("div").attr("class", "popover-inner");
52279       resize();
52280       function resize() {
52281         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
52282         curtain.cut(darkness.datum());
52283       }
52284     }
52285     curtain.reveal = function(box, html2, options2) {
52286       options2 = options2 || {};
52287       if (typeof box === "string") {
52288         box = select_default2(box).node();
52289       }
52290       if (box && box.getBoundingClientRect) {
52291         box = copyBox(box.getBoundingClientRect());
52292         var containerRect = containerNode.getBoundingClientRect();
52293         box.top -= containerRect.top;
52294         box.left -= containerRect.left;
52295       }
52296       if (box && options2.padding) {
52297         box.top -= options2.padding;
52298         box.left -= options2.padding;
52299         box.bottom += options2.padding;
52300         box.right += options2.padding;
52301         box.height += options2.padding * 2;
52302         box.width += options2.padding * 2;
52303       }
52304       var tooltipBox;
52305       if (options2.tooltipBox) {
52306         tooltipBox = options2.tooltipBox;
52307         if (typeof tooltipBox === "string") {
52308           tooltipBox = select_default2(tooltipBox).node();
52309         }
52310         if (tooltipBox && tooltipBox.getBoundingClientRect) {
52311           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
52312         }
52313       } else {
52314         tooltipBox = box;
52315       }
52316       if (tooltipBox && html2) {
52317         if (html2.indexOf("**") !== -1) {
52318           if (html2.indexOf("<span") === 0) {
52319             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
52320           } else {
52321             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
52322           }
52323           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
52324         }
52325         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
52326         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
52327         if (options2.buttonText && options2.buttonCallback) {
52328           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
52329         }
52330         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
52331         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
52332         if (options2.buttonText && options2.buttonCallback) {
52333           var button = tooltip.selectAll(".button-section .button.action");
52334           button.on("click", function(d3_event) {
52335             d3_event.preventDefault();
52336             options2.buttonCallback();
52337           });
52338         }
52339         var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
52340         if (options2.tooltipClass === "intro-mouse") {
52341           tip.height += 80;
52342         }
52343         if (tooltipBox.top + tooltipBox.height > h) {
52344           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
52345         }
52346         if (tooltipBox.left + tooltipBox.width > w) {
52347           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
52348         }
52349         if (tooltipBox.top + tooltipBox.height < 100) {
52350           side = "bottom";
52351           pos = [
52352             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52353             tooltipBox.top + tooltipBox.height
52354           ];
52355         } else if (tooltipBox.top > h - 140) {
52356           side = "top";
52357           pos = [
52358             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52359             tooltipBox.top - tip.height
52360           ];
52361         } else {
52362           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
52363           if (_mainLocalizer.textDirection() === "rtl") {
52364             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
52365               side = "right";
52366               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52367             } else {
52368               side = "left";
52369               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52370             }
52371           } else {
52372             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
52373               side = "left";
52374               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52375             } else {
52376               side = "right";
52377               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52378             }
52379           }
52380         }
52381         if (options2.duration !== 0 || !tooltip.classed(side)) {
52382           tooltip.call(uiToggle(true));
52383         }
52384         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
52385         var shiftY = 0;
52386         if (side === "left" || side === "right") {
52387           if (pos[1] < 60) {
52388             shiftY = 60 - pos[1];
52389           } else if (pos[1] + tip.height > h - 100) {
52390             shiftY = h - pos[1] - tip.height - 100;
52391           }
52392         }
52393         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
52394       } else {
52395         tooltip.classed("in", false).call(uiToggle(false));
52396       }
52397       curtain.cut(box, options2.duration);
52398       return tooltip;
52399     };
52400     curtain.cut = function(datum2, duration) {
52401       darkness.datum(datum2).interrupt();
52402       var selection2;
52403       if (duration === 0) {
52404         selection2 = darkness;
52405       } else {
52406         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
52407       }
52408       selection2.attr("d", function(d) {
52409         var containerWidth = containerNode.clientWidth;
52410         var containerHeight = containerNode.clientHeight;
52411         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
52412         if (!d)
52413           return string;
52414         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";
52415       });
52416     };
52417     curtain.remove = function() {
52418       surface.remove();
52419       tooltip.remove();
52420       select_default2(window).on("resize.curtain", null);
52421     };
52422     function copyBox(src) {
52423       return {
52424         top: src.top,
52425         right: src.right,
52426         bottom: src.bottom,
52427         left: src.left,
52428         width: src.width,
52429         height: src.height
52430       };
52431     }
52432     return curtain;
52433   }
52434
52435   // modules/ui/intro/welcome.js
52436   function uiIntroWelcome(context, reveal) {
52437     var dispatch10 = dispatch_default("done");
52438     var chapter = {
52439       title: "intro.welcome.title"
52440     };
52441     function welcome() {
52442       context.map().centerZoom([-85.63591, 41.94285], 19);
52443       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.welcome"), { buttonText: _t.html("intro.ok"), buttonCallback: practice });
52444     }
52445     function practice() {
52446       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.practice"), { buttonText: _t.html("intro.ok"), buttonCallback: words });
52447     }
52448     function words() {
52449       reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.words"), { buttonText: _t.html("intro.ok"), buttonCallback: chapters });
52450     }
52451     function chapters() {
52452       dispatch10.call("done");
52453       reveal(".intro-nav-wrap .chapter-navigation", helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") }));
52454     }
52455     chapter.enter = function() {
52456       welcome();
52457     };
52458     chapter.exit = function() {
52459       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
52460     };
52461     chapter.restart = function() {
52462       chapter.exit();
52463       chapter.enter();
52464     };
52465     return utilRebind(chapter, dispatch10, "on");
52466   }
52467
52468   // modules/ui/intro/navigation.js
52469   function uiIntroNavigation(context, reveal) {
52470     var dispatch10 = dispatch_default("done");
52471     var timeouts = [];
52472     var hallId = "n2061";
52473     var townHall = [-85.63591, 41.94285];
52474     var springStreetId = "w397";
52475     var springStreetEndId = "n1834";
52476     var springStreet = [-85.63582, 41.94255];
52477     var onewayField = _mainPresetIndex.field("oneway");
52478     var maxspeedField = _mainPresetIndex.field("maxspeed");
52479     var chapter = {
52480       title: "intro.navigation.title"
52481     };
52482     function timeout2(f2, t) {
52483       timeouts.push(window.setTimeout(f2, t));
52484     }
52485     function eventCancel(d3_event) {
52486       d3_event.stopPropagation();
52487       d3_event.preventDefault();
52488     }
52489     function isTownHallSelected() {
52490       var ids = context.selectedIDs();
52491       return ids.length === 1 && ids[0] === hallId;
52492     }
52493     function dragMap() {
52494       context.enter(modeBrowse(context));
52495       context.history().reset("initial");
52496       var msec = transitionTime(townHall, context.map().center());
52497       if (msec) {
52498         reveal(null, null, { duration: 0 });
52499       }
52500       context.map().centerZoomEase(townHall, 19, msec);
52501       timeout2(function() {
52502         var centerStart = context.map().center();
52503         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
52504         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
52505         reveal(".surface", dragString);
52506         context.map().on("drawn.intro", function() {
52507           reveal(".surface", dragString, { duration: 0 });
52508         });
52509         context.map().on("move.intro", function() {
52510           var centerNow = context.map().center();
52511           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
52512             context.map().on("move.intro", null);
52513             timeout2(function() {
52514               continueTo(zoomMap);
52515             }, 3e3);
52516           }
52517         });
52518       }, msec + 100);
52519       function continueTo(nextStep) {
52520         context.map().on("move.intro drawn.intro", null);
52521         nextStep();
52522       }
52523     }
52524     function zoomMap() {
52525       var zoomStart = context.map().zoom();
52526       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
52527       var zoomString = helpHtml("intro.navigation." + textId);
52528       reveal(".surface", zoomString);
52529       context.map().on("drawn.intro", function() {
52530         reveal(".surface", zoomString, { duration: 0 });
52531       });
52532       context.map().on("move.intro", function() {
52533         if (context.map().zoom() !== zoomStart) {
52534           context.map().on("move.intro", null);
52535           timeout2(function() {
52536             continueTo(features2);
52537           }, 3e3);
52538         }
52539       });
52540       function continueTo(nextStep) {
52541         context.map().on("move.intro drawn.intro", null);
52542         nextStep();
52543       }
52544     }
52545     function features2() {
52546       var onClick = function() {
52547         continueTo(pointsLinesAreas);
52548       };
52549       reveal(".surface", helpHtml("intro.navigation.features"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52550       context.map().on("drawn.intro", function() {
52551         reveal(".surface", helpHtml("intro.navigation.features"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52552       });
52553       function continueTo(nextStep) {
52554         context.map().on("drawn.intro", null);
52555         nextStep();
52556       }
52557     }
52558     function pointsLinesAreas() {
52559       var onClick = function() {
52560         continueTo(nodesWays);
52561       };
52562       reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52563       context.map().on("drawn.intro", function() {
52564         reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52565       });
52566       function continueTo(nextStep) {
52567         context.map().on("drawn.intro", null);
52568         nextStep();
52569       }
52570     }
52571     function nodesWays() {
52572       var onClick = function() {
52573         continueTo(clickTownHall);
52574       };
52575       reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52576       context.map().on("drawn.intro", function() {
52577         reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52578       });
52579       function continueTo(nextStep) {
52580         context.map().on("drawn.intro", null);
52581         nextStep();
52582       }
52583     }
52584     function clickTownHall() {
52585       context.enter(modeBrowse(context));
52586       context.history().reset("initial");
52587       var entity = context.hasEntity(hallId);
52588       if (!entity)
52589         return;
52590       reveal(null, null, { duration: 0 });
52591       context.map().centerZoomEase(entity.loc, 19, 500);
52592       timeout2(function() {
52593         var entity2 = context.hasEntity(hallId);
52594         if (!entity2)
52595           return;
52596         var box = pointBox(entity2.loc, context);
52597         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
52598         reveal(box, helpHtml("intro.navigation." + textId));
52599         context.map().on("move.intro drawn.intro", function() {
52600           var entity3 = context.hasEntity(hallId);
52601           if (!entity3)
52602             return;
52603           var box2 = pointBox(entity3.loc, context);
52604           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
52605         });
52606         context.on("enter.intro", function() {
52607           if (isTownHallSelected())
52608             continueTo(selectedTownHall);
52609         });
52610       }, 550);
52611       context.history().on("change.intro", function() {
52612         if (!context.hasEntity(hallId)) {
52613           continueTo(clickTownHall);
52614         }
52615       });
52616       function continueTo(nextStep) {
52617         context.on("enter.intro", null);
52618         context.map().on("move.intro drawn.intro", null);
52619         context.history().on("change.intro", null);
52620         nextStep();
52621       }
52622     }
52623     function selectedTownHall() {
52624       if (!isTownHallSelected())
52625         return clickTownHall();
52626       var entity = context.hasEntity(hallId);
52627       if (!entity)
52628         return clickTownHall();
52629       var box = pointBox(entity.loc, context);
52630       var onClick = function() {
52631         continueTo(editorTownHall);
52632       };
52633       reveal(box, helpHtml("intro.navigation.selected_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52634       context.map().on("move.intro drawn.intro", function() {
52635         var entity2 = context.hasEntity(hallId);
52636         if (!entity2)
52637           return;
52638         var box2 = pointBox(entity2.loc, context);
52639         reveal(box2, helpHtml("intro.navigation.selected_townhall"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52640       });
52641       context.history().on("change.intro", function() {
52642         if (!context.hasEntity(hallId)) {
52643           continueTo(clickTownHall);
52644         }
52645       });
52646       function continueTo(nextStep) {
52647         context.map().on("move.intro drawn.intro", null);
52648         context.history().on("change.intro", null);
52649         nextStep();
52650       }
52651     }
52652     function editorTownHall() {
52653       if (!isTownHallSelected())
52654         return clickTownHall();
52655       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52656       var onClick = function() {
52657         continueTo(presetTownHall);
52658       };
52659       reveal(".entity-editor-pane", helpHtml("intro.navigation.editor_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52660       context.on("exit.intro", function() {
52661         continueTo(clickTownHall);
52662       });
52663       context.history().on("change.intro", function() {
52664         if (!context.hasEntity(hallId)) {
52665           continueTo(clickTownHall);
52666         }
52667       });
52668       function continueTo(nextStep) {
52669         context.on("exit.intro", null);
52670         context.history().on("change.intro", null);
52671         context.container().select(".inspector-wrap").on("wheel.intro", null);
52672         nextStep();
52673       }
52674     }
52675     function presetTownHall() {
52676       if (!isTownHallSelected())
52677         return clickTownHall();
52678       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
52679       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52680       var entity = context.entity(context.selectedIDs()[0]);
52681       var preset = _mainPresetIndex.match(entity, context.graph());
52682       var onClick = function() {
52683         continueTo(fieldsTownHall);
52684       };
52685       reveal(".entity-editor-pane .section-feature-type", helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52686       context.on("exit.intro", function() {
52687         continueTo(clickTownHall);
52688       });
52689       context.history().on("change.intro", function() {
52690         if (!context.hasEntity(hallId)) {
52691           continueTo(clickTownHall);
52692         }
52693       });
52694       function continueTo(nextStep) {
52695         context.on("exit.intro", null);
52696         context.history().on("change.intro", null);
52697         context.container().select(".inspector-wrap").on("wheel.intro", null);
52698         nextStep();
52699       }
52700     }
52701     function fieldsTownHall() {
52702       if (!isTownHallSelected())
52703         return clickTownHall();
52704       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
52705       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52706       var onClick = function() {
52707         continueTo(closeTownHall);
52708       };
52709       reveal(".entity-editor-pane .section-preset-fields", helpHtml("intro.navigation.fields_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52710       context.on("exit.intro", function() {
52711         continueTo(clickTownHall);
52712       });
52713       context.history().on("change.intro", function() {
52714         if (!context.hasEntity(hallId)) {
52715           continueTo(clickTownHall);
52716         }
52717       });
52718       function continueTo(nextStep) {
52719         context.on("exit.intro", null);
52720         context.history().on("change.intro", null);
52721         context.container().select(".inspector-wrap").on("wheel.intro", null);
52722         nextStep();
52723       }
52724     }
52725     function closeTownHall() {
52726       if (!isTownHallSelected())
52727         return clickTownHall();
52728       var selector = ".entity-editor-pane button.close svg use";
52729       var href = select_default2(selector).attr("href") || "#iD-icon-close";
52730       reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } }));
52731       context.on("exit.intro", function() {
52732         continueTo(searchStreet);
52733       });
52734       context.history().on("change.intro", function() {
52735         var selector2 = ".entity-editor-pane button.close svg use";
52736         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
52737         reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }), { duration: 0 });
52738       });
52739       function continueTo(nextStep) {
52740         context.on("exit.intro", null);
52741         context.history().on("change.intro", null);
52742         nextStep();
52743       }
52744     }
52745     function searchStreet() {
52746       context.enter(modeBrowse(context));
52747       context.history().reset("initial");
52748       var msec = transitionTime(springStreet, context.map().center());
52749       if (msec) {
52750         reveal(null, null, { duration: 0 });
52751       }
52752       context.map().centerZoomEase(springStreet, 19, msec);
52753       timeout2(function() {
52754         reveal(".search-header input", helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") }));
52755         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
52756       }, msec + 100);
52757     }
52758     function checkSearchResult() {
52759       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
52760       var firstName = first.select(".entity-name");
52761       var name2 = _t("intro.graph.name.spring-street");
52762       if (!firstName.empty() && firstName.html() === name2) {
52763         reveal(first.node(), helpHtml("intro.navigation.choose_street", { name: name2 }), { duration: 300 });
52764         context.on("exit.intro", function() {
52765           continueTo(selectedStreet);
52766         });
52767         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
52768       }
52769       function continueTo(nextStep) {
52770         context.on("exit.intro", null);
52771         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
52772         nextStep();
52773       }
52774     }
52775     function selectedStreet() {
52776       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
52777         return searchStreet();
52778       }
52779       var onClick = function() {
52780         continueTo(editorStreet);
52781       };
52782       var entity = context.entity(springStreetEndId);
52783       var box = pointBox(entity.loc, context);
52784       box.height = 500;
52785       reveal(box, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52786       timeout2(function() {
52787         context.map().on("move.intro drawn.intro", function() {
52788           var entity2 = context.hasEntity(springStreetEndId);
52789           if (!entity2)
52790             return;
52791           var box2 = pointBox(entity2.loc, context);
52792           box2.height = 500;
52793           reveal(box2, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
52794         });
52795       }, 600);
52796       context.on("enter.intro", function(mode) {
52797         if (!context.hasEntity(springStreetId)) {
52798           return continueTo(searchStreet);
52799         }
52800         var ids = context.selectedIDs();
52801         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
52802           context.enter(modeSelect(context, [springStreetId]));
52803         }
52804       });
52805       context.history().on("change.intro", function() {
52806         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
52807           timeout2(function() {
52808             continueTo(searchStreet);
52809           }, 300);
52810         }
52811       });
52812       function continueTo(nextStep) {
52813         context.map().on("move.intro drawn.intro", null);
52814         context.on("enter.intro", null);
52815         context.history().on("change.intro", null);
52816         nextStep();
52817       }
52818     }
52819     function editorStreet() {
52820       var selector = ".entity-editor-pane button.close svg use";
52821       var href = select_default2(selector).attr("href") || "#iD-icon-close";
52822       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
52823         button: { html: icon(href, "inline") },
52824         field1: { html: onewayField.label() },
52825         field2: { html: maxspeedField.label() }
52826       }));
52827       context.on("exit.intro", function() {
52828         continueTo(play);
52829       });
52830       context.history().on("change.intro", function() {
52831         var selector2 = ".entity-editor-pane button.close svg use";
52832         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
52833         reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
52834           button: { html: icon(href2, "inline") },
52835           field1: { html: onewayField.label() },
52836           field2: { html: maxspeedField.label() }
52837         }), { duration: 0 });
52838       });
52839       function continueTo(nextStep) {
52840         context.on("exit.intro", null);
52841         context.history().on("change.intro", null);
52842         nextStep();
52843       }
52844     }
52845     function play() {
52846       dispatch10.call("done");
52847       reveal(".ideditor", helpHtml("intro.navigation.play", { next: _t("intro.points.title") }), {
52848         tooltipBox: ".intro-nav-wrap .chapter-point",
52849         buttonText: _t.html("intro.ok"),
52850         buttonCallback: function() {
52851           reveal(".ideditor");
52852         }
52853       });
52854     }
52855     chapter.enter = function() {
52856       dragMap();
52857     };
52858     chapter.exit = function() {
52859       timeouts.forEach(window.clearTimeout);
52860       context.on("enter.intro exit.intro", null);
52861       context.map().on("move.intro drawn.intro", null);
52862       context.history().on("change.intro", null);
52863       context.container().select(".inspector-wrap").on("wheel.intro", null);
52864       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
52865     };
52866     chapter.restart = function() {
52867       chapter.exit();
52868       chapter.enter();
52869     };
52870     return utilRebind(chapter, dispatch10, "on");
52871   }
52872
52873   // modules/ui/intro/point.js
52874   function uiIntroPoint(context, reveal) {
52875     var dispatch10 = dispatch_default("done");
52876     var timeouts = [];
52877     var intersection = [-85.63279, 41.94394];
52878     var building = [-85.632422, 41.944045];
52879     var cafePreset = _mainPresetIndex.item("amenity/cafe");
52880     var _pointID = null;
52881     var chapter = {
52882       title: "intro.points.title"
52883     };
52884     function timeout2(f2, t) {
52885       timeouts.push(window.setTimeout(f2, t));
52886     }
52887     function eventCancel(d3_event) {
52888       d3_event.stopPropagation();
52889       d3_event.preventDefault();
52890     }
52891     function addPoint() {
52892       context.enter(modeBrowse(context));
52893       context.history().reset("initial");
52894       var msec = transitionTime(intersection, context.map().center());
52895       if (msec) {
52896         reveal(null, null, { duration: 0 });
52897       }
52898       context.map().centerZoomEase(intersection, 19, msec);
52899       timeout2(function() {
52900         var tooltip = reveal("button.add-point", helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point"));
52901         _pointID = null;
52902         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
52903         context.on("enter.intro", function(mode) {
52904           if (mode.id !== "add-point")
52905             return;
52906           continueTo(placePoint);
52907         });
52908       }, msec + 100);
52909       function continueTo(nextStep) {
52910         context.on("enter.intro", null);
52911         nextStep();
52912       }
52913     }
52914     function placePoint() {
52915       if (context.mode().id !== "add-point") {
52916         return chapter.restart();
52917       }
52918       var pointBox2 = pad(building, 150, context);
52919       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
52920       reveal(pointBox2, helpHtml("intro.points." + textId));
52921       context.map().on("move.intro drawn.intro", function() {
52922         pointBox2 = pad(building, 150, context);
52923         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
52924       });
52925       context.on("enter.intro", function(mode) {
52926         if (mode.id !== "select")
52927           return chapter.restart();
52928         _pointID = context.mode().selectedIDs()[0];
52929         continueTo(searchPreset);
52930       });
52931       function continueTo(nextStep) {
52932         context.map().on("move.intro drawn.intro", null);
52933         context.on("enter.intro", null);
52934         nextStep();
52935       }
52936     }
52937     function searchPreset() {
52938       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
52939         return addPoint();
52940       }
52941       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52942       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
52943       reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
52944       context.on("enter.intro", function(mode) {
52945         if (!_pointID || !context.hasEntity(_pointID)) {
52946           return continueTo(addPoint);
52947         }
52948         var ids = context.selectedIDs();
52949         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
52950           context.enter(modeSelect(context, [_pointID]));
52951           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
52952           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
52953           reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
52954           context.history().on("change.intro", null);
52955         }
52956       });
52957       function checkPresetSearch() {
52958         var first = context.container().select(".preset-list-item:first-child");
52959         if (first.classed("preset-amenity-cafe")) {
52960           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
52961           reveal(first.select(".preset-list-button").node(), helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }), { duration: 300 });
52962           context.history().on("change.intro", function() {
52963             continueTo(aboutFeatureEditor);
52964           });
52965         }
52966       }
52967       function continueTo(nextStep) {
52968         context.on("enter.intro", null);
52969         context.history().on("change.intro", null);
52970         context.container().select(".inspector-wrap").on("wheel.intro", null);
52971         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
52972         nextStep();
52973       }
52974     }
52975     function aboutFeatureEditor() {
52976       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
52977         return addPoint();
52978       }
52979       timeout2(function() {
52980         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
52981           tooltipClass: "intro-points-describe",
52982           buttonText: _t.html("intro.ok"),
52983           buttonCallback: function() {
52984             continueTo(addName);
52985           }
52986         });
52987       }, 400);
52988       context.on("exit.intro", function() {
52989         continueTo(reselectPoint);
52990       });
52991       function continueTo(nextStep) {
52992         context.on("exit.intro", null);
52993         nextStep();
52994       }
52995     }
52996     function addName() {
52997       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
52998         return addPoint();
52999       }
53000       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53001       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
53002       timeout2(function() {
53003         var entity = context.entity(_pointID);
53004         if (entity.tags.name) {
53005           var tooltip = reveal(".entity-editor-pane", addNameString, {
53006             tooltipClass: "intro-points-describe",
53007             buttonText: _t.html("intro.ok"),
53008             buttonCallback: function() {
53009               continueTo(addCloseEditor);
53010             }
53011           });
53012           tooltip.select(".instruction").style("display", "none");
53013         } else {
53014           reveal(".entity-editor-pane", addNameString, { tooltipClass: "intro-points-describe" });
53015         }
53016       }, 400);
53017       context.history().on("change.intro", function() {
53018         continueTo(addCloseEditor);
53019       });
53020       context.on("exit.intro", function() {
53021         continueTo(reselectPoint);
53022       });
53023       function continueTo(nextStep) {
53024         context.on("exit.intro", null);
53025         context.history().on("change.intro", null);
53026         nextStep();
53027       }
53028     }
53029     function addCloseEditor() {
53030       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53031       var selector = ".entity-editor-pane button.close svg use";
53032       var href = select_default2(selector).attr("href") || "#iD-icon-close";
53033       context.on("exit.intro", function() {
53034         continueTo(reselectPoint);
53035       });
53036       reveal(".entity-editor-pane", helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } }));
53037       function continueTo(nextStep) {
53038         context.on("exit.intro", null);
53039         nextStep();
53040       }
53041     }
53042     function reselectPoint() {
53043       if (!_pointID)
53044         return chapter.restart();
53045       var entity = context.hasEntity(_pointID);
53046       if (!entity)
53047         return chapter.restart();
53048       var oldPreset = _mainPresetIndex.match(entity, context.graph());
53049       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
53050       context.enter(modeBrowse(context));
53051       var msec = transitionTime(entity.loc, context.map().center());
53052       if (msec) {
53053         reveal(null, null, { duration: 0 });
53054       }
53055       context.map().centerEase(entity.loc, msec);
53056       timeout2(function() {
53057         var box = pointBox(entity.loc, context);
53058         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
53059         timeout2(function() {
53060           context.map().on("move.intro drawn.intro", function() {
53061             var entity2 = context.hasEntity(_pointID);
53062             if (!entity2)
53063               return chapter.restart();
53064             var box2 = pointBox(entity2.loc, context);
53065             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
53066           });
53067         }, 600);
53068         context.on("enter.intro", function(mode) {
53069           if (mode.id !== "select")
53070             return;
53071           continueTo(updatePoint);
53072         });
53073       }, msec + 100);
53074       function continueTo(nextStep) {
53075         context.map().on("move.intro drawn.intro", null);
53076         context.on("enter.intro", null);
53077         nextStep();
53078       }
53079     }
53080     function updatePoint() {
53081       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53082         return continueTo(reselectPoint);
53083       }
53084       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53085       context.on("exit.intro", function() {
53086         continueTo(reselectPoint);
53087       });
53088       context.history().on("change.intro", function() {
53089         continueTo(updateCloseEditor);
53090       });
53091       timeout2(function() {
53092         reveal(".entity-editor-pane", helpHtml("intro.points.update"), { tooltipClass: "intro-points-describe" });
53093       }, 400);
53094       function continueTo(nextStep) {
53095         context.on("exit.intro", null);
53096         context.history().on("change.intro", null);
53097         nextStep();
53098       }
53099     }
53100     function updateCloseEditor() {
53101       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53102         return continueTo(reselectPoint);
53103       }
53104       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53105       context.on("exit.intro", function() {
53106         continueTo(rightClickPoint);
53107       });
53108       timeout2(function() {
53109         reveal(".entity-editor-pane", helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } }));
53110       }, 500);
53111       function continueTo(nextStep) {
53112         context.on("exit.intro", null);
53113         nextStep();
53114       }
53115     }
53116     function rightClickPoint() {
53117       if (!_pointID)
53118         return chapter.restart();
53119       var entity = context.hasEntity(_pointID);
53120       if (!entity)
53121         return chapter.restart();
53122       context.enter(modeBrowse(context));
53123       var box = pointBox(entity.loc, context);
53124       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
53125       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
53126       timeout2(function() {
53127         context.map().on("move.intro", function() {
53128           var entity2 = context.hasEntity(_pointID);
53129           if (!entity2)
53130             return chapter.restart();
53131           var box2 = pointBox(entity2.loc, context);
53132           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
53133         });
53134       }, 600);
53135       context.on("enter.intro", function(mode) {
53136         if (mode.id !== "select")
53137           return;
53138         var ids = context.selectedIDs();
53139         if (ids.length !== 1 || ids[0] !== _pointID)
53140           return;
53141         timeout2(function() {
53142           var node = selectMenuItem(context, "delete").node();
53143           if (!node)
53144             return;
53145           continueTo(enterDelete);
53146         }, 50);
53147       });
53148       function continueTo(nextStep) {
53149         context.on("enter.intro", null);
53150         context.map().on("move.intro", null);
53151         nextStep();
53152       }
53153     }
53154     function enterDelete() {
53155       if (!_pointID)
53156         return chapter.restart();
53157       var entity = context.hasEntity(_pointID);
53158       if (!entity)
53159         return chapter.restart();
53160       var node = selectMenuItem(context, "delete").node();
53161       if (!node) {
53162         return continueTo(rightClickPoint);
53163       }
53164       reveal(".edit-menu", helpHtml("intro.points.delete"), { padding: 50 });
53165       timeout2(function() {
53166         context.map().on("move.intro", function() {
53167           reveal(".edit-menu", helpHtml("intro.points.delete"), { duration: 0, padding: 50 });
53168         });
53169       }, 300);
53170       context.on("exit.intro", function() {
53171         if (!_pointID)
53172           return chapter.restart();
53173         var entity2 = context.hasEntity(_pointID);
53174         if (entity2)
53175           return continueTo(rightClickPoint);
53176       });
53177       context.history().on("change.intro", function(changed) {
53178         if (changed.deleted().length) {
53179           continueTo(undo);
53180         }
53181       });
53182       function continueTo(nextStep) {
53183         context.map().on("move.intro", null);
53184         context.history().on("change.intro", null);
53185         context.on("exit.intro", null);
53186         nextStep();
53187       }
53188     }
53189     function undo() {
53190       context.history().on("change.intro", function() {
53191         continueTo(play);
53192       });
53193       reveal(".top-toolbar button.undo-button", helpHtml("intro.points.undo"));
53194       function continueTo(nextStep) {
53195         context.history().on("change.intro", null);
53196         nextStep();
53197       }
53198     }
53199     function play() {
53200       dispatch10.call("done");
53201       reveal(".ideditor", helpHtml("intro.points.play", { next: _t("intro.areas.title") }), {
53202         tooltipBox: ".intro-nav-wrap .chapter-area",
53203         buttonText: _t.html("intro.ok"),
53204         buttonCallback: function() {
53205           reveal(".ideditor");
53206         }
53207       });
53208     }
53209     chapter.enter = function() {
53210       addPoint();
53211     };
53212     chapter.exit = function() {
53213       timeouts.forEach(window.clearTimeout);
53214       context.on("enter.intro exit.intro", null);
53215       context.map().on("move.intro drawn.intro", null);
53216       context.history().on("change.intro", null);
53217       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53218       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53219     };
53220     chapter.restart = function() {
53221       chapter.exit();
53222       chapter.enter();
53223     };
53224     return utilRebind(chapter, dispatch10, "on");
53225   }
53226
53227   // modules/ui/intro/area.js
53228   function uiIntroArea(context, reveal) {
53229     var dispatch10 = dispatch_default("done");
53230     var playground = [-85.63552, 41.94159];
53231     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
53232     var nameField = _mainPresetIndex.field("name");
53233     var descriptionField = _mainPresetIndex.field("description");
53234     var timeouts = [];
53235     var _areaID;
53236     var chapter = {
53237       title: "intro.areas.title"
53238     };
53239     function timeout2(f2, t) {
53240       timeouts.push(window.setTimeout(f2, t));
53241     }
53242     function eventCancel(d3_event) {
53243       d3_event.stopPropagation();
53244       d3_event.preventDefault();
53245     }
53246     function revealPlayground(center, text2, options2) {
53247       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
53248       var box = pad(center, padding, context);
53249       reveal(box, text2, options2);
53250     }
53251     function addArea() {
53252       context.enter(modeBrowse(context));
53253       context.history().reset("initial");
53254       _areaID = null;
53255       var msec = transitionTime(playground, context.map().center());
53256       if (msec) {
53257         reveal(null, null, { duration: 0 });
53258       }
53259       context.map().centerZoomEase(playground, 19, msec);
53260       timeout2(function() {
53261         var tooltip = reveal("button.add-area", helpHtml("intro.areas.add_playground"));
53262         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
53263         context.on("enter.intro", function(mode) {
53264           if (mode.id !== "add-area")
53265             return;
53266           continueTo(startPlayground);
53267         });
53268       }, msec + 100);
53269       function continueTo(nextStep) {
53270         context.on("enter.intro", null);
53271         nextStep();
53272       }
53273     }
53274     function startPlayground() {
53275       if (context.mode().id !== "add-area") {
53276         return chapter.restart();
53277       }
53278       _areaID = null;
53279       context.map().zoomEase(19.5, 500);
53280       timeout2(function() {
53281         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
53282         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
53283         revealPlayground(playground, startDrawString, { duration: 250 });
53284         timeout2(function() {
53285           context.map().on("move.intro drawn.intro", function() {
53286             revealPlayground(playground, startDrawString, { duration: 0 });
53287           });
53288           context.on("enter.intro", function(mode) {
53289             if (mode.id !== "draw-area")
53290               return chapter.restart();
53291             continueTo(continuePlayground);
53292           });
53293         }, 250);
53294       }, 550);
53295       function continueTo(nextStep) {
53296         context.map().on("move.intro drawn.intro", null);
53297         context.on("enter.intro", null);
53298         nextStep();
53299       }
53300     }
53301     function continuePlayground() {
53302       if (context.mode().id !== "draw-area") {
53303         return chapter.restart();
53304       }
53305       _areaID = null;
53306       revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 250 });
53307       timeout2(function() {
53308         context.map().on("move.intro drawn.intro", function() {
53309           revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 0 });
53310         });
53311       }, 250);
53312       context.on("enter.intro", function(mode) {
53313         if (mode.id === "draw-area") {
53314           var entity = context.hasEntity(context.selectedIDs()[0]);
53315           if (entity && entity.nodes.length >= 6) {
53316             return continueTo(finishPlayground);
53317           } else {
53318             return;
53319           }
53320         } else if (mode.id === "select") {
53321           _areaID = context.selectedIDs()[0];
53322           return continueTo(searchPresets);
53323         } else {
53324           return chapter.restart();
53325         }
53326       });
53327       function continueTo(nextStep) {
53328         context.map().on("move.intro drawn.intro", null);
53329         context.on("enter.intro", null);
53330         nextStep();
53331       }
53332     }
53333     function finishPlayground() {
53334       if (context.mode().id !== "draw-area") {
53335         return chapter.restart();
53336       }
53337       _areaID = null;
53338       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
53339       revealPlayground(playground, finishString, { duration: 250 });
53340       timeout2(function() {
53341         context.map().on("move.intro drawn.intro", function() {
53342           revealPlayground(playground, finishString, { duration: 0 });
53343         });
53344       }, 250);
53345       context.on("enter.intro", function(mode) {
53346         if (mode.id === "draw-area") {
53347           return;
53348         } else if (mode.id === "select") {
53349           _areaID = context.selectedIDs()[0];
53350           return continueTo(searchPresets);
53351         } else {
53352           return chapter.restart();
53353         }
53354       });
53355       function continueTo(nextStep) {
53356         context.map().on("move.intro drawn.intro", null);
53357         context.on("enter.intro", null);
53358         nextStep();
53359       }
53360     }
53361     function searchPresets() {
53362       if (!_areaID || !context.hasEntity(_areaID)) {
53363         return addArea();
53364       }
53365       var ids = context.selectedIDs();
53366       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53367         context.enter(modeSelect(context, [_areaID]));
53368       }
53369       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53370       timeout2(function() {
53371         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53372         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53373         reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
53374       }, 400);
53375       context.on("enter.intro", function(mode) {
53376         if (!_areaID || !context.hasEntity(_areaID)) {
53377           return continueTo(addArea);
53378         }
53379         var ids2 = context.selectedIDs();
53380         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
53381           context.enter(modeSelect(context, [_areaID]));
53382           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53383           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53384           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53385           reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
53386           context.history().on("change.intro", null);
53387         }
53388       });
53389       function checkPresetSearch() {
53390         var first = context.container().select(".preset-list-item:first-child");
53391         if (first.classed("preset-leisure-playground")) {
53392           reveal(first.select(".preset-list-button").node(), helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }), { duration: 300 });
53393           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
53394           context.history().on("change.intro", function() {
53395             continueTo(clickAddField);
53396           });
53397         }
53398       }
53399       function continueTo(nextStep) {
53400         context.container().select(".inspector-wrap").on("wheel.intro", null);
53401         context.on("enter.intro", null);
53402         context.history().on("change.intro", null);
53403         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53404         nextStep();
53405       }
53406     }
53407     function clickAddField() {
53408       if (!_areaID || !context.hasEntity(_areaID)) {
53409         return addArea();
53410       }
53411       var ids = context.selectedIDs();
53412       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53413         return searchPresets();
53414       }
53415       if (!context.container().select(".form-field-description").empty()) {
53416         return continueTo(describePlayground);
53417       }
53418       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53419       timeout2(function() {
53420         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53421         var entity = context.entity(_areaID);
53422         if (entity.tags.description) {
53423           return continueTo(play);
53424         }
53425         var box = context.container().select(".more-fields").node().getBoundingClientRect();
53426         if (box.top > 300) {
53427           var pane = context.container().select(".entity-editor-pane .inspector-body");
53428           var start2 = pane.node().scrollTop;
53429           var end = start2 + (box.top - 300);
53430           pane.transition().duration(250).tween("scroll.inspector", function() {
53431             var node = this;
53432             var i2 = number_default(start2, end);
53433             return function(t) {
53434               node.scrollTop = i2(t);
53435             };
53436           });
53437         }
53438         timeout2(function() {
53439           reveal(".more-fields .combobox-input", helpHtml("intro.areas.add_field", {
53440             name: { html: nameField.label() },
53441             description: { html: descriptionField.label() }
53442           }), { duration: 300 });
53443           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
53444             var watcher;
53445             watcher = window.setInterval(function() {
53446               if (!context.container().select("div.combobox").empty()) {
53447                 window.clearInterval(watcher);
53448                 continueTo(chooseDescriptionField);
53449               }
53450             }, 300);
53451           });
53452         }, 300);
53453       }, 400);
53454       context.on("exit.intro", function() {
53455         return continueTo(searchPresets);
53456       });
53457       function continueTo(nextStep) {
53458         context.container().select(".inspector-wrap").on("wheel.intro", null);
53459         context.container().select(".more-fields .combobox-input").on("click.intro", null);
53460         context.on("exit.intro", null);
53461         nextStep();
53462       }
53463     }
53464     function chooseDescriptionField() {
53465       if (!_areaID || !context.hasEntity(_areaID)) {
53466         return addArea();
53467       }
53468       var ids = context.selectedIDs();
53469       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53470         return searchPresets();
53471       }
53472       if (!context.container().select(".form-field-description").empty()) {
53473         return continueTo(describePlayground);
53474       }
53475       if (context.container().select("div.combobox").empty()) {
53476         return continueTo(clickAddField);
53477       }
53478       var watcher;
53479       watcher = window.setInterval(function() {
53480         if (context.container().select("div.combobox").empty()) {
53481           window.clearInterval(watcher);
53482           timeout2(function() {
53483             if (context.container().select(".form-field-description").empty()) {
53484               continueTo(retryChooseDescription);
53485             } else {
53486               continueTo(describePlayground);
53487             }
53488           }, 300);
53489         }
53490       }, 300);
53491       reveal("div.combobox", helpHtml("intro.areas.choose_field", { field: { html: descriptionField.label() } }), { duration: 300 });
53492       context.on("exit.intro", function() {
53493         return continueTo(searchPresets);
53494       });
53495       function continueTo(nextStep) {
53496         if (watcher)
53497           window.clearInterval(watcher);
53498         context.on("exit.intro", null);
53499         nextStep();
53500       }
53501     }
53502     function describePlayground() {
53503       if (!_areaID || !context.hasEntity(_areaID)) {
53504         return addArea();
53505       }
53506       var ids = context.selectedIDs();
53507       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53508         return searchPresets();
53509       }
53510       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53511       if (context.container().select(".form-field-description").empty()) {
53512         return continueTo(retryChooseDescription);
53513       }
53514       context.on("exit.intro", function() {
53515         continueTo(play);
53516       });
53517       reveal(".entity-editor-pane", helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }), { duration: 300 });
53518       function continueTo(nextStep) {
53519         context.on("exit.intro", null);
53520         nextStep();
53521       }
53522     }
53523     function retryChooseDescription() {
53524       if (!_areaID || !context.hasEntity(_areaID)) {
53525         return addArea();
53526       }
53527       var ids = context.selectedIDs();
53528       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
53529         return searchPresets();
53530       }
53531       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53532       reveal(".entity-editor-pane", helpHtml("intro.areas.retry_add_field", { field: { html: descriptionField.label() } }), {
53533         buttonText: _t.html("intro.ok"),
53534         buttonCallback: function() {
53535           continueTo(clickAddField);
53536         }
53537       });
53538       context.on("exit.intro", function() {
53539         return continueTo(searchPresets);
53540       });
53541       function continueTo(nextStep) {
53542         context.on("exit.intro", null);
53543         nextStep();
53544       }
53545     }
53546     function play() {
53547       dispatch10.call("done");
53548       reveal(".ideditor", helpHtml("intro.areas.play", { next: _t("intro.lines.title") }), {
53549         tooltipBox: ".intro-nav-wrap .chapter-line",
53550         buttonText: _t.html("intro.ok"),
53551         buttonCallback: function() {
53552           reveal(".ideditor");
53553         }
53554       });
53555     }
53556     chapter.enter = function() {
53557       addArea();
53558     };
53559     chapter.exit = function() {
53560       timeouts.forEach(window.clearTimeout);
53561       context.on("enter.intro exit.intro", null);
53562       context.map().on("move.intro drawn.intro", null);
53563       context.history().on("change.intro", null);
53564       context.container().select(".inspector-wrap").on("wheel.intro", null);
53565       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53566       context.container().select(".more-fields .combobox-input").on("click.intro", null);
53567     };
53568     chapter.restart = function() {
53569       chapter.exit();
53570       chapter.enter();
53571     };
53572     return utilRebind(chapter, dispatch10, "on");
53573   }
53574
53575   // modules/ui/intro/line.js
53576   function uiIntroLine(context, reveal) {
53577     var dispatch10 = dispatch_default("done");
53578     var timeouts = [];
53579     var _tulipRoadID = null;
53580     var flowerRoadID = "w646";
53581     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
53582     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
53583     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
53584     var roadCategory = _mainPresetIndex.item("category-road_minor");
53585     var residentialPreset = _mainPresetIndex.item("highway/residential");
53586     var woodRoadID = "w525";
53587     var woodRoadEndID = "n2862";
53588     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
53589     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
53590     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
53591     var washingtonStreetID = "w522";
53592     var twelfthAvenueID = "w1";
53593     var eleventhAvenueEndID = "n3550";
53594     var twelfthAvenueEndID = "n5";
53595     var _washingtonSegmentID = null;
53596     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
53597     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
53598     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
53599     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
53600     var chapter = {
53601       title: "intro.lines.title"
53602     };
53603     function timeout2(f2, t) {
53604       timeouts.push(window.setTimeout(f2, t));
53605     }
53606     function eventCancel(d3_event) {
53607       d3_event.stopPropagation();
53608       d3_event.preventDefault();
53609     }
53610     function addLine() {
53611       context.enter(modeBrowse(context));
53612       context.history().reset("initial");
53613       var msec = transitionTime(tulipRoadStart, context.map().center());
53614       if (msec) {
53615         reveal(null, null, { duration: 0 });
53616       }
53617       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
53618       timeout2(function() {
53619         var tooltip = reveal("button.add-line", helpHtml("intro.lines.add_line"));
53620         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
53621         context.on("enter.intro", function(mode) {
53622           if (mode.id !== "add-line")
53623             return;
53624           continueTo(startLine);
53625         });
53626       }, msec + 100);
53627       function continueTo(nextStep) {
53628         context.on("enter.intro", null);
53629         nextStep();
53630       }
53631     }
53632     function startLine() {
53633       if (context.mode().id !== "add-line")
53634         return chapter.restart();
53635       _tulipRoadID = null;
53636       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
53637       var box = pad(tulipRoadStart, padding, context);
53638       box.height = box.height + 100;
53639       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
53640       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
53641       reveal(box, startLineString);
53642       context.map().on("move.intro drawn.intro", function() {
53643         padding = 70 * Math.pow(2, context.map().zoom() - 18);
53644         box = pad(tulipRoadStart, padding, context);
53645         box.height = box.height + 100;
53646         reveal(box, startLineString, { duration: 0 });
53647       });
53648       context.on("enter.intro", function(mode) {
53649         if (mode.id !== "draw-line")
53650           return chapter.restart();
53651         continueTo(drawLine);
53652       });
53653       function continueTo(nextStep) {
53654         context.map().on("move.intro drawn.intro", null);
53655         context.on("enter.intro", null);
53656         nextStep();
53657       }
53658     }
53659     function drawLine() {
53660       if (context.mode().id !== "draw-line")
53661         return chapter.restart();
53662       _tulipRoadID = context.mode().selectedIDs()[0];
53663       context.map().centerEase(tulipRoadMidpoint, 500);
53664       timeout2(function() {
53665         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
53666         var box = pad(tulipRoadMidpoint, padding, context);
53667         box.height = box.height * 2;
53668         reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }));
53669         context.map().on("move.intro drawn.intro", function() {
53670           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
53671           box = pad(tulipRoadMidpoint, padding, context);
53672           box.height = box.height * 2;
53673           reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }), { duration: 0 });
53674         });
53675       }, 550);
53676       context.history().on("change.intro", function() {
53677         if (isLineConnected()) {
53678           continueTo(continueLine);
53679         }
53680       });
53681       context.on("enter.intro", function(mode) {
53682         if (mode.id === "draw-line") {
53683           return;
53684         } else if (mode.id === "select") {
53685           continueTo(retryIntersect);
53686           return;
53687         } else {
53688           return chapter.restart();
53689         }
53690       });
53691       function continueTo(nextStep) {
53692         context.map().on("move.intro drawn.intro", null);
53693         context.history().on("change.intro", null);
53694         context.on("enter.intro", null);
53695         nextStep();
53696       }
53697     }
53698     function isLineConnected() {
53699       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
53700       if (!entity)
53701         return false;
53702       var drawNodes = context.graph().childNodes(entity);
53703       return drawNodes.some(function(node) {
53704         return context.graph().parentWays(node).some(function(parent) {
53705           return parent.id === flowerRoadID;
53706         });
53707       });
53708     }
53709     function retryIntersect() {
53710       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
53711       var box = pad(tulipRoadIntersection, 80, context);
53712       reveal(box, helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") }));
53713       timeout2(chapter.restart, 3e3);
53714     }
53715     function continueLine() {
53716       if (context.mode().id !== "draw-line")
53717         return chapter.restart();
53718       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
53719       if (!entity)
53720         return chapter.restart();
53721       context.map().centerEase(tulipRoadIntersection, 500);
53722       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
53723       reveal(".surface", continueLineText);
53724       context.on("enter.intro", function(mode) {
53725         if (mode.id === "draw-line") {
53726           return;
53727         } else if (mode.id === "select") {
53728           return continueTo(chooseCategoryRoad);
53729         } else {
53730           return chapter.restart();
53731         }
53732       });
53733       function continueTo(nextStep) {
53734         context.on("enter.intro", null);
53735         nextStep();
53736       }
53737     }
53738     function chooseCategoryRoad() {
53739       if (context.mode().id !== "select")
53740         return chapter.restart();
53741       context.on("exit.intro", function() {
53742         return chapter.restart();
53743       });
53744       var button = context.container().select(".preset-category-road_minor .preset-list-button");
53745       if (button.empty())
53746         return chapter.restart();
53747       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53748       timeout2(function() {
53749         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
53750         reveal(button.node(), helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() }));
53751         button.on("click.intro", function() {
53752           continueTo(choosePresetResidential);
53753         });
53754       }, 400);
53755       function continueTo(nextStep) {
53756         context.container().select(".inspector-wrap").on("wheel.intro", null);
53757         context.container().select(".preset-list-button").on("click.intro", null);
53758         context.on("exit.intro", null);
53759         nextStep();
53760       }
53761     }
53762     function choosePresetResidential() {
53763       if (context.mode().id !== "select")
53764         return chapter.restart();
53765       context.on("exit.intro", function() {
53766         return chapter.restart();
53767       });
53768       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
53769       if (subgrid.empty())
53770         return chapter.restart();
53771       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
53772         continueTo(retryPresetResidential);
53773       });
53774       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
53775         continueTo(nameRoad);
53776       });
53777       timeout2(function() {
53778         reveal(subgrid.node(), helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }), { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 });
53779       }, 300);
53780       function continueTo(nextStep) {
53781         context.container().select(".preset-list-button").on("click.intro", null);
53782         context.on("exit.intro", null);
53783         nextStep();
53784       }
53785     }
53786     function retryPresetResidential() {
53787       if (context.mode().id !== "select")
53788         return chapter.restart();
53789       context.on("exit.intro", function() {
53790         return chapter.restart();
53791       });
53792       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53793       timeout2(function() {
53794         var button = context.container().select(".entity-editor-pane .preset-list-button");
53795         reveal(button.node(), helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() }));
53796         button.on("click.intro", function() {
53797           continueTo(chooseCategoryRoad);
53798         });
53799       }, 500);
53800       function continueTo(nextStep) {
53801         context.container().select(".inspector-wrap").on("wheel.intro", null);
53802         context.container().select(".preset-list-button").on("click.intro", null);
53803         context.on("exit.intro", null);
53804         nextStep();
53805       }
53806     }
53807     function nameRoad() {
53808       context.on("exit.intro", function() {
53809         continueTo(didNameRoad);
53810       });
53811       timeout2(function() {
53812         reveal(".entity-editor-pane", helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }), { tooltipClass: "intro-lines-name_road" });
53813       }, 500);
53814       function continueTo(nextStep) {
53815         context.on("exit.intro", null);
53816         nextStep();
53817       }
53818     }
53819     function didNameRoad() {
53820       context.history().checkpoint("doneAddLine");
53821       timeout2(function() {
53822         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
53823           buttonText: _t.html("intro.ok"),
53824           buttonCallback: function() {
53825             continueTo(updateLine);
53826           }
53827         });
53828       }, 500);
53829       function continueTo(nextStep) {
53830         nextStep();
53831       }
53832     }
53833     function updateLine() {
53834       context.history().reset("doneAddLine");
53835       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53836         return chapter.restart();
53837       }
53838       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
53839       if (msec) {
53840         reveal(null, null, { duration: 0 });
53841       }
53842       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
53843       timeout2(function() {
53844         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
53845         var box = pad(woodRoadDragMidpoint, padding, context);
53846         var advance = function() {
53847           continueTo(addNode);
53848         };
53849         reveal(box, helpHtml("intro.lines.update_line"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
53850         context.map().on("move.intro drawn.intro", function() {
53851           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
53852           var box2 = pad(woodRoadDragMidpoint, padding2, context);
53853           reveal(box2, helpHtml("intro.lines.update_line"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
53854         });
53855       }, msec + 100);
53856       function continueTo(nextStep) {
53857         context.map().on("move.intro drawn.intro", null);
53858         nextStep();
53859       }
53860     }
53861     function addNode() {
53862       context.history().reset("doneAddLine");
53863       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53864         return chapter.restart();
53865       }
53866       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
53867       var box = pad(woodRoadAddNode, padding, context);
53868       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
53869       reveal(box, addNodeString);
53870       context.map().on("move.intro drawn.intro", function() {
53871         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
53872         var box2 = pad(woodRoadAddNode, padding2, context);
53873         reveal(box2, addNodeString, { duration: 0 });
53874       });
53875       context.history().on("change.intro", function(changed) {
53876         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53877           return continueTo(updateLine);
53878         }
53879         if (changed.created().length === 1) {
53880           timeout2(function() {
53881             continueTo(startDragEndpoint);
53882           }, 500);
53883         }
53884       });
53885       context.on("enter.intro", function(mode) {
53886         if (mode.id !== "select") {
53887           continueTo(updateLine);
53888         }
53889       });
53890       function continueTo(nextStep) {
53891         context.map().on("move.intro drawn.intro", null);
53892         context.history().on("change.intro", null);
53893         context.on("enter.intro", null);
53894         nextStep();
53895       }
53896     }
53897     function startDragEndpoint() {
53898       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53899         return continueTo(updateLine);
53900       }
53901       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
53902       var box = pad(woodRoadDragEndpoint, padding, context);
53903       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
53904       reveal(box, startDragString);
53905       context.map().on("move.intro drawn.intro", function() {
53906         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53907           return continueTo(updateLine);
53908         }
53909         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
53910         var box2 = pad(woodRoadDragEndpoint, padding2, context);
53911         reveal(box2, startDragString, { duration: 0 });
53912         var entity = context.entity(woodRoadEndID);
53913         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
53914           continueTo(finishDragEndpoint);
53915         }
53916       });
53917       function continueTo(nextStep) {
53918         context.map().on("move.intro drawn.intro", null);
53919         nextStep();
53920       }
53921     }
53922     function finishDragEndpoint() {
53923       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53924         return continueTo(updateLine);
53925       }
53926       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
53927       var box = pad(woodRoadDragEndpoint, padding, context);
53928       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
53929       reveal(box, finishDragString);
53930       context.map().on("move.intro drawn.intro", function() {
53931         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53932           return continueTo(updateLine);
53933         }
53934         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
53935         var box2 = pad(woodRoadDragEndpoint, padding2, context);
53936         reveal(box2, finishDragString, { duration: 0 });
53937         var entity = context.entity(woodRoadEndID);
53938         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
53939           continueTo(startDragEndpoint);
53940         }
53941       });
53942       context.on("enter.intro", function() {
53943         continueTo(startDragMidpoint);
53944       });
53945       function continueTo(nextStep) {
53946         context.map().on("move.intro drawn.intro", null);
53947         context.on("enter.intro", null);
53948         nextStep();
53949       }
53950     }
53951     function startDragMidpoint() {
53952       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53953         return continueTo(updateLine);
53954       }
53955       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
53956         context.enter(modeSelect(context, [woodRoadID]));
53957       }
53958       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
53959       var box = pad(woodRoadDragMidpoint, padding, context);
53960       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
53961       context.map().on("move.intro drawn.intro", function() {
53962         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53963           return continueTo(updateLine);
53964         }
53965         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
53966         var box2 = pad(woodRoadDragMidpoint, padding2, context);
53967         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
53968       });
53969       context.history().on("change.intro", function(changed) {
53970         if (changed.created().length === 1) {
53971           continueTo(continueDragMidpoint);
53972         }
53973       });
53974       context.on("enter.intro", function(mode) {
53975         if (mode.id !== "select") {
53976           context.enter(modeSelect(context, [woodRoadID]));
53977         }
53978       });
53979       function continueTo(nextStep) {
53980         context.map().on("move.intro drawn.intro", null);
53981         context.history().on("change.intro", null);
53982         context.on("enter.intro", null);
53983         nextStep();
53984       }
53985     }
53986     function continueDragMidpoint() {
53987       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
53988         return continueTo(updateLine);
53989       }
53990       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
53991       var box = pad(woodRoadDragEndpoint, padding, context);
53992       box.height += 400;
53993       var advance = function() {
53994         context.history().checkpoint("doneUpdateLine");
53995         continueTo(deleteLines);
53996       };
53997       reveal(box, helpHtml("intro.lines.continue_drag_midpoint"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
53998       context.map().on("move.intro drawn.intro", function() {
53999         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54000           return continueTo(updateLine);
54001         }
54002         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
54003         var box2 = pad(woodRoadDragEndpoint, padding2, context);
54004         box2.height += 400;
54005         reveal(box2, helpHtml("intro.lines.continue_drag_midpoint"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54006       });
54007       function continueTo(nextStep) {
54008         context.map().on("move.intro drawn.intro", null);
54009         nextStep();
54010       }
54011     }
54012     function deleteLines() {
54013       context.history().reset("doneUpdateLine");
54014       context.enter(modeBrowse(context));
54015       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54016         return chapter.restart();
54017       }
54018       var msec = transitionTime(deleteLinesLoc, context.map().center());
54019       if (msec) {
54020         reveal(null, null, { duration: 0 });
54021       }
54022       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
54023       timeout2(function() {
54024         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54025         var box = pad(deleteLinesLoc, padding, context);
54026         box.top -= 200;
54027         box.height += 400;
54028         var advance = function() {
54029           continueTo(rightClickIntersection);
54030         };
54031         reveal(box, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
54032         context.map().on("move.intro drawn.intro", function() {
54033           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54034           var box2 = pad(deleteLinesLoc, padding2, context);
54035           box2.top -= 200;
54036           box2.height += 400;
54037           reveal(box2, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54038         });
54039         context.history().on("change.intro", function() {
54040           timeout2(function() {
54041             continueTo(deleteLines);
54042           }, 500);
54043         });
54044       }, msec + 100);
54045       function continueTo(nextStep) {
54046         context.map().on("move.intro drawn.intro", null);
54047         context.history().on("change.intro", null);
54048         nextStep();
54049       }
54050     }
54051     function rightClickIntersection() {
54052       context.history().reset("doneUpdateLine");
54053       context.enter(modeBrowse(context));
54054       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54055       var rightClickString = helpHtml("intro.lines.split_street", {
54056         street1: _t("intro.graph.name.11th-avenue"),
54057         street2: _t("intro.graph.name.washington-street")
54058       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
54059       timeout2(function() {
54060         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54061         var box = pad(eleventhAvenueEnd, padding, context);
54062         reveal(box, rightClickString);
54063         context.map().on("move.intro drawn.intro", function() {
54064           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54065           var box2 = pad(eleventhAvenueEnd, padding2, context);
54066           reveal(box2, rightClickString, { duration: 0 });
54067         });
54068         context.on("enter.intro", function(mode) {
54069           if (mode.id !== "select")
54070             return;
54071           var ids = context.selectedIDs();
54072           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
54073             return;
54074           timeout2(function() {
54075             var node = selectMenuItem(context, "split").node();
54076             if (!node)
54077               return;
54078             continueTo(splitIntersection);
54079           }, 50);
54080         });
54081         context.history().on("change.intro", function() {
54082           timeout2(function() {
54083             continueTo(deleteLines);
54084           }, 300);
54085         });
54086       }, 600);
54087       function continueTo(nextStep) {
54088         context.map().on("move.intro drawn.intro", null);
54089         context.on("enter.intro", null);
54090         context.history().on("change.intro", null);
54091         nextStep();
54092       }
54093     }
54094     function splitIntersection() {
54095       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54096         return continueTo(deleteLines);
54097       }
54098       var node = selectMenuItem(context, "split").node();
54099       if (!node) {
54100         return continueTo(rightClickIntersection);
54101       }
54102       var wasChanged = false;
54103       _washingtonSegmentID = null;
54104       reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { padding: 50 });
54105       context.map().on("move.intro drawn.intro", function() {
54106         var node2 = selectMenuItem(context, "split").node();
54107         if (!wasChanged && !node2) {
54108           return continueTo(rightClickIntersection);
54109         }
54110         reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { duration: 0, padding: 50 });
54111       });
54112       context.history().on("change.intro", function(changed) {
54113         wasChanged = true;
54114         timeout2(function() {
54115           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
54116             _washingtonSegmentID = changed.created()[0].id;
54117             continueTo(didSplit);
54118           } else {
54119             _washingtonSegmentID = null;
54120             continueTo(retrySplit);
54121           }
54122         }, 300);
54123       });
54124       function continueTo(nextStep) {
54125         context.map().on("move.intro drawn.intro", null);
54126         context.history().on("change.intro", null);
54127         nextStep();
54128       }
54129     }
54130     function retrySplit() {
54131       context.enter(modeBrowse(context));
54132       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54133       var advance = function() {
54134         continueTo(rightClickIntersection);
54135       };
54136       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54137       var box = pad(eleventhAvenueEnd, padding, context);
54138       reveal(box, helpHtml("intro.lines.retry_split"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
54139       context.map().on("move.intro drawn.intro", function() {
54140         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54141         var box2 = pad(eleventhAvenueEnd, padding2, context);
54142         reveal(box2, helpHtml("intro.lines.retry_split"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
54143       });
54144       function continueTo(nextStep) {
54145         context.map().on("move.intro drawn.intro", null);
54146         nextStep();
54147       }
54148     }
54149     function didSplit() {
54150       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54151         return continueTo(rightClickIntersection);
54152       }
54153       var ids = context.selectedIDs();
54154       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
54155       var street = _t("intro.graph.name.washington-street");
54156       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54157       var box = pad(twelfthAvenue, padding, context);
54158       box.width = box.width / 2;
54159       reveal(box, helpHtml(string, { street1: street, street2: street }), { duration: 500 });
54160       timeout2(function() {
54161         context.map().centerZoomEase(twelfthAvenue, 18, 500);
54162         context.map().on("move.intro drawn.intro", function() {
54163           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54164           var box2 = pad(twelfthAvenue, padding2, context);
54165           box2.width = box2.width / 2;
54166           reveal(box2, helpHtml(string, { street1: street, street2: street }), { duration: 0 });
54167         });
54168       }, 600);
54169       context.on("enter.intro", function() {
54170         var ids2 = context.selectedIDs();
54171         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
54172           continueTo(multiSelect);
54173         }
54174       });
54175       context.history().on("change.intro", function() {
54176         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54177           return continueTo(rightClickIntersection);
54178         }
54179       });
54180       function continueTo(nextStep) {
54181         context.map().on("move.intro drawn.intro", null);
54182         context.on("enter.intro", null);
54183         context.history().on("change.intro", null);
54184         nextStep();
54185       }
54186     }
54187     function multiSelect() {
54188       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54189         return continueTo(rightClickIntersection);
54190       }
54191       var ids = context.selectedIDs();
54192       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
54193       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
54194       if (hasWashington && hasTwelfth) {
54195         return continueTo(multiRightClick);
54196       } else if (!hasWashington && !hasTwelfth) {
54197         return continueTo(didSplit);
54198       }
54199       context.map().centerZoomEase(twelfthAvenue, 18, 500);
54200       timeout2(function() {
54201         var selected, other, padding, box;
54202         if (hasWashington) {
54203           selected = _t("intro.graph.name.washington-street");
54204           other = _t("intro.graph.name.12th-avenue");
54205           padding = 60 * Math.pow(2, context.map().zoom() - 18);
54206           box = pad(twelfthAvenueEnd, padding, context);
54207           box.width *= 3;
54208         } else {
54209           selected = _t("intro.graph.name.12th-avenue");
54210           other = _t("intro.graph.name.washington-street");
54211           padding = 200 * Math.pow(2, context.map().zoom() - 18);
54212           box = pad(twelfthAvenue, padding, context);
54213           box.width /= 2;
54214         }
54215         reveal(box, helpHtml("intro.lines.multi_select", { selected, other1: other }) + " " + helpHtml("intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"), { selected, other2: other }));
54216         context.map().on("move.intro drawn.intro", function() {
54217           if (hasWashington) {
54218             selected = _t("intro.graph.name.washington-street");
54219             other = _t("intro.graph.name.12th-avenue");
54220             padding = 60 * Math.pow(2, context.map().zoom() - 18);
54221             box = pad(twelfthAvenueEnd, padding, context);
54222             box.width *= 3;
54223           } else {
54224             selected = _t("intro.graph.name.12th-avenue");
54225             other = _t("intro.graph.name.washington-street");
54226             padding = 200 * Math.pow(2, context.map().zoom() - 18);
54227             box = pad(twelfthAvenue, padding, context);
54228             box.width /= 2;
54229           }
54230           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 });
54231         });
54232         context.on("enter.intro", function() {
54233           continueTo(multiSelect);
54234         });
54235         context.history().on("change.intro", function() {
54236           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54237             return continueTo(rightClickIntersection);
54238           }
54239         });
54240       }, 600);
54241       function continueTo(nextStep) {
54242         context.map().on("move.intro drawn.intro", null);
54243         context.on("enter.intro", null);
54244         context.history().on("change.intro", null);
54245         nextStep();
54246       }
54247     }
54248     function multiRightClick() {
54249       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54250         return continueTo(rightClickIntersection);
54251       }
54252       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54253       var box = pad(twelfthAvenue, padding, context);
54254       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
54255       reveal(box, rightClickString);
54256       context.map().on("move.intro drawn.intro", function() {
54257         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54258         var box2 = pad(twelfthAvenue, padding2, context);
54259         reveal(box2, rightClickString, { duration: 0 });
54260       });
54261       context.ui().editMenu().on("toggled.intro", function(open) {
54262         if (!open)
54263           return;
54264         timeout2(function() {
54265           var ids = context.selectedIDs();
54266           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
54267             var node = selectMenuItem(context, "delete").node();
54268             if (!node)
54269               return;
54270             continueTo(multiDelete);
54271           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
54272             return continueTo(multiSelect);
54273           } else {
54274             return continueTo(didSplit);
54275           }
54276         }, 300);
54277       });
54278       context.history().on("change.intro", function() {
54279         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54280           return continueTo(rightClickIntersection);
54281         }
54282       });
54283       function continueTo(nextStep) {
54284         context.map().on("move.intro drawn.intro", null);
54285         context.ui().editMenu().on("toggled.intro", null);
54286         context.history().on("change.intro", null);
54287         nextStep();
54288       }
54289     }
54290     function multiDelete() {
54291       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54292         return continueTo(rightClickIntersection);
54293       }
54294       var node = selectMenuItem(context, "delete").node();
54295       if (!node)
54296         return continueTo(multiRightClick);
54297       reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { padding: 50 });
54298       context.map().on("move.intro drawn.intro", function() {
54299         reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { duration: 0, padding: 50 });
54300       });
54301       context.on("exit.intro", function() {
54302         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
54303           return continueTo(multiSelect);
54304         }
54305       });
54306       context.history().on("change.intro", function() {
54307         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
54308           continueTo(retryDelete);
54309         } else {
54310           continueTo(play);
54311         }
54312       });
54313       function continueTo(nextStep) {
54314         context.map().on("move.intro drawn.intro", null);
54315         context.on("exit.intro", null);
54316         context.history().on("change.intro", null);
54317         nextStep();
54318       }
54319     }
54320     function retryDelete() {
54321       context.enter(modeBrowse(context));
54322       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54323       var box = pad(twelfthAvenue, padding, context);
54324       reveal(box, helpHtml("intro.lines.retry_delete"), {
54325         buttonText: _t.html("intro.ok"),
54326         buttonCallback: function() {
54327           continueTo(multiSelect);
54328         }
54329       });
54330       function continueTo(nextStep) {
54331         nextStep();
54332       }
54333     }
54334     function play() {
54335       dispatch10.call("done");
54336       reveal(".ideditor", helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }), {
54337         tooltipBox: ".intro-nav-wrap .chapter-building",
54338         buttonText: _t.html("intro.ok"),
54339         buttonCallback: function() {
54340           reveal(".ideditor");
54341         }
54342       });
54343     }
54344     chapter.enter = function() {
54345       addLine();
54346     };
54347     chapter.exit = function() {
54348       timeouts.forEach(window.clearTimeout);
54349       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
54350       context.on("enter.intro exit.intro", null);
54351       context.map().on("move.intro drawn.intro", null);
54352       context.history().on("change.intro", null);
54353       context.container().select(".inspector-wrap").on("wheel.intro", null);
54354       context.container().select(".preset-list-button").on("click.intro", null);
54355     };
54356     chapter.restart = function() {
54357       chapter.exit();
54358       chapter.enter();
54359     };
54360     return utilRebind(chapter, dispatch10, "on");
54361   }
54362
54363   // modules/ui/intro/building.js
54364   function uiIntroBuilding(context, reveal) {
54365     var dispatch10 = dispatch_default("done");
54366     var house = [-85.62815, 41.95638];
54367     var tank = [-85.62732, 41.95347];
54368     var buildingCatetory = _mainPresetIndex.item("category-building");
54369     var housePreset = _mainPresetIndex.item("building/house");
54370     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
54371     var timeouts = [];
54372     var _houseID = null;
54373     var _tankID = null;
54374     var chapter = {
54375       title: "intro.buildings.title"
54376     };
54377     function timeout2(f2, t) {
54378       timeouts.push(window.setTimeout(f2, t));
54379     }
54380     function eventCancel(d3_event) {
54381       d3_event.stopPropagation();
54382       d3_event.preventDefault();
54383     }
54384     function revealHouse(center, text2, options2) {
54385       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
54386       var box = pad(center, padding, context);
54387       reveal(box, text2, options2);
54388     }
54389     function revealTank(center, text2, options2) {
54390       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
54391       var box = pad(center, padding, context);
54392       reveal(box, text2, options2);
54393     }
54394     function addHouse() {
54395       context.enter(modeBrowse(context));
54396       context.history().reset("initial");
54397       _houseID = null;
54398       var msec = transitionTime(house, context.map().center());
54399       if (msec) {
54400         reveal(null, null, { duration: 0 });
54401       }
54402       context.map().centerZoomEase(house, 19, msec);
54403       timeout2(function() {
54404         var tooltip = reveal("button.add-area", helpHtml("intro.buildings.add_building"));
54405         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
54406         context.on("enter.intro", function(mode) {
54407           if (mode.id !== "add-area")
54408             return;
54409           continueTo(startHouse);
54410         });
54411       }, msec + 100);
54412       function continueTo(nextStep) {
54413         context.on("enter.intro", null);
54414         nextStep();
54415       }
54416     }
54417     function startHouse() {
54418       if (context.mode().id !== "add-area") {
54419         return continueTo(addHouse);
54420       }
54421       _houseID = null;
54422       context.map().zoomEase(20, 500);
54423       timeout2(function() {
54424         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
54425         revealHouse(house, startString);
54426         context.map().on("move.intro drawn.intro", function() {
54427           revealHouse(house, startString, { duration: 0 });
54428         });
54429         context.on("enter.intro", function(mode) {
54430           if (mode.id !== "draw-area")
54431             return chapter.restart();
54432           continueTo(continueHouse);
54433         });
54434       }, 550);
54435       function continueTo(nextStep) {
54436         context.map().on("move.intro drawn.intro", null);
54437         context.on("enter.intro", null);
54438         nextStep();
54439       }
54440     }
54441     function continueHouse() {
54442       if (context.mode().id !== "draw-area") {
54443         return continueTo(addHouse);
54444       }
54445       _houseID = null;
54446       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
54447       revealHouse(house, continueString);
54448       context.map().on("move.intro drawn.intro", function() {
54449         revealHouse(house, continueString, { duration: 0 });
54450       });
54451       context.on("enter.intro", function(mode) {
54452         if (mode.id === "draw-area") {
54453           return;
54454         } else if (mode.id === "select") {
54455           var graph = context.graph();
54456           var way = context.entity(context.selectedIDs()[0]);
54457           var nodes = graph.childNodes(way);
54458           var points = utilArrayUniq(nodes).map(function(n2) {
54459             return context.projection(n2.loc);
54460           });
54461           if (isMostlySquare(points)) {
54462             _houseID = way.id;
54463             return continueTo(chooseCategoryBuilding);
54464           } else {
54465             return continueTo(retryHouse);
54466           }
54467         } else {
54468           return chapter.restart();
54469         }
54470       });
54471       function continueTo(nextStep) {
54472         context.map().on("move.intro drawn.intro", null);
54473         context.on("enter.intro", null);
54474         nextStep();
54475       }
54476     }
54477     function retryHouse() {
54478       var onClick = function() {
54479         continueTo(addHouse);
54480       };
54481       revealHouse(house, helpHtml("intro.buildings.retry_building"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
54482       context.map().on("move.intro drawn.intro", function() {
54483         revealHouse(house, helpHtml("intro.buildings.retry_building"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
54484       });
54485       function continueTo(nextStep) {
54486         context.map().on("move.intro drawn.intro", null);
54487         nextStep();
54488       }
54489     }
54490     function chooseCategoryBuilding() {
54491       if (!_houseID || !context.hasEntity(_houseID)) {
54492         return addHouse();
54493       }
54494       var ids = context.selectedIDs();
54495       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54496         context.enter(modeSelect(context, [_houseID]));
54497       }
54498       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54499       timeout2(function() {
54500         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54501         var button = context.container().select(".preset-category-building .preset-list-button");
54502         reveal(button.node(), helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() }));
54503         button.on("click.intro", function() {
54504           button.on("click.intro", null);
54505           continueTo(choosePresetHouse);
54506         });
54507       }, 400);
54508       context.on("enter.intro", function(mode) {
54509         if (!_houseID || !context.hasEntity(_houseID)) {
54510           return continueTo(addHouse);
54511         }
54512         var ids2 = context.selectedIDs();
54513         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
54514           return continueTo(chooseCategoryBuilding);
54515         }
54516       });
54517       function continueTo(nextStep) {
54518         context.container().select(".inspector-wrap").on("wheel.intro", null);
54519         context.container().select(".preset-list-button").on("click.intro", null);
54520         context.on("enter.intro", null);
54521         nextStep();
54522       }
54523     }
54524     function choosePresetHouse() {
54525       if (!_houseID || !context.hasEntity(_houseID)) {
54526         return addHouse();
54527       }
54528       var ids = context.selectedIDs();
54529       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54530         context.enter(modeSelect(context, [_houseID]));
54531       }
54532       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54533       timeout2(function() {
54534         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54535         var button = context.container().select(".preset-building-house .preset-list-button");
54536         reveal(button.node(), helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }), { duration: 300 });
54537         button.on("click.intro", function() {
54538           button.on("click.intro", null);
54539           continueTo(closeEditorHouse);
54540         });
54541       }, 400);
54542       context.on("enter.intro", function(mode) {
54543         if (!_houseID || !context.hasEntity(_houseID)) {
54544           return continueTo(addHouse);
54545         }
54546         var ids2 = context.selectedIDs();
54547         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
54548           return continueTo(chooseCategoryBuilding);
54549         }
54550       });
54551       function continueTo(nextStep) {
54552         context.container().select(".inspector-wrap").on("wheel.intro", null);
54553         context.container().select(".preset-list-button").on("click.intro", null);
54554         context.on("enter.intro", null);
54555         nextStep();
54556       }
54557     }
54558     function closeEditorHouse() {
54559       if (!_houseID || !context.hasEntity(_houseID)) {
54560         return addHouse();
54561       }
54562       var ids = context.selectedIDs();
54563       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
54564         context.enter(modeSelect(context, [_houseID]));
54565       }
54566       context.history().checkpoint("hasHouse");
54567       context.on("exit.intro", function() {
54568         continueTo(rightClickHouse);
54569       });
54570       timeout2(function() {
54571         reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
54572       }, 500);
54573       function continueTo(nextStep) {
54574         context.on("exit.intro", null);
54575         nextStep();
54576       }
54577     }
54578     function rightClickHouse() {
54579       if (!_houseID)
54580         return chapter.restart();
54581       context.enter(modeBrowse(context));
54582       context.history().reset("hasHouse");
54583       var zoom = context.map().zoom();
54584       if (zoom < 20) {
54585         zoom = 20;
54586       }
54587       context.map().centerZoomEase(house, zoom, 500);
54588       context.on("enter.intro", function(mode) {
54589         if (mode.id !== "select")
54590           return;
54591         var ids = context.selectedIDs();
54592         if (ids.length !== 1 || ids[0] !== _houseID)
54593           return;
54594         timeout2(function() {
54595           var node = selectMenuItem(context, "orthogonalize").node();
54596           if (!node)
54597             return;
54598           continueTo(clickSquare);
54599         }, 50);
54600       });
54601       context.map().on("move.intro drawn.intro", function() {
54602         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
54603         revealHouse(house, rightclickString, { duration: 0 });
54604       });
54605       context.history().on("change.intro", function() {
54606         continueTo(rightClickHouse);
54607       });
54608       function continueTo(nextStep) {
54609         context.on("enter.intro", null);
54610         context.map().on("move.intro drawn.intro", null);
54611         context.history().on("change.intro", null);
54612         nextStep();
54613       }
54614     }
54615     function clickSquare() {
54616       if (!_houseID)
54617         return chapter.restart();
54618       var entity = context.hasEntity(_houseID);
54619       if (!entity)
54620         return continueTo(rightClickHouse);
54621       var node = selectMenuItem(context, "orthogonalize").node();
54622       if (!node) {
54623         return continueTo(rightClickHouse);
54624       }
54625       var wasChanged = false;
54626       reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { padding: 50 });
54627       context.on("enter.intro", function(mode) {
54628         if (mode.id === "browse") {
54629           continueTo(rightClickHouse);
54630         } else if (mode.id === "move" || mode.id === "rotate") {
54631           continueTo(retryClickSquare);
54632         }
54633       });
54634       context.map().on("move.intro", function() {
54635         var node2 = selectMenuItem(context, "orthogonalize").node();
54636         if (!wasChanged && !node2) {
54637           return continueTo(rightClickHouse);
54638         }
54639         reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { duration: 0, padding: 50 });
54640       });
54641       context.history().on("change.intro", function() {
54642         wasChanged = true;
54643         context.history().on("change.intro", null);
54644         timeout2(function() {
54645           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
54646             continueTo(doneSquare);
54647           } else {
54648             continueTo(retryClickSquare);
54649           }
54650         }, 500);
54651       });
54652       function continueTo(nextStep) {
54653         context.on("enter.intro", null);
54654         context.map().on("move.intro", null);
54655         context.history().on("change.intro", null);
54656         nextStep();
54657       }
54658     }
54659     function retryClickSquare() {
54660       context.enter(modeBrowse(context));
54661       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
54662         buttonText: _t.html("intro.ok"),
54663         buttonCallback: function() {
54664           continueTo(rightClickHouse);
54665         }
54666       });
54667       function continueTo(nextStep) {
54668         nextStep();
54669       }
54670     }
54671     function doneSquare() {
54672       context.history().checkpoint("doneSquare");
54673       revealHouse(house, helpHtml("intro.buildings.done_square"), {
54674         buttonText: _t.html("intro.ok"),
54675         buttonCallback: function() {
54676           continueTo(addTank);
54677         }
54678       });
54679       function continueTo(nextStep) {
54680         nextStep();
54681       }
54682     }
54683     function addTank() {
54684       context.enter(modeBrowse(context));
54685       context.history().reset("doneSquare");
54686       _tankID = null;
54687       var msec = transitionTime(tank, context.map().center());
54688       if (msec) {
54689         reveal(null, null, { duration: 0 });
54690       }
54691       context.map().centerZoomEase(tank, 19.5, msec);
54692       timeout2(function() {
54693         reveal("button.add-area", helpHtml("intro.buildings.add_tank"));
54694         context.on("enter.intro", function(mode) {
54695           if (mode.id !== "add-area")
54696             return;
54697           continueTo(startTank);
54698         });
54699       }, msec + 100);
54700       function continueTo(nextStep) {
54701         context.on("enter.intro", null);
54702         nextStep();
54703       }
54704     }
54705     function startTank() {
54706       if (context.mode().id !== "add-area") {
54707         return continueTo(addTank);
54708       }
54709       _tankID = null;
54710       timeout2(function() {
54711         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
54712         revealTank(tank, startString);
54713         context.map().on("move.intro drawn.intro", function() {
54714           revealTank(tank, startString, { duration: 0 });
54715         });
54716         context.on("enter.intro", function(mode) {
54717           if (mode.id !== "draw-area")
54718             return chapter.restart();
54719           continueTo(continueTank);
54720         });
54721       }, 550);
54722       function continueTo(nextStep) {
54723         context.map().on("move.intro drawn.intro", null);
54724         context.on("enter.intro", null);
54725         nextStep();
54726       }
54727     }
54728     function continueTank() {
54729       if (context.mode().id !== "draw-area") {
54730         return continueTo(addTank);
54731       }
54732       _tankID = null;
54733       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
54734       revealTank(tank, continueString);
54735       context.map().on("move.intro drawn.intro", function() {
54736         revealTank(tank, continueString, { duration: 0 });
54737       });
54738       context.on("enter.intro", function(mode) {
54739         if (mode.id === "draw-area") {
54740           return;
54741         } else if (mode.id === "select") {
54742           _tankID = context.selectedIDs()[0];
54743           return continueTo(searchPresetTank);
54744         } else {
54745           return continueTo(addTank);
54746         }
54747       });
54748       function continueTo(nextStep) {
54749         context.map().on("move.intro drawn.intro", null);
54750         context.on("enter.intro", null);
54751         nextStep();
54752       }
54753     }
54754     function searchPresetTank() {
54755       if (!_tankID || !context.hasEntity(_tankID)) {
54756         return addTank();
54757       }
54758       var ids = context.selectedIDs();
54759       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
54760         context.enter(modeSelect(context, [_tankID]));
54761       }
54762       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54763       timeout2(function() {
54764         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54765         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54766         reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
54767       }, 400);
54768       context.on("enter.intro", function(mode) {
54769         if (!_tankID || !context.hasEntity(_tankID)) {
54770           return continueTo(addTank);
54771         }
54772         var ids2 = context.selectedIDs();
54773         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
54774           context.enter(modeSelect(context, [_tankID]));
54775           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54776           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54777           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54778           reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
54779           context.history().on("change.intro", null);
54780         }
54781       });
54782       function checkPresetSearch() {
54783         var first = context.container().select(".preset-list-item:first-child");
54784         if (first.classed("preset-man_made-storage_tank")) {
54785           reveal(first.select(".preset-list-button").node(), helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }), { duration: 300 });
54786           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
54787           context.history().on("change.intro", function() {
54788             continueTo(closeEditorTank);
54789           });
54790         }
54791       }
54792       function continueTo(nextStep) {
54793         context.container().select(".inspector-wrap").on("wheel.intro", null);
54794         context.on("enter.intro", null);
54795         context.history().on("change.intro", null);
54796         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54797         nextStep();
54798       }
54799     }
54800     function closeEditorTank() {
54801       if (!_tankID || !context.hasEntity(_tankID)) {
54802         return addTank();
54803       }
54804       var ids = context.selectedIDs();
54805       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
54806         context.enter(modeSelect(context, [_tankID]));
54807       }
54808       context.history().checkpoint("hasTank");
54809       context.on("exit.intro", function() {
54810         continueTo(rightClickTank);
54811       });
54812       timeout2(function() {
54813         reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
54814       }, 500);
54815       function continueTo(nextStep) {
54816         context.on("exit.intro", null);
54817         nextStep();
54818       }
54819     }
54820     function rightClickTank() {
54821       if (!_tankID)
54822         return continueTo(addTank);
54823       context.enter(modeBrowse(context));
54824       context.history().reset("hasTank");
54825       context.map().centerEase(tank, 500);
54826       timeout2(function() {
54827         context.on("enter.intro", function(mode) {
54828           if (mode.id !== "select")
54829             return;
54830           var ids = context.selectedIDs();
54831           if (ids.length !== 1 || ids[0] !== _tankID)
54832             return;
54833           timeout2(function() {
54834             var node = selectMenuItem(context, "circularize").node();
54835             if (!node)
54836               return;
54837             continueTo(clickCircle);
54838           }, 50);
54839         });
54840         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
54841         revealTank(tank, rightclickString);
54842         context.map().on("move.intro drawn.intro", function() {
54843           revealTank(tank, rightclickString, { duration: 0 });
54844         });
54845         context.history().on("change.intro", function() {
54846           continueTo(rightClickTank);
54847         });
54848       }, 600);
54849       function continueTo(nextStep) {
54850         context.on("enter.intro", null);
54851         context.map().on("move.intro drawn.intro", null);
54852         context.history().on("change.intro", null);
54853         nextStep();
54854       }
54855     }
54856     function clickCircle() {
54857       if (!_tankID)
54858         return chapter.restart();
54859       var entity = context.hasEntity(_tankID);
54860       if (!entity)
54861         return continueTo(rightClickTank);
54862       var node = selectMenuItem(context, "circularize").node();
54863       if (!node) {
54864         return continueTo(rightClickTank);
54865       }
54866       var wasChanged = false;
54867       reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { padding: 50 });
54868       context.on("enter.intro", function(mode) {
54869         if (mode.id === "browse") {
54870           continueTo(rightClickTank);
54871         } else if (mode.id === "move" || mode.id === "rotate") {
54872           continueTo(retryClickCircle);
54873         }
54874       });
54875       context.map().on("move.intro", function() {
54876         var node2 = selectMenuItem(context, "circularize").node();
54877         if (!wasChanged && !node2) {
54878           return continueTo(rightClickTank);
54879         }
54880         reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { duration: 0, padding: 50 });
54881       });
54882       context.history().on("change.intro", function() {
54883         wasChanged = true;
54884         context.history().on("change.intro", null);
54885         timeout2(function() {
54886           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
54887             continueTo(play);
54888           } else {
54889             continueTo(retryClickCircle);
54890           }
54891         }, 500);
54892       });
54893       function continueTo(nextStep) {
54894         context.on("enter.intro", null);
54895         context.map().on("move.intro", null);
54896         context.history().on("change.intro", null);
54897         nextStep();
54898       }
54899     }
54900     function retryClickCircle() {
54901       context.enter(modeBrowse(context));
54902       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
54903         buttonText: _t.html("intro.ok"),
54904         buttonCallback: function() {
54905           continueTo(rightClickTank);
54906         }
54907       });
54908       function continueTo(nextStep) {
54909         nextStep();
54910       }
54911     }
54912     function play() {
54913       dispatch10.call("done");
54914       reveal(".ideditor", helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }), {
54915         tooltipBox: ".intro-nav-wrap .chapter-startEditing",
54916         buttonText: _t.html("intro.ok"),
54917         buttonCallback: function() {
54918           reveal(".ideditor");
54919         }
54920       });
54921     }
54922     chapter.enter = function() {
54923       addHouse();
54924     };
54925     chapter.exit = function() {
54926       timeouts.forEach(window.clearTimeout);
54927       context.on("enter.intro exit.intro", null);
54928       context.map().on("move.intro drawn.intro", null);
54929       context.history().on("change.intro", null);
54930       context.container().select(".inspector-wrap").on("wheel.intro", null);
54931       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54932       context.container().select(".more-fields .combobox-input").on("click.intro", null);
54933     };
54934     chapter.restart = function() {
54935       chapter.exit();
54936       chapter.enter();
54937     };
54938     return utilRebind(chapter, dispatch10, "on");
54939   }
54940
54941   // modules/ui/intro/start_editing.js
54942   function uiIntroStartEditing(context, reveal) {
54943     var dispatch10 = dispatch_default("done", "startEditing");
54944     var modalSelection = select_default2(null);
54945     var chapter = {
54946       title: "intro.startediting.title"
54947     };
54948     function showHelp() {
54949       reveal(".map-control.help-control", helpHtml("intro.startediting.help"), {
54950         buttonText: _t.html("intro.ok"),
54951         buttonCallback: function() {
54952           shortcuts();
54953         }
54954       });
54955     }
54956     function shortcuts() {
54957       reveal(".map-control.help-control", helpHtml("intro.startediting.shortcuts"), {
54958         buttonText: _t.html("intro.ok"),
54959         buttonCallback: function() {
54960           showSave();
54961         }
54962       });
54963     }
54964     function showSave() {
54965       context.container().selectAll(".shaded").remove();
54966       reveal(".top-toolbar button.save", helpHtml("intro.startediting.save"), {
54967         buttonText: _t.html("intro.ok"),
54968         buttonCallback: function() {
54969           showStart();
54970         }
54971       });
54972     }
54973     function showStart() {
54974       context.container().selectAll(".shaded").remove();
54975       modalSelection = uiModal(context.container());
54976       modalSelection.select(".modal").attr("class", "modal-splash modal");
54977       modalSelection.selectAll(".close").remove();
54978       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
54979         modalSelection.remove();
54980       });
54981       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
54982       startbutton.append("h2").call(_t.append("intro.startediting.start"));
54983       dispatch10.call("startEditing");
54984     }
54985     chapter.enter = function() {
54986       showHelp();
54987     };
54988     chapter.exit = function() {
54989       modalSelection.remove();
54990       context.container().selectAll(".shaded").remove();
54991     };
54992     return utilRebind(chapter, dispatch10, "on");
54993   }
54994
54995   // modules/ui/intro/intro.js
54996   var chapterUi = {
54997     welcome: uiIntroWelcome,
54998     navigation: uiIntroNavigation,
54999     point: uiIntroPoint,
55000     area: uiIntroArea,
55001     line: uiIntroLine,
55002     building: uiIntroBuilding,
55003     startEditing: uiIntroStartEditing
55004   };
55005   var chapterFlow = [
55006     "welcome",
55007     "navigation",
55008     "point",
55009     "area",
55010     "line",
55011     "building",
55012     "startEditing"
55013   ];
55014   function uiIntro(context) {
55015     const INTRO_IMAGERY = "EsriWorldImageryClarity";
55016     let _introGraph = {};
55017     let _currChapter;
55018     function intro(selection2) {
55019       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
55020         for (let id2 in dataIntroGraph) {
55021           if (!_introGraph[id2]) {
55022             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
55023           }
55024         }
55025         selection2.call(startIntro);
55026       }).catch(function() {
55027       });
55028     }
55029     function startIntro(selection2) {
55030       context.enter(modeBrowse(context));
55031       let osm = context.connection();
55032       let history = context.history().toJSON();
55033       let hash = window.location.hash;
55034       let center = context.map().center();
55035       let zoom = context.map().zoom();
55036       let background = context.background().baseLayerSource();
55037       let overlays = context.background().overlayLayerSources();
55038       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
55039       let caches = osm && osm.caches();
55040       let baseEntities = context.history().graph().base().entities;
55041       context.ui().sidebar.expand();
55042       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
55043       context.inIntro(true);
55044       if (osm) {
55045         osm.toggle(false).reset();
55046       }
55047       context.history().reset();
55048       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
55049       context.history().checkpoint("initial");
55050       let imagery = context.background().findSource(INTRO_IMAGERY);
55051       if (imagery) {
55052         context.background().baseLayerSource(imagery);
55053       } else {
55054         context.background().bing();
55055       }
55056       overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55057       let layers = context.layers();
55058       layers.all().forEach((item) => {
55059         if (typeof item.layer.enabled === "function") {
55060           item.layer.enabled(item.id === "osm");
55061         }
55062       });
55063       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
55064       let curtain = uiCurtain(context.container().node());
55065       selection2.call(curtain);
55066       corePreferences("walkthrough_started", "yes");
55067       let storedProgress = corePreferences("walkthrough_progress") || "";
55068       let progress = storedProgress.split(";").filter(Boolean);
55069       let chapters = chapterFlow.map((chapter, i2) => {
55070         let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
55071           buttons.filter((d) => d.title === s.title).classed("finished", true);
55072           if (i2 < chapterFlow.length - 1) {
55073             const next = chapterFlow[i2 + 1];
55074             context.container().select(`button.chapter-${next}`).classed("next", true);
55075           }
55076           progress.push(chapter);
55077           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55078         });
55079         return s;
55080       });
55081       chapters[chapters.length - 1].on("startEditing", () => {
55082         progress.push("startEditing");
55083         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55084         let incomplete = utilArrayDifference(chapterFlow, progress);
55085         if (!incomplete.length) {
55086           corePreferences("walkthrough_completed", "yes");
55087         }
55088         curtain.remove();
55089         navwrap.remove();
55090         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
55091         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
55092         if (osm) {
55093           osm.toggle(true).reset().caches(caches);
55094         }
55095         context.history().reset().merge(Object.values(baseEntities));
55096         context.background().baseLayerSource(background);
55097         overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55098         if (history) {
55099           context.history().fromJSON(history, false);
55100         }
55101         context.map().centerZoom(center, zoom);
55102         window.location.replace(hash);
55103         context.inIntro(false);
55104       });
55105       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
55106       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
55107       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
55108       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
55109       buttons.append("span").html((d) => _t.html(d.title));
55110       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
55111       enterChapter(null, chapters[0]);
55112       function enterChapter(d3_event, newChapter) {
55113         if (_currChapter) {
55114           _currChapter.exit();
55115         }
55116         context.enter(modeBrowse(context));
55117         _currChapter = newChapter;
55118         _currChapter.enter();
55119         buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
55120       }
55121     }
55122     return intro;
55123   }
55124
55125   // modules/ui/issues_info.js
55126   function uiIssuesInfo(context) {
55127     var warningsItem = {
55128       id: "warnings",
55129       count: 0,
55130       iconID: "iD-icon-alert",
55131       descriptionID: "issues.warnings_and_errors"
55132     };
55133     var resolvedItem = {
55134       id: "resolved",
55135       count: 0,
55136       iconID: "iD-icon-apply",
55137       descriptionID: "issues.user_resolved_issues"
55138     };
55139     function update(selection2) {
55140       var shownItems = [];
55141       var liveIssues = context.validator().getIssues({
55142         what: corePreferences("validate-what") || "edited",
55143         where: corePreferences("validate-where") || "all"
55144       });
55145       if (liveIssues.length) {
55146         warningsItem.count = liveIssues.length;
55147         shownItems.push(warningsItem);
55148       }
55149       if (corePreferences("validate-what") === "all") {
55150         var resolvedIssues = context.validator().getResolvedIssues();
55151         if (resolvedIssues.length) {
55152           resolvedItem.count = resolvedIssues.length;
55153           shownItems.push(resolvedItem);
55154         }
55155       }
55156       var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
55157         return d.id;
55158       });
55159       chips.exit().remove();
55160       var enter = chips.enter().append("a").attr("class", function(d) {
55161         return "chip " + d.id + "-count";
55162       }).attr("href", "#").each(function(d) {
55163         var chipSelection = select_default2(this);
55164         var tooltipBehavior = uiTooltip().placement("top").title(_t.html(d.descriptionID));
55165         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
55166           d3_event.preventDefault();
55167           tooltipBehavior.hide(select_default2(this));
55168           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
55169         });
55170         chipSelection.call(svgIcon("#" + d.iconID));
55171       });
55172       enter.append("span").attr("class", "count");
55173       enter.merge(chips).selectAll("span.count").text(function(d) {
55174         return d.count.toString();
55175       });
55176     }
55177     return function(selection2) {
55178       update(selection2);
55179       context.validator().on("validated.infobox", function() {
55180         update(selection2);
55181       });
55182     };
55183   }
55184
55185   // modules/ui/map_in_map.js
55186   function uiMapInMap(context) {
55187     function mapInMap(selection2) {
55188       var backgroundLayer = rendererTileLayer(context);
55189       var overlayLayers = {};
55190       var projection2 = geoRawMercator();
55191       var dataLayer = svgData(projection2, context).showLabels(false);
55192       var debugLayer = svgDebug(projection2, context);
55193       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
55194       var wrap2 = select_default2(null);
55195       var tiles = select_default2(null);
55196       var viewport = select_default2(null);
55197       var _isTransformed = false;
55198       var _isHidden = true;
55199       var _skipEvents = false;
55200       var _gesture = null;
55201       var _zDiff = 6;
55202       var _dMini;
55203       var _cMini;
55204       var _tStart;
55205       var _tCurr;
55206       var _timeoutID;
55207       function zoomStarted() {
55208         if (_skipEvents)
55209           return;
55210         _tStart = _tCurr = projection2.transform();
55211         _gesture = null;
55212       }
55213       function zoomed(d3_event) {
55214         if (_skipEvents)
55215           return;
55216         var x = d3_event.transform.x;
55217         var y = d3_event.transform.y;
55218         var k = d3_event.transform.k;
55219         var isZooming = k !== _tStart.k;
55220         var isPanning = x !== _tStart.x || y !== _tStart.y;
55221         if (!isZooming && !isPanning) {
55222           return;
55223         }
55224         if (!_gesture) {
55225           _gesture = isZooming ? "zoom" : "pan";
55226         }
55227         var tMini = projection2.transform();
55228         var tX, tY, scale;
55229         if (_gesture === "zoom") {
55230           scale = k / tMini.k;
55231           tX = (_cMini[0] / scale - _cMini[0]) * scale;
55232           tY = (_cMini[1] / scale - _cMini[1]) * scale;
55233         } else {
55234           k = tMini.k;
55235           scale = 1;
55236           tX = x - tMini.x;
55237           tY = y - tMini.y;
55238         }
55239         utilSetTransform(tiles, tX, tY, scale);
55240         utilSetTransform(viewport, 0, 0, scale);
55241         _isTransformed = true;
55242         _tCurr = identity2.translate(x, y).scale(k);
55243         var zMain = geoScaleToZoom(context.projection.scale());
55244         var zMini = geoScaleToZoom(k);
55245         _zDiff = zMain - zMini;
55246         queueRedraw();
55247       }
55248       function zoomEnded() {
55249         if (_skipEvents)
55250           return;
55251         if (_gesture !== "pan")
55252           return;
55253         updateProjection();
55254         _gesture = null;
55255         context.map().center(projection2.invert(_cMini));
55256       }
55257       function updateProjection() {
55258         var loc = context.map().center();
55259         var tMain = context.projection.transform();
55260         var zMain = geoScaleToZoom(tMain.k);
55261         var zMini = Math.max(zMain - _zDiff, 0.5);
55262         var kMini = geoZoomToScale(zMini);
55263         projection2.translate([tMain.x, tMain.y]).scale(kMini);
55264         var point = projection2(loc);
55265         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
55266         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
55267         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
55268         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
55269         _tCurr = projection2.transform();
55270         if (_isTransformed) {
55271           utilSetTransform(tiles, 0, 0);
55272           utilSetTransform(viewport, 0, 0);
55273           _isTransformed = false;
55274         }
55275         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
55276         _skipEvents = true;
55277         wrap2.call(zoom.transform, _tCurr);
55278         _skipEvents = false;
55279       }
55280       function redraw() {
55281         clearTimeout(_timeoutID);
55282         if (_isHidden)
55283           return;
55284         updateProjection();
55285         var zMini = geoScaleToZoom(projection2.scale());
55286         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
55287         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
55288         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
55289         var background = tiles.selectAll(".map-in-map-background").data([0]);
55290         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
55291         var overlaySources = context.background().overlayLayerSources();
55292         var activeOverlayLayers = [];
55293         for (var i2 = 0; i2 < overlaySources.length; i2++) {
55294           if (overlaySources[i2].validZoom(zMini)) {
55295             if (!overlayLayers[i2])
55296               overlayLayers[i2] = rendererTileLayer(context);
55297             activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
55298           }
55299         }
55300         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
55301         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
55302         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
55303           return d.source().name();
55304         });
55305         overlays.exit().remove();
55306         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
55307           select_default2(this).call(layer);
55308         });
55309         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
55310         dataLayers.exit().remove();
55311         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
55312         if (_gesture !== "pan") {
55313           var getPath = path_default(projection2);
55314           var bbox = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
55315           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
55316           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
55317           var path = viewport.selectAll(".map-in-map-bbox").data([bbox]);
55318           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
55319             return getPath.area(d) < 30;
55320           });
55321         }
55322       }
55323       function queueRedraw() {
55324         clearTimeout(_timeoutID);
55325         _timeoutID = setTimeout(function() {
55326           redraw();
55327         }, 750);
55328       }
55329       function toggle(d3_event) {
55330         if (d3_event)
55331           d3_event.preventDefault();
55332         _isHidden = !_isHidden;
55333         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
55334         if (_isHidden) {
55335           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
55336             selection2.selectAll(".map-in-map").style("display", "none");
55337           });
55338         } else {
55339           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
55340             redraw();
55341           });
55342         }
55343       }
55344       uiMapInMap.toggle = toggle;
55345       wrap2 = selection2.selectAll(".map-in-map").data([0]);
55346       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
55347       _dMini = [200, 150];
55348       _cMini = geoVecScale(_dMini, 0.5);
55349       context.map().on("drawn.map-in-map", function(drawn) {
55350         if (drawn.full === true) {
55351           redraw();
55352         }
55353       });
55354       redraw();
55355       context.keybinding().on(_t("background.minimap.key"), toggle);
55356     }
55357     return mapInMap;
55358   }
55359
55360   // modules/ui/notice.js
55361   function uiNotice(context) {
55362     return function(selection2) {
55363       var div = selection2.append("div").attr("class", "notice");
55364       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
55365         context.map().zoomEase(context.minEditableZoom());
55366       }).on("wheel", function(d3_event) {
55367         var e22 = new WheelEvent(d3_event.type, d3_event);
55368         context.surface().node().dispatchEvent(e22);
55369       });
55370       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
55371       function disableTooHigh() {
55372         var canEdit = context.map().zoom() >= context.minEditableZoom();
55373         div.style("display", canEdit ? "none" : "block");
55374       }
55375       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
55376       disableTooHigh();
55377     };
55378   }
55379
55380   // modules/ui/photoviewer.js
55381   function uiPhotoviewer(context) {
55382     var dispatch10 = dispatch_default("resize");
55383     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
55384     function photoviewer(selection2) {
55385       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
55386         if (services.streetside) {
55387           services.streetside.hideViewer(context);
55388         }
55389         if (services.mapillary) {
55390           services.mapillary.hideViewer(context);
55391         }
55392         if (services.kartaview) {
55393           services.kartaview.hideViewer(context);
55394         }
55395       }).append("div").call(svgIcon("#iD-icon-close"));
55396       function preventDefault(d3_event) {
55397         d3_event.preventDefault();
55398       }
55399       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true }));
55400       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true }));
55401       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true }));
55402       function buildResizeListener(target, eventName, dispatch11, options2) {
55403         var resizeOnX = !!options2.resizeOnX;
55404         var resizeOnY = !!options2.resizeOnY;
55405         var minHeight = options2.minHeight || 240;
55406         var minWidth = options2.minWidth || 320;
55407         var pointerId;
55408         var startX;
55409         var startY;
55410         var startWidth;
55411         var startHeight;
55412         function startResize(d3_event) {
55413           if (pointerId !== (d3_event.pointerId || "mouse"))
55414             return;
55415           d3_event.preventDefault();
55416           d3_event.stopPropagation();
55417           var mapSize = context.map().dimensions();
55418           if (resizeOnX) {
55419             var maxWidth = mapSize[0];
55420             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
55421             target.style("width", newWidth + "px");
55422           }
55423           if (resizeOnY) {
55424             var maxHeight = mapSize[1] - 90;
55425             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
55426             target.style("height", newHeight + "px");
55427           }
55428           dispatch11.call(eventName, target, utilGetDimensions(target, true));
55429         }
55430         function clamp3(num, min3, max3) {
55431           return Math.max(min3, Math.min(num, max3));
55432         }
55433         function stopResize(d3_event) {
55434           if (pointerId !== (d3_event.pointerId || "mouse"))
55435             return;
55436           d3_event.preventDefault();
55437           d3_event.stopPropagation();
55438           select_default2(window).on("." + eventName, null);
55439         }
55440         return function initResize(d3_event) {
55441           d3_event.preventDefault();
55442           d3_event.stopPropagation();
55443           pointerId = d3_event.pointerId || "mouse";
55444           startX = d3_event.clientX;
55445           startY = d3_event.clientY;
55446           var targetRect = target.node().getBoundingClientRect();
55447           startWidth = targetRect.width;
55448           startHeight = targetRect.height;
55449           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
55450           if (_pointerPrefix === "pointer") {
55451             select_default2(window).on("pointercancel." + eventName, stopResize, false);
55452           }
55453         };
55454       }
55455     }
55456     photoviewer.onMapResize = function() {
55457       var photoviewer2 = context.container().select(".photoviewer");
55458       var content = context.container().select(".main-content");
55459       var mapDimensions = utilGetDimensions(content, true);
55460       var photoDimensions = utilGetDimensions(photoviewer2, true);
55461       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
55462         var setPhotoDimensions = [
55463           Math.min(photoDimensions[0], mapDimensions[0]),
55464           Math.min(photoDimensions[1], mapDimensions[1] - 90)
55465         ];
55466         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
55467         dispatch10.call("resize", photoviewer2, setPhotoDimensions);
55468       }
55469     };
55470     return utilRebind(photoviewer, dispatch10, "on");
55471   }
55472
55473   // modules/ui/restore.js
55474   function uiRestore(context) {
55475     return function(selection2) {
55476       if (!context.history().hasRestorableChanges())
55477         return;
55478       let modalSelection = uiModal(selection2, true);
55479       modalSelection.select(".modal").attr("class", "modal fillL");
55480       let introModal = modalSelection.select(".content");
55481       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
55482       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
55483       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
55484       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
55485         context.history().restore();
55486         modalSelection.remove();
55487       });
55488       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
55489       restore.append("div").call(_t.append("restore.restore"));
55490       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
55491         context.history().clearSaved();
55492         modalSelection.remove();
55493       });
55494       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
55495       reset.append("div").call(_t.append("restore.reset"));
55496       restore.node().focus();
55497     };
55498   }
55499
55500   // modules/ui/scale.js
55501   function uiScale(context) {
55502     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
55503     function scaleDefs(loc1, loc2) {
55504       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;
55505       if (isImperial) {
55506         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
55507       } else {
55508         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
55509       }
55510       for (i2 = 0; i2 < buckets.length; i2++) {
55511         val = buckets[i2];
55512         if (dist >= val) {
55513           scale.dist = Math.floor(dist / val) * val;
55514           break;
55515         } else {
55516           scale.dist = +dist.toFixed(2);
55517         }
55518       }
55519       dLon = geoMetersToLon(scale.dist / conversion, lat);
55520       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
55521       scale.text = displayLength(scale.dist / conversion, isImperial);
55522       return scale;
55523     }
55524     function update(selection2) {
55525       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
55526       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
55527       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
55528     }
55529     return function(selection2) {
55530       function switchUnits() {
55531         isImperial = !isImperial;
55532         selection2.call(update);
55533       }
55534       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
55535       scalegroup.append("path").attr("class", "scale-path");
55536       selection2.append("div").attr("class", "scale-text");
55537       selection2.call(update);
55538       context.map().on("move.scale", function() {
55539         update(selection2);
55540       });
55541     };
55542   }
55543
55544   // modules/ui/shortcuts.js
55545   function uiShortcuts(context) {
55546     var detected = utilDetect();
55547     var _activeTab = 0;
55548     var _modalSelection;
55549     var _selection = select_default2(null);
55550     var _dataShortcuts;
55551     function shortcutsModal(_modalSelection2) {
55552       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
55553       var content = _modalSelection2.select(".content");
55554       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
55555       _mainFileFetcher.get("shortcuts").then(function(data) {
55556         _dataShortcuts = data;
55557         content.call(render);
55558       }).catch(function() {
55559       });
55560     }
55561     function render(selection2) {
55562       if (!_dataShortcuts)
55563         return;
55564       var wrapper = selection2.selectAll(".wrapper").data([0]);
55565       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
55566       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
55567       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
55568       wrapper = wrapper.merge(wrapperEnter);
55569       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
55570       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
55571         d3_event.preventDefault();
55572         var i2 = _dataShortcuts.indexOf(d);
55573         _activeTab = i2;
55574         render(selection2);
55575       });
55576       tabsEnter.append("span").html(function(d) {
55577         return _t.html(d.text);
55578       });
55579       wrapper.selectAll(".tab").classed("active", function(d, i2) {
55580         return i2 === _activeTab;
55581       });
55582       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
55583       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
55584         return "shortcut-tab shortcut-tab-" + d.tab;
55585       });
55586       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
55587         return d.columns;
55588       }).enter().append("table").attr("class", "shortcut-column");
55589       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
55590         return d.rows;
55591       }).enter().append("tr").attr("class", "shortcut-row");
55592       var sectionRows = rowsEnter.filter(function(d) {
55593         return !d.shortcuts;
55594       });
55595       sectionRows.append("td");
55596       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
55597         return _t.html(d.text);
55598       });
55599       var shortcutRows = rowsEnter.filter(function(d) {
55600         return d.shortcuts;
55601       });
55602       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
55603       var modifierKeys = shortcutKeys.filter(function(d) {
55604         return d.modifiers;
55605       });
55606       modifierKeys.selectAll("kbd.modifier").data(function(d) {
55607         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
55608           return ["\u2318"];
55609         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
55610           return [];
55611         } else {
55612           return d.modifiers;
55613         }
55614       }).enter().each(function() {
55615         var selection3 = select_default2(this);
55616         selection3.append("kbd").attr("class", "modifier").text(function(d) {
55617           return uiCmd.display(d);
55618         });
55619         selection3.append("span").text("+");
55620       });
55621       shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
55622         var arr = d.shortcuts;
55623         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
55624           arr = ["Y"];
55625         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
55626           arr = ["F11"];
55627         }
55628         arr = arr.map(function(s) {
55629           return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
55630         });
55631         return utilArrayUniq(arr).map(function(s) {
55632           return {
55633             shortcut: s,
55634             separator: d.separator,
55635             suffix: d.suffix
55636           };
55637         });
55638       }).enter().each(function(d, i2, nodes) {
55639         var selection3 = select_default2(this);
55640         var click = d.shortcut.toLowerCase().match(/(.*).click/);
55641         if (click && click[1]) {
55642           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
55643         } else if (d.shortcut.toLowerCase() === "long-press") {
55644           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
55645         } else if (d.shortcut.toLowerCase() === "tap") {
55646           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
55647         } else {
55648           selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
55649             return d2.shortcut;
55650           });
55651         }
55652         if (i2 < nodes.length - 1) {
55653           selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
55654         } else if (i2 === nodes.length - 1 && d.suffix) {
55655           selection3.append("span").text(d.suffix);
55656         }
55657       });
55658       shortcutKeys.filter(function(d) {
55659         return d.gesture;
55660       }).each(function() {
55661         var selection3 = select_default2(this);
55662         selection3.append("span").text("+");
55663         selection3.append("span").attr("class", "gesture").html(function(d) {
55664           return _t.html(d.gesture);
55665         });
55666       });
55667       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
55668         return d.text ? _t.html(d.text) : "\xA0";
55669       });
55670       wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
55671         return i2 === _activeTab ? "flex" : "none";
55672       });
55673     }
55674     return function(selection2, show) {
55675       _selection = selection2;
55676       if (show) {
55677         _modalSelection = uiModal(selection2);
55678         _modalSelection.call(shortcutsModal);
55679       } else {
55680         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
55681           if (context.container().selectAll(".modal-shortcuts").size()) {
55682             if (_modalSelection) {
55683               _modalSelection.close();
55684               _modalSelection = null;
55685             }
55686           } else {
55687             _modalSelection = uiModal(_selection);
55688             _modalSelection.call(shortcutsModal);
55689           }
55690         });
55691       }
55692     };
55693   }
55694
55695   // modules/ui/data_header.js
55696   function uiDataHeader() {
55697     var _datum;
55698     function dataHeader(selection2) {
55699       var header = selection2.selectAll(".data-header").data(_datum ? [_datum] : [], function(d) {
55700         return d.__featurehash__;
55701       });
55702       header.exit().remove();
55703       var headerEnter = header.enter().append("div").attr("class", "data-header");
55704       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
55705       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
55706       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
55707     }
55708     dataHeader.datum = function(val) {
55709       if (!arguments.length)
55710         return _datum;
55711       _datum = val;
55712       return this;
55713     };
55714     return dataHeader;
55715   }
55716
55717   // modules/ui/combobox.js
55718   var _comboHideTimerID;
55719   function uiCombobox(context, klass) {
55720     var dispatch10 = dispatch_default("accept", "cancel");
55721     var container = context.container();
55722     var _suggestions = [];
55723     var _data = [];
55724     var _fetched = {};
55725     var _selected = null;
55726     var _canAutocomplete = true;
55727     var _caseSensitive = false;
55728     var _cancelFetch = false;
55729     var _minItems = 2;
55730     var _tDown = 0;
55731     var _mouseEnterHandler, _mouseLeaveHandler;
55732     var _fetcher = function(val, cb) {
55733       cb(_data.filter(function(d) {
55734         var terms = d.terms || [];
55735         terms.push(d.value);
55736         return terms.some(function(term) {
55737           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
55738         });
55739       }));
55740     };
55741     var combobox = function(input, attachTo) {
55742       if (!input || input.empty())
55743         return;
55744       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() {
55745         var parent = this.parentNode;
55746         var sibling = this.nextSibling;
55747         select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
55748           return d === input.node();
55749         }).data([input.node()]).enter().insert("div", function() {
55750           return sibling;
55751         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
55752           d3_event.preventDefault();
55753           input.node().focus();
55754           mousedown(d3_event);
55755         }).on("mouseup.combo-caret", function(d3_event) {
55756           d3_event.preventDefault();
55757           mouseup(d3_event);
55758         });
55759       });
55760       function mousedown(d3_event) {
55761         if (d3_event.button !== 0)
55762           return;
55763         if (input.classed("disabled"))
55764           return;
55765         _tDown = +new Date();
55766         var start2 = input.property("selectionStart");
55767         var end = input.property("selectionEnd");
55768         if (start2 !== end) {
55769           var val = utilGetSetValue(input);
55770           input.node().setSelectionRange(val.length, val.length);
55771           return;
55772         }
55773         input.on("mouseup.combo-input", mouseup);
55774       }
55775       function mouseup(d3_event) {
55776         input.on("mouseup.combo-input", null);
55777         if (d3_event.button !== 0)
55778           return;
55779         if (input.classed("disabled"))
55780           return;
55781         if (input.node() !== document.activeElement)
55782           return;
55783         var start2 = input.property("selectionStart");
55784         var end = input.property("selectionEnd");
55785         if (start2 !== end)
55786           return;
55787         var combo = container.selectAll(".combobox");
55788         if (combo.empty() || combo.datum() !== input.node()) {
55789           var tOrig = _tDown;
55790           window.setTimeout(function() {
55791             if (tOrig !== _tDown)
55792               return;
55793             fetchComboData("", function() {
55794               show();
55795               render();
55796             });
55797           }, 250);
55798         } else {
55799           hide();
55800         }
55801       }
55802       function focus() {
55803         fetchComboData("");
55804       }
55805       function blur() {
55806         _comboHideTimerID = window.setTimeout(hide, 75);
55807       }
55808       function show() {
55809         hide();
55810         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) {
55811           d3_event.preventDefault();
55812         });
55813         container.on("scroll.combo-scroll", render, true);
55814       }
55815       function hide() {
55816         if (_comboHideTimerID) {
55817           window.clearTimeout(_comboHideTimerID);
55818           _comboHideTimerID = void 0;
55819         }
55820         container.selectAll(".combobox").remove();
55821         container.on("scroll.combo-scroll", null);
55822       }
55823       function keydown(d3_event) {
55824         var shown = !container.selectAll(".combobox").empty();
55825         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
55826         switch (d3_event.keyCode) {
55827           case 8:
55828           case 46:
55829             d3_event.stopPropagation();
55830             _selected = null;
55831             render();
55832             input.on("input.combo-input", function() {
55833               var start2 = input.property("selectionStart");
55834               input.node().setSelectionRange(start2, start2);
55835               input.on("input.combo-input", change);
55836             });
55837             break;
55838           case 9:
55839             accept(d3_event);
55840             break;
55841           case 13:
55842             d3_event.preventDefault();
55843             d3_event.stopPropagation();
55844             break;
55845           case 38:
55846             if (tagName === "textarea" && !shown)
55847               return;
55848             d3_event.preventDefault();
55849             if (tagName === "input" && !shown) {
55850               show();
55851             }
55852             nav(-1);
55853             break;
55854           case 40:
55855             if (tagName === "textarea" && !shown)
55856               return;
55857             d3_event.preventDefault();
55858             if (tagName === "input" && !shown) {
55859               show();
55860             }
55861             nav(1);
55862             break;
55863         }
55864       }
55865       function keyup(d3_event) {
55866         switch (d3_event.keyCode) {
55867           case 27:
55868             cancel();
55869             break;
55870           case 13:
55871             accept(d3_event);
55872             break;
55873         }
55874       }
55875       function change() {
55876         fetchComboData(value(), function() {
55877           _selected = null;
55878           var val = input.property("value");
55879           if (_suggestions.length) {
55880             if (input.property("selectionEnd") === val.length) {
55881               _selected = tryAutocomplete();
55882             }
55883             if (!_selected) {
55884               _selected = val;
55885             }
55886           }
55887           if (val.length) {
55888             var combo = container.selectAll(".combobox");
55889             if (combo.empty()) {
55890               show();
55891             }
55892           } else {
55893             hide();
55894           }
55895           render();
55896         });
55897       }
55898       function nav(dir) {
55899         if (_suggestions.length) {
55900           var index = -1;
55901           for (var i2 = 0; i2 < _suggestions.length; i2++) {
55902             if (_selected && _suggestions[i2].value === _selected) {
55903               index = i2;
55904               break;
55905             }
55906           }
55907           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
55908           _selected = _suggestions[index].value;
55909           input.property("value", _selected);
55910         }
55911         render();
55912         ensureVisible();
55913       }
55914       function ensureVisible() {
55915         var combo = container.selectAll(".combobox");
55916         if (combo.empty())
55917           return;
55918         var containerRect = container.node().getBoundingClientRect();
55919         var comboRect = combo.node().getBoundingClientRect();
55920         if (comboRect.bottom > containerRect.bottom) {
55921           var node = attachTo ? attachTo.node() : input.node();
55922           node.scrollIntoView({ behavior: "instant", block: "center" });
55923           render();
55924         }
55925         var selected = combo.selectAll(".combobox-option.selected").node();
55926         if (selected) {
55927           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
55928         }
55929       }
55930       function value() {
55931         var value2 = input.property("value");
55932         var start2 = input.property("selectionStart");
55933         var end = input.property("selectionEnd");
55934         if (start2 && end) {
55935           value2 = value2.substring(0, start2);
55936         }
55937         return value2;
55938       }
55939       function fetchComboData(v, cb) {
55940         _cancelFetch = false;
55941         _fetcher.call(input, v, function(results) {
55942           if (_cancelFetch)
55943             return;
55944           _suggestions = results;
55945           results.forEach(function(d) {
55946             _fetched[d.value] = d;
55947           });
55948           if (cb) {
55949             cb();
55950           }
55951         });
55952       }
55953       function tryAutocomplete() {
55954         if (!_canAutocomplete)
55955           return;
55956         var val = _caseSensitive ? value() : value().toLowerCase();
55957         if (!val)
55958           return;
55959         if (!isNaN(parseFloat(val)) && isFinite(val))
55960           return;
55961         var bestIndex = -1;
55962         for (var i2 = 0; i2 < _suggestions.length; i2++) {
55963           var suggestion = _suggestions[i2].value;
55964           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
55965           if (compare === val) {
55966             bestIndex = i2;
55967             break;
55968           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
55969             bestIndex = i2;
55970           }
55971         }
55972         if (bestIndex !== -1) {
55973           var bestVal = _suggestions[bestIndex].value;
55974           input.property("value", bestVal);
55975           input.node().setSelectionRange(val.length, bestVal.length);
55976           return bestVal;
55977         }
55978       }
55979       function render() {
55980         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
55981           hide();
55982           return;
55983         }
55984         var shown = !container.selectAll(".combobox").empty();
55985         if (!shown)
55986           return;
55987         var combo = container.selectAll(".combobox");
55988         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
55989           return d.value;
55990         });
55991         options2.exit().remove();
55992         options2.enter().append("a").attr("class", function(d) {
55993           return "combobox-option " + (d.klass || "");
55994         }).attr("title", function(d) {
55995           return d.title;
55996         }).html(function(d) {
55997           return d.display || d.value;
55998         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
55999           return d.value === _selected;
56000         }).on("click.combo-option", accept).order();
56001         var node = attachTo ? attachTo.node() : input.node();
56002         var containerRect = container.node().getBoundingClientRect();
56003         var rect = node.getBoundingClientRect();
56004         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
56005       }
56006       function accept(d3_event, d) {
56007         _cancelFetch = true;
56008         var thiz = input.node();
56009         if (d) {
56010           utilGetSetValue(input, d.value);
56011           utilTriggerEvent(input, "change");
56012         }
56013         var val = utilGetSetValue(input);
56014         thiz.setSelectionRange(val.length, val.length);
56015         d = _fetched[val];
56016         dispatch10.call("accept", thiz, d, val);
56017         hide();
56018       }
56019       function cancel() {
56020         _cancelFetch = true;
56021         var thiz = input.node();
56022         var val = utilGetSetValue(input);
56023         var start2 = input.property("selectionStart");
56024         var end = input.property("selectionEnd");
56025         val = val.slice(0, start2) + val.slice(end);
56026         utilGetSetValue(input, val);
56027         thiz.setSelectionRange(val.length, val.length);
56028         dispatch10.call("cancel", thiz);
56029         hide();
56030       }
56031     };
56032     combobox.canAutocomplete = function(val) {
56033       if (!arguments.length)
56034         return _canAutocomplete;
56035       _canAutocomplete = val;
56036       return combobox;
56037     };
56038     combobox.caseSensitive = function(val) {
56039       if (!arguments.length)
56040         return _caseSensitive;
56041       _caseSensitive = val;
56042       return combobox;
56043     };
56044     combobox.data = function(val) {
56045       if (!arguments.length)
56046         return _data;
56047       _data = val;
56048       return combobox;
56049     };
56050     combobox.fetcher = function(val) {
56051       if (!arguments.length)
56052         return _fetcher;
56053       _fetcher = val;
56054       return combobox;
56055     };
56056     combobox.minItems = function(val) {
56057       if (!arguments.length)
56058         return _minItems;
56059       _minItems = val;
56060       return combobox;
56061     };
56062     combobox.itemsMouseEnter = function(val) {
56063       if (!arguments.length)
56064         return _mouseEnterHandler;
56065       _mouseEnterHandler = val;
56066       return combobox;
56067     };
56068     combobox.itemsMouseLeave = function(val) {
56069       if (!arguments.length)
56070         return _mouseLeaveHandler;
56071       _mouseLeaveHandler = val;
56072       return combobox;
56073     };
56074     return utilRebind(combobox, dispatch10, "on");
56075   }
56076   uiCombobox.off = function(input, context) {
56077     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);
56078     context.container().on("scroll.combo-scroll", null);
56079   };
56080
56081   // modules/ui/disclosure.js
56082   function uiDisclosure(context, key, expandedDefault) {
56083     var dispatch10 = dispatch_default("toggled");
56084     var _expanded;
56085     var _label = utilFunctor("");
56086     var _updatePreference = true;
56087     var _content = function() {
56088     };
56089     var disclosure = function(selection2) {
56090       if (_expanded === void 0 || _expanded === null) {
56091         var preference = corePreferences("disclosure." + key + ".expanded");
56092         _expanded = preference === null ? !!expandedDefault : preference === "true";
56093       }
56094       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
56095       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"));
56096       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
56097       hideToggle = hideToggleEnter.merge(hideToggle);
56098       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
56099       hideToggle.selectAll(".hide-toggle-text").html(_label());
56100       hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
56101       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
56102       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
56103       if (_expanded) {
56104         wrap2.call(_content);
56105       }
56106       function toggle(d3_event) {
56107         d3_event.preventDefault();
56108         _expanded = !_expanded;
56109         if (_updatePreference) {
56110           corePreferences("disclosure." + key + ".expanded", _expanded);
56111         }
56112         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
56113         hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
56114         wrap2.call(uiToggle(_expanded));
56115         if (_expanded) {
56116           wrap2.call(_content);
56117         }
56118         dispatch10.call("toggled", this, _expanded);
56119       }
56120     };
56121     disclosure.label = function(val) {
56122       if (!arguments.length)
56123         return _label;
56124       _label = utilFunctor(val);
56125       return disclosure;
56126     };
56127     disclosure.expanded = function(val) {
56128       if (!arguments.length)
56129         return _expanded;
56130       _expanded = val;
56131       return disclosure;
56132     };
56133     disclosure.updatePreference = function(val) {
56134       if (!arguments.length)
56135         return _updatePreference;
56136       _updatePreference = val;
56137       return disclosure;
56138     };
56139     disclosure.content = function(val) {
56140       if (!arguments.length)
56141         return _content;
56142       _content = val;
56143       return disclosure;
56144     };
56145     return utilRebind(disclosure, dispatch10, "on");
56146   }
56147
56148   // modules/ui/section.js
56149   function uiSection(id2, context) {
56150     var _classes = utilFunctor("");
56151     var _shouldDisplay;
56152     var _content;
56153     var _disclosure;
56154     var _label;
56155     var _expandedByDefault = utilFunctor(true);
56156     var _disclosureContent;
56157     var _disclosureExpanded;
56158     var _containerSelection = select_default2(null);
56159     var section = {
56160       id: id2
56161     };
56162     section.classes = function(val) {
56163       if (!arguments.length)
56164         return _classes;
56165       _classes = utilFunctor(val);
56166       return section;
56167     };
56168     section.label = function(val) {
56169       if (!arguments.length)
56170         return _label;
56171       _label = utilFunctor(val);
56172       return section;
56173     };
56174     section.expandedByDefault = function(val) {
56175       if (!arguments.length)
56176         return _expandedByDefault;
56177       _expandedByDefault = utilFunctor(val);
56178       return section;
56179     };
56180     section.shouldDisplay = function(val) {
56181       if (!arguments.length)
56182         return _shouldDisplay;
56183       _shouldDisplay = utilFunctor(val);
56184       return section;
56185     };
56186     section.content = function(val) {
56187       if (!arguments.length)
56188         return _content;
56189       _content = val;
56190       return section;
56191     };
56192     section.disclosureContent = function(val) {
56193       if (!arguments.length)
56194         return _disclosureContent;
56195       _disclosureContent = val;
56196       return section;
56197     };
56198     section.disclosureExpanded = function(val) {
56199       if (!arguments.length)
56200         return _disclosureExpanded;
56201       _disclosureExpanded = val;
56202       return section;
56203     };
56204     section.render = function(selection2) {
56205       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
56206       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
56207       _containerSelection = sectionEnter.merge(_containerSelection);
56208       _containerSelection.call(renderContent);
56209     };
56210     section.reRender = function() {
56211       _containerSelection.call(renderContent);
56212     };
56213     section.selection = function() {
56214       return _containerSelection;
56215     };
56216     section.disclosure = function() {
56217       return _disclosure;
56218     };
56219     function renderContent(selection2) {
56220       if (_shouldDisplay) {
56221         var shouldDisplay = _shouldDisplay();
56222         selection2.classed("hide", !shouldDisplay);
56223         if (!shouldDisplay) {
56224           selection2.html("");
56225           return;
56226         }
56227       }
56228       if (_disclosureContent) {
56229         if (!_disclosure) {
56230           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
56231         }
56232         if (_disclosureExpanded !== void 0) {
56233           _disclosure.expanded(_disclosureExpanded);
56234           _disclosureExpanded = void 0;
56235         }
56236         selection2.call(_disclosure);
56237         return;
56238       }
56239       if (_content) {
56240         selection2.call(_content);
56241       }
56242     }
56243     return section;
56244   }
56245
56246   // modules/ui/tag_reference.js
56247   function uiTagReference(what) {
56248     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
56249     var tagReference = {};
56250     var _button = select_default2(null);
56251     var _body = select_default2(null);
56252     var _loaded;
56253     var _showing;
56254     function load() {
56255       if (!wikibase)
56256         return;
56257       _button.classed("tag-reference-loading", true);
56258       wikibase.getDocs(what, gotDocs);
56259     }
56260     function gotDocs(err, docs) {
56261       _body.html("");
56262       if (!docs || !docs.title) {
56263         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
56264         done();
56265         return;
56266       }
56267       if (docs.imageURL) {
56268         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
56269           done();
56270         }).on("error", function() {
56271           select_default2(this).remove();
56272           done();
56273         });
56274       } else {
56275         done();
56276       }
56277       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
56278       if (docs.description) {
56279         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
56280       } else {
56281         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
56282       }
56283       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"));
56284       if (docs.wiki) {
56285         _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));
56286       }
56287       if (what.key === "comment") {
56288         _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"));
56289       }
56290     }
56291     function done() {
56292       _loaded = true;
56293       _button.classed("tag-reference-loading", false);
56294       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
56295       _showing = true;
56296       _button.selectAll("svg.icon use").each(function() {
56297         var iconUse = select_default2(this);
56298         if (iconUse.attr("href") === "#iD-icon-info") {
56299           iconUse.attr("href", "#iD-icon-info-filled");
56300         }
56301       });
56302     }
56303     function hide() {
56304       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
56305         _body.classed("expanded", false);
56306       });
56307       _showing = false;
56308       _button.selectAll("svg.icon use").each(function() {
56309         var iconUse = select_default2(this);
56310         if (iconUse.attr("href") === "#iD-icon-info-filled") {
56311           iconUse.attr("href", "#iD-icon-info");
56312         }
56313       });
56314     }
56315     tagReference.button = function(selection2, klass, iconName) {
56316       _button = selection2.selectAll(".tag-reference-button").data([0]);
56317       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
56318       _button.on("click", function(d3_event) {
56319         d3_event.stopPropagation();
56320         d3_event.preventDefault();
56321         this.blur();
56322         if (_showing) {
56323           hide();
56324         } else if (_loaded) {
56325           done();
56326         } else {
56327           load();
56328         }
56329       });
56330     };
56331     tagReference.body = function(selection2) {
56332       var itemID = what.qid || what.key + "-" + (what.value || "");
56333       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
56334         return d;
56335       });
56336       _body.exit().remove();
56337       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
56338       if (_showing === false) {
56339         hide();
56340       }
56341     };
56342     tagReference.showing = function(val) {
56343       if (!arguments.length)
56344         return _showing;
56345       _showing = val;
56346       return tagReference;
56347     };
56348     return tagReference;
56349   }
56350
56351   // modules/ui/field_help.js
56352   function uiFieldHelp(context, fieldName) {
56353     var fieldHelp = {};
56354     var _inspector = select_default2(null);
56355     var _wrap = select_default2(null);
56356     var _body = select_default2(null);
56357     var fieldHelpKeys = {
56358       restrictions: [
56359         ["about", [
56360           "about",
56361           "from_via_to",
56362           "maxdist",
56363           "maxvia"
56364         ]],
56365         ["inspecting", [
56366           "about",
56367           "from_shadow",
56368           "allow_shadow",
56369           "restrict_shadow",
56370           "only_shadow",
56371           "restricted",
56372           "only"
56373         ]],
56374         ["modifying", [
56375           "about",
56376           "indicators",
56377           "allow_turn",
56378           "restrict_turn",
56379           "only_turn"
56380         ]],
56381         ["tips", [
56382           "simple",
56383           "simple_example",
56384           "indirect",
56385           "indirect_example",
56386           "indirect_noedit"
56387         ]]
56388       ]
56389     };
56390     var fieldHelpHeadings = {};
56391     var replacements = {
56392       distField: { html: _t.html("restriction.controls.distance") },
56393       viaField: { html: _t.html("restriction.controls.via") },
56394       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
56395       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
56396       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
56397       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
56398       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
56399       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
56400       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
56401     };
56402     var docs = fieldHelpKeys[fieldName].map(function(key) {
56403       var helpkey = "help.field." + fieldName + "." + key[0];
56404       var text2 = key[1].reduce(function(all, part) {
56405         var subkey = helpkey + "." + part;
56406         var depth = fieldHelpHeadings[subkey];
56407         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
56408         return all + hhh + _t.html(subkey, replacements) + "\n\n";
56409       }, "");
56410       return {
56411         key: helpkey,
56412         title: _t.html(helpkey + ".title"),
56413         html: marked(text2.trim())
56414       };
56415     });
56416     function show() {
56417       updatePosition();
56418       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
56419     }
56420     function hide() {
56421       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
56422         _body.classed("hide", true);
56423       });
56424     }
56425     function clickHelp(index) {
56426       var d = docs[index];
56427       var tkeys = fieldHelpKeys[fieldName][index][1];
56428       _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
56429         return i2 === index;
56430       });
56431       var content = _body.selectAll(".field-help-content").html(d.html);
56432       content.selectAll("p").attr("class", function(d2, i2) {
56433         return tkeys[i2];
56434       });
56435       if (d.key === "help.field.restrictions.inspecting") {
56436         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
56437       } else if (d.key === "help.field.restrictions.modifying") {
56438         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
56439       }
56440     }
56441     fieldHelp.button = function(selection2) {
56442       if (_body.empty())
56443         return;
56444       var button = selection2.selectAll(".field-help-button").data([0]);
56445       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
56446         d3_event.stopPropagation();
56447         d3_event.preventDefault();
56448         if (_body.classed("hide")) {
56449           show();
56450         } else {
56451           hide();
56452         }
56453       });
56454     };
56455     function updatePosition() {
56456       var wrap2 = _wrap.node();
56457       var inspector = _inspector.node();
56458       var wRect = wrap2.getBoundingClientRect();
56459       var iRect = inspector.getBoundingClientRect();
56460       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
56461     }
56462     fieldHelp.body = function(selection2) {
56463       _wrap = selection2.selectAll(".form-field-input-wrap");
56464       if (_wrap.empty())
56465         return;
56466       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
56467       if (_inspector.empty())
56468         return;
56469       _body = _inspector.selectAll(".field-help-body").data([0]);
56470       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
56471       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
56472       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
56473       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
56474         d3_event.stopPropagation();
56475         d3_event.preventDefault();
56476         hide();
56477       }).call(svgIcon("#iD-icon-close"));
56478       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
56479       var titles = docs.map(function(d) {
56480         return d.title;
56481       });
56482       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
56483         return d;
56484       }).on("click", function(d3_event, d) {
56485         d3_event.stopPropagation();
56486         d3_event.preventDefault();
56487         clickHelp(titles.indexOf(d));
56488       });
56489       enter.append("div").attr("class", "field-help-content");
56490       _body = _body.merge(enter);
56491       clickHelp(0);
56492     };
56493     return fieldHelp;
56494   }
56495
56496   // modules/ui/fields/check.js
56497   function uiFieldCheck(field, context) {
56498     var dispatch10 = dispatch_default("change");
56499     var options2 = field.options;
56500     var values = [];
56501     var texts = [];
56502     var _tags;
56503     var input = select_default2(null);
56504     var text2 = select_default2(null);
56505     var label = select_default2(null);
56506     var reverser = select_default2(null);
56507     var _impliedYes;
56508     var _entityIDs = [];
56509     var _value;
56510     if (options2) {
56511       for (var i2 in options2) {
56512         var v = options2[i2];
56513         values.push(v === "undefined" ? void 0 : v);
56514         texts.push(field.t.html("options." + v, { "default": v }));
56515       }
56516     } else {
56517       values = [void 0, "yes"];
56518       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
56519       if (field.type !== "defaultCheck") {
56520         values.push("no");
56521         texts.push(_t.html("inspector.check.no"));
56522       }
56523     }
56524     function checkImpliedYes() {
56525       _impliedYes = field.id === "oneway_yes";
56526       if (field.id === "oneway") {
56527         var entity = context.entity(_entityIDs[0]);
56528         for (var key in entity.tags) {
56529           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
56530             _impliedYes = true;
56531             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
56532             break;
56533           }
56534         }
56535       }
56536     }
56537     function reverserHidden() {
56538       if (!context.container().select("div.inspector-hover").empty())
56539         return true;
56540       return !(_value === "yes" || _impliedYes && !_value);
56541     }
56542     function reverserSetText(selection2) {
56543       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
56544       if (reverserHidden() || !entity)
56545         return selection2;
56546       var first = entity.first();
56547       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
56548       var pseudoDirection = first < last;
56549       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
56550       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
56551       return selection2;
56552     }
56553     var check = function(selection2) {
56554       checkImpliedYes();
56555       label = selection2.selectAll(".form-field-input-wrap").data([0]);
56556       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
56557       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
56558       enter.append("span").html(texts[0]).attr("class", "value");
56559       if (field.type === "onewayCheck") {
56560         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
56561       }
56562       label = label.merge(enter);
56563       input = label.selectAll("input");
56564       text2 = label.selectAll("span.value");
56565       input.on("click", function(d3_event) {
56566         d3_event.stopPropagation();
56567         var t = {};
56568         if (Array.isArray(_tags[field.key])) {
56569           if (values.indexOf("yes") !== -1) {
56570             t[field.key] = "yes";
56571           } else {
56572             t[field.key] = values[0];
56573           }
56574         } else {
56575           t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
56576         }
56577         if (t[field.key] === "reversible" || t[field.key] === "alternating") {
56578           t[field.key] = values[0];
56579         }
56580         dispatch10.call("change", this, t);
56581       });
56582       if (field.type === "onewayCheck") {
56583         reverser = label.selectAll(".reverser");
56584         reverser.call(reverserSetText).on("click", function(d3_event) {
56585           d3_event.preventDefault();
56586           d3_event.stopPropagation();
56587           context.perform(function(graph) {
56588             for (var i3 in _entityIDs) {
56589               graph = actionReverse(_entityIDs[i3])(graph);
56590             }
56591             return graph;
56592           }, _t("operations.reverse.annotation.line", { n: 1 }));
56593           context.validator().validate();
56594           select_default2(this).call(reverserSetText);
56595         });
56596       }
56597     };
56598     check.entityIDs = function(val) {
56599       if (!arguments.length)
56600         return _entityIDs;
56601       _entityIDs = val;
56602       return check;
56603     };
56604     check.tags = function(tags) {
56605       _tags = tags;
56606       function isChecked(val) {
56607         return val !== "no" && val !== "" && val !== void 0 && val !== null;
56608       }
56609       function textFor(val) {
56610         if (val === "")
56611           val = void 0;
56612         var index = values.indexOf(val);
56613         return index !== -1 ? texts[index] : '"' + val + '"';
56614       }
56615       checkImpliedYes();
56616       var isMixed = Array.isArray(tags[field.key]);
56617       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
56618       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
56619         _value = "yes";
56620       }
56621       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
56622       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
56623       label.classed("set", !!_value);
56624       if (field.type === "onewayCheck") {
56625         reverser.classed("hide", reverserHidden()).call(reverserSetText);
56626       }
56627     };
56628     check.focus = function() {
56629       input.node().focus();
56630     };
56631     return utilRebind(check, dispatch10, "on");
56632   }
56633
56634   // modules/ui/fields/combo.js
56635   function uiFieldCombo(field, context) {
56636     var dispatch10 = dispatch_default("change");
56637     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
56638     var _isNetwork = field.type === "networkCombo";
56639     var _isSemi = field.type === "semiCombo";
56640     var _optarray = field.options;
56641     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
56642     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
56643     var _snake_case = field.snake_case || field.snake_case === void 0;
56644     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(_isMulti || _isSemi ? 1 : 2);
56645     var _container = select_default2(null);
56646     var _inputWrap = select_default2(null);
56647     var _input = select_default2(null);
56648     var _comboData = [];
56649     var _multiData = [];
56650     var _entityIDs = [];
56651     var _tags;
56652     var _countryCode;
56653     var _staticPlaceholder;
56654     var _dataDeprecated = [];
56655     _mainFileFetcher.get("deprecated").then(function(d) {
56656       _dataDeprecated = d;
56657     }).catch(function() {
56658     });
56659     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
56660       field.key += ":";
56661     }
56662     function snake(s) {
56663       return s.replace(/\s+/g, "_").toLowerCase();
56664     }
56665     function clean2(s) {
56666       return s.split(";").map(function(s2) {
56667         return s2.trim();
56668       }).join(";");
56669     }
56670     function tagValue(dval) {
56671       dval = clean2(dval || "");
56672       var found = _comboData.find(function(o) {
56673         return o.key && clean2(o.value) === dval;
56674       });
56675       if (found)
56676         return found.key;
56677       if (field.type === "typeCombo" && !dval) {
56678         return "yes";
56679       }
56680       return (_snake_case ? snake(dval) : dval) || void 0;
56681     }
56682     function displayValue(tval) {
56683       tval = tval || "";
56684       if (field.hasTextForStringId("options." + tval)) {
56685         return field.t("options." + tval, { default: tval });
56686       }
56687       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
56688         return "";
56689       }
56690       return tval;
56691     }
56692     function objectDifference(a, b) {
56693       return a.filter(function(d1) {
56694         return !b.some(function(d2) {
56695           return !d2.isMixed && d1.value === d2.value;
56696         });
56697       });
56698     }
56699     function initCombo(selection2, attachTo) {
56700       if (!_allowCustomValues) {
56701         selection2.attr("readonly", "readonly");
56702       }
56703       if (_showTagInfoSuggestions && services.taginfo) {
56704         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
56705         setTaginfoValues("", setPlaceholder);
56706       } else {
56707         selection2.call(_combobox, attachTo);
56708         setStaticValues(setPlaceholder);
56709       }
56710     }
56711     function setStaticValues(callback) {
56712       if (!_optarray)
56713         return;
56714       _comboData = _optarray.map(function(v) {
56715         return {
56716           key: v,
56717           value: field.t("options." + v, { default: v }),
56718           title: v,
56719           display: field.t.html("options." + v, { default: v }),
56720           klass: field.hasTextForStringId("options." + v) ? "" : "raw-option"
56721         };
56722       });
56723       _combobox.data(objectDifference(_comboData, _multiData));
56724       if (callback)
56725         callback(_comboData);
56726     }
56727     function setTaginfoValues(q, callback) {
56728       var fn = _isMulti ? "multikeys" : "values";
56729       var query = (_isMulti ? field.key : "") + q;
56730       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
56731       if (hasCountryPrefix) {
56732         query = _countryCode + ":";
56733       }
56734       var params = {
56735         debounce: q !== "",
56736         key: field.key,
56737         query
56738       };
56739       if (_entityIDs.length) {
56740         params.geometry = context.graph().geometry(_entityIDs[0]);
56741       }
56742       services.taginfo[fn](params, function(err, data) {
56743         if (err)
56744           return;
56745         data = data.filter(function(d) {
56746           if (field.type === "typeCombo" && d.value === "yes") {
56747             return false;
56748           }
56749           return !d.count || d.count > 10;
56750         });
56751         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
56752         if (deprecatedValues) {
56753           data = data.filter(function(d) {
56754             return deprecatedValues.indexOf(d.value) === -1;
56755           });
56756         }
56757         if (hasCountryPrefix) {
56758           data = data.filter(function(d) {
56759             return d.value.toLowerCase().indexOf(_countryCode + ":") === 0;
56760           });
56761         }
56762         _container.classed("empty-combobox", data.length === 0);
56763         _comboData = data.map(function(d) {
56764           var k = d.value;
56765           if (_isMulti)
56766             k = k.replace(field.key, "");
56767           var label = field.t("options." + k, { default: k });
56768           return {
56769             key: k,
56770             value: label,
56771             display: field.t.html("options." + k, { default: k }),
56772             title: d.title || label,
56773             klass: field.hasTextForStringId("options." + k) ? "" : "raw-option"
56774           };
56775         });
56776         _comboData = objectDifference(_comboData, _multiData);
56777         if (callback)
56778           callback(_comboData);
56779       });
56780     }
56781     function setPlaceholder(values) {
56782       if (_isMulti || _isSemi) {
56783         _staticPlaceholder = field.placeholder() || _t("inspector.add");
56784       } else {
56785         var vals = values.map(function(d) {
56786           return d.value;
56787         }).filter(function(s) {
56788           return s.length < 20;
56789         });
56790         var placeholders = vals.length > 1 ? vals : values.map(function(d) {
56791           return d.key;
56792         });
56793         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
56794       }
56795       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
56796         _staticPlaceholder += "\u2026";
56797       }
56798       var ph;
56799       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
56800         ph = _t("inspector.multiple_values");
56801       } else {
56802         ph = _staticPlaceholder;
56803       }
56804       _container.selectAll("input").attr("placeholder", ph);
56805     }
56806     function change() {
56807       var t = {};
56808       var val;
56809       if (_isMulti || _isSemi) {
56810         val = tagValue(utilGetSetValue(_input).replace(/,/g, ";")) || "";
56811         _container.classed("active", false);
56812         utilGetSetValue(_input, "");
56813         var vals = val.split(";").filter(Boolean);
56814         if (!vals.length)
56815           return;
56816         if (_isMulti) {
56817           utilArrayUniq(vals).forEach(function(v) {
56818             var key = (field.key || "") + v;
56819             if (_tags) {
56820               var old = _tags[key];
56821               if (typeof old === "string" && old.toLowerCase() !== "no")
56822                 return;
56823             }
56824             key = context.cleanTagKey(key);
56825             field.keys.push(key);
56826             t[key] = "yes";
56827           });
56828         } else if (_isSemi) {
56829           var arr = _multiData.map(function(d) {
56830             return d.key;
56831           });
56832           arr = arr.concat(vals);
56833           t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
56834         }
56835         window.setTimeout(function() {
56836           _input.node().focus();
56837         }, 10);
56838       } else {
56839         var rawValue = utilGetSetValue(_input);
56840         if (!rawValue && Array.isArray(_tags[field.key]))
56841           return;
56842         val = context.cleanTagValue(tagValue(rawValue));
56843         t[field.key] = val || void 0;
56844       }
56845       dispatch10.call("change", this, t);
56846     }
56847     function removeMultikey(d3_event, d) {
56848       d3_event.preventDefault();
56849       d3_event.stopPropagation();
56850       var t = {};
56851       if (_isMulti) {
56852         t[d.key] = void 0;
56853       } else if (_isSemi) {
56854         var arr = _multiData.map(function(md) {
56855           return md.key === d.key ? null : md.key;
56856         }).filter(Boolean);
56857         arr = utilArrayUniq(arr);
56858         t[field.key] = arr.length ? arr.join(";") : void 0;
56859       }
56860       dispatch10.call("change", this, t);
56861     }
56862     function combo(selection2) {
56863       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
56864       var type3 = _isMulti || _isSemi ? "multicombo" : "combo";
56865       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type3).merge(_container);
56866       if (_isMulti || _isSemi) {
56867         _container = _container.selectAll(".chiplist").data([0]);
56868         var listClass = "chiplist";
56869         if (field.key === "destination" || field.key === "via") {
56870           listClass += " full-line-chips";
56871         }
56872         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
56873           window.setTimeout(function() {
56874             _input.node().focus();
56875           }, 10);
56876         }).merge(_container);
56877         _inputWrap = _container.selectAll(".input-wrap").data([0]);
56878         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
56879         _input = _inputWrap.selectAll("input").data([0]);
56880       } else {
56881         _input = _container.selectAll("input").data([0]);
56882       }
56883       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
56884       if (_isNetwork) {
56885         var extent = combinedEntityExtent();
56886         var countryCode = extent && iso1A2Code(extent.center());
56887         _countryCode = countryCode && countryCode.toLowerCase();
56888       }
56889       _input.on("change", change).on("blur", change);
56890       _input.on("keydown.field", function(d3_event) {
56891         switch (d3_event.keyCode) {
56892           case 13:
56893             _input.node().blur();
56894             d3_event.stopPropagation();
56895             break;
56896         }
56897       });
56898       if (_isMulti || _isSemi) {
56899         _combobox.on("accept", function() {
56900           _input.node().blur();
56901           _input.node().focus();
56902         });
56903         _input.on("focus", function() {
56904           _container.classed("active", true);
56905         });
56906       }
56907     }
56908     combo.tags = function(tags) {
56909       _tags = tags;
56910       if (_isMulti || _isSemi) {
56911         _multiData = [];
56912         var maxLength;
56913         if (_isMulti) {
56914           for (var k in tags) {
56915             if (field.key && k.indexOf(field.key) !== 0)
56916               continue;
56917             if (!field.key && field.keys.indexOf(k) === -1)
56918               continue;
56919             var v = tags[k];
56920             if (!v || typeof v === "string" && v.toLowerCase() === "no")
56921               continue;
56922             var suffix = field.key ? k.substr(field.key.length) : k;
56923             _multiData.push({
56924               key: k,
56925               value: displayValue(suffix),
56926               isMixed: Array.isArray(v)
56927             });
56928           }
56929           if (field.key) {
56930             field.keys = _multiData.map(function(d) {
56931               return d.key;
56932             });
56933             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
56934           } else {
56935             maxLength = context.maxCharsForTagKey();
56936           }
56937         } else if (_isSemi) {
56938           var allValues = [];
56939           var commonValues;
56940           if (Array.isArray(tags[field.key])) {
56941             tags[field.key].forEach(function(tagVal) {
56942               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
56943               allValues = allValues.concat(thisVals);
56944               if (!commonValues) {
56945                 commonValues = thisVals;
56946               } else {
56947                 commonValues = commonValues.filter((value) => thisVals.includes(value));
56948               }
56949             });
56950             allValues = utilArrayUniq(allValues).filter(Boolean);
56951           } else {
56952             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
56953             commonValues = allValues;
56954           }
56955           _multiData = allValues.map(function(v2) {
56956             return {
56957               key: v2,
56958               value: displayValue(v2),
56959               isMixed: !commonValues.includes(v2)
56960             };
56961           });
56962           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
56963           maxLength = context.maxCharsForTagValue() - currLength;
56964           if (currLength > 0) {
56965             maxLength -= 1;
56966           }
56967         }
56968         maxLength = Math.max(0, maxLength);
56969         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
56970         var available = objectDifference(_comboData, _multiData);
56971         _combobox.data(available);
56972         var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0;
56973         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
56974         var chips = _container.selectAll(".chip").data(_multiData);
56975         chips.exit().remove();
56976         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
56977         enter.append("span");
56978         enter.append("a");
56979         chips = chips.merge(enter).order().classed("raw-value", function(d) {
56980           var k2 = d.key;
56981           if (_isMulti)
56982             k2 = k2.replace(field.key, "");
56983           return !field.hasTextForStringId("options." + k2);
56984         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
56985           return d.isMixed;
56986         }).attr("title", function(d) {
56987           return d.isMixed ? _t("inspector.unshared_value_tooltip") : null;
56988         });
56989         if (allowDragAndDrop) {
56990           registerDragAndDrop(chips);
56991         }
56992         chips.select("span").text(function(d) {
56993           return d.value;
56994         });
56995         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
56996       } else {
56997         var isMixed = Array.isArray(tags[field.key]);
56998         var mixedValues = isMixed && tags[field.key].map(function(val) {
56999           return displayValue(val);
57000         }).filter(Boolean);
57001         var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes");
57002         var isRawValue = showsValue && !field.hasTextForStringId("options." + tags[field.key]);
57003         var isKnownValue = showsValue && !isRawValue;
57004         var isReadOnly = !_allowCustomValues || isKnownValue;
57005         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) {
57006           if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
57007             d3_event.preventDefault();
57008             d3_event.stopPropagation();
57009             var t = {};
57010             t[field.key] = void 0;
57011             dispatch10.call("change", this, t);
57012           }
57013         });
57014       }
57015     };
57016     function registerDragAndDrop(selection2) {
57017       var dragOrigin, targetIndex;
57018       selection2.call(drag_default().on("start", function(d3_event) {
57019         dragOrigin = {
57020           x: d3_event.x,
57021           y: d3_event.y
57022         };
57023         targetIndex = null;
57024       }).on("drag", function(d3_event) {
57025         var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
57026         if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
57027           return;
57028         var index = selection2.nodes().indexOf(this);
57029         select_default2(this).classed("dragging", true);
57030         targetIndex = null;
57031         var targetIndexOffsetTop = null;
57032         var draggedTagWidth = select_default2(this).node().offsetWidth;
57033         if (field.key === "destination" || field.key === "via") {
57034           _container.selectAll(".chip").style("transform", function(d2, index2) {
57035             var node = select_default2(this).node();
57036             if (index === index2) {
57037               return "translate(" + x + "px, " + y + "px)";
57038             } else if (index2 > index && d3_event.y > node.offsetTop) {
57039               if (targetIndex === null || index2 > targetIndex) {
57040                 targetIndex = index2;
57041               }
57042               return "translateY(-100%)";
57043             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
57044               if (targetIndex === null || index2 < targetIndex) {
57045                 targetIndex = index2;
57046               }
57047               return "translateY(100%)";
57048             }
57049             return null;
57050           });
57051         } else {
57052           _container.selectAll(".chip").each(function(d2, index2) {
57053             var node = select_default2(this).node();
57054             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) {
57055               targetIndex = index2;
57056               targetIndexOffsetTop = node.offsetTop;
57057             }
57058           }).style("transform", function(d2, index2) {
57059             var node = select_default2(this).node();
57060             if (index === index2) {
57061               return "translate(" + x + "px, " + y + "px)";
57062             }
57063             if (node.offsetTop === targetIndexOffsetTop) {
57064               if (index2 < index && index2 >= targetIndex) {
57065                 return "translateX(" + draggedTagWidth + "px)";
57066               } else if (index2 > index && index2 <= targetIndex) {
57067                 return "translateX(-" + draggedTagWidth + "px)";
57068               }
57069             }
57070             return null;
57071           });
57072         }
57073       }).on("end", function() {
57074         if (!select_default2(this).classed("dragging")) {
57075           return;
57076         }
57077         var index = selection2.nodes().indexOf(this);
57078         select_default2(this).classed("dragging", false);
57079         _container.selectAll(".chip").style("transform", null);
57080         if (typeof targetIndex === "number") {
57081           var element = _multiData[index];
57082           _multiData.splice(index, 1);
57083           _multiData.splice(targetIndex, 0, element);
57084           var t = {};
57085           if (_multiData.length) {
57086             t[field.key] = _multiData.map(function(element2) {
57087               return element2.key;
57088             }).join(";");
57089           } else {
57090             t[field.key] = void 0;
57091           }
57092           dispatch10.call("change", this, t);
57093         }
57094         dragOrigin = void 0;
57095         targetIndex = void 0;
57096       }));
57097     }
57098     combo.focus = function() {
57099       _input.node().focus();
57100     };
57101     combo.entityIDs = function(val) {
57102       if (!arguments.length)
57103         return _entityIDs;
57104       _entityIDs = val;
57105       return combo;
57106     };
57107     function combinedEntityExtent() {
57108       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57109     }
57110     return utilRebind(combo, dispatch10, "on");
57111   }
57112
57113   // modules/ui/fields/input.js
57114   function uiFieldText(field, context) {
57115     var dispatch10 = dispatch_default("change");
57116     var input = select_default2(null);
57117     var outlinkButton = select_default2(null);
57118     var wrap2 = select_default2(null);
57119     var _entityIDs = [];
57120     var _tags;
57121     var _phoneFormats = {};
57122     if (field.type === "tel") {
57123       _mainFileFetcher.get("phone_formats").then(function(d) {
57124         _phoneFormats = d;
57125         updatePhonePlaceholder();
57126       }).catch(function() {
57127       });
57128     }
57129     function calcLocked() {
57130       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
57131         var entity = context.graph().hasEntity(entityID);
57132         if (!entity)
57133           return false;
57134         if (entity.tags.wikidata)
57135           return true;
57136         var preset = _mainPresetIndex.match(entity, context.graph());
57137         var isSuggestion = preset && preset.suggestion;
57138         var which = field.id;
57139         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
57140       });
57141       field.locked(isLocked);
57142     }
57143     function i2(selection2) {
57144       calcLocked();
57145       var isLocked = field.locked();
57146       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57147       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57148       input = wrap2.selectAll("input").data([0]);
57149       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);
57150       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
57151       if (field.type === "tel") {
57152         updatePhonePlaceholder();
57153       } else if (field.type === "number") {
57154         var rtl = _mainLocalizer.textDirection() === "rtl";
57155         input.attr("type", "text");
57156         var inc = field.increment;
57157         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
57158         buttons.enter().append("button").attr("class", function(d) {
57159           var which = d > 0 ? "increment" : "decrement";
57160           return "form-field-button " + which;
57161         }).attr("title", function(d) {
57162           var which = d > 0 ? "increment" : "decrement";
57163           return _t(`inspector.${which}`);
57164         }).merge(buttons).on("click", function(d3_event, d) {
57165           d3_event.preventDefault();
57166           var raw_vals = input.node().value || "0";
57167           var vals = raw_vals.split(";");
57168           vals = vals.map(function(v) {
57169             var num = parseFloat(v.trim(), 10);
57170             return isFinite(num) ? clamped(num + d) : v.trim();
57171           });
57172           input.node().value = vals.join(";");
57173           change()();
57174         });
57175       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
57176         input.attr("type", "text");
57177         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
57178         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
57179           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
57180           if (domainResults.length >= 2 && domainResults[1]) {
57181             var domain2 = domainResults[1];
57182             return _t("icons.view_on", { domain: domain2 });
57183           }
57184           return "";
57185         }).on("click", function(d3_event) {
57186           d3_event.preventDefault();
57187           var value = validIdentifierValueForLink();
57188           if (value) {
57189             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
57190             window.open(url, "_blank");
57191           }
57192         }).merge(outlinkButton);
57193       } else if (field.type === "url") {
57194         input.attr("type", "text");
57195         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
57196         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) {
57197           d3_event.preventDefault();
57198           const value = validIdentifierValueForLink();
57199           if (value)
57200             window.open(value, "_blank");
57201         }).merge(outlinkButton);
57202       } else if (field.key.split(":").includes("colour")) {
57203         input.attr("type", "text");
57204         updateColourPreview();
57205       }
57206     }
57207     function isColourValid(colour) {
57208       if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
57209         return false;
57210       } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) {
57211         return false;
57212       }
57213       return true;
57214     }
57215     function updateColourPreview() {
57216       wrap2.selectAll(".colour-preview").remove();
57217       const colour = utilGetSetValue(input);
57218       if (!isColourValid(colour) && colour !== "")
57219         return;
57220       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
57221       outlinkButton = wrap2.selectAll(".colour-preview").data([colour]);
57222       colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) {
57223         d3_event.preventDefault();
57224         var colour2 = this.value;
57225         if (!isColourValid(colour2))
57226           return;
57227         utilGetSetValue(input, this.value);
57228         change()();
57229         updateColourPreview();
57230       }, 100));
57231       outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
57232       if (colour === "") {
57233         outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit"));
57234       }
57235       outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton);
57236     }
57237     function updatePhonePlaceholder() {
57238       if (input.empty() || !Object.keys(_phoneFormats).length)
57239         return;
57240       var extent = combinedEntityExtent();
57241       var countryCode = extent && iso1A2Code(extent.center());
57242       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
57243       if (format2)
57244         input.attr("placeholder", format2);
57245     }
57246     function validIdentifierValueForLink() {
57247       const value = utilGetSetValue(input).trim();
57248       if (field.type === "url" && value) {
57249         try {
57250           return new URL(value).href;
57251         } catch (e) {
57252           return null;
57253         }
57254       }
57255       if (field.type === "identifier" && field.pattern) {
57256         return value && value.match(new RegExp(field.pattern))[0];
57257       }
57258       return null;
57259     }
57260     function clamped(num) {
57261       if (field.minValue !== void 0) {
57262         num = Math.max(num, field.minValue);
57263       }
57264       if (field.maxValue !== void 0) {
57265         num = Math.min(num, field.maxValue);
57266       }
57267       return num;
57268     }
57269     function change(onInput) {
57270       return function() {
57271         var t = {};
57272         var val = utilGetSetValue(input);
57273         if (!onInput)
57274           val = context.cleanTagValue(val);
57275         if (!val && Array.isArray(_tags[field.key]))
57276           return;
57277         if (!onInput) {
57278           if (field.type === "number" && val) {
57279             var vals = val.split(";");
57280             vals = vals.map(function(v) {
57281               var num = parseFloat(v.trim(), 10);
57282               return isFinite(num) ? clamped(num) : v.trim();
57283             });
57284             val = vals.join(";");
57285           }
57286           utilGetSetValue(input, val);
57287         }
57288         t[field.key] = val || void 0;
57289         dispatch10.call("change", this, t, onInput);
57290       };
57291     }
57292     i2.entityIDs = function(val) {
57293       if (!arguments.length)
57294         return _entityIDs;
57295       _entityIDs = val;
57296       return i2;
57297     };
57298     i2.tags = function(tags) {
57299       _tags = tags;
57300       var isMixed = Array.isArray(tags[field.key]);
57301       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);
57302       if (field.key.split(":").includes("colour"))
57303         updateColourPreview();
57304       if (outlinkButton && !outlinkButton.empty()) {
57305         var disabled = !validIdentifierValueForLink();
57306         outlinkButton.classed("disabled", disabled);
57307       }
57308     };
57309     i2.focus = function() {
57310       var node = input.node();
57311       if (node)
57312         node.focus();
57313     };
57314     function combinedEntityExtent() {
57315       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57316     }
57317     return utilRebind(i2, dispatch10, "on");
57318   }
57319
57320   // modules/ui/fields/access.js
57321   function uiFieldAccess(field, context) {
57322     var dispatch10 = dispatch_default("change");
57323     var items = select_default2(null);
57324     var _tags;
57325     function access(selection2) {
57326       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57327       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57328       var list = wrap2.selectAll("ul").data([0]);
57329       list = list.enter().append("ul").attr("class", "rows").merge(list);
57330       items = list.selectAll("li").data(field.keys);
57331       var enter = items.enter().append("li").attr("class", function(d) {
57332         return "labeled-input preset-access-" + d;
57333       });
57334       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
57335         return "preset-input-access-" + d;
57336       }).html(function(d) {
57337         return field.t.html("types." + d);
57338       });
57339       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
57340         return "preset-input-access preset-input-access-" + d;
57341       }).call(utilNoAuto).each(function(d) {
57342         select_default2(this).call(uiCombobox(context, "access-" + d).data(access.options(d)));
57343       });
57344       items = items.merge(enter);
57345       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
57346     }
57347     function change(d3_event, d) {
57348       var tag = {};
57349       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
57350       if (!value && typeof _tags[d] !== "string")
57351         return;
57352       tag[d] = value || void 0;
57353       dispatch10.call("change", this, tag);
57354     }
57355     access.options = function(type3) {
57356       var options2 = [
57357         "yes",
57358         "no",
57359         "designated",
57360         "permissive",
57361         "destination",
57362         "customers",
57363         "private",
57364         "permit",
57365         "unknown"
57366       ];
57367       if (type3 === "access") {
57368         options2 = options2.filter((v) => v !== "yes" && v !== "designated");
57369       }
57370       if (type3 === "bicycle") {
57371         options2.splice(options2.length - 4, 0, "dismount");
57372       }
57373       return options2.map(function(option) {
57374         return {
57375           title: field.t("options." + option + ".description"),
57376           value: option
57377         };
57378       });
57379     };
57380     var placeholdersByHighway = {
57381       footway: {
57382         foot: "designated",
57383         motor_vehicle: "no"
57384       },
57385       steps: {
57386         foot: "yes",
57387         motor_vehicle: "no",
57388         bicycle: "no",
57389         horse: "no"
57390       },
57391       pedestrian: {
57392         foot: "yes",
57393         motor_vehicle: "no"
57394       },
57395       cycleway: {
57396         motor_vehicle: "no",
57397         bicycle: "designated"
57398       },
57399       bridleway: {
57400         motor_vehicle: "no",
57401         horse: "designated"
57402       },
57403       path: {
57404         foot: "yes",
57405         motor_vehicle: "no",
57406         bicycle: "yes",
57407         horse: "yes"
57408       },
57409       motorway: {
57410         foot: "no",
57411         motor_vehicle: "yes",
57412         bicycle: "no",
57413         horse: "no"
57414       },
57415       trunk: {
57416         motor_vehicle: "yes"
57417       },
57418       primary: {
57419         foot: "yes",
57420         motor_vehicle: "yes",
57421         bicycle: "yes",
57422         horse: "yes"
57423       },
57424       secondary: {
57425         foot: "yes",
57426         motor_vehicle: "yes",
57427         bicycle: "yes",
57428         horse: "yes"
57429       },
57430       tertiary: {
57431         foot: "yes",
57432         motor_vehicle: "yes",
57433         bicycle: "yes",
57434         horse: "yes"
57435       },
57436       residential: {
57437         foot: "yes",
57438         motor_vehicle: "yes",
57439         bicycle: "yes",
57440         horse: "yes"
57441       },
57442       unclassified: {
57443         foot: "yes",
57444         motor_vehicle: "yes",
57445         bicycle: "yes",
57446         horse: "yes"
57447       },
57448       service: {
57449         foot: "yes",
57450         motor_vehicle: "yes",
57451         bicycle: "yes",
57452         horse: "yes"
57453       },
57454       motorway_link: {
57455         foot: "no",
57456         motor_vehicle: "yes",
57457         bicycle: "no",
57458         horse: "no"
57459       },
57460       trunk_link: {
57461         motor_vehicle: "yes"
57462       },
57463       primary_link: {
57464         foot: "yes",
57465         motor_vehicle: "yes",
57466         bicycle: "yes",
57467         horse: "yes"
57468       },
57469       secondary_link: {
57470         foot: "yes",
57471         motor_vehicle: "yes",
57472         bicycle: "yes",
57473         horse: "yes"
57474       },
57475       tertiary_link: {
57476         foot: "yes",
57477         motor_vehicle: "yes",
57478         bicycle: "yes",
57479         horse: "yes"
57480       },
57481       construction: {
57482         access: "no"
57483       }
57484     };
57485     access.tags = function(tags) {
57486       _tags = tags;
57487       utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
57488         return typeof tags[d] === "string" ? tags[d] : "";
57489       }).classed("mixed", function(d) {
57490         return tags[d] && Array.isArray(tags[d]);
57491       }).attr("title", function(d) {
57492         return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
57493       }).attr("placeholder", function(d) {
57494         if (tags[d] && Array.isArray(tags[d])) {
57495           return _t("inspector.multiple_values");
57496         }
57497         if (d === "bicycle" || d === "motor_vehicle") {
57498           if (tags.vehicle && typeof tags.vehicle === "string") {
57499             return tags.vehicle;
57500           }
57501         }
57502         if (tags.access && typeof tags.access === "string") {
57503           return tags.access;
57504         }
57505         if (tags.highway) {
57506           if (typeof tags.highway === "string") {
57507             if (placeholdersByHighway[tags.highway] && placeholdersByHighway[tags.highway][d]) {
57508               return placeholdersByHighway[tags.highway][d];
57509             }
57510           } else {
57511             var impliedAccesses = tags.highway.filter(Boolean).map(function(highwayVal) {
57512               return placeholdersByHighway[highwayVal] && placeholdersByHighway[highwayVal][d];
57513             }).filter(Boolean);
57514             if (impliedAccesses.length === tags.highway.length && new Set(impliedAccesses).size === 1) {
57515               return impliedAccesses[0];
57516             }
57517           }
57518         }
57519         if (d === "access") {
57520           return "yes";
57521         }
57522         return field.placeholder();
57523       });
57524     };
57525     access.focus = function() {
57526       items.selectAll(".preset-input-access").node().focus();
57527     };
57528     return utilRebind(access, dispatch10, "on");
57529   }
57530
57531   // modules/ui/fields/address.js
57532   function uiFieldAddress(field, context) {
57533     var dispatch10 = dispatch_default("change");
57534     var _selection = select_default2(null);
57535     var _wrap = select_default2(null);
57536     var addrField = _mainPresetIndex.field("address");
57537     var _entityIDs = [];
57538     var _tags;
57539     var _countryCode;
57540     var _addressFormats = [{
57541       format: [
57542         ["housenumber", "street"],
57543         ["city", "postcode"]
57544       ]
57545     }];
57546     _mainFileFetcher.get("address_formats").then(function(d) {
57547       _addressFormats = d;
57548       if (!_selection.empty()) {
57549         _selection.call(address);
57550       }
57551     }).catch(function() {
57552     });
57553     function getNearStreets() {
57554       var extent = combinedEntityExtent();
57555       var l = extent.center();
57556       var box = geoExtent(l).padByMeters(200);
57557       var streets = context.history().intersects(box).filter(isAddressable).map(function(d) {
57558         var loc = context.projection([
57559           (extent[0][0] + extent[1][0]) / 2,
57560           (extent[0][1] + extent[1][1]) / 2
57561         ]);
57562         var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
57563         return {
57564           title: d.tags.name,
57565           value: d.tags.name,
57566           dist: choice.distance
57567         };
57568       }).sort(function(a, b) {
57569         return a.dist - b.dist;
57570       });
57571       return utilArrayUniqBy(streets, "value");
57572       function isAddressable(d) {
57573         return d.tags.highway && d.tags.name && d.type === "way";
57574       }
57575     }
57576     function getNearCities() {
57577       var extent = combinedEntityExtent();
57578       var l = extent.center();
57579       var box = geoExtent(l).padByMeters(200);
57580       var cities = context.history().intersects(box).filter(isAddressable).map(function(d) {
57581         return {
57582           title: d.tags["addr:city"] || d.tags.name,
57583           value: d.tags["addr:city"] || d.tags.name,
57584           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
57585         };
57586       }).sort(function(a, b) {
57587         return a.dist - b.dist;
57588       });
57589       return utilArrayUniqBy(cities, "value");
57590       function isAddressable(d) {
57591         if (d.tags.name) {
57592           if (d.tags.admin_level === "8" && d.tags.boundary === "administrative")
57593             return true;
57594           if (d.tags.border_type === "city")
57595             return true;
57596           if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
57597             return true;
57598         }
57599         if (d.tags["addr:city"])
57600           return true;
57601         return false;
57602       }
57603     }
57604     function getNearValues(key) {
57605       var extent = combinedEntityExtent();
57606       var l = extent.center();
57607       var box = geoExtent(l).padByMeters(200);
57608       var results = context.history().intersects(box).filter(function hasTag(d) {
57609         return _entityIDs.indexOf(d.id) === -1 && d.tags[key];
57610       }).map(function(d) {
57611         return {
57612           title: d.tags[key],
57613           value: d.tags[key],
57614           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
57615         };
57616       }).sort(function(a, b) {
57617         return a.dist - b.dist;
57618       });
57619       return utilArrayUniqBy(results, "value");
57620     }
57621     function updateForCountryCode() {
57622       if (!_countryCode)
57623         return;
57624       var addressFormat;
57625       for (var i2 = 0; i2 < _addressFormats.length; i2++) {
57626         var format2 = _addressFormats[i2];
57627         if (!format2.countryCodes) {
57628           addressFormat = format2;
57629         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
57630           addressFormat = format2;
57631           break;
57632         }
57633       }
57634       var dropdowns = addressFormat.dropdowns || [
57635         "city",
57636         "county",
57637         "country",
57638         "district",
57639         "hamlet",
57640         "neighbourhood",
57641         "place",
57642         "postcode",
57643         "province",
57644         "quarter",
57645         "state",
57646         "street",
57647         "subdistrict",
57648         "suburb"
57649       ];
57650       var widths = addressFormat.widths || {
57651         housenumber: 1 / 3,
57652         street: 2 / 3,
57653         city: 2 / 3,
57654         state: 1 / 4,
57655         postcode: 1 / 3
57656       };
57657       function row(r) {
57658         var total = r.reduce(function(sum, key) {
57659           return sum + (widths[key] || 0.5);
57660         }, 0);
57661         return r.map(function(key) {
57662           return {
57663             id: key,
57664             width: (widths[key] || 0.5) / total
57665           };
57666         });
57667       }
57668       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
57669         return d.toString();
57670       });
57671       rows.exit().remove();
57672       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
57673         return "addr-" + d.id;
57674       }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
57675         return d.width * 100 + "%";
57676       });
57677       function addDropdown(d) {
57678         if (dropdowns.indexOf(d.id) === -1)
57679           return;
57680         var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues;
57681         select_default2(this).call(uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) {
57682           callback(nearValues("addr:" + d.id));
57683         }));
57684       }
57685       _wrap.selectAll("input").on("blur", change()).on("change", change());
57686       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
57687       if (_tags)
57688         updateTags(_tags);
57689     }
57690     function address(selection2) {
57691       _selection = selection2;
57692       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
57693       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
57694       var extent = combinedEntityExtent();
57695       if (extent) {
57696         var countryCode;
57697         if (context.inIntro()) {
57698           countryCode = _t("intro.graph.countrycode");
57699         } else {
57700           var center = extent.center();
57701           countryCode = iso1A2Code(center);
57702         }
57703         if (countryCode) {
57704           _countryCode = countryCode.toLowerCase();
57705           updateForCountryCode();
57706         }
57707       }
57708     }
57709     function change(onInput) {
57710       return function() {
57711         var tags = {};
57712         _wrap.selectAll("input").each(function(subfield) {
57713           var key = field.key + ":" + subfield.id;
57714           var value = this.value;
57715           if (!onInput)
57716             value = context.cleanTagValue(value);
57717           if (Array.isArray(_tags[key]) && !value)
57718             return;
57719           tags[key] = value || void 0;
57720         });
57721         dispatch10.call("change", this, tags, onInput);
57722       };
57723     }
57724     function updatePlaceholder(inputSelection) {
57725       return inputSelection.attr("placeholder", function(subfield) {
57726         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
57727           return _t("inspector.multiple_values");
57728         }
57729         if (_countryCode) {
57730           var localkey = subfield.id + "!" + _countryCode;
57731           var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id;
57732           return addrField.t("placeholders." + tkey);
57733         }
57734       });
57735     }
57736     function updateTags(tags) {
57737       utilGetSetValue(_wrap.selectAll("input"), function(subfield) {
57738         var val = tags[field.key + ":" + subfield.id];
57739         return typeof val === "string" ? val : "";
57740       }).attr("title", function(subfield) {
57741         var val = tags[field.key + ":" + subfield.id];
57742         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
57743       }).classed("mixed", function(subfield) {
57744         return Array.isArray(tags[field.key + ":" + subfield.id]);
57745       }).call(updatePlaceholder);
57746     }
57747     function combinedEntityExtent() {
57748       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
57749     }
57750     address.entityIDs = function(val) {
57751       if (!arguments.length)
57752         return _entityIDs;
57753       _entityIDs = val;
57754       return address;
57755     };
57756     address.tags = function(tags) {
57757       _tags = tags;
57758       updateTags(tags);
57759     };
57760     address.focus = function() {
57761       var node = _wrap.selectAll("input").node();
57762       if (node)
57763         node.focus();
57764     };
57765     return utilRebind(address, dispatch10, "on");
57766   }
57767
57768   // modules/ui/fields/cycleway.js
57769   function uiFieldCycleway(field, context) {
57770     var dispatch10 = dispatch_default("change");
57771     var items = select_default2(null);
57772     var wrap2 = select_default2(null);
57773     var _tags;
57774     function cycleway(selection2) {
57775       function stripcolon(s) {
57776         return s.replace(":", "");
57777       }
57778       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57779       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57780       var div = wrap2.selectAll("ul").data([0]);
57781       div = div.enter().append("ul").attr("class", "rows").merge(div);
57782       var keys = ["cycleway:left", "cycleway:right"];
57783       items = div.selectAll("li").data(keys);
57784       var enter = items.enter().append("li").attr("class", function(d) {
57785         return "labeled-input preset-cycleway-" + stripcolon(d);
57786       });
57787       enter.append("span").attr("class", "label preset-label-cycleway").attr("for", function(d) {
57788         return "preset-input-cycleway-" + stripcolon(d);
57789       }).html(function(d) {
57790         return field.t.html("types." + d);
57791       });
57792       enter.append("div").attr("class", "preset-input-cycleway-wrap").append("input").attr("type", "text").attr("class", function(d) {
57793         return "preset-input-cycleway preset-input-" + stripcolon(d);
57794       }).call(utilNoAuto).each(function(d) {
57795         select_default2(this).call(uiCombobox(context, "cycleway-" + stripcolon(d)).data(cycleway.options(d)));
57796       });
57797       items = items.merge(enter);
57798       wrap2.selectAll(".preset-input-cycleway").on("change", change).on("blur", change);
57799     }
57800     function change(d3_event, key) {
57801       var newValue = context.cleanTagValue(utilGetSetValue(select_default2(this)));
57802       if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key])))
57803         return;
57804       if (newValue === "none" || newValue === "") {
57805         newValue = void 0;
57806       }
57807       var otherKey = key === "cycleway:left" ? "cycleway:right" : "cycleway:left";
57808       var otherValue = typeof _tags.cycleway === "string" ? _tags.cycleway : _tags[otherKey];
57809       if (otherValue && Array.isArray(otherValue)) {
57810         otherValue = otherValue[0];
57811       }
57812       if (otherValue === "none" || otherValue === "") {
57813         otherValue = void 0;
57814       }
57815       var tag = {};
57816       if (newValue === otherValue) {
57817         tag = {
57818           cycleway: newValue,
57819           "cycleway:left": void 0,
57820           "cycleway:right": void 0
57821         };
57822       } else {
57823         tag = {
57824           cycleway: void 0
57825         };
57826         tag[key] = newValue;
57827         tag[otherKey] = otherValue;
57828       }
57829       dispatch10.call("change", this, tag);
57830     }
57831     cycleway.options = function() {
57832       return field.options.map(function(option) {
57833         return {
57834           title: field.t("options." + option + ".description"),
57835           value: option
57836         };
57837       });
57838     };
57839     cycleway.tags = function(tags) {
57840       _tags = tags;
57841       var commonValue = typeof tags.cycleway === "string" && tags.cycleway;
57842       utilGetSetValue(items.selectAll(".preset-input-cycleway"), function(d) {
57843         if (commonValue)
57844           return commonValue;
57845         return !tags.cycleway && typeof tags[d] === "string" ? tags[d] : "";
57846       }).attr("title", function(d) {
57847         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
57848           var vals = [];
57849           if (Array.isArray(tags.cycleway)) {
57850             vals = vals.concat(tags.cycleway);
57851           }
57852           if (Array.isArray(tags[d])) {
57853             vals = vals.concat(tags[d]);
57854           }
57855           return vals.filter(Boolean).join("\n");
57856         }
57857         return null;
57858       }).attr("placeholder", function(d) {
57859         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
57860           return _t("inspector.multiple_values");
57861         }
57862         return field.placeholder();
57863       }).classed("mixed", function(d) {
57864         return Array.isArray(tags.cycleway) || Array.isArray(tags[d]);
57865       });
57866     };
57867     cycleway.focus = function() {
57868       var node = wrap2.selectAll("input").node();
57869       if (node)
57870         node.focus();
57871     };
57872     return utilRebind(cycleway, dispatch10, "on");
57873   }
57874
57875   // modules/ui/fields/lanes.js
57876   function uiFieldLanes(field, context) {
57877     var dispatch10 = dispatch_default("change");
57878     var LANE_WIDTH = 40;
57879     var LANE_HEIGHT = 200;
57880     var _entityIDs = [];
57881     function lanes(selection2) {
57882       var lanesData = context.entity(_entityIDs[0]).lanes();
57883       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
57884         selection2.call(lanes.off);
57885         return;
57886       }
57887       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
57888       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
57889       var surface = wrap2.selectAll(".surface").data([0]);
57890       var d = utilGetDimensions(wrap2);
57891       var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
57892       surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
57893       var lanesSelection = surface.selectAll(".lanes").data([0]);
57894       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
57895       lanesSelection.attr("transform", function() {
57896         return "translate(" + freeSpace / 2 + ", 0)";
57897       });
57898       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
57899       lane.exit().remove();
57900       var enter = lane.enter().append("g").attr("class", "lane");
57901       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
57902       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
57903       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
57904       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
57905       lane = lane.merge(enter);
57906       lane.attr("transform", function(d2) {
57907         return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
57908       });
57909       lane.select(".forward").style("visibility", function(d2) {
57910         return d2.direction === "forward" ? "visible" : "hidden";
57911       });
57912       lane.select(".bothways").style("visibility", function(d2) {
57913         return d2.direction === "bothways" ? "visible" : "hidden";
57914       });
57915       lane.select(".backward").style("visibility", function(d2) {
57916         return d2.direction === "backward" ? "visible" : "hidden";
57917       });
57918     }
57919     lanes.entityIDs = function(val) {
57920       _entityIDs = val;
57921     };
57922     lanes.tags = function() {
57923     };
57924     lanes.focus = function() {
57925     };
57926     lanes.off = function() {
57927     };
57928     return utilRebind(lanes, dispatch10, "on");
57929   }
57930   uiFieldLanes.supportsMultiselection = false;
57931
57932   // modules/ui/fields/localized.js
57933   var _languagesArray = [];
57934   function uiFieldLocalized(field, context) {
57935     var dispatch10 = dispatch_default("change", "input");
57936     var wikipedia = services.wikipedia;
57937     var input = select_default2(null);
57938     var localizedInputs = select_default2(null);
57939     var _countryCode;
57940     var _tags;
57941     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
57942     });
57943     var _territoryLanguages = {};
57944     _mainFileFetcher.get("territory_languages").then(function(d) {
57945       _territoryLanguages = d;
57946     }).catch(function() {
57947     });
57948     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
57949     var _selection = select_default2(null);
57950     var _multilingual = [];
57951     var _buttonTip = uiTooltip().title(_t.html("translate.translate")).placement("left");
57952     var _wikiTitles;
57953     var _entityIDs = [];
57954     function loadLanguagesArray(dataLanguages) {
57955       if (_languagesArray.length !== 0)
57956         return;
57957       var replacements = {
57958         sr: "sr-Cyrl",
57959         "sr-Cyrl": false
57960       };
57961       for (var code in dataLanguages) {
57962         if (replacements[code] === false)
57963           continue;
57964         var metaCode = code;
57965         if (replacements[code])
57966           metaCode = replacements[code];
57967         _languagesArray.push({
57968           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
57969           nativeName: dataLanguages[metaCode].nativeName,
57970           code,
57971           label: _mainLocalizer.languageName(metaCode)
57972         });
57973       }
57974     }
57975     function calcLocked() {
57976       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
57977         var entity = context.graph().hasEntity(entityID);
57978         if (!entity)
57979           return false;
57980         if (entity.tags.wikidata)
57981           return true;
57982         if (entity.tags["name:etymology:wikidata"])
57983           return true;
57984         var preset = _mainPresetIndex.match(entity, context.graph());
57985         if (preset) {
57986           var isSuggestion = preset.suggestion;
57987           var fields = preset.fields();
57988           var showsBrandField = fields.some(function(d) {
57989             return d.id === "brand";
57990           });
57991           var showsOperatorField = fields.some(function(d) {
57992             return d.id === "operator";
57993           });
57994           var setsName = preset.addTags.name;
57995           var setsBrandWikidata = preset.addTags["brand:wikidata"];
57996           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
57997           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
57998         }
57999         return false;
58000       });
58001       field.locked(isLocked);
58002     }
58003     function calcMultilingual(tags) {
58004       var existingLangsOrdered = _multilingual.map(function(item2) {
58005         return item2.lang;
58006       });
58007       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
58008       for (var k in tags) {
58009         var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
58010         if (m && m[1] === field.key && m[2]) {
58011           var item = { lang: m[2], value: tags[k] };
58012           if (existingLangs.has(item.lang)) {
58013             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
58014             existingLangs.delete(item.lang);
58015           } else {
58016             _multilingual.push(item);
58017           }
58018         }
58019       }
58020       _multilingual.forEach(function(item2) {
58021         if (item2.lang && existingLangs.has(item2.lang)) {
58022           item2.value = "";
58023         }
58024       });
58025     }
58026     function localized(selection2) {
58027       _selection = selection2;
58028       calcLocked();
58029       var isLocked = field.locked();
58030       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58031       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58032       input = wrap2.selectAll(".localized-main").data([0]);
58033       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
58034       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
58035       var translateButton = wrap2.selectAll(".localized-add").data([0]);
58036       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);
58037       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
58038       if (_tags && !_multilingual.length) {
58039         calcMultilingual(_tags);
58040       }
58041       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
58042       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
58043       localizedInputs.call(renderMultilingual);
58044       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
58045       selection2.selectAll(".combobox-caret").classed("nope", true);
58046       function addNew(d3_event) {
58047         d3_event.preventDefault();
58048         if (field.locked())
58049           return;
58050         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
58051         var langExists = _multilingual.find(function(datum2) {
58052           return datum2.lang === defaultLang;
58053         });
58054         var isLangEn = defaultLang.indexOf("en") > -1;
58055         if (isLangEn || langExists) {
58056           defaultLang = "";
58057           langExists = _multilingual.find(function(datum2) {
58058             return datum2.lang === defaultLang;
58059           });
58060         }
58061         if (!langExists) {
58062           _multilingual.unshift({ lang: defaultLang, value: "" });
58063           localizedInputs.call(renderMultilingual);
58064         }
58065       }
58066       function change(onInput) {
58067         return function(d3_event) {
58068           if (field.locked()) {
58069             d3_event.preventDefault();
58070             return;
58071           }
58072           var val = utilGetSetValue(select_default2(this));
58073           if (!onInput)
58074             val = context.cleanTagValue(val);
58075           if (!val && Array.isArray(_tags[field.key]))
58076             return;
58077           var t = {};
58078           t[field.key] = val || void 0;
58079           dispatch10.call("change", this, t, onInput);
58080         };
58081       }
58082     }
58083     function key(lang) {
58084       return field.key + ":" + lang;
58085     }
58086     function changeLang(d3_event, d) {
58087       var tags = {};
58088       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
58089       var language = _languagesArray.find(function(d2) {
58090         return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
58091       });
58092       if (language)
58093         lang = language.code;
58094       if (d.lang && d.lang !== lang) {
58095         tags[key(d.lang)] = void 0;
58096       }
58097       var newKey = lang && context.cleanTagKey(key(lang));
58098       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
58099       if (newKey && value) {
58100         tags[newKey] = value;
58101       } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
58102         tags[newKey] = _wikiTitles[d.lang];
58103       }
58104       d.lang = lang;
58105       dispatch10.call("change", this, tags);
58106     }
58107     function changeValue(d3_event, d) {
58108       if (!d.lang)
58109         return;
58110       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
58111       if (!value && Array.isArray(d.value))
58112         return;
58113       var t = {};
58114       t[key(d.lang)] = value;
58115       d.value = value;
58116       dispatch10.call("change", this, t);
58117     }
58118     function fetchLanguages(value, cb) {
58119       var v = value.toLowerCase();
58120       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
58121       if (_countryCode && _territoryLanguages[_countryCode]) {
58122         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
58123       }
58124       var langItems = [];
58125       langCodes.forEach(function(code) {
58126         var langItem = _languagesArray.find(function(item) {
58127           return item.code === code;
58128         });
58129         if (langItem)
58130           langItems.push(langItem);
58131       });
58132       langItems = utilArrayUniq(langItems.concat(_languagesArray));
58133       cb(langItems.filter(function(d) {
58134         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;
58135       }).map(function(d) {
58136         return { value: d.label };
58137       }));
58138     }
58139     function renderMultilingual(selection2) {
58140       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
58141         return d.lang;
58142       });
58143       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
58144       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
58145         var wrap2 = select_default2(this);
58146         var domId = utilUniqueDomId(index);
58147         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
58148         var text2 = label.append("span").attr("class", "label-text");
58149         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
58150         text2.append("span").attr("class", "label-textannotation");
58151         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
58152           if (field.locked())
58153             return;
58154           d3_event.preventDefault();
58155           _multilingual.splice(_multilingual.indexOf(d), 1);
58156           var langKey = d.lang && key(d.lang);
58157           if (langKey && langKey in _tags) {
58158             delete _tags[langKey];
58159             var t = {};
58160             t[langKey] = void 0;
58161             dispatch10.call("change", this, t);
58162             return;
58163           }
58164           renderMultilingual(selection2);
58165         }).call(svgIcon("#iD-operation-delete"));
58166         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);
58167         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
58168       });
58169       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() {
58170         select_default2(this).style("max-height", "").style("overflow", "visible");
58171       });
58172       entries = entries.merge(entriesEnter);
58173       entries.order();
58174       entries.classed("present", true);
58175       utilGetSetValue(entries.select(".localized-lang"), function(d) {
58176         var langItem = _languagesArray.find(function(item) {
58177           return item.code === d.lang;
58178         });
58179         if (langItem)
58180           return langItem.label;
58181         return d.lang;
58182       });
58183       utilGetSetValue(entries.select(".localized-value"), function(d) {
58184         return typeof d.value === "string" ? d.value : "";
58185       }).attr("title", function(d) {
58186         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
58187       }).attr("placeholder", function(d) {
58188         return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
58189       }).classed("mixed", function(d) {
58190         return Array.isArray(d.value);
58191       });
58192     }
58193     localized.tags = function(tags) {
58194       _tags = tags;
58195       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
58196         _wikiTitles = {};
58197         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
58198         if (wm && wm[0] && wm[1]) {
58199           wikipedia.translations(wm[1], wm[2], function(err, d) {
58200             if (err || !d)
58201               return;
58202             _wikiTitles = d;
58203           });
58204         }
58205       }
58206       var isMixed = Array.isArray(tags[field.key]);
58207       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);
58208       calcMultilingual(tags);
58209       _selection.call(localized);
58210     };
58211     localized.focus = function() {
58212       input.node().focus();
58213     };
58214     localized.entityIDs = function(val) {
58215       if (!arguments.length)
58216         return _entityIDs;
58217       _entityIDs = val;
58218       _multilingual = [];
58219       loadCountryCode();
58220       return localized;
58221     };
58222     function loadCountryCode() {
58223       var extent = combinedEntityExtent();
58224       var countryCode = extent && iso1A2Code(extent.center());
58225       _countryCode = countryCode && countryCode.toLowerCase();
58226     }
58227     function combinedEntityExtent() {
58228       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58229     }
58230     return utilRebind(localized, dispatch10, "on");
58231   }
58232
58233   // modules/ui/fields/roadheight.js
58234   function uiFieldRoadheight(field, context) {
58235     var dispatch10 = dispatch_default("change");
58236     var primaryUnitInput = select_default2(null);
58237     var primaryInput = select_default2(null);
58238     var secondaryInput = select_default2(null);
58239     var secondaryUnitInput = select_default2(null);
58240     var _entityIDs = [];
58241     var _tags;
58242     var _isImperial;
58243     var primaryUnits = [
58244       {
58245         value: "m",
58246         title: _t("inspector.roadheight.meter")
58247       },
58248       {
58249         value: "ft",
58250         title: _t("inspector.roadheight.foot")
58251       }
58252     ];
58253     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
58254     function roadheight(selection2) {
58255       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58256       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58257       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
58258       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
58259       primaryInput.on("change", change).on("blur", change);
58260       var loc = combinedEntityExtent().center();
58261       _isImperial = roadHeightUnit(loc) === "ft";
58262       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
58263       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
58264       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
58265       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
58266       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
58267       secondaryInput.on("change", change).on("blur", change);
58268       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
58269       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
58270       function changeUnits() {
58271         _isImperial = utilGetSetValue(primaryUnitInput) === "ft";
58272         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
58273         setUnitSuggestions();
58274         change();
58275       }
58276     }
58277     function setUnitSuggestions() {
58278       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
58279     }
58280     function change() {
58281       var tag = {};
58282       var primaryValue = utilGetSetValue(primaryInput).trim();
58283       var secondaryValue = utilGetSetValue(secondaryInput).trim();
58284       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
58285         return;
58286       if (!primaryValue && !secondaryValue) {
58287         tag[field.key] = void 0;
58288       } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) {
58289         tag[field.key] = context.cleanTagValue(primaryValue);
58290       } else {
58291         if (primaryValue !== "") {
58292           primaryValue = context.cleanTagValue(primaryValue + "'");
58293         }
58294         if (secondaryValue !== "") {
58295           secondaryValue = context.cleanTagValue(secondaryValue + '"');
58296         }
58297         tag[field.key] = primaryValue + secondaryValue;
58298       }
58299       dispatch10.call("change", this, tag);
58300     }
58301     roadheight.tags = function(tags) {
58302       _tags = tags;
58303       var primaryValue = tags[field.key];
58304       var secondaryValue;
58305       var isMixed = Array.isArray(primaryValue);
58306       if (!isMixed) {
58307         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
58308           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
58309           if (secondaryValue !== null) {
58310             secondaryValue = secondaryValue[1];
58311           }
58312           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
58313           if (primaryValue !== null) {
58314             primaryValue = primaryValue[1];
58315           }
58316           _isImperial = true;
58317         } else if (primaryValue) {
58318           _isImperial = false;
58319         }
58320       }
58321       setUnitSuggestions();
58322       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);
58323       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");
58324       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
58325     };
58326     roadheight.focus = function() {
58327       primaryInput.node().focus();
58328     };
58329     roadheight.entityIDs = function(val) {
58330       _entityIDs = val;
58331     };
58332     function combinedEntityExtent() {
58333       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58334     }
58335     return utilRebind(roadheight, dispatch10, "on");
58336   }
58337
58338   // modules/ui/fields/roadspeed.js
58339   function uiFieldRoadspeed(field, context) {
58340     var dispatch10 = dispatch_default("change");
58341     var unitInput = select_default2(null);
58342     var input = select_default2(null);
58343     var _entityIDs = [];
58344     var _tags;
58345     var _isImperial;
58346     var speedCombo = uiCombobox(context, "roadspeed");
58347     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
58348     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
58349     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
58350     function roadspeed(selection2) {
58351       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58352       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58353       input = wrap2.selectAll("input.roadspeed-number").data([0]);
58354       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
58355       input.on("change", change).on("blur", change);
58356       var loc = combinedEntityExtent().center();
58357       _isImperial = roadSpeedUnit(loc) === "mph";
58358       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
58359       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
58360       unitInput.on("blur", changeUnits).on("change", changeUnits);
58361       function changeUnits() {
58362         _isImperial = utilGetSetValue(unitInput) === "mph";
58363         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
58364         setUnitSuggestions();
58365         change();
58366       }
58367     }
58368     function setUnitSuggestions() {
58369       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
58370       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
58371     }
58372     function comboValues(d) {
58373       return {
58374         value: d.toString(),
58375         title: d.toString()
58376       };
58377     }
58378     function change() {
58379       var tag = {};
58380       var value = utilGetSetValue(input).trim();
58381       if (!value && Array.isArray(_tags[field.key]))
58382         return;
58383       if (!value) {
58384         tag[field.key] = void 0;
58385       } else if (isNaN(value) || !_isImperial) {
58386         tag[field.key] = context.cleanTagValue(value);
58387       } else {
58388         tag[field.key] = context.cleanTagValue(value + " mph");
58389       }
58390       dispatch10.call("change", this, tag);
58391     }
58392     roadspeed.tags = function(tags) {
58393       _tags = tags;
58394       var value = tags[field.key];
58395       var isMixed = Array.isArray(value);
58396       if (!isMixed) {
58397         if (value && value.indexOf("mph") >= 0) {
58398           value = parseInt(value, 10).toString();
58399           _isImperial = true;
58400         } else if (value) {
58401           _isImperial = false;
58402         }
58403       }
58404       setUnitSuggestions();
58405       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);
58406     };
58407     roadspeed.focus = function() {
58408       input.node().focus();
58409     };
58410     roadspeed.entityIDs = function(val) {
58411       _entityIDs = val;
58412     };
58413     function combinedEntityExtent() {
58414       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58415     }
58416     return utilRebind(roadspeed, dispatch10, "on");
58417   }
58418
58419   // modules/ui/fields/radio.js
58420   function uiFieldRadio(field, context) {
58421     var dispatch10 = dispatch_default("change");
58422     var placeholder = select_default2(null);
58423     var wrap2 = select_default2(null);
58424     var labels = select_default2(null);
58425     var radios = select_default2(null);
58426     var radioData = (field.options || field.keys).slice();
58427     var typeField;
58428     var layerField;
58429     var _oldType = {};
58430     var _entityIDs = [];
58431     function selectedKey() {
58432       var node = wrap2.selectAll(".form-field-input-radio label.active input");
58433       return !node.empty() && node.datum();
58434     }
58435     function radio(selection2) {
58436       selection2.classed("preset-radio", true);
58437       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58438       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
58439       enter.append("span").attr("class", "placeholder");
58440       wrap2 = wrap2.merge(enter);
58441       placeholder = wrap2.selectAll(".placeholder");
58442       labels = wrap2.selectAll("label").data(radioData);
58443       enter = labels.enter().append("label");
58444       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
58445         return field.t("options." + d, { "default": d });
58446       }).attr("checked", false);
58447       enter.append("span").html(function(d) {
58448         return field.t.html("options." + d, { "default": d });
58449       });
58450       labels = labels.merge(enter);
58451       radios = labels.selectAll("input").on("change", changeRadio);
58452     }
58453     function structureExtras(selection2, tags) {
58454       var selected = selectedKey() || tags.layer !== void 0;
58455       var type3 = _mainPresetIndex.field(selected);
58456       var layer = _mainPresetIndex.field("layer");
58457       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
58458       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
58459       extrasWrap.exit().remove();
58460       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
58461       var list = extrasWrap.selectAll("ul").data([0]);
58462       list = list.enter().append("ul").attr("class", "rows").merge(list);
58463       if (type3) {
58464         if (!typeField || typeField.id !== selected) {
58465           typeField = uiField(context, type3, _entityIDs, { wrap: false }).on("change", changeType);
58466         }
58467         typeField.tags(tags);
58468       } else {
58469         typeField = null;
58470       }
58471       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
58472         return d.id;
58473       });
58474       typeItem.exit().remove();
58475       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
58476       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
58477       typeEnter.append("div").attr("class", "structure-input-type-wrap");
58478       typeItem = typeItem.merge(typeEnter);
58479       if (typeField) {
58480         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
58481       }
58482       if (layer && showLayer) {
58483         if (!layerField) {
58484           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
58485         }
58486         layerField.tags(tags);
58487         field.keys = utilArrayUnion(field.keys, ["layer"]);
58488       } else {
58489         layerField = null;
58490         field.keys = field.keys.filter(function(k) {
58491           return k !== "layer";
58492         });
58493       }
58494       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
58495       layerItem.exit().remove();
58496       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
58497       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
58498       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
58499       layerItem = layerItem.merge(layerEnter);
58500       if (layerField) {
58501         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
58502       }
58503     }
58504     function changeType(t, onInput) {
58505       var key = selectedKey();
58506       if (!key)
58507         return;
58508       var val = t[key];
58509       if (val !== "no") {
58510         _oldType[key] = val;
58511       }
58512       if (field.type === "structureRadio") {
58513         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
58514           t.layer = void 0;
58515         }
58516         if (t.layer === void 0) {
58517           if (key === "bridge" && val !== "no") {
58518             t.layer = "1";
58519           }
58520           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
58521             t.layer = "-1";
58522           }
58523         }
58524       }
58525       dispatch10.call("change", this, t, onInput);
58526     }
58527     function changeLayer(t, onInput) {
58528       if (t.layer === "0") {
58529         t.layer = void 0;
58530       }
58531       dispatch10.call("change", this, t, onInput);
58532     }
58533     function changeRadio() {
58534       var t = {};
58535       var activeKey;
58536       if (field.key) {
58537         t[field.key] = void 0;
58538       }
58539       radios.each(function(d) {
58540         var active = select_default2(this).property("checked");
58541         if (active)
58542           activeKey = d;
58543         if (field.key) {
58544           if (active)
58545             t[field.key] = d;
58546         } else {
58547           var val = _oldType[activeKey] || "yes";
58548           t[d] = active ? val : void 0;
58549         }
58550       });
58551       if (field.type === "structureRadio") {
58552         if (activeKey === "bridge") {
58553           t.layer = "1";
58554         } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
58555           t.layer = "-1";
58556         } else {
58557           t.layer = void 0;
58558         }
58559       }
58560       dispatch10.call("change", this, t);
58561     }
58562     radio.tags = function(tags) {
58563       function isOptionChecked(d) {
58564         if (field.key) {
58565           return tags[field.key] === d;
58566         }
58567         return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
58568       }
58569       function isMixed(d) {
58570         if (field.key) {
58571           return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
58572         }
58573         return Array.isArray(tags[d]);
58574       }
58575       radios.property("checked", function(d) {
58576         return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
58577       });
58578       labels.classed("active", function(d) {
58579         if (field.key) {
58580           return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
58581         }
58582         return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
58583       }).classed("mixed", isMixed).attr("title", function(d) {
58584         return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
58585       });
58586       var selection2 = radios.filter(function() {
58587         return this.checked;
58588       });
58589       if (selection2.empty()) {
58590         placeholder.text("");
58591         placeholder.call(_t.append("inspector.none"));
58592       } else {
58593         placeholder.text(selection2.attr("value"));
58594         _oldType[selection2.datum()] = tags[selection2.datum()];
58595       }
58596       if (field.type === "structureRadio") {
58597         if (!!tags.waterway && !_oldType.tunnel) {
58598           _oldType.tunnel = "culvert";
58599         }
58600         wrap2.call(structureExtras, tags);
58601       }
58602     };
58603     radio.focus = function() {
58604       radios.node().focus();
58605     };
58606     radio.entityIDs = function(val) {
58607       if (!arguments.length)
58608         return _entityIDs;
58609       _entityIDs = val;
58610       _oldType = {};
58611       return radio;
58612     };
58613     radio.isAllowed = function() {
58614       return _entityIDs.length === 1;
58615     };
58616     return utilRebind(radio, dispatch10, "on");
58617   }
58618
58619   // modules/ui/fields/restrictions.js
58620   function uiFieldRestrictions(field, context) {
58621     var dispatch10 = dispatch_default("change");
58622     var breathe = behaviorBreathe(context);
58623     corePreferences("turn-restriction-via-way", null);
58624     var storedViaWay = corePreferences("turn-restriction-via-way0");
58625     var storedDistance = corePreferences("turn-restriction-distance");
58626     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
58627     var _maxDistance = storedDistance ? +storedDistance : 30;
58628     var _initialized2 = false;
58629     var _parent = select_default2(null);
58630     var _container = select_default2(null);
58631     var _oldTurns;
58632     var _graph;
58633     var _vertexID;
58634     var _intersection;
58635     var _fromWayID;
58636     var _lastXPos;
58637     function restrictions(selection2) {
58638       _parent = selection2;
58639       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
58640         _graph = context.graph();
58641         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
58642       }
58643       var isOK = _intersection && _intersection.vertices.length && _intersection.vertices.filter(function(vertex) {
58644         return vertex.id === _vertexID;
58645       }).length && _intersection.ways.length > 2 && _intersection.ways.filter(function(way) {
58646         return way.__to;
58647       }).length > 1;
58648       select_default2(selection2.node().parentNode).classed("hide", !isOK);
58649       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
58650         selection2.call(restrictions.off);
58651         return;
58652       }
58653       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58654       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58655       var container = wrap2.selectAll(".restriction-container").data([0]);
58656       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
58657       containerEnter.append("div").attr("class", "restriction-help");
58658       _container = containerEnter.merge(container).call(renderViewer);
58659       var controls = wrap2.selectAll(".restriction-controls").data([0]);
58660       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
58661     }
58662     function renderControls(selection2) {
58663       var distControl = selection2.selectAll(".restriction-distance").data([0]);
58664       distControl.exit().remove();
58665       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
58666       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
58667       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
58668       distControlEnter.append("span").attr("class", "restriction-distance-text");
58669       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
58670         var val = select_default2(this).property("value");
58671         _maxDistance = +val;
58672         _intersection = null;
58673         _container.selectAll(".layer-osm .layer-turns *").remove();
58674         corePreferences("turn-restriction-distance", _maxDistance);
58675         _parent.call(restrictions);
58676       });
58677       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
58678       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
58679       viaControl.exit().remove();
58680       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
58681       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
58682       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
58683       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
58684       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
58685         var val = select_default2(this).property("value");
58686         _maxViaWay = +val;
58687         _container.selectAll(".layer-osm .layer-turns *").remove();
58688         corePreferences("turn-restriction-via-way0", _maxViaWay);
58689         _parent.call(restrictions);
58690       });
58691       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
58692     }
58693     function renderViewer(selection2) {
58694       if (!_intersection)
58695         return;
58696       var vgraph = _intersection.graph;
58697       var filter2 = utilFunctor(true);
58698       var projection2 = geoRawMercator();
58699       var sdims = utilGetDimensions(context.container().select(".sidebar"));
58700       var d = [sdims[0] - 50, 370];
58701       var c = geoVecScale(d, 0.5);
58702       var z = 22;
58703       projection2.scale(geoZoomToScale(z));
58704       var extent = geoExtent();
58705       for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
58706         extent._extend(_intersection.vertices[i2].extent());
58707       }
58708       var padTop = 35;
58709       if (_intersection.vertices.length > 1) {
58710         var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
58711         var vPadding = 160;
58712         var tl = projection2([extent[0][0], extent[1][1]]);
58713         var br = projection2([extent[1][0], extent[0][1]]);
58714         var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
58715         var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
58716         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
58717         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
58718         z = z - Math.max(hZoomDiff, vZoomDiff);
58719         projection2.scale(geoZoomToScale(z));
58720       }
58721       var extentCenter = projection2(extent.center());
58722       extentCenter[1] = extentCenter[1] - padTop / 2;
58723       projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
58724       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
58725       var drawVertices = svgVertices(projection2, context);
58726       var drawLines = svgLines(projection2, context);
58727       var drawTurns = svgTurns(projection2, context);
58728       var firstTime = selection2.selectAll(".surface").empty();
58729       selection2.call(drawLayers);
58730       var surface = selection2.selectAll(".surface").classed("tr", true);
58731       if (firstTime) {
58732         _initialized2 = true;
58733         surface.call(breathe);
58734       }
58735       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
58736         _fromWayID = null;
58737         _oldTurns = null;
58738       }
58739       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));
58740       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
58741       surface.selectAll(".selected").classed("selected", false);
58742       surface.selectAll(".related").classed("related", false);
58743       var way;
58744       if (_fromWayID) {
58745         way = vgraph.entity(_fromWayID);
58746         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
58747       }
58748       document.addEventListener("resizeWindow", function() {
58749         utilSetDimensions(_container, null);
58750         redraw(1);
58751       }, false);
58752       updateHints(null);
58753       function click(d3_event) {
58754         surface.call(breathe.off).call(breathe);
58755         var datum2 = d3_event.target.__data__;
58756         var entity = datum2 && datum2.properties && datum2.properties.entity;
58757         if (entity) {
58758           datum2 = entity;
58759         }
58760         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
58761           _fromWayID = datum2.id;
58762           _oldTurns = null;
58763           redraw();
58764         } else if (datum2 instanceof osmTurn) {
58765           var actions, extraActions, turns, i3;
58766           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
58767           if (datum2.restrictionID && !datum2.direct) {
58768             return;
58769           } else if (datum2.restrictionID && !datum2.only) {
58770             var seen = {};
58771             var datumOnly = JSON.parse(JSON.stringify(datum2));
58772             datumOnly.only = true;
58773             restrictionType = restrictionType.replace(/^no/, "only");
58774             turns = _intersection.turns(_fromWayID, 2);
58775             extraActions = [];
58776             _oldTurns = [];
58777             for (i3 = 0; i3 < turns.length; i3++) {
58778               var turn = turns[i3];
58779               if (seen[turn.restrictionID])
58780                 continue;
58781               if (turn.direct && turn.path[1] === datum2.path[1]) {
58782                 seen[turns[i3].restrictionID] = true;
58783                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
58784                 _oldTurns.push(turn);
58785                 extraActions.push(actionUnrestrictTurn(turn));
58786               }
58787             }
58788             actions = _intersection.actions.concat(extraActions, [
58789               actionRestrictTurn(datumOnly, restrictionType),
58790               _t("operations.restriction.annotation.create")
58791             ]);
58792           } else if (datum2.restrictionID) {
58793             turns = _oldTurns || [];
58794             extraActions = [];
58795             for (i3 = 0; i3 < turns.length; i3++) {
58796               if (turns[i3].key !== datum2.key) {
58797                 extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
58798               }
58799             }
58800             _oldTurns = null;
58801             actions = _intersection.actions.concat(extraActions, [
58802               actionUnrestrictTurn(datum2),
58803               _t("operations.restriction.annotation.delete")
58804             ]);
58805           } else {
58806             actions = _intersection.actions.concat([
58807               actionRestrictTurn(datum2, restrictionType),
58808               _t("operations.restriction.annotation.create")
58809             ]);
58810           }
58811           context.perform.apply(context, actions);
58812           var s = surface.selectAll("." + datum2.key);
58813           datum2 = s.empty() ? null : s.datum();
58814           updateHints(datum2);
58815         } else {
58816           _fromWayID = null;
58817           _oldTurns = null;
58818           redraw();
58819         }
58820       }
58821       function mouseover(d3_event) {
58822         var datum2 = d3_event.target.__data__;
58823         updateHints(datum2);
58824       }
58825       _lastXPos = _lastXPos || sdims[0];
58826       function redraw(minChange) {
58827         var xPos = -1;
58828         if (minChange) {
58829           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
58830         }
58831         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
58832           if (context.hasEntity(_vertexID)) {
58833             _lastXPos = xPos;
58834             _container.call(renderViewer);
58835           }
58836         }
58837       }
58838       function highlightPathsFrom(wayID) {
58839         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
58840         surface.selectAll("." + wayID).classed("related", true);
58841         if (wayID) {
58842           var turns = _intersection.turns(wayID, _maxViaWay);
58843           for (var i3 = 0; i3 < turns.length; i3++) {
58844             var turn = turns[i3];
58845             var ids = [turn.to.way];
58846             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
58847             if (turn.only || turns.length === 1) {
58848               if (turn.via.ways) {
58849                 ids = ids.concat(turn.via.ways);
58850               }
58851             } else if (turn.to.way === wayID) {
58852               continue;
58853             }
58854             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
58855           }
58856         }
58857       }
58858       function updateHints(datum2) {
58859         var help = _container.selectAll(".restriction-help").html("");
58860         var placeholders = {};
58861         ["from", "via", "to"].forEach(function(k) {
58862           placeholders[k] = { html: '<span class="qualifier">' + _t("restriction.help." + k) + "</span>" };
58863         });
58864         var entity = datum2 && datum2.properties && datum2.properties.entity;
58865         if (entity) {
58866           datum2 = entity;
58867         }
58868         if (_fromWayID) {
58869           way = vgraph.entity(_fromWayID);
58870           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
58871         }
58872         if (datum2 instanceof osmWay && datum2.__from) {
58873           way = datum2;
58874           highlightPathsFrom(_fromWayID ? null : way.id);
58875           surface.selectAll("." + way.id).classed("related", true);
58876           var clickSelect = !_fromWayID || _fromWayID !== way.id;
58877           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
58878             from: placeholders.from,
58879             fromName: displayName(way.id, vgraph)
58880           }));
58881         } else if (datum2 instanceof osmTurn) {
58882           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
58883           var turnType = restrictionType.replace(/^(only|no)\_/, "");
58884           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
58885           var klass, turnText, nextText;
58886           if (datum2.no) {
58887             klass = "restrict";
58888             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
58889             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
58890           } else if (datum2.only) {
58891             klass = "only";
58892             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
58893             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
58894           } else {
58895             klass = "allow";
58896             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
58897             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
58898           }
58899           help.append("div").attr("class", "qualifier " + klass).html(turnText);
58900           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
58901             from: placeholders.from,
58902             fromName: displayName(datum2.from.way, vgraph),
58903             to: placeholders.to,
58904             toName: displayName(datum2.to.way, vgraph)
58905           }));
58906           if (datum2.via.ways && datum2.via.ways.length) {
58907             var names = [];
58908             for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
58909               var prev = names[names.length - 1];
58910               var curr = displayName(datum2.via.ways[i3], vgraph);
58911               if (!prev || curr !== prev) {
58912                 names.push(curr);
58913               }
58914             }
58915             help.append("div").html(_t.html("restriction.help.via_names", {
58916               via: placeholders.via,
58917               viaNames: names.join(", ")
58918             }));
58919           }
58920           if (!indirect) {
58921             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
58922           }
58923           highlightPathsFrom(null);
58924           var alongIDs = datum2.path.slice();
58925           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
58926         } else {
58927           highlightPathsFrom(null);
58928           if (_fromWayID) {
58929             help.append("div").html(_t.html("restriction.help.from_name", {
58930               from: placeholders.from,
58931               fromName: displayName(_fromWayID, vgraph)
58932             }));
58933           } else {
58934             help.append("div").html(_t.html("restriction.help.select_from", {
58935               from: placeholders.from
58936             }));
58937           }
58938         }
58939       }
58940     }
58941     function displayMaxDistance(maxDist) {
58942       return (selection2) => {
58943         var isImperial = !_mainLocalizer.usesMetric();
58944         var opts;
58945         if (isImperial) {
58946           var distToFeet = {
58947             20: 70,
58948             25: 85,
58949             30: 100,
58950             35: 115,
58951             40: 130,
58952             45: 145,
58953             50: 160
58954           }[maxDist];
58955           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
58956         } else {
58957           opts = { distance: _t("units.meters", { quantity: maxDist }) };
58958         }
58959         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
58960       };
58961     }
58962     function displayMaxVia(maxVia) {
58963       return (selection2) => {
58964         selection2 = selection2.html("");
58965         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"));
58966       };
58967     }
58968     function displayName(entityID, graph) {
58969       var entity = graph.entity(entityID);
58970       var name2 = utilDisplayName(entity) || "";
58971       var matched = _mainPresetIndex.match(entity, graph);
58972       var type3 = matched && matched.name() || utilDisplayType(entity.id);
58973       return name2 || type3;
58974     }
58975     restrictions.entityIDs = function(val) {
58976       _intersection = null;
58977       _fromWayID = null;
58978       _oldTurns = null;
58979       _vertexID = val[0];
58980     };
58981     restrictions.tags = function() {
58982     };
58983     restrictions.focus = function() {
58984     };
58985     restrictions.off = function(selection2) {
58986       if (!_initialized2)
58987         return;
58988       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
58989       select_default2(window).on("resize.restrictions", null);
58990     };
58991     return utilRebind(restrictions, dispatch10, "on");
58992   }
58993   uiFieldRestrictions.supportsMultiselection = false;
58994
58995   // modules/ui/fields/textarea.js
58996   function uiFieldTextarea(field, context) {
58997     var dispatch10 = dispatch_default("change");
58998     var input = select_default2(null);
58999     var _tags;
59000     function textarea(selection2) {
59001       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59002       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59003       input = wrap2.selectAll("textarea").data([0]);
59004       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
59005     }
59006     function change(onInput) {
59007       return function() {
59008         var val = utilGetSetValue(input);
59009         if (!onInput)
59010           val = context.cleanTagValue(val);
59011         if (!val && Array.isArray(_tags[field.key]))
59012           return;
59013         var t = {};
59014         t[field.key] = val || void 0;
59015         dispatch10.call("change", this, t, onInput);
59016       };
59017     }
59018     textarea.tags = function(tags) {
59019       _tags = tags;
59020       var isMixed = Array.isArray(tags[field.key]);
59021       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);
59022     };
59023     textarea.focus = function() {
59024       input.node().focus();
59025     };
59026     return utilRebind(textarea, dispatch10, "on");
59027   }
59028
59029   // modules/ui/fields/wikidata.js
59030   function uiFieldWikidata(field, context) {
59031     var wikidata = services.wikidata;
59032     var dispatch10 = dispatch_default("change");
59033     var _selection = select_default2(null);
59034     var _searchInput = select_default2(null);
59035     var _qid = null;
59036     var _wikidataEntity = null;
59037     var _wikiURL = "";
59038     var _entityIDs = [];
59039     var _wikipediaKey = field.keys && field.keys.find(function(key) {
59040       return key.includes("wikipedia");
59041     }), _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
59042     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
59043     function wiki(selection2) {
59044       _selection = selection2;
59045       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59046       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59047       var list = wrap2.selectAll("ul").data([0]);
59048       list = list.enter().append("ul").attr("class", "rows").merge(list);
59049       var searchRow = list.selectAll("li.wikidata-search").data([0]);
59050       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
59051       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
59052         var node = select_default2(this).node();
59053         node.setSelectionRange(0, node.value.length);
59054       }).on("blur", function() {
59055         setLabelForEntity();
59056       }).call(combobox.fetcher(fetchWikidataItems));
59057       combobox.on("accept", function(d) {
59058         if (d) {
59059           _qid = d.id;
59060           change();
59061         }
59062       }).on("cancel", function() {
59063         setLabelForEntity();
59064       });
59065       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) {
59066         d3_event.preventDefault();
59067         if (_wikiURL)
59068           window.open(_wikiURL, "_blank");
59069       });
59070       searchRow = searchRow.merge(searchRowEnter);
59071       _searchInput = searchRow.select("input");
59072       var wikidataProperties = ["description", "identifier"];
59073       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
59074       var enter = items.enter().append("li").attr("class", function(d) {
59075         return "labeled-input preset-wikidata-" + d;
59076       });
59077       enter.append("span").attr("class", "label").html(function(d) {
59078         return _t.html("wikidata." + d);
59079       });
59080       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
59081       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
59082         d3_event.preventDefault();
59083         select_default2(this.parentNode).select("input").node().select();
59084         document.execCommand("copy");
59085       });
59086     }
59087     function fetchWikidataItems(q, callback) {
59088       if (!q && _hintKey) {
59089         for (var i2 in _entityIDs) {
59090           var entity = context.hasEntity(_entityIDs[i2]);
59091           if (entity.tags[_hintKey]) {
59092             q = entity.tags[_hintKey];
59093             break;
59094           }
59095         }
59096       }
59097       wikidata.itemsForSearchQuery(q, function(err, data) {
59098         if (err)
59099           return;
59100         for (var i3 in data) {
59101           data[i3].value = data[i3].label + " (" + data[i3].id + ")";
59102           data[i3].title = data[i3].description;
59103         }
59104         if (callback)
59105           callback(data);
59106       });
59107     }
59108     function change() {
59109       var syncTags = {};
59110       syncTags[field.key] = _qid;
59111       dispatch10.call("change", this, syncTags);
59112       var initGraph = context.graph();
59113       var initEntityIDs = _entityIDs;
59114       wikidata.entityByQID(_qid, function(err, entity) {
59115         if (err)
59116           return;
59117         if (context.graph() !== initGraph)
59118           return;
59119         if (!entity.sitelinks)
59120           return;
59121         var langs = wikidata.languagesToQuery();
59122         ["labels", "descriptions"].forEach(function(key) {
59123           if (!entity[key])
59124             return;
59125           var valueLangs = Object.keys(entity[key]);
59126           if (valueLangs.length === 0)
59127             return;
59128           var valueLang = valueLangs[0];
59129           if (langs.indexOf(valueLang) === -1) {
59130             langs.push(valueLang);
59131           }
59132         });
59133         var newWikipediaValue;
59134         if (_wikipediaKey) {
59135           var foundPreferred;
59136           for (var i2 in langs) {
59137             var lang = langs[i2];
59138             var siteID = lang.replace("-", "_") + "wiki";
59139             if (entity.sitelinks[siteID]) {
59140               foundPreferred = true;
59141               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
59142               break;
59143             }
59144           }
59145           if (!foundPreferred) {
59146             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
59147               return site.endsWith("wiki");
59148             });
59149             if (wikiSiteKeys.length === 0) {
59150               newWikipediaValue = null;
59151             } else {
59152               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
59153               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
59154               newWikipediaValue = wikiLang + ":" + wikiTitle;
59155             }
59156           }
59157         }
59158         if (newWikipediaValue) {
59159           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
59160         }
59161         if (typeof newWikipediaValue === "undefined")
59162           return;
59163         var actions = initEntityIDs.map(function(entityID) {
59164           var entity2 = context.hasEntity(entityID);
59165           if (!entity2)
59166             return null;
59167           var currTags = Object.assign({}, entity2.tags);
59168           if (newWikipediaValue === null) {
59169             if (!currTags[_wikipediaKey])
59170               return null;
59171             delete currTags[_wikipediaKey];
59172           } else {
59173             currTags[_wikipediaKey] = newWikipediaValue;
59174           }
59175           return actionChangeTags(entityID, currTags);
59176         }).filter(Boolean);
59177         if (!actions.length)
59178           return;
59179         context.overwrite(function actionUpdateWikipediaTags(graph) {
59180           actions.forEach(function(action) {
59181             graph = action(graph);
59182           });
59183           return graph;
59184         }, context.history().undoAnnotation());
59185       });
59186     }
59187     function setLabelForEntity() {
59188       var label = "";
59189       if (_wikidataEntity) {
59190         label = entityPropertyForDisplay(_wikidataEntity, "labels");
59191         if (label.length === 0) {
59192           label = _wikidataEntity.id.toString();
59193         }
59194       }
59195       utilGetSetValue(_searchInput, label);
59196     }
59197     wiki.tags = function(tags) {
59198       var isMixed = Array.isArray(tags[field.key]);
59199       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
59200       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
59201       if (!/^Q[0-9]*$/.test(_qid)) {
59202         unrecognized();
59203         return;
59204       }
59205       _wikiURL = "https://wikidata.org/wiki/" + _qid;
59206       wikidata.entityByQID(_qid, function(err, entity) {
59207         if (err) {
59208           unrecognized();
59209           return;
59210         }
59211         _wikidataEntity = entity;
59212         setLabelForEntity();
59213         var description2 = entityPropertyForDisplay(entity, "descriptions");
59214         _selection.select("button.wiki-link").classed("disabled", false);
59215         _selection.select(".preset-wikidata-description").style("display", function() {
59216           return description2.length > 0 ? "flex" : "none";
59217         }).select("input").attr("value", description2);
59218         _selection.select(".preset-wikidata-identifier").style("display", function() {
59219           return entity.id ? "flex" : "none";
59220         }).select("input").attr("value", entity.id);
59221       });
59222       function unrecognized() {
59223         _wikidataEntity = null;
59224         setLabelForEntity();
59225         _selection.select(".preset-wikidata-description").style("display", "none");
59226         _selection.select(".preset-wikidata-identifier").style("display", "none");
59227         _selection.select("button.wiki-link").classed("disabled", true);
59228         if (_qid && _qid !== "") {
59229           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
59230         } else {
59231           _wikiURL = "";
59232         }
59233       }
59234     };
59235     function entityPropertyForDisplay(wikidataEntity, propKey) {
59236       if (!wikidataEntity[propKey])
59237         return "";
59238       var propObj = wikidataEntity[propKey];
59239       var langKeys = Object.keys(propObj);
59240       if (langKeys.length === 0)
59241         return "";
59242       var langs = wikidata.languagesToQuery();
59243       for (var i2 in langs) {
59244         var lang = langs[i2];
59245         var valueObj = propObj[lang];
59246         if (valueObj && valueObj.value && valueObj.value.length > 0)
59247           return valueObj.value;
59248       }
59249       return propObj[langKeys[0]].value;
59250     }
59251     wiki.entityIDs = function(val) {
59252       if (!arguments.length)
59253         return _entityIDs;
59254       _entityIDs = val;
59255       return wiki;
59256     };
59257     wiki.focus = function() {
59258       _searchInput.node().focus();
59259     };
59260     return utilRebind(wiki, dispatch10, "on");
59261   }
59262
59263   // modules/ui/fields/wikipedia.js
59264   function uiFieldWikipedia(field, context) {
59265     const dispatch10 = dispatch_default("change");
59266     const wikipedia = services.wikipedia;
59267     const wikidata = services.wikidata;
59268     let _langInput = select_default2(null);
59269     let _titleInput = select_default2(null);
59270     let _wikiURL = "";
59271     let _entityIDs;
59272     let _tags;
59273     let _dataWikipedia = [];
59274     _mainFileFetcher.get("wmf_sitematrix").then((d) => {
59275       _dataWikipedia = d;
59276       if (_tags)
59277         updateForTags(_tags);
59278     }).catch(() => {
59279     });
59280     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
59281       const v = value.toLowerCase();
59282       callback(_dataWikipedia.filter((d) => {
59283         return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
59284       }).map((d) => ({ value: d[1] })));
59285     });
59286     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
59287       if (!value) {
59288         value = "";
59289         for (let i2 in _entityIDs) {
59290           let entity = context.hasEntity(_entityIDs[i2]);
59291           if (entity.tags.name) {
59292             value = entity.tags.name;
59293             break;
59294           }
59295         }
59296       }
59297       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
59298       searchfn(language()[2], value, (query, data) => {
59299         callback(data.map((d) => ({ value: d })));
59300       });
59301     });
59302     function wiki(selection2) {
59303       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59304       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
59305       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
59306       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
59307       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
59308       _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);
59309       _langInput.on("blur", changeLang).on("change", changeLang);
59310       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
59311       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
59312       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
59313       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
59314       _titleInput.on("blur", function() {
59315         change(true);
59316       }).on("change", function() {
59317         change(false);
59318       });
59319       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
59320       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);
59321       link2.on("click", (d3_event) => {
59322         d3_event.preventDefault();
59323         if (_wikiURL)
59324           window.open(_wikiURL, "_blank");
59325       });
59326     }
59327     function defaultLanguageInfo(skipEnglishFallback) {
59328       const langCode = _mainLocalizer.languageCode().toLowerCase();
59329       for (let i2 in _dataWikipedia) {
59330         let d = _dataWikipedia[i2];
59331         if (d[2] === langCode)
59332           return d;
59333       }
59334       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
59335     }
59336     function language(skipEnglishFallback) {
59337       const value = utilGetSetValue(_langInput).toLowerCase();
59338       for (let i2 in _dataWikipedia) {
59339         let d = _dataWikipedia[i2];
59340         if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
59341           return d;
59342       }
59343       return defaultLanguageInfo(skipEnglishFallback);
59344     }
59345     function changeLang() {
59346       utilGetSetValue(_langInput, language()[1]);
59347       change(true);
59348     }
59349     function change(skipWikidata) {
59350       let value = utilGetSetValue(_titleInput);
59351       const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
59352       const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
59353       let syncTags = {};
59354       if (langInfo) {
59355         const nativeLangName = langInfo[1];
59356         value = decodeURIComponent(m[2]).replace(/_/g, " ");
59357         if (m[3]) {
59358           let anchor;
59359           anchor = decodeURIComponent(m[3]);
59360           value += "#" + anchor.replace(/_/g, " ");
59361         }
59362         value = value.slice(0, 1).toUpperCase() + value.slice(1);
59363         utilGetSetValue(_langInput, nativeLangName);
59364         utilGetSetValue(_titleInput, value);
59365       }
59366       if (value) {
59367         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
59368       } else {
59369         syncTags.wikipedia = void 0;
59370       }
59371       dispatch10.call("change", this, syncTags);
59372       if (skipWikidata || !value || !language()[2])
59373         return;
59374       const initGraph = context.graph();
59375       const initEntityIDs = _entityIDs;
59376       wikidata.itemsByTitle(language()[2], value, (err, data) => {
59377         if (err || !data || !Object.keys(data).length)
59378           return;
59379         if (context.graph() !== initGraph)
59380           return;
59381         const qids = Object.keys(data);
59382         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
59383         let actions = initEntityIDs.map((entityID) => {
59384           let entity = context.entity(entityID).tags;
59385           let currTags = Object.assign({}, entity);
59386           if (currTags.wikidata !== value2) {
59387             currTags.wikidata = value2;
59388             return actionChangeTags(entityID, currTags);
59389           }
59390           return null;
59391         }).filter(Boolean);
59392         if (!actions.length)
59393           return;
59394         context.overwrite(function actionUpdateWikidataTags(graph) {
59395           actions.forEach(function(action) {
59396             graph = action(graph);
59397           });
59398           return graph;
59399         }, context.history().undoAnnotation());
59400       });
59401     }
59402     wiki.tags = (tags) => {
59403       _tags = tags;
59404       updateForTags(tags);
59405     };
59406     function updateForTags(tags) {
59407       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
59408       const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
59409       const tagLang = m && m[1];
59410       const tagArticleTitle = m && m[2];
59411       let anchor = m && m[3];
59412       const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
59413       if (tagLangInfo) {
59414         const nativeLangName = tagLangInfo[1];
59415         utilGetSetValue(_langInput, nativeLangName);
59416         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
59417         if (anchor) {
59418           try {
59419             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
59420           } catch (e) {
59421             anchor = anchor.replace(/ /g, "_");
59422           }
59423         }
59424         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
59425       } else {
59426         utilGetSetValue(_titleInput, value);
59427         if (value && value !== "") {
59428           utilGetSetValue(_langInput, "");
59429           const defaultLangInfo = defaultLanguageInfo();
59430           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
59431         } else {
59432           const shownOrDefaultLangInfo = language(true);
59433           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
59434           _wikiURL = "";
59435         }
59436       }
59437     }
59438     wiki.entityIDs = (val) => {
59439       if (!arguments.length)
59440         return _entityIDs;
59441       _entityIDs = val;
59442       return wiki;
59443     };
59444     wiki.focus = () => {
59445       _titleInput.node().focus();
59446     };
59447     return utilRebind(wiki, dispatch10, "on");
59448   }
59449   uiFieldWikipedia.supportsMultiselection = false;
59450
59451   // modules/ui/fields/index.js
59452   var uiFields = {
59453     access: uiFieldAccess,
59454     address: uiFieldAddress,
59455     check: uiFieldCheck,
59456     combo: uiFieldCombo,
59457     cycleway: uiFieldCycleway,
59458     defaultCheck: uiFieldCheck,
59459     email: uiFieldText,
59460     identifier: uiFieldText,
59461     lanes: uiFieldLanes,
59462     localized: uiFieldLocalized,
59463     roadheight: uiFieldRoadheight,
59464     roadspeed: uiFieldRoadspeed,
59465     manyCombo: uiFieldCombo,
59466     multiCombo: uiFieldCombo,
59467     networkCombo: uiFieldCombo,
59468     number: uiFieldText,
59469     onewayCheck: uiFieldCheck,
59470     radio: uiFieldRadio,
59471     restrictions: uiFieldRestrictions,
59472     semiCombo: uiFieldCombo,
59473     structureRadio: uiFieldRadio,
59474     tel: uiFieldText,
59475     text: uiFieldText,
59476     textarea: uiFieldTextarea,
59477     typeCombo: uiFieldCombo,
59478     url: uiFieldText,
59479     wikidata: uiFieldWikidata,
59480     wikipedia: uiFieldWikipedia
59481   };
59482
59483   // modules/ui/field.js
59484   function uiField(context, presetField2, entityIDs, options2) {
59485     options2 = Object.assign({
59486       show: true,
59487       wrap: true,
59488       remove: true,
59489       revert: true,
59490       info: true
59491     }, options2);
59492     var dispatch10 = dispatch_default("change", "revert");
59493     var field = Object.assign({}, presetField2);
59494     field.domId = utilUniqueDomId("form-field-" + field.safeid);
59495     var _show = options2.show;
59496     var _state = "";
59497     var _tags = {};
59498     var _entityExtent;
59499     if (entityIDs && entityIDs.length) {
59500       _entityExtent = entityIDs.reduce(function(extent, entityID) {
59501         var entity = context.graph().entity(entityID);
59502         return extent.extend(entity.extent(context.graph()));
59503       }, geoExtent());
59504     }
59505     var _locked = false;
59506     var _lockedTip = uiTooltip().title(_t.html("inspector.lock.suggestion", { label: field.label })).placement("bottom");
59507     field.keys = field.keys || [field.key];
59508     if (_show && !field.impl) {
59509       createField();
59510     }
59511     function createField() {
59512       field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
59513         dispatch10.call("change", field, t, onInput);
59514       });
59515       if (entityIDs) {
59516         field.entityIDs = entityIDs;
59517         if (field.impl.entityIDs) {
59518           field.impl.entityIDs(entityIDs);
59519         }
59520       }
59521     }
59522     function isModified() {
59523       if (!entityIDs || !entityIDs.length)
59524         return false;
59525       return entityIDs.some(function(entityID) {
59526         var original = context.graph().base().entities[entityID];
59527         var latest = context.graph().entity(entityID);
59528         return field.keys.some(function(key) {
59529           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
59530         });
59531       });
59532     }
59533     function tagsContainFieldKey() {
59534       return field.keys.some(function(key) {
59535         if (field.type === "multiCombo") {
59536           for (var tagKey in _tags) {
59537             if (tagKey.indexOf(key) === 0) {
59538               return true;
59539             }
59540           }
59541           return false;
59542         }
59543         return _tags[key] !== void 0;
59544       });
59545     }
59546     function revert(d3_event, d) {
59547       d3_event.stopPropagation();
59548       d3_event.preventDefault();
59549       if (!entityIDs || _locked)
59550         return;
59551       dispatch10.call("revert", d, d.keys);
59552     }
59553     function remove2(d3_event, d) {
59554       d3_event.stopPropagation();
59555       d3_event.preventDefault();
59556       if (_locked)
59557         return;
59558       var t = {};
59559       d.keys.forEach(function(key) {
59560         t[key] = void 0;
59561       });
59562       dispatch10.call("change", d, t);
59563     }
59564     field.render = function(selection2) {
59565       var container = selection2.selectAll(".form-field").data([field]);
59566       var enter = container.enter().append("div").attr("class", function(d) {
59567         return "form-field form-field-" + d.safeid;
59568       }).classed("nowrap", !options2.wrap);
59569       if (options2.wrap) {
59570         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
59571           return d.domId;
59572         });
59573         var textEnter = labelEnter.append("span").attr("class", "label-text");
59574         textEnter.append("span").attr("class", "label-textvalue").html(function(d) {
59575           return d.label();
59576         });
59577         textEnter.append("span").attr("class", "label-textannotation");
59578         if (options2.remove) {
59579           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
59580         }
59581         if (options2.revert) {
59582           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
59583         }
59584       }
59585       container = container.merge(enter);
59586       container.select(".field-label > .remove-icon").on("click", remove2);
59587       container.select(".field-label > .modified-icon").on("click", revert);
59588       container.each(function(d) {
59589         var selection3 = select_default2(this);
59590         if (!d.impl) {
59591           createField();
59592         }
59593         var reference, help;
59594         if (options2.wrap && field.type === "restrictions") {
59595           help = uiFieldHelp(context, "restrictions");
59596         }
59597         if (options2.wrap && options2.info) {
59598           var referenceKey = d.key || "";
59599           if (d.type === "multiCombo") {
59600             referenceKey = referenceKey.replace(/:$/, "");
59601           }
59602           reference = uiTagReference(d.reference || { key: referenceKey }, context);
59603           if (_state === "hover") {
59604             reference.showing(false);
59605           }
59606         }
59607         selection3.call(d.impl);
59608         if (help) {
59609           selection3.call(help.body).select(".field-label").call(help.button);
59610         }
59611         if (reference) {
59612           selection3.call(reference.body).select(".field-label").call(reference.button);
59613         }
59614         d.impl.tags(_tags);
59615       });
59616       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
59617       var annotation = container.selectAll(".field-label .label-textannotation");
59618       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
59619       icon2.exit().remove();
59620       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
59621       container.call(_locked ? _lockedTip : _lockedTip.destroy);
59622     };
59623     field.state = function(val) {
59624       if (!arguments.length)
59625         return _state;
59626       _state = val;
59627       return field;
59628     };
59629     field.tags = function(val) {
59630       if (!arguments.length)
59631         return _tags;
59632       _tags = val;
59633       if (tagsContainFieldKey() && !_show) {
59634         _show = true;
59635         if (!field.impl) {
59636           createField();
59637         }
59638       }
59639       return field;
59640     };
59641     field.locked = function(val) {
59642       if (!arguments.length)
59643         return _locked;
59644       _locked = val;
59645       return field;
59646     };
59647     field.show = function() {
59648       _show = true;
59649       if (!field.impl) {
59650         createField();
59651       }
59652       if (field.default && field.key && _tags[field.key] !== field.default) {
59653         var t = {};
59654         t[field.key] = field.default;
59655         dispatch10.call("change", this, t);
59656       }
59657     };
59658     field.isShown = function() {
59659       return _show;
59660     };
59661     field.isAllowed = function() {
59662       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
59663         return false;
59664       if (field.geometry && !entityIDs.every(function(entityID) {
59665         return field.matchGeometry(context.graph().geometry(entityID));
59666       }))
59667         return false;
59668       if (entityIDs && _entityExtent && field.locationSetID) {
59669         var validLocations = _mainLocations.locationsAt(_entityExtent.center());
59670         if (!validLocations[field.locationSetID])
59671           return false;
59672       }
59673       var prerequisiteTag = field.prerequisiteTag;
59674       if (entityIDs && !tagsContainFieldKey() && prerequisiteTag) {
59675         if (!entityIDs.every(function(entityID) {
59676           var entity = context.graph().entity(entityID);
59677           if (prerequisiteTag.key) {
59678             var value = entity.tags[prerequisiteTag.key];
59679             if (!value)
59680               return false;
59681             if (prerequisiteTag.valueNot) {
59682               return prerequisiteTag.valueNot !== value;
59683             }
59684             if (prerequisiteTag.value) {
59685               return prerequisiteTag.value === value;
59686             }
59687           } else if (prerequisiteTag.keyNot) {
59688             if (entity.tags[prerequisiteTag.keyNot])
59689               return false;
59690           }
59691           return true;
59692         }))
59693           return false;
59694       }
59695       return true;
59696     };
59697     field.focus = function() {
59698       if (field.impl) {
59699         field.impl.focus();
59700       }
59701     };
59702     return utilRebind(field, dispatch10, "on");
59703   }
59704
59705   // modules/ui/form_fields.js
59706   function uiFormFields(context) {
59707     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
59708     var _fieldsArr = [];
59709     var _lastPlaceholder = "";
59710     var _state = "";
59711     var _klass = "";
59712     function formFields(selection2) {
59713       var allowedFields = _fieldsArr.filter(function(field) {
59714         return field.isAllowed();
59715       });
59716       var shown = allowedFields.filter(function(field) {
59717         return field.isShown();
59718       });
59719       var notShown = allowedFields.filter(function(field) {
59720         return !field.isShown();
59721       });
59722       var container = selection2.selectAll(".form-fields-container").data([0]);
59723       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
59724       var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
59725         return d.id + (d.entityIDs ? d.entityIDs.join() : "");
59726       });
59727       fields.exit().remove();
59728       var enter = fields.enter().append("div").attr("class", function(d) {
59729         return "wrap-form-field wrap-form-field-" + d.safeid;
59730       });
59731       fields = fields.merge(enter);
59732       fields.order().each(function(d) {
59733         select_default2(this).call(d.render);
59734       });
59735       var titles = [];
59736       var moreFields = notShown.map(function(field) {
59737         var title = field.title();
59738         titles.push(title);
59739         var terms = field.terms();
59740         if (field.key)
59741           terms.push(field.key);
59742         if (field.keys)
59743           terms = terms.concat(field.keys);
59744         return {
59745           display: field.label(),
59746           value: title,
59747           title,
59748           field,
59749           terms
59750         };
59751       });
59752       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
59753       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
59754       more.exit().remove();
59755       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
59756       moreEnter.append("span").call(_t.append("inspector.add_fields"));
59757       more = moreEnter.merge(more);
59758       var input = more.selectAll(".value").data([0]);
59759       input.exit().remove();
59760       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
59761       input.call(utilGetSetValue, "").call(moreCombo.data(moreFields).on("accept", function(d) {
59762         if (!d)
59763           return;
59764         var field = d.field;
59765         field.show();
59766         selection2.call(formFields);
59767         field.focus();
59768       }));
59769       if (_lastPlaceholder !== placeholder) {
59770         input.attr("placeholder", placeholder);
59771         _lastPlaceholder = placeholder;
59772       }
59773     }
59774     formFields.fieldsArr = function(val) {
59775       if (!arguments.length)
59776         return _fieldsArr;
59777       _fieldsArr = val || [];
59778       return formFields;
59779     };
59780     formFields.state = function(val) {
59781       if (!arguments.length)
59782         return _state;
59783       _state = val;
59784       return formFields;
59785     };
59786     formFields.klass = function(val) {
59787       if (!arguments.length)
59788         return _klass;
59789       _klass = val;
59790       return formFields;
59791     };
59792     return formFields;
59793   }
59794
59795   // modules/ui/changeset_editor.js
59796   function uiChangesetEditor(context) {
59797     var dispatch10 = dispatch_default("change");
59798     var formFields = uiFormFields(context);
59799     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
59800     var _fieldsArr;
59801     var _tags;
59802     var _changesetID;
59803     function changesetEditor(selection2) {
59804       render(selection2);
59805     }
59806     function render(selection2) {
59807       var initial = false;
59808       if (!_fieldsArr) {
59809         initial = true;
59810         var presets = _mainPresetIndex;
59811         _fieldsArr = [
59812           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
59813           uiField(context, presets.field("source"), null, { show: false, revert: false }),
59814           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
59815         ];
59816         _fieldsArr.forEach(function(field) {
59817           field.on("change", function(t, onInput) {
59818             dispatch10.call("change", field, void 0, t, onInput);
59819           });
59820         });
59821       }
59822       _fieldsArr.forEach(function(field) {
59823         field.tags(_tags);
59824       });
59825       selection2.call(formFields.fieldsArr(_fieldsArr));
59826       if (initial) {
59827         var commentField = selection2.select(".form-field-comment textarea");
59828         var commentNode = commentField.node();
59829         if (commentNode) {
59830           commentNode.focus();
59831           commentNode.select();
59832         }
59833         utilTriggerEvent(commentField, "blur");
59834         var osm = context.connection();
59835         if (osm) {
59836           osm.userChangesets(function(err, changesets) {
59837             if (err)
59838               return;
59839             var comments = changesets.map(function(changeset) {
59840               var comment = changeset.tags.comment;
59841               return comment ? { title: comment, value: comment } : null;
59842             }).filter(Boolean);
59843             commentField.call(commentCombo.data(utilArrayUniqBy(comments, "title")));
59844           });
59845         }
59846       }
59847       var hasGoogle = _tags.comment.match(/google/i);
59848       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(hasGoogle ? [0] : []);
59849       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
59850       var commentEnter = commentWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning comment-warning").style("opacity", 0);
59851       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"));
59852       commentEnter.transition().duration(200).style("opacity", 1);
59853     }
59854     changesetEditor.tags = function(_) {
59855       if (!arguments.length)
59856         return _tags;
59857       _tags = _;
59858       return changesetEditor;
59859     };
59860     changesetEditor.changesetID = function(_) {
59861       if (!arguments.length)
59862         return _changesetID;
59863       if (_changesetID === _)
59864         return changesetEditor;
59865       _changesetID = _;
59866       _fieldsArr = null;
59867       return changesetEditor;
59868     };
59869     return utilRebind(changesetEditor, dispatch10, "on");
59870   }
59871
59872   // modules/ui/commit.js
59873   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
59874
59875   // modules/util/jxon.js
59876   var JXON = new function() {
59877     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
59878     function parseText(sValue) {
59879       if (rIsNull.test(sValue)) {
59880         return null;
59881       }
59882       if (rIsBool.test(sValue)) {
59883         return sValue.toLowerCase() === "true";
59884       }
59885       if (isFinite(sValue)) {
59886         return parseFloat(sValue);
59887       }
59888       if (isFinite(Date.parse(sValue))) {
59889         return new Date(sValue);
59890       }
59891       return sValue;
59892     }
59893     function EmptyTree() {
59894     }
59895     EmptyTree.prototype.toString = function() {
59896       return "null";
59897     };
59898     EmptyTree.prototype.valueOf = function() {
59899       return null;
59900     };
59901     function objectify(vValue) {
59902       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
59903     }
59904     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
59905       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
59906       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : true;
59907       if (bChildren) {
59908         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
59909           oNode = oParentNode.childNodes.item(nItem);
59910           if (oNode.nodeType === 4) {
59911             sCollectedTxt += oNode.nodeValue;
59912           } else if (oNode.nodeType === 3) {
59913             sCollectedTxt += oNode.nodeValue.trim();
59914           } else if (oNode.nodeType === 1 && !oNode.prefix) {
59915             aCache.push(oNode);
59916           }
59917         }
59918       }
59919       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
59920       if (!bHighVerb && (bChildren || bAttributes)) {
59921         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
59922       }
59923       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
59924         sProp = aCache[nElId].nodeName.toLowerCase();
59925         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
59926         if (vResult.hasOwnProperty(sProp)) {
59927           if (vResult[sProp].constructor !== Array) {
59928             vResult[sProp] = [vResult[sProp]];
59929           }
59930           vResult[sProp].push(vContent);
59931         } else {
59932           vResult[sProp] = vContent;
59933           nLength++;
59934         }
59935       }
59936       if (bAttributes) {
59937         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
59938         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
59939           oAttrib = oParentNode.attributes.item(nAttrib);
59940           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
59941         }
59942         if (bNesteAttr) {
59943           if (bFreeze) {
59944             Object.freeze(oAttrParent);
59945           }
59946           vResult[sAttributesProp] = oAttrParent;
59947           nLength -= nAttrLen - 1;
59948         }
59949       }
59950       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
59951         vResult[sValueProp] = vBuiltVal;
59952       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
59953         vResult = vBuiltVal;
59954       }
59955       if (bFreeze && (bHighVerb || nLength > 0)) {
59956         Object.freeze(vResult);
59957       }
59958       aCache.length = nLevelStart;
59959       return vResult;
59960     }
59961     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
59962       var vValue, oChild;
59963       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
59964         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
59965       } else if (oParentObj.constructor === Date) {
59966         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
59967       }
59968       for (var sName in oParentObj) {
59969         vValue = oParentObj[sName];
59970         if (isFinite(sName) || vValue instanceof Function) {
59971           continue;
59972         }
59973         if (sName === sValueProp) {
59974           if (vValue !== null && vValue !== true) {
59975             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
59976           }
59977         } else if (sName === sAttributesProp) {
59978           for (var sAttrib in vValue) {
59979             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
59980           }
59981         } else if (sName.charAt(0) === sAttrPref) {
59982           oParentEl.setAttribute(sName.slice(1), vValue);
59983         } else if (vValue.constructor === Array) {
59984           for (var nItem = 0; nItem < vValue.length; nItem++) {
59985             oChild = oXMLDoc.createElement(sName);
59986             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
59987             oParentEl.appendChild(oChild);
59988           }
59989         } else {
59990           oChild = oXMLDoc.createElement(sName);
59991           if (vValue instanceof Object) {
59992             loadObjTree(oXMLDoc, oChild, vValue);
59993           } else if (vValue !== null && vValue !== true) {
59994             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
59995           }
59996           oParentEl.appendChild(oChild);
59997         }
59998       }
59999     }
60000     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
60001       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : 1;
60002       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
60003     };
60004     this.unbuild = function(oObjTree) {
60005       var oNewDoc = document.implementation.createDocument("", "", null);
60006       loadObjTree(oNewDoc, oNewDoc, oObjTree);
60007       return oNewDoc;
60008     };
60009     this.stringify = function(oObjTree) {
60010       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
60011     };
60012   }();
60013
60014   // modules/ui/sections/changes.js
60015   function uiSectionChanges(context) {
60016     var _discardTags = {};
60017     _mainFileFetcher.get("discarded").then(function(d) {
60018       _discardTags = d;
60019     }).catch(function() {
60020     });
60021     var section = uiSection("changes-list", context).label(function() {
60022       var history = context.history();
60023       var summary = history.difference().summary();
60024       return _t.html("inspector.title_count", { title: { html: _t.html("commit.changes") }, count: summary.length });
60025     }).disclosureContent(renderDisclosureContent);
60026     function renderDisclosureContent(selection2) {
60027       var history = context.history();
60028       var summary = history.difference().summary();
60029       var container = selection2.selectAll(".commit-section").data([0]);
60030       var containerEnter = container.enter().append("div").attr("class", "commit-section");
60031       containerEnter.append("ul").attr("class", "changeset-list");
60032       container = containerEnter.merge(container);
60033       var items = container.select("ul").selectAll("li").data(summary);
60034       var itemsEnter = items.enter().append("li").attr("class", "change-item");
60035       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
60036       buttons.each(function(d) {
60037         select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
60038       });
60039       buttons.append("span").attr("class", "change-type").html(function(d) {
60040         return _t.html("commit." + d.changeType) + " ";
60041       });
60042       buttons.append("strong").attr("class", "entity-type").text(function(d) {
60043         var matched = _mainPresetIndex.match(d.entity, d.graph);
60044         return matched && matched.name() || utilDisplayType(d.entity.id);
60045       });
60046       buttons.append("span").attr("class", "entity-name").text(function(d) {
60047         var name2 = utilDisplayName(d.entity) || "", string = "";
60048         if (name2 !== "") {
60049           string += ":";
60050         }
60051         return string += " " + name2;
60052       });
60053       items = itemsEnter.merge(items);
60054       var changeset = new osmChangeset().update({ id: void 0 });
60055       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
60056       delete changeset.id;
60057       var data = JXON.stringify(changeset.osmChangeJXON(changes));
60058       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
60059       var fileName = "changes.osc";
60060       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
60061       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
60062       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
60063       function mouseover(d) {
60064         if (d.entity) {
60065           context.surface().selectAll(utilEntityOrMemberSelector([d.entity.id], context.graph())).classed("hover", true);
60066         }
60067       }
60068       function mouseout() {
60069         context.surface().selectAll(".hover").classed("hover", false);
60070       }
60071       function click(d3_event, change) {
60072         if (change.changeType !== "deleted") {
60073           var entity = change.entity;
60074           context.map().zoomToEase(entity);
60075           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
60076         }
60077       }
60078     }
60079     return section;
60080   }
60081
60082   // modules/ui/commit_warnings.js
60083   function uiCommitWarnings(context) {
60084     function commitWarnings(selection2) {
60085       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
60086       for (var severity in issuesBySeverity) {
60087         var issues = issuesBySeverity[severity];
60088         if (severity !== "error") {
60089           issues = issues.filter(function(issue) {
60090             return issue.type !== "help_request";
60091           });
60092         }
60093         var section = severity + "-section";
60094         var issueItem = severity + "-item";
60095         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
60096         container.exit().remove();
60097         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
60098         containerEnter.append("h3").html(severity === "warning" ? _t.html("commit.warnings") : _t.html("commit.errors"));
60099         containerEnter.append("ul").attr("class", "changeset-list");
60100         container = containerEnter.merge(container);
60101         var items = container.select("ul").selectAll("li").data(issues, function(d) {
60102           return d.key;
60103         });
60104         items.exit().remove();
60105         var itemsEnter = items.enter().append("li").attr("class", issueItem);
60106         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
60107           if (d.entityIds) {
60108             context.surface().selectAll(utilEntityOrMemberSelector(d.entityIds, context.graph())).classed("hover", true);
60109           }
60110         }).on("mouseout", function() {
60111           context.surface().selectAll(".hover").classed("hover", false);
60112         }).on("click", function(d3_event, d) {
60113           context.validator().focusIssue(d);
60114         });
60115         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
60116         buttons.append("strong").attr("class", "issue-message");
60117         buttons.filter(function(d) {
60118           return d.tooltip;
60119         }).call(uiTooltip().title(function(d) {
60120           return d.tooltip;
60121         }).placement("top"));
60122         items = itemsEnter.merge(items);
60123         items.selectAll(".issue-message").html(function(d) {
60124           return d.message(context);
60125         });
60126       }
60127     }
60128     return commitWarnings;
60129   }
60130
60131   // modules/ui/commit.js
60132   var readOnlyTags = [
60133     /^changesets_count$/,
60134     /^created_by$/,
60135     /^ideditor:/,
60136     /^imagery_used$/,
60137     /^host$/,
60138     /^locale$/,
60139     /^warnings:/,
60140     /^resolved:/,
60141     /^closed:note$/,
60142     /^closed:keepright$/,
60143     /^closed:improveosm:/,
60144     /^closed:osmose:/
60145   ];
60146   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
60147   function uiCommit(context) {
60148     var dispatch10 = dispatch_default("cancel");
60149     var _userDetails2;
60150     var _selection;
60151     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
60152     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
60153     var commitChanges = uiSectionChanges(context);
60154     var commitWarnings = uiCommitWarnings(context);
60155     function commit(selection2) {
60156       _selection = selection2;
60157       if (!context.changeset)
60158         initChangeset();
60159       loadDerivedChangesetTags();
60160       selection2.call(render);
60161     }
60162     function initChangeset() {
60163       var commentDate = +corePreferences("commentDate") || 0;
60164       var currDate = Date.now();
60165       var cutoff = 2 * 86400 * 1e3;
60166       if (commentDate > currDate || currDate - commentDate > cutoff) {
60167         corePreferences("comment", null);
60168         corePreferences("hashtags", null);
60169         corePreferences("source", null);
60170       }
60171       if (context.defaultChangesetComment()) {
60172         corePreferences("comment", context.defaultChangesetComment());
60173         corePreferences("commentDate", Date.now());
60174       }
60175       if (context.defaultChangesetSource()) {
60176         corePreferences("source", context.defaultChangesetSource());
60177         corePreferences("commentDate", Date.now());
60178       }
60179       if (context.defaultChangesetHashtags()) {
60180         corePreferences("hashtags", context.defaultChangesetHashtags());
60181         corePreferences("commentDate", Date.now());
60182       }
60183       var detected = utilDetect();
60184       var tags = {
60185         comment: corePreferences("comment") || "",
60186         created_by: context.cleanTagValue("iD " + context.version),
60187         host: context.cleanTagValue(detected.host),
60188         locale: context.cleanTagValue(_mainLocalizer.localeCode())
60189       };
60190       findHashtags(tags, true);
60191       var hashtags = corePreferences("hashtags");
60192       if (hashtags) {
60193         tags.hashtags = hashtags;
60194       }
60195       var source = corePreferences("source");
60196       if (source) {
60197         tags.source = source;
60198       }
60199       var photoOverlaysUsed = context.history().photoOverlaysUsed();
60200       if (photoOverlaysUsed.length) {
60201         var sources = (tags.source || "").split(";");
60202         if (sources.indexOf("streetlevel imagery") === -1) {
60203           sources.push("streetlevel imagery");
60204         }
60205         photoOverlaysUsed.forEach(function(photoOverlay) {
60206           if (sources.indexOf(photoOverlay) === -1) {
60207             sources.push(photoOverlay);
60208           }
60209         });
60210         tags.source = context.cleanTagValue(sources.join(";"));
60211       }
60212       context.changeset = new osmChangeset({ tags });
60213     }
60214     function loadDerivedChangesetTags() {
60215       var osm = context.connection();
60216       if (!osm)
60217         return;
60218       var tags = Object.assign({}, context.changeset.tags);
60219       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
60220       tags.imagery_used = imageryUsed || "None";
60221       var osmClosed = osm.getClosedIDs();
60222       var itemType;
60223       if (osmClosed.length) {
60224         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
60225       }
60226       if (services.keepRight) {
60227         var krClosed = services.keepRight.getClosedIDs();
60228         if (krClosed.length) {
60229           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
60230         }
60231       }
60232       if (services.improveOSM) {
60233         var iOsmClosed = services.improveOSM.getClosedCounts();
60234         for (itemType in iOsmClosed) {
60235           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
60236         }
60237       }
60238       if (services.osmose) {
60239         var osmoseClosed = services.osmose.getClosedCounts();
60240         for (itemType in osmoseClosed) {
60241           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
60242         }
60243       }
60244       for (var key in tags) {
60245         if (key.match(/(^warnings:)|(^resolved:)/)) {
60246           delete tags[key];
60247         }
60248       }
60249       function addIssueCounts(issues, prefix) {
60250         var issuesByType = utilArrayGroupBy(issues, "type");
60251         for (var issueType in issuesByType) {
60252           var issuesOfType = issuesByType[issueType];
60253           if (issuesOfType[0].subtype) {
60254             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
60255             for (var issueSubtype in issuesBySubtype) {
60256               var issuesOfSubtype = issuesBySubtype[issueSubtype];
60257               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
60258             }
60259           } else {
60260             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
60261           }
60262         }
60263       }
60264       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
60265         return issue.type !== "help_request";
60266       });
60267       addIssueCounts(warnings, "warnings");
60268       var resolvedIssues = context.validator().getResolvedIssues();
60269       addIssueCounts(resolvedIssues, "resolved");
60270       context.changeset = context.changeset.update({ tags });
60271     }
60272     function render(selection2) {
60273       var osm = context.connection();
60274       if (!osm)
60275         return;
60276       var header = selection2.selectAll(".header").data([0]);
60277       var headerTitle = header.enter().append("div").attr("class", "header fillL");
60278       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
60279       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
60280         dispatch10.call("cancel", this);
60281       }).call(svgIcon("#iD-icon-close"));
60282       var body = selection2.selectAll(".body").data([0]);
60283       body = body.enter().append("div").attr("class", "body").merge(body);
60284       var changesetSection = body.selectAll(".changeset-editor").data([0]);
60285       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
60286       changesetSection.call(changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags));
60287       body.call(commitWarnings);
60288       var saveSection = body.selectAll(".save-section").data([0]);
60289       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
60290       var prose = saveSection.selectAll(".commit-info").data([0]);
60291       if (prose.enter().size()) {
60292         _userDetails2 = null;
60293       }
60294       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
60295       osm.userDetails(function(err, user) {
60296         if (err)
60297           return;
60298         if (_userDetails2 === user)
60299           return;
60300         _userDetails2 = user;
60301         var userLink = select_default2(document.createElement("div"));
60302         if (user.image_url) {
60303           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
60304         }
60305         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
60306         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
60307       });
60308       var requestReview = saveSection.selectAll(".request-review").data([0]);
60309       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
60310       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
60311       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
60312       if (!labelEnter.empty()) {
60313         labelEnter.call(uiTooltip().title(_t.html("commit.request_review_info")).placement("top"));
60314       }
60315       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
60316       labelEnter.append("span").call(_t.append("commit.request_review"));
60317       requestReview = requestReview.merge(requestReviewEnter);
60318       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
60319       var buttonSection = saveSection.selectAll(".buttons").data([0]);
60320       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
60321       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
60322       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
60323       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
60324       var uploadBlockerTooltipText = getUploadBlockerMessage();
60325       buttonSection = buttonSection.merge(buttonEnter);
60326       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
60327         dispatch10.call("cancel", this);
60328       });
60329       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
60330         if (!select_default2(this).classed("disabled")) {
60331           this.blur();
60332           for (var key in context.changeset.tags) {
60333             if (!key)
60334               delete context.changeset.tags[key];
60335           }
60336           context.uploader().save(context.changeset);
60337         }
60338       });
60339       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
60340       if (uploadBlockerTooltipText) {
60341         buttonSection.selectAll(".save-button").call(uiTooltip().title(uploadBlockerTooltipText).placement("top"));
60342       }
60343       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
60344       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
60345       tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
60346       var changesSection = body.selectAll(".commit-changes-section").data([0]);
60347       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
60348       changesSection.call(commitChanges.render);
60349       function toggleRequestReview() {
60350         var rr = requestReviewInput.property("checked");
60351         updateChangeset({ review_requested: rr ? "yes" : void 0 });
60352         tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
60353       }
60354     }
60355     function getUploadBlockerMessage() {
60356       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
60357       if (errors.length) {
60358         return _t("commit.outstanding_errors_message", { count: errors.length });
60359       } else {
60360         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
60361         if (!hasChangesetComment) {
60362           return _t("commit.comment_needed_message");
60363         }
60364       }
60365       return null;
60366     }
60367     function changeTags(_, changed, onInput) {
60368       if (changed.hasOwnProperty("comment")) {
60369         if (changed.comment === void 0) {
60370           changed.comment = "";
60371         }
60372         if (!onInput) {
60373           corePreferences("comment", changed.comment);
60374           corePreferences("commentDate", Date.now());
60375         }
60376       }
60377       if (changed.hasOwnProperty("source")) {
60378         if (changed.source === void 0) {
60379           corePreferences("source", null);
60380         } else if (!onInput) {
60381           corePreferences("source", changed.source);
60382           corePreferences("commentDate", Date.now());
60383         }
60384       }
60385       updateChangeset(changed, onInput);
60386       if (_selection) {
60387         _selection.call(render);
60388       }
60389     }
60390     function findHashtags(tags, commentOnly) {
60391       var detectedHashtags = commentHashtags();
60392       if (detectedHashtags.length) {
60393         corePreferences("hashtags", null);
60394       }
60395       if (!detectedHashtags.length || !commentOnly) {
60396         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
60397       }
60398       var allLowerCase = /* @__PURE__ */ new Set();
60399       return detectedHashtags.filter(function(hashtag) {
60400         var lowerCase = hashtag.toLowerCase();
60401         if (!allLowerCase.has(lowerCase)) {
60402           allLowerCase.add(lowerCase);
60403           return true;
60404         }
60405         return false;
60406       });
60407       function commentHashtags() {
60408         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
60409         return matches || [];
60410       }
60411       function hashtagHashtags() {
60412         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
60413           if (s[0] !== "#") {
60414             s = "#" + s;
60415           }
60416           var matched = s.match(hashtagRegex);
60417           return matched && matched[0];
60418         }).filter(Boolean);
60419         return matches || [];
60420       }
60421     }
60422     function isReviewRequested(tags) {
60423       var rr = tags.review_requested;
60424       if (rr === void 0)
60425         return false;
60426       rr = rr.trim().toLowerCase();
60427       return !(rr === "" || rr === "no");
60428     }
60429     function updateChangeset(changed, onInput) {
60430       var tags = Object.assign({}, context.changeset.tags);
60431       Object.keys(changed).forEach(function(k) {
60432         var v = changed[k];
60433         k = context.cleanTagKey(k);
60434         if (readOnlyTags.indexOf(k) !== -1)
60435           return;
60436         if (v === void 0) {
60437           delete tags[k];
60438         } else if (onInput) {
60439           tags[k] = v;
60440         } else {
60441           tags[k] = context.cleanTagValue(v);
60442         }
60443       });
60444       if (!onInput) {
60445         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
60446         var arr = findHashtags(tags, commentOnly);
60447         if (arr.length) {
60448           tags.hashtags = context.cleanTagValue(arr.join(";"));
60449           corePreferences("hashtags", tags.hashtags);
60450         } else {
60451           delete tags.hashtags;
60452           corePreferences("hashtags", null);
60453         }
60454       }
60455       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
60456         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
60457         tags.changesets_count = String(changesetsCount);
60458         if (changesetsCount <= 100) {
60459           var s;
60460           s = corePreferences("walkthrough_completed");
60461           if (s) {
60462             tags["ideditor:walkthrough_completed"] = s;
60463           }
60464           s = corePreferences("walkthrough_progress");
60465           if (s) {
60466             tags["ideditor:walkthrough_progress"] = s;
60467           }
60468           s = corePreferences("walkthrough_started");
60469           if (s) {
60470             tags["ideditor:walkthrough_started"] = s;
60471           }
60472         }
60473       } else {
60474         delete tags.changesets_count;
60475       }
60476       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
60477         context.changeset = context.changeset.update({ tags });
60478       }
60479     }
60480     commit.reset = function() {
60481       context.changeset = null;
60482     };
60483     return utilRebind(commit, dispatch10, "on");
60484   }
60485
60486   // modules/ui/confirm.js
60487   function uiConfirm(selection2) {
60488     var modalSelection = uiModal(selection2);
60489     modalSelection.select(".modal").classed("modal-alert", true);
60490     var section = modalSelection.select(".content");
60491     section.append("div").attr("class", "modal-section header");
60492     section.append("div").attr("class", "modal-section message-text");
60493     var buttons = section.append("div").attr("class", "modal-section buttons cf");
60494     modalSelection.okButton = function() {
60495       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
60496         modalSelection.remove();
60497       }).call(_t.append("confirm.okay")).node().focus();
60498       return modalSelection;
60499     };
60500     return modalSelection;
60501   }
60502
60503   // modules/ui/conflicts.js
60504   function uiConflicts(context) {
60505     var dispatch10 = dispatch_default("cancel", "save");
60506     var keybinding = utilKeybinding("conflicts");
60507     var _origChanges;
60508     var _conflictList;
60509     var _shownConflictIndex;
60510     function keybindingOn() {
60511       select_default2(document).call(keybinding.on("\u238B", cancel, true));
60512     }
60513     function keybindingOff() {
60514       select_default2(document).call(keybinding.unbind);
60515     }
60516     function tryAgain() {
60517       keybindingOff();
60518       dispatch10.call("save");
60519     }
60520     function cancel() {
60521       keybindingOff();
60522       dispatch10.call("cancel");
60523     }
60524     function conflicts(selection2) {
60525       keybindingOn();
60526       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
60527       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
60528       headerEnter.append("h2").call(_t.append("save.conflict.header"));
60529       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
60530       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
60531       var changeset = new osmChangeset();
60532       delete changeset.id;
60533       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
60534       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
60535       var fileName = "changes.osc";
60536       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
60537       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
60538       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
60539       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
60540       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
60541       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
60542       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
60543       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
60544     }
60545     function showConflict(selection2, index) {
60546       index = utilWrap(index, _conflictList.length);
60547       _shownConflictIndex = index;
60548       var parent = select_default2(selection2.node().parentNode);
60549       if (index === _conflictList.length - 1) {
60550         window.setTimeout(function() {
60551           parent.select(".conflicts-button").attr("disabled", null);
60552           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
60553         }, 250);
60554       }
60555       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
60556       conflict.exit().remove();
60557       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
60558       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
60559       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
60560         return d.name;
60561       }).on("click", function(d3_event, d) {
60562         d3_event.preventDefault();
60563         zoomToEntity(d.id);
60564       });
60565       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
60566       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
60567         return d.details || [];
60568       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
60569         return d;
60570       });
60571       details.append("div").attr("class", "conflict-choices").call(addChoices);
60572       details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").html(function(d) {
60573         return _t.html("save.conflict." + d);
60574       }).attr("class", "conflict-nav-button action col6").attr("disabled", function(d, i2) {
60575         return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
60576       }).on("click", function(d3_event, d) {
60577         d3_event.preventDefault();
60578         var container = parent.selectAll(".conflict-container");
60579         var sign2 = d === "previous" ? -1 : 1;
60580         container.selectAll(".conflict").remove();
60581         container.call(showConflict, index + sign2);
60582       });
60583     }
60584     function addChoices(selection2) {
60585       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
60586         return d.choices || [];
60587       });
60588       var choicesEnter = choices.enter().append("li").attr("class", "layer");
60589       var labelEnter = choicesEnter.append("label");
60590       labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
60591         return d.id;
60592       }).on("change", function(d3_event, d) {
60593         var ul = this.parentNode.parentNode.parentNode;
60594         ul.__data__.chosen = d.id;
60595         choose(d3_event, ul, d);
60596       });
60597       labelEnter.append("span").text(function(d) {
60598         return d.text;
60599       });
60600       choicesEnter.merge(choices).each(function(d) {
60601         var ul = this.parentNode;
60602         if (ul.__data__.chosen === d.id) {
60603           choose(null, ul, d);
60604         }
60605       });
60606     }
60607     function choose(d3_event, ul, datum2) {
60608       if (d3_event)
60609         d3_event.preventDefault();
60610       select_default2(ul).selectAll("li").classed("active", function(d) {
60611         return d === datum2;
60612       }).selectAll("input").property("checked", function(d) {
60613         return d === datum2;
60614       });
60615       var extent = geoExtent();
60616       var entity;
60617       entity = context.graph().hasEntity(datum2.id);
60618       if (entity)
60619         extent._extend(entity.extent(context.graph()));
60620       datum2.action();
60621       entity = context.graph().hasEntity(datum2.id);
60622       if (entity)
60623         extent._extend(entity.extent(context.graph()));
60624       zoomToEntity(datum2.id, extent);
60625     }
60626     function zoomToEntity(id2, extent) {
60627       context.surface().selectAll(".hover").classed("hover", false);
60628       var entity = context.graph().hasEntity(id2);
60629       if (entity) {
60630         if (extent) {
60631           context.map().trimmedExtent(extent);
60632         } else {
60633           context.map().zoomToEase(entity);
60634         }
60635         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
60636       }
60637     }
60638     conflicts.conflictList = function(_) {
60639       if (!arguments.length)
60640         return _conflictList;
60641       _conflictList = _;
60642       return conflicts;
60643     };
60644     conflicts.origChanges = function(_) {
60645       if (!arguments.length)
60646         return _origChanges;
60647       _origChanges = _;
60648       return conflicts;
60649     };
60650     conflicts.shownEntityIds = function() {
60651       if (_conflictList && typeof _shownConflictIndex === "number") {
60652         return [_conflictList[_shownConflictIndex].id];
60653       }
60654       return [];
60655     };
60656     return utilRebind(conflicts, dispatch10, "on");
60657   }
60658
60659   // modules/ui/entity_editor.js
60660   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
60661
60662   // modules/ui/sections/entity_issues.js
60663   function uiSectionEntityIssues(context) {
60664     var preference = corePreferences("entity-issues.reference.expanded");
60665     var _expanded = preference === null ? true : preference === "true";
60666     var _entityIDs = [];
60667     var _issues = [];
60668     var _activeIssueID;
60669     var section = uiSection("entity-issues", context).shouldDisplay(function() {
60670       return _issues.length > 0;
60671     }).label(function() {
60672       return _t.html("inspector.title_count", { title: { html: _t.html("issues.list_title") }, count: _issues.length });
60673     }).disclosureContent(renderDisclosureContent);
60674     context.validator().on("validated.entity_issues", function() {
60675       reloadIssues();
60676       section.reRender();
60677     }).on("focusedIssue.entity_issues", function(issue) {
60678       makeActiveIssue(issue.id);
60679     });
60680     function reloadIssues() {
60681       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
60682     }
60683     function makeActiveIssue(issueID) {
60684       _activeIssueID = issueID;
60685       section.selection().selectAll(".issue-container").classed("active", function(d) {
60686         return d.id === _activeIssueID;
60687       });
60688     }
60689     function renderDisclosureContent(selection2) {
60690       selection2.classed("grouped-items-area", true);
60691       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
60692       var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
60693         return d.key;
60694       });
60695       containers.exit().remove();
60696       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
60697       var itemsEnter = containersEnter.append("div").attr("class", function(d) {
60698         return "issue severity-" + d.severity;
60699       }).on("mouseover.highlight", function(d3_event, d) {
60700         var ids = d.entityIds.filter(function(e) {
60701           return _entityIDs.indexOf(e) === -1;
60702         });
60703         utilHighlightEntities(ids, true, context);
60704       }).on("mouseout.highlight", function(d3_event, d) {
60705         var ids = d.entityIds.filter(function(e) {
60706           return _entityIDs.indexOf(e) === -1;
60707         });
60708         utilHighlightEntities(ids, false, context);
60709       });
60710       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
60711       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
60712         makeActiveIssue(d.id);
60713         var extent = d.extent(context.graph());
60714         if (extent) {
60715           var setZoom = Math.max(context.map().zoom(), 19);
60716           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
60717         }
60718       });
60719       textEnter.each(function(d) {
60720         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
60721         select_default2(this).call(svgIcon(iconName, "issue-icon"));
60722       });
60723       textEnter.append("span").attr("class", "issue-message");
60724       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
60725       infoButton.on("click", function(d3_event) {
60726         d3_event.stopPropagation();
60727         d3_event.preventDefault();
60728         this.blur();
60729         var container = select_default2(this.parentNode.parentNode.parentNode);
60730         var info = container.selectAll(".issue-info");
60731         var isExpanded = info.classed("expanded");
60732         _expanded = !isExpanded;
60733         corePreferences("entity-issues.reference.expanded", _expanded);
60734         if (isExpanded) {
60735           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
60736             info.classed("expanded", false);
60737           });
60738         } else {
60739           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
60740             info.style("max-height", null);
60741           });
60742         }
60743       });
60744       itemsEnter.append("ul").attr("class", "issue-fix-list");
60745       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
60746         if (typeof d.reference === "function") {
60747           select_default2(this).call(d.reference);
60748         } else {
60749           select_default2(this).call(_t.append("inspector.no_documentation_key"));
60750         }
60751       });
60752       containers = containers.merge(containersEnter).classed("active", function(d) {
60753         return d.id === _activeIssueID;
60754       });
60755       containers.selectAll(".issue-message").html(function(d) {
60756         return d.message(context);
60757       });
60758       var fixLists = containers.selectAll(".issue-fix-list");
60759       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
60760         return d.fixes ? d.fixes(context) : [];
60761       }, function(fix) {
60762         return fix.id;
60763       });
60764       fixes.exit().remove();
60765       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
60766       var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
60767         if (select_default2(this).attr("disabled") || !d.onClick)
60768           return;
60769         if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3)
60770           return;
60771         d.issue.dateLastRanFix = new Date();
60772         utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
60773         new Promise(function(resolve, reject) {
60774           d.onClick(context, resolve, reject);
60775           if (d.onClick.length <= 1) {
60776             resolve();
60777           }
60778         }).then(function() {
60779           context.validator().validate();
60780         });
60781       }).on("mouseover.highlight", function(d3_event, d) {
60782         utilHighlightEntities(d.entityIds, true, context);
60783       }).on("mouseout.highlight", function(d3_event, d) {
60784         utilHighlightEntities(d.entityIds, false, context);
60785       });
60786       buttons.each(function(d) {
60787         var iconName = d.icon || "iD-icon-wrench";
60788         if (iconName.startsWith("maki")) {
60789           iconName += "-15";
60790         }
60791         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
60792       });
60793       buttons.append("span").attr("class", "fix-message").html(function(d) {
60794         return d.title;
60795       });
60796       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
60797         return d.onClick;
60798       }).attr("disabled", function(d) {
60799         return d.onClick ? null : "true";
60800       }).attr("title", function(d) {
60801         if (d.disabledReason) {
60802           return d.disabledReason;
60803         }
60804         return null;
60805       });
60806     }
60807     section.entityIDs = function(val) {
60808       if (!arguments.length)
60809         return _entityIDs;
60810       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
60811         _entityIDs = val;
60812         _activeIssueID = null;
60813         reloadIssues();
60814       }
60815       return section;
60816     };
60817     return section;
60818   }
60819
60820   // modules/ui/preset_icon.js
60821   function uiPresetIcon() {
60822     let _preset;
60823     let _geometry;
60824     function presetIcon(selection2) {
60825       selection2.each(render);
60826     }
60827     function getIcon(p, geom) {
60828       if (p.icon)
60829         return p.icon;
60830       if (geom === "line")
60831         return "iD-other-line";
60832       if (geom === "vertex")
60833         return p.isFallback() ? "" : "temaki-vertex";
60834       return "maki-marker-stroked";
60835     }
60836     function renderPointBorder(container, drawPoint) {
60837       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
60838       pointBorder.exit().remove();
60839       let pointBorderEnter = pointBorder.enter();
60840       const w = 40;
60841       const h = 40;
60842       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");
60843       pointBorder = pointBorderEnter.merge(pointBorder);
60844     }
60845     function renderCategoryBorder(container, category) {
60846       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
60847       categoryBorder.exit().remove();
60848       let categoryBorderEnter = categoryBorder.enter();
60849       const d = 60;
60850       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}`);
60851       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");
60852       categoryBorder = categoryBorderEnter.merge(categoryBorder);
60853       if (category) {
60854         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
60855       }
60856     }
60857     function renderCircleFill(container, drawVertex) {
60858       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
60859       vertexFill.exit().remove();
60860       let vertexFillEnter = vertexFill.enter();
60861       const w = 60;
60862       const h = 60;
60863       const d = 40;
60864       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);
60865       vertexFill = vertexFillEnter.merge(vertexFill);
60866     }
60867     function renderSquareFill(container, drawArea, tagClasses) {
60868       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
60869       fill.exit().remove();
60870       let fillEnter = fill.enter();
60871       const d = 60;
60872       const w = d;
60873       const h = d;
60874       const l = d * 2 / 3;
60875       const c1 = (w - l) / 2;
60876       const c2 = c1 + l;
60877       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}`);
60878       ["fill", "stroke"].forEach((klass) => {
60879         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
60880       });
60881       const rVertex = 2.5;
60882       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
60883         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
60884       });
60885       const rMidpoint = 1.25;
60886       [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point) => {
60887         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
60888       });
60889       fill = fillEnter.merge(fill);
60890       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
60891       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
60892     }
60893     function renderLine(container, drawLine, tagClasses) {
60894       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
60895       line.exit().remove();
60896       let lineEnter = line.enter();
60897       const d = 60;
60898       const w = d;
60899       const h = d;
60900       const y = Math.round(d * 0.72);
60901       const l = Math.round(d * 0.6);
60902       const r = 2.5;
60903       const x12 = (w - l) / 2;
60904       const x2 = x12 + l;
60905       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
60906       ["casing", "stroke"].forEach((klass) => {
60907         lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
60908       });
60909       [[x12 - 1, y], [x2 + 1, y]].forEach((point) => {
60910         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
60911       });
60912       line = lineEnter.merge(line);
60913       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
60914       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
60915     }
60916     function renderRoute(container, drawRoute, p) {
60917       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
60918       route.exit().remove();
60919       let routeEnter = route.enter();
60920       const d = 60;
60921       const w = d;
60922       const h = d;
60923       const y12 = Math.round(d * 0.8);
60924       const y2 = Math.round(d * 0.68);
60925       const l = Math.round(d * 0.6);
60926       const r = 2;
60927       const x12 = (w - l) / 2;
60928       const x2 = x12 + l / 3;
60929       const x3 = x2 + l / 3;
60930       const x4 = x3 + l / 3;
60931       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
60932       ["casing", "stroke"].forEach((klass) => {
60933         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
60934         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
60935         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
60936       });
60937       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
60938         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
60939       });
60940       route = routeEnter.merge(route);
60941       if (drawRoute) {
60942         let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
60943         const segmentPresetIDs = routeSegments[routeType];
60944         for (let i2 in segmentPresetIDs) {
60945           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
60946           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
60947           route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
60948           route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
60949         }
60950       }
60951     }
60952     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
60953       const isMaki = picon && /^maki-/.test(picon);
60954       const isTemaki = picon && /^temaki-/.test(picon);
60955       const isFa = picon && /^fa[srb]-/.test(picon);
60956       const isiDIcon = picon && !(isMaki || isTemaki || isFa);
60957       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
60958       icon2.exit().remove();
60959       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
60960       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
60961       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
60962       icon2.selectAll("use").attr("href", "#" + picon);
60963     }
60964     function renderImageIcon(container, imageURL) {
60965       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
60966       imageIcon.exit().remove();
60967       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);
60968       imageIcon.attr("src", imageURL);
60969     }
60970     const routeSegments = {
60971       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
60972       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
60973       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
60974       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
60975       ferry: ["route/ferry", "route/ferry", "route/ferry"],
60976       foot: ["highway/footway", "highway/footway", "highway/footway"],
60977       hiking: ["highway/path", "highway/path", "highway/path"],
60978       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
60979       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
60980       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
60981       mtb: ["highway/path", "highway/track", "highway/bridleway"],
60982       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
60983       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
60984       power: ["power/line", "power/line", "power/line"],
60985       road: ["highway/secondary", "highway/primary", "highway/trunk"],
60986       subway: ["railway/subway", "railway/subway", "railway/subway"],
60987       train: ["railway/rail", "railway/rail", "railway/rail"],
60988       tram: ["railway/tram", "railway/tram", "railway/tram"],
60989       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
60990     };
60991     function render() {
60992       let p = _preset.apply(this, arguments);
60993       let geom = _geometry ? _geometry.apply(this, arguments) : null;
60994       if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
60995         geom = "route";
60996       }
60997       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
60998       const isFallback = p.isFallback && p.isFallback();
60999       const imageURL = showThirdPartyIcons === "true" && p.imageURL;
61000       const picon = getIcon(p, geom);
61001       const isCategory = !p.setTags;
61002       const drawPoint = false;
61003       const drawVertex = picon !== null && geom === "vertex" && !isFallback;
61004       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
61005       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
61006       const drawRoute = picon && geom === "route";
61007       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
61008       let tags = !isCategory ? p.setTags({}, geom) : {};
61009       for (let k in tags) {
61010         if (tags[k] === "*") {
61011           tags[k] = "yes";
61012         }
61013       }
61014       let tagClasses = svgTagClasses().getClassesString(tags, "");
61015       let selection2 = select_default2(this);
61016       let container = selection2.selectAll(".preset-icon-container").data([0]);
61017       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
61018       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
61019       renderCategoryBorder(container, isCategory && p);
61020       renderPointBorder(container, drawPoint);
61021       renderCircleFill(container, drawVertex);
61022       renderSquareFill(container, drawArea, tagClasses);
61023       renderLine(container, drawLine, tagClasses);
61024       renderRoute(container, drawRoute, p);
61025       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
61026       renderImageIcon(container, imageURL);
61027     }
61028     presetIcon.preset = function(val) {
61029       if (!arguments.length)
61030         return _preset;
61031       _preset = utilFunctor(val);
61032       return presetIcon;
61033     };
61034     presetIcon.geometry = function(val) {
61035       if (!arguments.length)
61036         return _geometry;
61037       _geometry = utilFunctor(val);
61038       return presetIcon;
61039     };
61040     return presetIcon;
61041   }
61042
61043   // modules/ui/sections/feature_type.js
61044   function uiSectionFeatureType(context) {
61045     var dispatch10 = dispatch_default("choose");
61046     var _entityIDs = [];
61047     var _presets = [];
61048     var _tagReference;
61049     var section = uiSection("feature-type", context).label(_t.html("inspector.feature_type")).disclosureContent(renderDisclosureContent);
61050     function renderDisclosureContent(selection2) {
61051       selection2.classed("preset-list-item", true);
61052       selection2.classed("mixed-types", _presets.length > 1);
61053       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
61054       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(uiTooltip().title(_t.html("inspector.back_tooltip")).placement("bottom"));
61055       presetButton.append("div").attr("class", "preset-icon-container");
61056       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
61057       presetButtonWrap.append("div").attr("class", "accessory-buttons");
61058       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
61059       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
61060       if (_tagReference) {
61061         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
61062         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
61063       }
61064       selection2.selectAll(".preset-reset").on("click", function() {
61065         dispatch10.call("choose", this, _presets);
61066       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
61067         d3_event.preventDefault();
61068         d3_event.stopPropagation();
61069       });
61070       var geometries = entityGeometries();
61071       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")));
61072       var names = _presets.length === 1 ? [
61073         _presets[0].nameLabel(),
61074         _presets[0].subtitleLabel()
61075       ].filter(Boolean) : [_t("inspector.multiple_types")];
61076       var label = selection2.select(".label-inner");
61077       var nameparts = label.selectAll(".namepart").data(names, function(d) {
61078         return d;
61079       });
61080       nameparts.exit().remove();
61081       nameparts.enter().append("div").attr("class", "namepart").html(function(d) {
61082         return d;
61083       });
61084     }
61085     section.entityIDs = function(val) {
61086       if (!arguments.length)
61087         return _entityIDs;
61088       _entityIDs = val;
61089       return section;
61090     };
61091     section.presets = function(val) {
61092       if (!arguments.length)
61093         return _presets;
61094       if (!utilArrayIdentical(val, _presets)) {
61095         _presets = val;
61096         if (_presets.length === 1) {
61097           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
61098         }
61099       }
61100       return section;
61101     };
61102     function entityGeometries() {
61103       var counts = {};
61104       for (var i2 in _entityIDs) {
61105         var geometry = context.graph().geometry(_entityIDs[i2]);
61106         if (!counts[geometry])
61107           counts[geometry] = 0;
61108         counts[geometry] += 1;
61109       }
61110       return Object.keys(counts).sort(function(geom1, geom2) {
61111         return counts[geom2] - counts[geom1];
61112       });
61113     }
61114     return utilRebind(section, dispatch10, "on");
61115   }
61116
61117   // modules/ui/sections/preset_fields.js
61118   function uiSectionPresetFields(context) {
61119     var section = uiSection("preset-fields", context).label(_t.html("inspector.fields")).disclosureContent(renderDisclosureContent);
61120     var dispatch10 = dispatch_default("change", "revert");
61121     var formFields = uiFormFields(context);
61122     var _state;
61123     var _fieldsArr;
61124     var _presets = [];
61125     var _tags;
61126     var _entityIDs;
61127     function renderDisclosureContent(selection2) {
61128       if (!_fieldsArr) {
61129         var graph = context.graph();
61130         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
61131           geoms[graph.entity(entityID).geometry(graph)] = true;
61132           return geoms;
61133         }, {}));
61134         var presetsManager = _mainPresetIndex;
61135         var allFields = [];
61136         var allMoreFields = [];
61137         var sharedTotalFields;
61138         _presets.forEach(function(preset) {
61139           var fields = preset.fields();
61140           var moreFields = preset.moreFields();
61141           allFields = utilArrayUnion(allFields, fields);
61142           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
61143           if (!sharedTotalFields) {
61144             sharedTotalFields = utilArrayUnion(fields, moreFields);
61145           } else {
61146             sharedTotalFields = sharedTotalFields.filter(function(field) {
61147               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
61148             });
61149           }
61150         });
61151         var sharedFields = allFields.filter(function(field) {
61152           return sharedTotalFields.indexOf(field) !== -1;
61153         });
61154         var sharedMoreFields = allMoreFields.filter(function(field) {
61155           return sharedTotalFields.indexOf(field) !== -1;
61156         });
61157         _fieldsArr = [];
61158         sharedFields.forEach(function(field) {
61159           if (field.matchAllGeometry(geometries)) {
61160             _fieldsArr.push(uiField(context, field, _entityIDs));
61161           }
61162         });
61163         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
61164         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
61165           _fieldsArr.push(uiField(context, presetsManager.field("restrictions"), _entityIDs));
61166         }
61167         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
61168         additionalFields.sort(function(field1, field2) {
61169           return field1.label().localeCompare(field2.label(), _mainLocalizer.localeCode());
61170         });
61171         additionalFields.forEach(function(field) {
61172           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
61173             _fieldsArr.push(uiField(context, field, _entityIDs, { show: false }));
61174           }
61175         });
61176         _fieldsArr.forEach(function(field) {
61177           field.on("change", function(t, onInput) {
61178             dispatch10.call("change", field, _entityIDs, t, onInput);
61179           }).on("revert", function(keys) {
61180             dispatch10.call("revert", field, keys);
61181           });
61182         });
61183       }
61184       _fieldsArr.forEach(function(field) {
61185         field.state(_state).tags(_tags);
61186       });
61187       selection2.call(formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area"));
61188       selection2.selectAll(".wrap-form-field input").on("keydown", function(d3_event) {
61189         if (d3_event.keyCode === 13 && context.container().select(".combobox").empty()) {
61190           context.enter(modeBrowse(context));
61191         }
61192       });
61193     }
61194     section.presets = function(val) {
61195       if (!arguments.length)
61196         return _presets;
61197       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
61198         _presets = val;
61199         _fieldsArr = null;
61200       }
61201       return section;
61202     };
61203     section.state = function(val) {
61204       if (!arguments.length)
61205         return _state;
61206       _state = val;
61207       return section;
61208     };
61209     section.tags = function(val) {
61210       if (!arguments.length)
61211         return _tags;
61212       _tags = val;
61213       return section;
61214     };
61215     section.entityIDs = function(val) {
61216       if (!arguments.length)
61217         return _entityIDs;
61218       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
61219         _entityIDs = val;
61220         _fieldsArr = null;
61221       }
61222       return section;
61223     };
61224     return utilRebind(section, dispatch10, "on");
61225   }
61226
61227   // modules/ui/sections/raw_member_editor.js
61228   function uiSectionRawMemberEditor(context) {
61229     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
61230       if (!_entityIDs || _entityIDs.length !== 1)
61231         return false;
61232       var entity = context.hasEntity(_entityIDs[0]);
61233       return entity && entity.type === "relation";
61234     }).label(function() {
61235       var entity = context.hasEntity(_entityIDs[0]);
61236       if (!entity)
61237         return "";
61238       var gt = entity.members.length > _maxMembers ? ">" : "";
61239       var count = gt + entity.members.slice(0, _maxMembers).length;
61240       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.members") }, count });
61241     }).disclosureContent(renderDisclosureContent);
61242     var taginfo = services.taginfo;
61243     var _entityIDs;
61244     var _maxMembers = 1e3;
61245     function downloadMember(d3_event, d) {
61246       d3_event.preventDefault();
61247       select_default2(this.parentNode).classed("tag-reference-loading", true);
61248       context.loadEntity(d.id, function() {
61249         section.reRender();
61250       });
61251     }
61252     function zoomToMember(d3_event, d) {
61253       d3_event.preventDefault();
61254       var entity = context.entity(d.id);
61255       context.map().zoomToEase(entity);
61256       utilHighlightEntities([d.id], true, context);
61257     }
61258     function selectMember(d3_event, d) {
61259       d3_event.preventDefault();
61260       utilHighlightEntities([d.id], false, context);
61261       var entity = context.entity(d.id);
61262       var mapExtent = context.map().extent();
61263       if (!entity.intersects(mapExtent, context.graph())) {
61264         context.map().zoomToEase(entity);
61265       }
61266       context.enter(modeSelect(context, [d.id]));
61267     }
61268     function changeRole(d3_event, d) {
61269       var oldRole = d.role;
61270       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
61271       if (oldRole !== newRole) {
61272         var member = { id: d.id, type: d.type, role: newRole };
61273         context.perform(actionChangeMember(d.relation.id, member, d.index), _t("operations.change_role.annotation", {
61274           n: 1
61275         }));
61276         context.validator().validate();
61277       }
61278     }
61279     function deleteMember(d3_event, d) {
61280       utilHighlightEntities([d.id], false, context);
61281       context.perform(actionDeleteMember(d.relation.id, d.index), _t("operations.delete_member.annotation", {
61282         n: 1
61283       }));
61284       if (!context.hasEntity(d.relation.id)) {
61285         context.enter(modeBrowse(context));
61286       } else {
61287         context.validator().validate();
61288       }
61289     }
61290     function renderDisclosureContent(selection2) {
61291       var entityID = _entityIDs[0];
61292       var memberships = [];
61293       var entity = context.entity(entityID);
61294       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
61295         memberships.push({
61296           index,
61297           id: member.id,
61298           type: member.type,
61299           role: member.role,
61300           relation: entity,
61301           member: context.hasEntity(member.id),
61302           domId: utilUniqueDomId(entityID + "-member-" + index)
61303         });
61304       });
61305       var list = selection2.selectAll(".member-list").data([0]);
61306       list = list.enter().append("ul").attr("class", "member-list").merge(list);
61307       var items = list.selectAll("li").data(memberships, function(d) {
61308         return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
61309       });
61310       items.exit().each(unbind).remove();
61311       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
61312         return !d.member;
61313       });
61314       itemsEnter.each(function(d) {
61315         var item = select_default2(this);
61316         var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
61317         if (d.member) {
61318           item.on("mouseover", function() {
61319             utilHighlightEntities([d.id], true, context);
61320           }).on("mouseout", function() {
61321             utilHighlightEntities([d.id], false, context);
61322           });
61323           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
61324           labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
61325             var matched = _mainPresetIndex.match(d2.member, context.graph());
61326             return matched && matched.name() || utilDisplayType(d2.member.id);
61327           });
61328           labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
61329             return utilDisplayName(d2.member);
61330           });
61331           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
61332           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
61333         } else {
61334           var labelText = label.append("span").attr("class", "label-text");
61335           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
61336           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
61337           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
61338         }
61339       });
61340       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61341       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
61342         return d.domId;
61343       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
61344       if (taginfo) {
61345         wrapEnter.each(bindTypeahead);
61346       }
61347       items = items.merge(itemsEnter).order();
61348       items.select("input.member-role").property("value", function(d) {
61349         return d.role;
61350       }).on("blur", changeRole).on("change", changeRole);
61351       items.select("button.member-delete").on("click", deleteMember);
61352       var dragOrigin, targetIndex;
61353       items.call(drag_default().on("start", function(d3_event) {
61354         dragOrigin = {
61355           x: d3_event.x,
61356           y: d3_event.y
61357         };
61358         targetIndex = null;
61359       }).on("drag", function(d3_event) {
61360         var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
61361         if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
61362           return;
61363         var index = items.nodes().indexOf(this);
61364         select_default2(this).classed("dragging", true);
61365         targetIndex = null;
61366         selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
61367           var node = select_default2(this).node();
61368           if (index === index2) {
61369             return "translate(" + x + "px, " + y + "px)";
61370           } else if (index2 > index && d3_event.y > node.offsetTop) {
61371             if (targetIndex === null || index2 > targetIndex) {
61372               targetIndex = index2;
61373             }
61374             return "translateY(-100%)";
61375           } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
61376             if (targetIndex === null || index2 < targetIndex) {
61377               targetIndex = index2;
61378             }
61379             return "translateY(100%)";
61380           }
61381           return null;
61382         });
61383       }).on("end", function(d3_event, d) {
61384         if (!select_default2(this).classed("dragging"))
61385           return;
61386         var index = items.nodes().indexOf(this);
61387         select_default2(this).classed("dragging", false);
61388         selection2.selectAll("li.member-row").style("transform", null);
61389         if (targetIndex !== null) {
61390           context.perform(actionMoveMember(d.relation.id, index, targetIndex), _t("operations.reorder_members.annotation"));
61391           context.validator().validate();
61392         }
61393       }));
61394       function bindTypeahead(d) {
61395         var row = select_default2(this);
61396         var role = row.selectAll("input.member-role");
61397         var origValue = role.property("value");
61398         function sort(value, data) {
61399           var sameletter = [];
61400           var other = [];
61401           for (var i2 = 0; i2 < data.length; i2++) {
61402             if (data[i2].value.substring(0, value.length) === value) {
61403               sameletter.push(data[i2]);
61404             } else {
61405               other.push(data[i2]);
61406             }
61407           }
61408           return sameletter.concat(other);
61409         }
61410         role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
61411           var geometry;
61412           if (d.member) {
61413             geometry = context.graph().geometry(d.member.id);
61414           } else if (d.type === "relation") {
61415             geometry = "relation";
61416           } else if (d.type === "way") {
61417             geometry = "line";
61418           } else {
61419             geometry = "point";
61420           }
61421           var rtype = entity.tags.type;
61422           taginfo.roles({
61423             debounce: true,
61424             rtype: rtype || "",
61425             geometry,
61426             query: role2
61427           }, function(err, data) {
61428             if (!err)
61429               callback(sort(role2, data));
61430           });
61431         }).on("cancel", function() {
61432           role.property("value", origValue);
61433         }));
61434       }
61435       function unbind() {
61436         var row = select_default2(this);
61437         row.selectAll("input.member-role").call(uiCombobox.off, context);
61438       }
61439     }
61440     section.entityIDs = function(val) {
61441       if (!arguments.length)
61442         return _entityIDs;
61443       _entityIDs = val;
61444       return section;
61445     };
61446     return section;
61447   }
61448
61449   // modules/actions/delete_members.js
61450   function actionDeleteMembers(relationId, memberIndexes) {
61451     return function(graph) {
61452       memberIndexes.sort((a, b) => b - a);
61453       for (var i2 in memberIndexes) {
61454         graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
61455       }
61456       return graph;
61457     };
61458   }
61459
61460   // modules/ui/sections/raw_membership_editor.js
61461   function uiSectionRawMembershipEditor(context) {
61462     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
61463       return _entityIDs && _entityIDs.length;
61464     }).label(function() {
61465       var parents = getSharedParentRelations();
61466       var gt = parents.length > _maxMemberships ? ">" : "";
61467       var count = gt + parents.slice(0, _maxMemberships).length;
61468       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.relations") }, count });
61469     }).disclosureContent(renderDisclosureContent);
61470     var taginfo = services.taginfo;
61471     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
61472       if (d.relation)
61473         utilHighlightEntities([d.relation.id], true, context);
61474     }).itemsMouseLeave(function(d3_event, d) {
61475       if (d.relation)
61476         utilHighlightEntities([d.relation.id], false, context);
61477     });
61478     var _inChange = false;
61479     var _entityIDs = [];
61480     var _showBlank;
61481     var _maxMemberships = 1e3;
61482     function getSharedParentRelations() {
61483       var parents = [];
61484       for (var i2 = 0; i2 < _entityIDs.length; i2++) {
61485         var entity = context.graph().hasEntity(_entityIDs[i2]);
61486         if (!entity)
61487           continue;
61488         if (i2 === 0) {
61489           parents = context.graph().parentRelations(entity);
61490         } else {
61491           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
61492         }
61493         if (!parents.length)
61494           break;
61495       }
61496       return parents;
61497     }
61498     function getMemberships() {
61499       var memberships = [];
61500       var relations = getSharedParentRelations().slice(0, _maxMemberships);
61501       var isMultiselect = _entityIDs.length > 1;
61502       var i2, relation, membership, index, member, indexedMember;
61503       for (i2 = 0; i2 < relations.length; i2++) {
61504         relation = relations[i2];
61505         membership = {
61506           relation,
61507           members: [],
61508           hash: osmEntity.key(relation)
61509         };
61510         for (index = 0; index < relation.members.length; index++) {
61511           member = relation.members[index];
61512           if (_entityIDs.indexOf(member.id) !== -1) {
61513             indexedMember = Object.assign({}, member, { index });
61514             membership.members.push(indexedMember);
61515             membership.hash += "," + index.toString();
61516             if (!isMultiselect) {
61517               memberships.push(membership);
61518               membership = {
61519                 relation,
61520                 members: [],
61521                 hash: osmEntity.key(relation)
61522               };
61523             }
61524           }
61525         }
61526         if (membership.members.length)
61527           memberships.push(membership);
61528       }
61529       memberships.forEach(function(membership2) {
61530         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
61531         var roles = [];
61532         membership2.members.forEach(function(member2) {
61533           if (roles.indexOf(member2.role) === -1)
61534             roles.push(member2.role);
61535         });
61536         membership2.role = roles.length === 1 ? roles[0] : roles;
61537       });
61538       return memberships;
61539     }
61540     function selectRelation(d3_event, d) {
61541       d3_event.preventDefault();
61542       utilHighlightEntities([d.relation.id], false, context);
61543       context.enter(modeSelect(context, [d.relation.id]));
61544     }
61545     function zoomToRelation(d3_event, d) {
61546       d3_event.preventDefault();
61547       var entity = context.entity(d.relation.id);
61548       context.map().zoomToEase(entity);
61549       utilHighlightEntities([d.relation.id], true, context);
61550     }
61551     function changeRole(d3_event, d) {
61552       if (d === 0)
61553         return;
61554       if (_inChange)
61555         return;
61556       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
61557       if (!newRole.trim() && typeof d.role !== "string")
61558         return;
61559       var membersToUpdate = d.members.filter(function(member) {
61560         return member.role !== newRole;
61561       });
61562       if (membersToUpdate.length) {
61563         _inChange = true;
61564         context.perform(function actionChangeMemberRoles(graph) {
61565           membersToUpdate.forEach(function(member) {
61566             var newMember = Object.assign({}, member, { role: newRole });
61567             delete newMember.index;
61568             graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
61569           });
61570           return graph;
61571         }, _t("operations.change_role.annotation", {
61572           n: membersToUpdate.length
61573         }));
61574         context.validator().validate();
61575       }
61576       _inChange = false;
61577     }
61578     function addMembership(d, role) {
61579       this.blur();
61580       _showBlank = false;
61581       function actionAddMembers(relationId, ids, role2) {
61582         return function(graph) {
61583           for (var i2 in ids) {
61584             var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
61585             graph = actionAddMember(relationId, member)(graph);
61586           }
61587           return graph;
61588         };
61589       }
61590       if (d.relation) {
61591         context.perform(actionAddMembers(d.relation.id, _entityIDs, role), _t("operations.add_member.annotation", {
61592           n: _entityIDs.length
61593         }));
61594         context.validator().validate();
61595       } else {
61596         var relation = osmRelation();
61597         context.perform(actionAddEntity(relation), actionAddMembers(relation.id, _entityIDs, role), _t("operations.add.annotation.relation"));
61598         context.enter(modeSelect(context, [relation.id]).newFeature(true));
61599       }
61600     }
61601     function deleteMembership(d3_event, d) {
61602       this.blur();
61603       if (d === 0)
61604         return;
61605       utilHighlightEntities([d.relation.id], false, context);
61606       var indexes = d.members.map(function(member) {
61607         return member.index;
61608       });
61609       context.perform(actionDeleteMembers(d.relation.id, indexes), _t("operations.delete_member.annotation", {
61610         n: _entityIDs.length
61611       }));
61612       context.validator().validate();
61613     }
61614     function fetchNearbyRelations(q, callback) {
61615       var newRelation = {
61616         relation: null,
61617         value: _t("inspector.new_relation"),
61618         display: _t.html("inspector.new_relation")
61619       };
61620       var entityID = _entityIDs[0];
61621       var result = [];
61622       var graph = context.graph();
61623       function baseDisplayLabel(entity) {
61624         var matched = _mainPresetIndex.match(entity, graph);
61625         var presetName = matched && matched.name() || _t("inspector.relation");
61626         var entityName = utilDisplayName(entity) || "";
61627         return presetName + " " + entityName;
61628       }
61629       var explicitRelation = q && context.hasEntity(q.toLowerCase());
61630       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
61631         result.push({
61632           relation: explicitRelation,
61633           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
61634         });
61635       } else {
61636         context.history().intersects(context.map().extent()).forEach(function(entity) {
61637           if (entity.type !== "relation" || entity.id === entityID)
61638             return;
61639           var value = baseDisplayLabel(entity);
61640           if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
61641             return;
61642           result.push({ relation: entity, value });
61643         });
61644         result.sort(function(a, b) {
61645           return osmRelation.creationOrder(a.relation, b.relation);
61646         });
61647         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
61648           return v.length > 1;
61649         });
61650         dupeGroups.forEach(function(group) {
61651           group.forEach(function(obj) {
61652             obj.value += " " + obj.relation.id;
61653           });
61654         });
61655       }
61656       result.forEach(function(obj) {
61657         obj.title = obj.value;
61658       });
61659       result.unshift(newRelation);
61660       callback(result);
61661     }
61662     function renderDisclosureContent(selection2) {
61663       var memberships = getMemberships();
61664       var list = selection2.selectAll(".member-list").data([0]);
61665       list = list.enter().append("ul").attr("class", "member-list").merge(list);
61666       var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
61667         return d.hash;
61668       });
61669       items.exit().each(unbind).remove();
61670       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
61671       itemsEnter.on("mouseover", function(d3_event, d) {
61672         utilHighlightEntities([d.relation.id], true, context);
61673       }).on("mouseout", function(d3_event, d) {
61674         utilHighlightEntities([d.relation.id], false, context);
61675       });
61676       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
61677         return d.domId;
61678       });
61679       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
61680       labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
61681         var matched = _mainPresetIndex.match(d.relation, context.graph());
61682         return matched && matched.name() || _t.html("inspector.relation");
61683       });
61684       labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
61685         return utilDisplayName(d.relation);
61686       });
61687       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
61688       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
61689       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61690       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
61691         return d.domId;
61692       }).property("type", "text").property("value", function(d) {
61693         return typeof d.role === "string" ? d.role : "";
61694       }).attr("title", function(d) {
61695         return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
61696       }).attr("placeholder", function(d) {
61697         return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
61698       }).classed("mixed", function(d) {
61699         return Array.isArray(d.role);
61700       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
61701       if (taginfo) {
61702         wrapEnter.each(bindTypeahead);
61703       }
61704       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
61705       newMembership.exit().remove();
61706       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
61707       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
61708       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
61709       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
61710         list.selectAll(".member-row-new").remove();
61711       });
61712       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
61713       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
61714       newMembership = newMembership.merge(newMembershipEnter);
61715       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity));
61716       var addRow = selection2.selectAll(".add-row").data([0]);
61717       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
61718       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
61719       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
61720       addRelationButton.call(uiTooltip().title(_t.html("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
61721       addRowEnter.append("div").attr("class", "space-value");
61722       addRowEnter.append("div").attr("class", "space-buttons");
61723       addRow = addRow.merge(addRowEnter);
61724       addRow.select(".add-relation").on("click", function() {
61725         _showBlank = true;
61726         section.reRender();
61727         list.selectAll(".member-entity-input").node().focus();
61728       });
61729       function acceptEntity(d) {
61730         if (!d) {
61731           cancelEntity();
61732           return;
61733         }
61734         if (d.relation)
61735           utilHighlightEntities([d.relation.id], false, context);
61736         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
61737         addMembership(d, role);
61738       }
61739       function cancelEntity() {
61740         var input = newMembership.selectAll(".member-entity-input");
61741         input.property("value", "");
61742         context.surface().selectAll(".highlighted").classed("highlighted", false);
61743       }
61744       function bindTypeahead(d) {
61745         var row = select_default2(this);
61746         var role = row.selectAll("input.member-role");
61747         var origValue = role.property("value");
61748         function sort(value, data) {
61749           var sameletter = [];
61750           var other = [];
61751           for (var i2 = 0; i2 < data.length; i2++) {
61752             if (data[i2].value.substring(0, value.length) === value) {
61753               sameletter.push(data[i2]);
61754             } else {
61755               other.push(data[i2]);
61756             }
61757           }
61758           return sameletter.concat(other);
61759         }
61760         role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
61761           var rtype = d.relation.tags.type;
61762           taginfo.roles({
61763             debounce: true,
61764             rtype: rtype || "",
61765             geometry: context.graph().geometry(_entityIDs[0]),
61766             query: role2
61767           }, function(err, data) {
61768             if (!err)
61769               callback(sort(role2, data));
61770           });
61771         }).on("cancel", function() {
61772           role.property("value", origValue);
61773         }));
61774       }
61775       function unbind() {
61776         var row = select_default2(this);
61777         row.selectAll("input.member-role").call(uiCombobox.off, context);
61778       }
61779     }
61780     section.entityIDs = function(val) {
61781       if (!arguments.length)
61782         return _entityIDs;
61783       _entityIDs = val;
61784       _showBlank = false;
61785       return section;
61786     };
61787     return section;
61788   }
61789
61790   // modules/ui/sections/selection_list.js
61791   function uiSectionSelectionList(context) {
61792     var _selectedIDs = [];
61793     var section = uiSection("selected-features", context).shouldDisplay(function() {
61794       return _selectedIDs.length > 1;
61795     }).label(function() {
61796       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.features") }, count: _selectedIDs.length });
61797     }).disclosureContent(renderDisclosureContent);
61798     context.history().on("change.selectionList", function(difference) {
61799       if (difference) {
61800         section.reRender();
61801       }
61802     });
61803     section.entityIDs = function(val) {
61804       if (!arguments.length)
61805         return _selectedIDs;
61806       _selectedIDs = val;
61807       return section;
61808     };
61809     function selectEntity(d3_event, entity) {
61810       context.enter(modeSelect(context, [entity.id]));
61811     }
61812     function deselectEntity(d3_event, entity) {
61813       var selectedIDs = _selectedIDs.slice();
61814       var index = selectedIDs.indexOf(entity.id);
61815       if (index > -1) {
61816         selectedIDs.splice(index, 1);
61817         context.enter(modeSelect(context, selectedIDs));
61818       }
61819     }
61820     function renderDisclosureContent(selection2) {
61821       var list = selection2.selectAll(".feature-list").data([0]);
61822       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
61823       var entities = _selectedIDs.map(function(id2) {
61824         return context.hasEntity(id2);
61825       }).filter(Boolean);
61826       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
61827       items.exit().remove();
61828       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
61829         select_default2(this).on("mouseover", function() {
61830           utilHighlightEntities([d.id], true, context);
61831         }).on("mouseout", function() {
61832           utilHighlightEntities([d.id], false, context);
61833         });
61834       });
61835       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
61836       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
61837       label.append("span").attr("class", "entity-type");
61838       label.append("span").attr("class", "entity-name");
61839       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
61840       items = items.merge(enter);
61841       items.selectAll(".entity-geom-icon use").attr("href", function() {
61842         var entity = this.parentNode.parentNode.__data__;
61843         return "#iD-icon-" + entity.geometry(context.graph());
61844       });
61845       items.selectAll(".entity-type").text(function(entity) {
61846         return _mainPresetIndex.match(entity, context.graph()).name();
61847       });
61848       items.selectAll(".entity-name").text(function(d) {
61849         var entity = context.entity(d.id);
61850         return utilDisplayName(entity);
61851       });
61852     }
61853     return section;
61854   }
61855
61856   // modules/ui/entity_editor.js
61857   function uiEntityEditor(context) {
61858     var dispatch10 = dispatch_default("choose");
61859     var _state = "select";
61860     var _coalesceChanges = false;
61861     var _modified = false;
61862     var _base;
61863     var _entityIDs;
61864     var _activePresets = [];
61865     var _newFeature;
61866     var _sections;
61867     function entityEditor(selection2) {
61868       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
61869       var header = selection2.selectAll(".header").data([0]);
61870       var headerEnter = header.enter().append("div").attr("class", "header fillL");
61871       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
61872       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t(`icons.${direction}`)).call(svgIcon(`#iD-icon-${direction}`));
61873       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
61874         context.enter(modeBrowse(context));
61875       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
61876       headerEnter.append("h2");
61877       header = header.merge(headerEnter);
61878       header.selectAll("h2").html(_entityIDs.length === 1 ? _t.html("inspector.edit") : _t.html("inspector.edit_features"));
61879       header.selectAll(".preset-reset").on("click", function() {
61880         dispatch10.call("choose", this, _activePresets);
61881       });
61882       var body = selection2.selectAll(".inspector-body").data([0]);
61883       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
61884       body = body.merge(bodyEnter);
61885       if (!_sections) {
61886         _sections = [
61887           uiSectionSelectionList(context),
61888           uiSectionFeatureType(context).on("choose", function(presets) {
61889             dispatch10.call("choose", this, presets);
61890           }),
61891           uiSectionEntityIssues(context),
61892           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
61893           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
61894           uiSectionRawMemberEditor(context),
61895           uiSectionRawMembershipEditor(context)
61896         ];
61897       }
61898       _sections.forEach(function(section) {
61899         if (section.entityIDs) {
61900           section.entityIDs(_entityIDs);
61901         }
61902         if (section.presets) {
61903           section.presets(_activePresets);
61904         }
61905         if (section.tags) {
61906           section.tags(combinedTags);
61907         }
61908         if (section.state) {
61909           section.state(_state);
61910         }
61911         body.call(section.render);
61912       });
61913       context.history().on("change.entity-editor", historyChanged);
61914       function historyChanged(difference) {
61915         if (selection2.selectAll(".entity-editor").empty())
61916           return;
61917         if (_state === "hide")
61918           return;
61919         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
61920         if (!significant)
61921           return;
61922         _entityIDs = _entityIDs.filter(context.hasEntity);
61923         if (!_entityIDs.length)
61924           return;
61925         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
61926         loadActivePresets();
61927         var graph = context.graph();
61928         entityEditor.modified(_base !== graph);
61929         entityEditor(selection2);
61930         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
61931           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
61932         }
61933       }
61934     }
61935     function changeTags(entityIDs, changed, onInput) {
61936       var actions = [];
61937       for (var i2 in entityIDs) {
61938         var entityID = entityIDs[i2];
61939         var entity = context.entity(entityID);
61940         var tags = Object.assign({}, entity.tags);
61941         for (var k in changed) {
61942           if (!k)
61943             continue;
61944           var v = changed[k];
61945           if (typeof v === "object") {
61946             tags[k] = tags[v.oldKey];
61947           } else if (v !== void 0 || tags.hasOwnProperty(k)) {
61948             tags[k] = v;
61949           }
61950         }
61951         if (!onInput) {
61952           tags = utilCleanTags(tags);
61953         }
61954         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
61955           actions.push(actionChangeTags(entityID, tags));
61956         }
61957       }
61958       if (actions.length) {
61959         var combinedAction = function(graph) {
61960           actions.forEach(function(action) {
61961             graph = action(graph);
61962           });
61963           return graph;
61964         };
61965         var annotation = _t("operations.change_tags.annotation");
61966         if (_coalesceChanges) {
61967           context.overwrite(combinedAction, annotation);
61968         } else {
61969           context.perform(combinedAction, annotation);
61970           _coalesceChanges = !!onInput;
61971         }
61972       }
61973       if (!onInput) {
61974         context.validator().validate();
61975       }
61976     }
61977     function revertTags(keys) {
61978       var actions = [];
61979       for (var i2 in _entityIDs) {
61980         var entityID = _entityIDs[i2];
61981         var original = context.graph().base().entities[entityID];
61982         var changed = {};
61983         for (var j2 in keys) {
61984           var key = keys[j2];
61985           changed[key] = original ? original.tags[key] : void 0;
61986         }
61987         var entity = context.entity(entityID);
61988         var tags = Object.assign({}, entity.tags);
61989         for (var k in changed) {
61990           if (!k)
61991             continue;
61992           var v = changed[k];
61993           if (v !== void 0 || tags.hasOwnProperty(k)) {
61994             tags[k] = v;
61995           }
61996         }
61997         tags = utilCleanTags(tags);
61998         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
61999           actions.push(actionChangeTags(entityID, tags));
62000         }
62001       }
62002       if (actions.length) {
62003         var combinedAction = function(graph) {
62004           actions.forEach(function(action) {
62005             graph = action(graph);
62006           });
62007           return graph;
62008         };
62009         var annotation = _t("operations.change_tags.annotation");
62010         if (_coalesceChanges) {
62011           context.overwrite(combinedAction, annotation);
62012         } else {
62013           context.perform(combinedAction, annotation);
62014           _coalesceChanges = false;
62015         }
62016       }
62017       context.validator().validate();
62018     }
62019     entityEditor.modified = function(val) {
62020       if (!arguments.length)
62021         return _modified;
62022       _modified = val;
62023       return entityEditor;
62024     };
62025     entityEditor.state = function(val) {
62026       if (!arguments.length)
62027         return _state;
62028       _state = val;
62029       return entityEditor;
62030     };
62031     entityEditor.entityIDs = function(val) {
62032       if (!arguments.length)
62033         return _entityIDs;
62034       _base = context.graph();
62035       _coalesceChanges = false;
62036       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
62037         return entityEditor;
62038       _entityIDs = val;
62039       loadActivePresets(true);
62040       return entityEditor.modified(false);
62041     };
62042     entityEditor.newFeature = function(val) {
62043       if (!arguments.length)
62044         return _newFeature;
62045       _newFeature = val;
62046       return entityEditor;
62047     };
62048     function loadActivePresets(isForNewSelection) {
62049       var graph = context.graph();
62050       var counts = {};
62051       for (var i2 in _entityIDs) {
62052         var entity = graph.hasEntity(_entityIDs[i2]);
62053         if (!entity)
62054           return;
62055         var match = _mainPresetIndex.match(entity, graph);
62056         if (!counts[match.id])
62057           counts[match.id] = 0;
62058         counts[match.id] += 1;
62059       }
62060       var matches = Object.keys(counts).sort(function(p1, p2) {
62061         return counts[p2] - counts[p1];
62062       }).map(function(pID) {
62063         return _mainPresetIndex.item(pID);
62064       });
62065       if (!isForNewSelection) {
62066         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
62067         if (weakPreset && matches.length === 1 && matches[0].isFallback())
62068           return;
62069       }
62070       entityEditor.presets(matches);
62071     }
62072     entityEditor.presets = function(val) {
62073       if (!arguments.length)
62074         return _activePresets;
62075       if (!utilArrayIdentical(val, _activePresets)) {
62076         _activePresets = val;
62077       }
62078       return entityEditor;
62079     };
62080     return utilRebind(entityEditor, dispatch10, "on");
62081   }
62082
62083   // modules/ui/feature_list.js
62084   var sexagesimal = __toESM(require_sexagesimal());
62085   function uiFeatureList(context) {
62086     var _geocodeResults;
62087     function featureList(selection2) {
62088       var header = selection2.append("div").attr("class", "header fillL");
62089       header.append("h2").call(_t.append("inspector.feature_list"));
62090       var searchWrap = selection2.append("div").attr("class", "search-header");
62091       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
62092       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
62093       var listWrap = selection2.append("div").attr("class", "inspector-body");
62094       var list = listWrap.append("div").attr("class", "feature-list");
62095       context.on("exit.feature-list", clearSearch);
62096       context.map().on("drawn.feature-list", mapDrawn);
62097       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
62098       function focusSearch(d3_event) {
62099         var mode = context.mode() && context.mode().id;
62100         if (mode !== "browse")
62101           return;
62102         d3_event.preventDefault();
62103         search.node().focus();
62104       }
62105       function keydown(d3_event) {
62106         if (d3_event.keyCode === 27) {
62107           search.node().blur();
62108         }
62109       }
62110       function keypress(d3_event) {
62111         var q = search.property("value"), items = list.selectAll(".feature-list-item");
62112         if (d3_event.keyCode === 13 && q.length && items.size()) {
62113           click(d3_event, items.datum());
62114         }
62115       }
62116       function inputevent() {
62117         _geocodeResults = void 0;
62118         drawList();
62119       }
62120       function clearSearch() {
62121         search.property("value", "");
62122         drawList();
62123       }
62124       function mapDrawn(e) {
62125         if (e.full) {
62126           drawList();
62127         }
62128       }
62129       function features2() {
62130         var result = [];
62131         var graph = context.graph();
62132         var visibleCenter = context.map().extent().center();
62133         var q = search.property("value").toLowerCase();
62134         if (!q)
62135           return result;
62136         var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
62137         if (locationMatch) {
62138           var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
62139           result.push({
62140             id: -1,
62141             geometry: "point",
62142             type: _t("inspector.location"),
62143             name: dmsCoordinatePair([loc[1], loc[0]]),
62144             location: loc
62145           });
62146         }
62147         var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
62148         if (idMatch) {
62149           var elemType = idMatch[1].charAt(0);
62150           var elemId = idMatch[2];
62151           result.push({
62152             id: elemType + elemId,
62153             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
62154             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
62155             name: elemId
62156           });
62157         }
62158         var allEntities = graph.entities;
62159         var localResults = [];
62160         for (var id2 in allEntities) {
62161           var entity = allEntities[id2];
62162           if (!entity)
62163             continue;
62164           var name2 = utilDisplayName(entity) || "";
62165           if (name2.toLowerCase().indexOf(q) < 0)
62166             continue;
62167           var matched = _mainPresetIndex.match(entity, graph);
62168           var type3 = matched && matched.name() || utilDisplayType(entity.id);
62169           var extent = entity.extent(graph);
62170           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
62171           localResults.push({
62172             id: entity.id,
62173             entity,
62174             geometry: entity.geometry(graph),
62175             type: type3,
62176             name: name2,
62177             distance
62178           });
62179           if (localResults.length > 100)
62180             break;
62181         }
62182         localResults = localResults.sort(function byDistance(a, b) {
62183           return a.distance - b.distance;
62184         });
62185         result = result.concat(localResults);
62186         (_geocodeResults || []).forEach(function(d) {
62187           if (d.osm_type && d.osm_id) {
62188             var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
62189             var tags = {};
62190             tags[d.class] = d.type;
62191             var attrs = { id: id3, type: d.osm_type, tags };
62192             if (d.osm_type === "way") {
62193               attrs.nodes = ["a", "a"];
62194             }
62195             var tempEntity = osmEntity(attrs);
62196             var tempGraph = coreGraph([tempEntity]);
62197             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
62198             var type4 = matched2 && matched2.name() || utilDisplayType(id3);
62199             result.push({
62200               id: tempEntity.id,
62201               geometry: tempEntity.geometry(tempGraph),
62202               type: type4,
62203               name: d.display_name,
62204               extent: new geoExtent([parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])], [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])])
62205             });
62206           }
62207         });
62208         if (q.match(/^[0-9]+$/)) {
62209           result.push({
62210             id: "n" + q,
62211             geometry: "point",
62212             type: _t("inspector.node"),
62213             name: q
62214           });
62215           result.push({
62216             id: "w" + q,
62217             geometry: "line",
62218             type: _t("inspector.way"),
62219             name: q
62220           });
62221           result.push({
62222             id: "r" + q,
62223             geometry: "relation",
62224             type: _t("inspector.relation"),
62225             name: q
62226           });
62227         }
62228         return result;
62229       }
62230       function drawList() {
62231         var value = search.property("value");
62232         var results = features2();
62233         list.classed("filtered", value.length);
62234         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"));
62235         resultsIndicator.append("span").attr("class", "entity-name");
62236         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
62237         if (services.geocoder) {
62238           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"));
62239         }
62240         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
62241         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
62242         list.selectAll(".feature-list-item").data([-1]).remove();
62243         var items = list.selectAll(".feature-list-item").data(results, function(d) {
62244           return d.id;
62245         });
62246         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
62247         var label = enter.append("div").attr("class", "label");
62248         label.each(function(d) {
62249           select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
62250         });
62251         label.append("span").attr("class", "entity-type").text(function(d) {
62252           return d.type;
62253         });
62254         label.append("span").attr("class", "entity-name").text(function(d) {
62255           return d.name;
62256         });
62257         enter.style("opacity", 0).transition().style("opacity", 1);
62258         items.order();
62259         items.exit().remove();
62260       }
62261       function mouseover(d3_event, d) {
62262         if (d.id === -1)
62263           return;
62264         utilHighlightEntities([d.id], true, context);
62265       }
62266       function mouseout(d3_event, d) {
62267         if (d.id === -1)
62268           return;
62269         utilHighlightEntities([d.id], false, context);
62270       }
62271       function click(d3_event, d) {
62272         d3_event.preventDefault();
62273         if (d.location) {
62274           context.map().centerZoomEase([d.location[1], d.location[0]], 19);
62275         } else if (d.entity) {
62276           utilHighlightEntities([d.id], false, context);
62277           context.enter(modeSelect(context, [d.entity.id]));
62278           context.map().zoomToEase(d.entity);
62279         } else {
62280           context.zoomToEntity(d.id);
62281         }
62282       }
62283       function geocoderSearch() {
62284         services.geocoder.search(search.property("value"), function(err, resp) {
62285           _geocodeResults = resp || [];
62286           drawList();
62287         });
62288       }
62289     }
62290     return featureList;
62291   }
62292
62293   // modules/ui/improveOSM_comments.js
62294   function uiImproveOsmComments() {
62295     let _qaItem;
62296     function issueComments(selection2) {
62297       let comments = selection2.selectAll(".comments-container").data([0]);
62298       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
62299       services.improveOSM.getComments(_qaItem).then((d) => {
62300         if (!d.comments)
62301           return;
62302         const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
62303         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
62304         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
62305         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
62306         metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
62307           const osm = services.osm;
62308           let selection3 = select_default2(this);
62309           if (osm && d2.username) {
62310             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
62311           }
62312           selection3.text((d4) => d4.username);
62313         });
62314         metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
62315         mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
62316       }).catch((err) => {
62317         console.log(err);
62318       });
62319     }
62320     function localeDateString2(s) {
62321       if (!s)
62322         return null;
62323       const options2 = { day: "numeric", month: "short", year: "numeric" };
62324       const d = new Date(s * 1e3);
62325       if (isNaN(d.getTime()))
62326         return null;
62327       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
62328     }
62329     issueComments.issue = function(val) {
62330       if (!arguments.length)
62331         return _qaItem;
62332       _qaItem = val;
62333       return issueComments;
62334     };
62335     return issueComments;
62336   }
62337
62338   // modules/ui/improveOSM_details.js
62339   function uiImproveOsmDetails(context) {
62340     let _qaItem;
62341     function issueDetail(d) {
62342       if (d.desc)
62343         return d.desc;
62344       const issueKey = d.issueKey;
62345       d.replacements = d.replacements || {};
62346       d.replacements.default = { html: _t.html("inspector.unknown") };
62347       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
62348     }
62349     function improveOsmDetails(selection2) {
62350       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62351       details.exit().remove();
62352       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
62353       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
62354       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
62355       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
62356       let relatedEntities = [];
62357       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
62358         const link2 = select_default2(this);
62359         const isObjectLink = link2.classed("error_object_link");
62360         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
62361         const entity = context.hasEntity(entityID);
62362         relatedEntities.push(entityID);
62363         link2.on("mouseenter", () => {
62364           utilHighlightEntities([entityID], true, context);
62365         }).on("mouseleave", () => {
62366           utilHighlightEntities([entityID], false, context);
62367         }).on("click", (d3_event) => {
62368           d3_event.preventDefault();
62369           utilHighlightEntities([entityID], false, context);
62370           const osmlayer = context.layers().layer("osm");
62371           if (!osmlayer.enabled()) {
62372             osmlayer.enabled(true);
62373           }
62374           context.map().centerZoom(_qaItem.loc, 20);
62375           if (entity) {
62376             context.enter(modeSelect(context, [entityID]));
62377           } else {
62378             context.loadEntity(entityID, (err, result) => {
62379               if (err)
62380                 return;
62381               const entity2 = result.data.find((e) => e.id === entityID);
62382               if (entity2)
62383                 context.enter(modeSelect(context, [entityID]));
62384             });
62385           }
62386         });
62387         if (entity) {
62388           let name2 = utilDisplayName(entity);
62389           if (!name2 && !isObjectLink) {
62390             const preset = _mainPresetIndex.match(entity, context.graph());
62391             name2 = preset && !preset.isFallback() && preset.name();
62392           }
62393           if (name2) {
62394             this.innerText = name2;
62395           }
62396         }
62397       });
62398       context.features().forceVisible(relatedEntities);
62399       context.map().pan([0, 0]);
62400     }
62401     improveOsmDetails.issue = function(val) {
62402       if (!arguments.length)
62403         return _qaItem;
62404       _qaItem = val;
62405       return improveOsmDetails;
62406     };
62407     return improveOsmDetails;
62408   }
62409
62410   // modules/ui/improveOSM_header.js
62411   function uiImproveOsmHeader() {
62412     let _qaItem;
62413     function issueTitle(d) {
62414       const issueKey = d.issueKey;
62415       d.replacements = d.replacements || {};
62416       d.replacements.default = { html: _t.html("inspector.unknown") };
62417       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
62418     }
62419     function improveOsmHeader(selection2) {
62420       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62421       header.exit().remove();
62422       const headerEnter = header.enter().append("div").attr("class", "qa-header");
62423       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}`);
62424       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");
62425       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 : "");
62426       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
62427     }
62428     improveOsmHeader.issue = function(val) {
62429       if (!arguments.length)
62430         return _qaItem;
62431       _qaItem = val;
62432       return improveOsmHeader;
62433     };
62434     return improveOsmHeader;
62435   }
62436
62437   // modules/ui/improveOSM_editor.js
62438   function uiImproveOsmEditor(context) {
62439     const dispatch10 = dispatch_default("change");
62440     const qaDetails = uiImproveOsmDetails(context);
62441     const qaComments = uiImproveOsmComments(context);
62442     const qaHeader = uiImproveOsmHeader(context);
62443     let _qaItem;
62444     function improveOsmEditor(selection2) {
62445       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
62446       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
62447       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
62448       let body = selection2.selectAll(".body").data([0]);
62449       body = body.enter().append("div").attr("class", "body").merge(body);
62450       const editor = body.selectAll(".qa-editor").data([0]);
62451       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);
62452     }
62453     function improveOsmSaveSection(selection2) {
62454       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
62455       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
62456       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62457       saveSection.exit().remove();
62458       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
62459       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
62460       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);
62461       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
62462       function changeInput() {
62463         const input = select_default2(this);
62464         let val = input.property("value").trim();
62465         if (val === "") {
62466           val = void 0;
62467         }
62468         _qaItem = _qaItem.update({ newComment: val });
62469         const qaService = services.improveOSM;
62470         if (qaService) {
62471           qaService.replaceItem(_qaItem);
62472         }
62473         saveSection.call(qaSaveButtons);
62474       }
62475     }
62476     function qaSaveButtons(selection2) {
62477       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
62478       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
62479       buttonSection.exit().remove();
62480       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
62481       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
62482       buttonEnter.append("button").attr("class", "button close-button action");
62483       buttonEnter.append("button").attr("class", "button ignore-button action");
62484       buttonSection = buttonSection.merge(buttonEnter);
62485       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
62486         this.blur();
62487         const qaService = services.improveOSM;
62488         if (qaService) {
62489           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62490         }
62491       });
62492       buttonSection.select(".close-button").html((d) => {
62493         const andComment = d.newComment ? "_comment" : "";
62494         return _t.html(`QA.keepRight.close${andComment}`);
62495       }).on("click.close", function(d3_event, d) {
62496         this.blur();
62497         const qaService = services.improveOSM;
62498         if (qaService) {
62499           d.newStatus = "SOLVED";
62500           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62501         }
62502       });
62503       buttonSection.select(".ignore-button").html((d) => {
62504         const andComment = d.newComment ? "_comment" : "";
62505         return _t.html(`QA.keepRight.ignore${andComment}`);
62506       }).on("click.ignore", function(d3_event, d) {
62507         this.blur();
62508         const qaService = services.improveOSM;
62509         if (qaService) {
62510           d.newStatus = "INVALID";
62511           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
62512         }
62513       });
62514     }
62515     improveOsmEditor.error = function(val) {
62516       if (!arguments.length)
62517         return _qaItem;
62518       _qaItem = val;
62519       return improveOsmEditor;
62520     };
62521     return utilRebind(improveOsmEditor, dispatch10, "on");
62522   }
62523
62524   // modules/ui/preset_list.js
62525   function uiPresetList(context) {
62526     var dispatch10 = dispatch_default("cancel", "choose");
62527     var _entityIDs;
62528     var _currLoc;
62529     var _currentPresets;
62530     var _autofocus = false;
62531     function presetList(selection2) {
62532       if (!_entityIDs)
62533         return;
62534       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
62535       selection2.html("");
62536       var messagewrap = selection2.append("div").attr("class", "header fillL");
62537       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
62538       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
62539       messagewrap.append("button").attr("class", "preset-choose").attr("title", direction).on("click", function() {
62540         dispatch10.call("cancel", this);
62541       }).call(svgIcon(`#iD-icon-${direction}`));
62542       function initialKeydown(d3_event) {
62543         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
62544           d3_event.preventDefault();
62545           d3_event.stopPropagation();
62546           operationDelete(context, _entityIDs)();
62547         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
62548           d3_event.preventDefault();
62549           d3_event.stopPropagation();
62550           context.undo();
62551         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
62552           select_default2(this).on("keydown", keydown);
62553           keydown.call(this, d3_event);
62554         }
62555       }
62556       function keydown(d3_event) {
62557         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && search.node().selectionStart === search.property("value").length) {
62558           d3_event.preventDefault();
62559           d3_event.stopPropagation();
62560           var buttons = list.selectAll(".preset-list-button");
62561           if (!buttons.empty())
62562             buttons.nodes()[0].focus();
62563         }
62564       }
62565       function keypress(d3_event) {
62566         var value = search.property("value");
62567         if (d3_event.keyCode === 13 && value.length) {
62568           list.selectAll(".preset-list-item:first-child").each(function(d) {
62569             d.choose.call(this);
62570           });
62571         }
62572       }
62573       function inputevent() {
62574         var value = search.property("value");
62575         list.classed("filtered", value.length);
62576         var results, messageText;
62577         if (value.length) {
62578           results = presets.search(value, entityGeometries()[0], _currLoc);
62579           messageText = _t.html("inspector.results", {
62580             n: results.collection.length,
62581             search: value
62582           });
62583         } else {
62584           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc);
62585           messageText = _t.html("inspector.choose");
62586         }
62587         list.call(drawList, results);
62588         message.html(messageText);
62589       }
62590       var searchWrap = selection2.append("div").attr("class", "search-header");
62591       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
62592       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));
62593       if (_autofocus) {
62594         search.node().focus();
62595         setTimeout(function() {
62596           search.node().focus();
62597         }, 0);
62598       }
62599       var listWrap = selection2.append("div").attr("class", "inspector-body");
62600       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc));
62601       context.features().on("change.preset-list", updateForFeatureHiddenState);
62602     }
62603     function drawList(list, presets) {
62604       presets = presets.matchAllGeometry(entityGeometries());
62605       var collection = presets.collection.reduce(function(collection2, preset) {
62606         if (!preset)
62607           return collection2;
62608         if (preset.members) {
62609           if (preset.members.collection.filter(function(preset2) {
62610             return preset2.addable();
62611           }).length > 1) {
62612             collection2.push(CategoryItem(preset));
62613           }
62614         } else if (preset.addable()) {
62615           collection2.push(PresetItem(preset));
62616         }
62617         return collection2;
62618       }, []);
62619       var items = list.selectAll(".preset-list-item").data(collection, function(d) {
62620         return d.preset.id;
62621       });
62622       items.order();
62623       items.exit().remove();
62624       items.enter().append("div").attr("class", function(item) {
62625         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
62626       }).classed("current", function(item) {
62627         return _currentPresets.indexOf(item.preset) !== -1;
62628       }).each(function(item) {
62629         select_default2(this).call(item);
62630       }).style("opacity", 0).transition().style("opacity", 1);
62631       updateForFeatureHiddenState();
62632     }
62633     function itemKeydown(d3_event) {
62634       var item = select_default2(this.closest(".preset-list-item"));
62635       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
62636       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
62637         d3_event.preventDefault();
62638         d3_event.stopPropagation();
62639         var nextItem = select_default2(item.node().nextElementSibling);
62640         if (nextItem.empty()) {
62641           if (!parentItem.empty()) {
62642             nextItem = select_default2(parentItem.node().nextElementSibling);
62643           }
62644         } else if (select_default2(this).classed("expanded")) {
62645           nextItem = item.select(".subgrid .preset-list-item:first-child");
62646         }
62647         if (!nextItem.empty()) {
62648           nextItem.select(".preset-list-button").node().focus();
62649         }
62650       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
62651         d3_event.preventDefault();
62652         d3_event.stopPropagation();
62653         var previousItem = select_default2(item.node().previousElementSibling);
62654         if (previousItem.empty()) {
62655           if (!parentItem.empty()) {
62656             previousItem = parentItem;
62657           }
62658         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
62659           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
62660         }
62661         if (!previousItem.empty()) {
62662           previousItem.select(".preset-list-button").node().focus();
62663         } else {
62664           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
62665           search.node().focus();
62666         }
62667       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
62668         d3_event.preventDefault();
62669         d3_event.stopPropagation();
62670         if (!parentItem.empty()) {
62671           parentItem.select(".preset-list-button").node().focus();
62672         }
62673       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
62674         d3_event.preventDefault();
62675         d3_event.stopPropagation();
62676         item.datum().choose.call(select_default2(this).node());
62677       }
62678     }
62679     function CategoryItem(preset) {
62680       var box, sublist, shown = false;
62681       function item(selection2) {
62682         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
62683         function click() {
62684           var isExpanded = select_default2(this).classed("expanded");
62685           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
62686           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
62687           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
62688           item.choose();
62689         }
62690         var geometries = entityGeometries();
62691         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) {
62692           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
62693             d3_event.preventDefault();
62694             d3_event.stopPropagation();
62695             if (!select_default2(this).classed("expanded")) {
62696               click.call(this, d3_event);
62697             }
62698           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
62699             d3_event.preventDefault();
62700             d3_event.stopPropagation();
62701             if (select_default2(this).classed("expanded")) {
62702               click.call(this, d3_event);
62703             }
62704           } else {
62705             itemKeydown.call(this, d3_event);
62706           }
62707         });
62708         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62709         label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").html(function() {
62710           return preset.nameLabel() + "&hellip;";
62711         });
62712         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
62713         box.append("div").attr("class", "arrow");
62714         sublist = box.append("div").attr("class", "preset-list fillL3");
62715       }
62716       item.choose = function() {
62717         if (!box || !sublist)
62718           return;
62719         if (shown) {
62720           shown = false;
62721           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
62722         } else {
62723           shown = true;
62724           var members = preset.members.matchAllGeometry(entityGeometries());
62725           sublist.call(drawList, members);
62726           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
62727         }
62728       };
62729       item.preset = preset;
62730       return item;
62731     }
62732     function PresetItem(preset) {
62733       function item(selection2) {
62734         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
62735         var geometries = entityGeometries();
62736         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);
62737         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62738         var nameparts = [
62739           preset.nameLabel(),
62740           preset.subtitleLabel()
62741         ].filter(Boolean);
62742         label.selectAll(".namepart").data(nameparts).enter().append("div").attr("class", "namepart").html(function(d) {
62743           return d;
62744         });
62745         wrap2.call(item.reference.button);
62746         selection2.call(item.reference.body);
62747       }
62748       item.choose = function() {
62749         if (select_default2(this).classed("disabled"))
62750           return;
62751         if (!context.inIntro()) {
62752           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
62753         }
62754         context.perform(function(graph) {
62755           for (var i2 in _entityIDs) {
62756             var entityID = _entityIDs[i2];
62757             var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
62758             graph = actionChangePreset(entityID, oldPreset, preset)(graph);
62759           }
62760           return graph;
62761         }, _t("operations.change_tags.annotation"));
62762         context.validator().validate();
62763         dispatch10.call("choose", this, preset);
62764       };
62765       item.help = function(d3_event) {
62766         d3_event.stopPropagation();
62767         item.reference.toggle();
62768       };
62769       item.preset = preset;
62770       item.reference = uiTagReference(preset.reference(), context);
62771       return item;
62772     }
62773     function updateForFeatureHiddenState() {
62774       if (!_entityIDs.every(context.hasEntity))
62775         return;
62776       var geometries = entityGeometries();
62777       var button = context.container().selectAll(".preset-list .preset-list-button");
62778       button.call(uiTooltip().destroyAny);
62779       button.each(function(item, index) {
62780         var hiddenPresetFeaturesId;
62781         for (var i2 in geometries) {
62782           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
62783           if (hiddenPresetFeaturesId)
62784             break;
62785         }
62786         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
62787         select_default2(this).classed("disabled", isHiddenPreset);
62788         if (isHiddenPreset) {
62789           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
62790           select_default2(this).call(uiTooltip().title(_t.html("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
62791             features: { html: _t.html("feature." + hiddenPresetFeaturesId + ".description") }
62792           })).placement(index < 2 ? "bottom" : "top"));
62793         }
62794       });
62795     }
62796     presetList.autofocus = function(val) {
62797       if (!arguments.length)
62798         return _autofocus;
62799       _autofocus = val;
62800       return presetList;
62801     };
62802     presetList.entityIDs = function(val) {
62803       if (!arguments.length)
62804         return _entityIDs;
62805       _entityIDs = val;
62806       _currLoc = null;
62807       if (_entityIDs && _entityIDs.length) {
62808         const extent = _entityIDs.reduce(function(extent2, entityID) {
62809           var entity = context.graph().entity(entityID);
62810           return extent2.extend(entity.extent(context.graph()));
62811         }, geoExtent());
62812         _currLoc = extent.center();
62813         var presets = _entityIDs.map(function(entityID) {
62814           return _mainPresetIndex.match(context.entity(entityID), context.graph());
62815         });
62816         presetList.presets(presets);
62817       }
62818       return presetList;
62819     };
62820     presetList.presets = function(val) {
62821       if (!arguments.length)
62822         return _currentPresets;
62823       _currentPresets = val;
62824       return presetList;
62825     };
62826     function entityGeometries() {
62827       var counts = {};
62828       for (var i2 in _entityIDs) {
62829         var entityID = _entityIDs[i2];
62830         var entity = context.entity(entityID);
62831         var geometry = entity.geometry(context.graph());
62832         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
62833           geometry = "point";
62834         }
62835         if (!counts[geometry])
62836           counts[geometry] = 0;
62837         counts[geometry] += 1;
62838       }
62839       return Object.keys(counts).sort(function(geom1, geom2) {
62840         return counts[geom2] - counts[geom1];
62841       });
62842     }
62843     return utilRebind(presetList, dispatch10, "on");
62844   }
62845
62846   // modules/ui/view_on_osm.js
62847   function uiViewOnOSM(context) {
62848     var _what;
62849     function viewOnOSM(selection2) {
62850       var url;
62851       if (_what instanceof osmEntity) {
62852         url = context.connection().entityURL(_what);
62853       } else if (_what instanceof osmNote) {
62854         url = context.connection().noteURL(_what);
62855       }
62856       var data = !_what || _what.isNew() ? [] : [_what];
62857       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
62858         return d.id;
62859       });
62860       link2.exit().remove();
62861       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
62862       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
62863     }
62864     viewOnOSM.what = function(_) {
62865       if (!arguments.length)
62866         return _what;
62867       _what = _;
62868       return viewOnOSM;
62869     };
62870     return viewOnOSM;
62871   }
62872
62873   // modules/ui/inspector.js
62874   function uiInspector(context) {
62875     var presetList = uiPresetList(context);
62876     var entityEditor = uiEntityEditor(context);
62877     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
62878     var _state = "select";
62879     var _entityIDs;
62880     var _newFeature = false;
62881     function inspector(selection2) {
62882       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
62883         inspector.setPreset();
62884       });
62885       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
62886       wrap2 = selection2.selectAll(".panewrap").data([0]);
62887       var enter = wrap2.enter().append("div").attr("class", "panewrap");
62888       enter.append("div").attr("class", "preset-list-pane pane");
62889       enter.append("div").attr("class", "entity-editor-pane pane");
62890       wrap2 = wrap2.merge(enter);
62891       presetPane = wrap2.selectAll(".preset-list-pane");
62892       editorPane = wrap2.selectAll(".entity-editor-pane");
62893       function shouldDefaultToPresetList() {
62894         if (_state !== "select")
62895           return false;
62896         if (_entityIDs.length !== 1)
62897           return false;
62898         var entityID = _entityIDs[0];
62899         var entity = context.hasEntity(entityID);
62900         if (!entity)
62901           return false;
62902         if (entity.hasNonGeometryTags())
62903           return false;
62904         if (_newFeature)
62905           return true;
62906         if (entity.geometry(context.graph()) !== "vertex")
62907           return false;
62908         if (context.graph().parentRelations(entity).length)
62909           return false;
62910         if (context.validator().getEntityIssues(entityID).length)
62911           return false;
62912         if (entity.isHighwayIntersection(context.graph()))
62913           return false;
62914         return true;
62915       }
62916       if (shouldDefaultToPresetList()) {
62917         wrap2.style("right", "-100%");
62918         editorPane.classed("hide", true);
62919         presetPane.classed("hide", false).call(presetList);
62920       } else {
62921         wrap2.style("right", "0%");
62922         presetPane.classed("hide", true);
62923         editorPane.classed("hide", false).call(entityEditor);
62924       }
62925       var footer = selection2.selectAll(".footer").data([0]);
62926       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
62927       footer.call(uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0])));
62928     }
62929     inspector.showList = function(presets) {
62930       presetPane.classed("hide", false);
62931       wrap2.transition().styleTween("right", function() {
62932         return value_default("0%", "-100%");
62933       }).on("end", function() {
62934         editorPane.classed("hide", true);
62935       });
62936       if (presets) {
62937         presetList.presets(presets);
62938       }
62939       presetPane.call(presetList.autofocus(true));
62940     };
62941     inspector.setPreset = function(preset) {
62942       if (preset && preset.id === "type/multipolygon") {
62943         presetPane.call(presetList.autofocus(true));
62944       } else {
62945         editorPane.classed("hide", false);
62946         wrap2.transition().styleTween("right", function() {
62947           return value_default("-100%", "0%");
62948         }).on("end", function() {
62949           presetPane.classed("hide", true);
62950         });
62951         if (preset) {
62952           entityEditor.presets([preset]);
62953         }
62954         editorPane.call(entityEditor);
62955       }
62956     };
62957     inspector.state = function(val) {
62958       if (!arguments.length)
62959         return _state;
62960       _state = val;
62961       entityEditor.state(_state);
62962       context.container().selectAll(".field-help-body").remove();
62963       return inspector;
62964     };
62965     inspector.entityIDs = function(val) {
62966       if (!arguments.length)
62967         return _entityIDs;
62968       _entityIDs = val;
62969       return inspector;
62970     };
62971     inspector.newFeature = function(val) {
62972       if (!arguments.length)
62973         return _newFeature;
62974       _newFeature = val;
62975       return inspector;
62976     };
62977     return inspector;
62978   }
62979
62980   // modules/ui/keepRight_details.js
62981   function uiKeepRightDetails(context) {
62982     let _qaItem;
62983     function issueDetail(d) {
62984       const { itemType, parentIssueType } = d;
62985       const unknown = { html: _t.html("inspector.unknown") };
62986       let replacements = d.replacements || {};
62987       replacements.default = unknown;
62988       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
62989         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
62990       } else {
62991         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
62992       }
62993     }
62994     function keepRightDetails(selection2) {
62995       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
62996       details.exit().remove();
62997       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
62998       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
62999       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
63000       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
63001       let relatedEntities = [];
63002       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
63003         const link2 = select_default2(this);
63004         const isObjectLink = link2.classed("error_object_link");
63005         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
63006         const entity = context.hasEntity(entityID);
63007         relatedEntities.push(entityID);
63008         link2.on("mouseenter", () => {
63009           utilHighlightEntities([entityID], true, context);
63010         }).on("mouseleave", () => {
63011           utilHighlightEntities([entityID], false, context);
63012         }).on("click", (d3_event) => {
63013           d3_event.preventDefault();
63014           utilHighlightEntities([entityID], false, context);
63015           const osmlayer = context.layers().layer("osm");
63016           if (!osmlayer.enabled()) {
63017             osmlayer.enabled(true);
63018           }
63019           context.map().centerZoomEase(_qaItem.loc, 20);
63020           if (entity) {
63021             context.enter(modeSelect(context, [entityID]));
63022           } else {
63023             context.loadEntity(entityID, (err, result) => {
63024               if (err)
63025                 return;
63026               const entity2 = result.data.find((e) => e.id === entityID);
63027               if (entity2)
63028                 context.enter(modeSelect(context, [entityID]));
63029             });
63030           }
63031         });
63032         if (entity) {
63033           let name2 = utilDisplayName(entity);
63034           if (!name2 && !isObjectLink) {
63035             const preset = _mainPresetIndex.match(entity, context.graph());
63036             name2 = preset && !preset.isFallback() && preset.name();
63037           }
63038           if (name2) {
63039             this.innerText = name2;
63040           }
63041         }
63042       });
63043       context.features().forceVisible(relatedEntities);
63044       context.map().pan([0, 0]);
63045     }
63046     keepRightDetails.issue = function(val) {
63047       if (!arguments.length)
63048         return _qaItem;
63049       _qaItem = val;
63050       return keepRightDetails;
63051     };
63052     return keepRightDetails;
63053   }
63054
63055   // modules/ui/keepRight_header.js
63056   function uiKeepRightHeader() {
63057     let _qaItem;
63058     function issueTitle(d) {
63059       const { itemType, parentIssueType } = d;
63060       const unknown = _t.html("inspector.unknown");
63061       let replacements = d.replacements || {};
63062       replacements.default = { html: unknown };
63063       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
63064         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
63065       } else {
63066         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
63067       }
63068     }
63069     function keepRightHeader(selection2) {
63070       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
63071       header.exit().remove();
63072       const headerEnter = header.enter().append("div").attr("class", "qa-header");
63073       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
63074       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"));
63075       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
63076     }
63077     keepRightHeader.issue = function(val) {
63078       if (!arguments.length)
63079         return _qaItem;
63080       _qaItem = val;
63081       return keepRightHeader;
63082     };
63083     return keepRightHeader;
63084   }
63085
63086   // modules/ui/view_on_keepRight.js
63087   function uiViewOnKeepRight() {
63088     let _qaItem;
63089     function viewOnKeepRight(selection2) {
63090       let url;
63091       if (services.keepRight && _qaItem instanceof QAItem) {
63092         url = services.keepRight.issueURL(_qaItem);
63093       }
63094       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
63095       link2.exit().remove();
63096       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"));
63097       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
63098     }
63099     viewOnKeepRight.what = function(val) {
63100       if (!arguments.length)
63101         return _qaItem;
63102       _qaItem = val;
63103       return viewOnKeepRight;
63104     };
63105     return viewOnKeepRight;
63106   }
63107
63108   // modules/ui/keepRight_editor.js
63109   function uiKeepRightEditor(context) {
63110     const dispatch10 = dispatch_default("change");
63111     const qaDetails = uiKeepRightDetails(context);
63112     const qaHeader = uiKeepRightHeader(context);
63113     let _qaItem;
63114     function keepRightEditor(selection2) {
63115       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
63116       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
63117       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
63118       let body = selection2.selectAll(".body").data([0]);
63119       body = body.enter().append("div").attr("class", "body").merge(body);
63120       const editor = body.selectAll(".qa-editor").data([0]);
63121       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
63122       const footer = selection2.selectAll(".footer").data([0]);
63123       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
63124     }
63125     function keepRightSaveSection(selection2) {
63126       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63127       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
63128       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
63129       saveSection.exit().remove();
63130       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
63131       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
63132       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);
63133       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
63134       function changeInput() {
63135         const input = select_default2(this);
63136         let val = input.property("value").trim();
63137         if (val === _qaItem.comment) {
63138           val = void 0;
63139         }
63140         _qaItem = _qaItem.update({ newComment: val });
63141         const qaService = services.keepRight;
63142         if (qaService) {
63143           qaService.replaceItem(_qaItem);
63144         }
63145         saveSection.call(qaSaveButtons);
63146       }
63147     }
63148     function qaSaveButtons(selection2) {
63149       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63150       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
63151       buttonSection.exit().remove();
63152       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
63153       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
63154       buttonEnter.append("button").attr("class", "button close-button action");
63155       buttonEnter.append("button").attr("class", "button ignore-button action");
63156       buttonSection = buttonSection.merge(buttonEnter);
63157       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
63158         this.blur();
63159         const qaService = services.keepRight;
63160         if (qaService) {
63161           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63162         }
63163       });
63164       buttonSection.select(".close-button").html((d) => {
63165         const andComment = d.newComment ? "_comment" : "";
63166         return _t.html(`QA.keepRight.close${andComment}`);
63167       }).on("click.close", function(d3_event, d) {
63168         this.blur();
63169         const qaService = services.keepRight;
63170         if (qaService) {
63171           d.newStatus = "ignore_t";
63172           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63173         }
63174       });
63175       buttonSection.select(".ignore-button").html((d) => {
63176         const andComment = d.newComment ? "_comment" : "";
63177         return _t.html(`QA.keepRight.ignore${andComment}`);
63178       }).on("click.ignore", function(d3_event, d) {
63179         this.blur();
63180         const qaService = services.keepRight;
63181         if (qaService) {
63182           d.newStatus = "ignore";
63183           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63184         }
63185       });
63186     }
63187     keepRightEditor.error = function(val) {
63188       if (!arguments.length)
63189         return _qaItem;
63190       _qaItem = val;
63191       return keepRightEditor;
63192     };
63193     return utilRebind(keepRightEditor, dispatch10, "on");
63194   }
63195
63196   // modules/ui/lasso.js
63197   function uiLasso(context) {
63198     var group, polygon2;
63199     lasso.coordinates = [];
63200     function lasso(selection2) {
63201       context.container().classed("lasso", true);
63202       group = selection2.append("g").attr("class", "lasso hide");
63203       polygon2 = group.append("path").attr("class", "lasso-path");
63204       group.call(uiToggle(true));
63205     }
63206     function draw() {
63207       if (polygon2) {
63208         polygon2.data([lasso.coordinates]).attr("d", function(d) {
63209           return "M" + d.join(" L") + " Z";
63210         });
63211       }
63212     }
63213     lasso.extent = function() {
63214       return lasso.coordinates.reduce(function(extent, point) {
63215         return extent.extend(geoExtent(point));
63216       }, geoExtent());
63217     };
63218     lasso.p = function(_) {
63219       if (!arguments.length)
63220         return lasso;
63221       lasso.coordinates.push(_);
63222       draw();
63223       return lasso;
63224     };
63225     lasso.close = function() {
63226       if (group) {
63227         group.call(uiToggle(false, function() {
63228           select_default2(this).remove();
63229         }));
63230       }
63231       context.container().classed("lasso", false);
63232     };
63233     return lasso;
63234   }
63235
63236   // modules/ui/note_comments.js
63237   function uiNoteComments() {
63238     var _note;
63239     function noteComments(selection2) {
63240       if (_note.isNew())
63241         return;
63242       var comments = selection2.selectAll(".comments-container").data([0]);
63243       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
63244       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
63245       commentEnter.append("div").attr("class", function(d) {
63246         return "comment-avatar user-" + d.uid;
63247       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
63248       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
63249       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
63250       metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
63251         var selection3 = select_default2(this);
63252         var osm = services.osm;
63253         if (osm && d.user) {
63254           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
63255         }
63256         if (d.user) {
63257           selection3.text(d.user);
63258         } else {
63259           selection3.call(_t.append("note.anonymous"));
63260         }
63261       });
63262       metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
63263         return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
63264       });
63265       mainEnter.append("div").attr("class", "comment-text").html(function(d) {
63266         return d.html;
63267       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
63268       comments.call(replaceAvatars);
63269     }
63270     function replaceAvatars(selection2) {
63271       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
63272       var osm = services.osm;
63273       if (showThirdPartyIcons !== "true" || !osm)
63274         return;
63275       var uids = {};
63276       _note.comments.forEach(function(d) {
63277         if (d.uid)
63278           uids[d.uid] = true;
63279       });
63280       Object.keys(uids).forEach(function(uid) {
63281         osm.loadUser(uid, function(err, user) {
63282           if (!user || !user.image_url)
63283             return;
63284           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);
63285         });
63286       });
63287     }
63288     function localeDateString2(s) {
63289       if (!s)
63290         return null;
63291       var options2 = { day: "numeric", month: "short", year: "numeric" };
63292       s = s.replace(/-/g, "/");
63293       var d = new Date(s);
63294       if (isNaN(d.getTime()))
63295         return null;
63296       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
63297     }
63298     noteComments.note = function(val) {
63299       if (!arguments.length)
63300         return _note;
63301       _note = val;
63302       return noteComments;
63303     };
63304     return noteComments;
63305   }
63306
63307   // modules/ui/note_header.js
63308   function uiNoteHeader() {
63309     var _note;
63310     function noteHeader(selection2) {
63311       var header = selection2.selectAll(".note-header").data(_note ? [_note] : [], function(d) {
63312         return d.status + d.id;
63313       });
63314       header.exit().remove();
63315       var headerEnter = header.enter().append("div").attr("class", "note-header");
63316       var iconEnter = headerEnter.append("div").attr("class", function(d) {
63317         return "note-header-icon " + d.status;
63318       }).classed("new", function(d) {
63319         return d.id < 0;
63320       });
63321       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
63322       iconEnter.each(function(d) {
63323         var statusIcon;
63324         if (d.id < 0) {
63325           statusIcon = "#iD-icon-plus";
63326         } else if (d.status === "open") {
63327           statusIcon = "#iD-icon-close";
63328         } else {
63329           statusIcon = "#iD-icon-apply";
63330         }
63331         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
63332       });
63333       headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
63334         if (_note.isNew()) {
63335           return _t.html("note.new");
63336         }
63337         return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
63338       });
63339     }
63340     noteHeader.note = function(val) {
63341       if (!arguments.length)
63342         return _note;
63343       _note = val;
63344       return noteHeader;
63345     };
63346     return noteHeader;
63347   }
63348
63349   // modules/ui/note_report.js
63350   function uiNoteReport() {
63351     var _note;
63352     function noteReport(selection2) {
63353       var url;
63354       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
63355         url = services.osm.noteReportURL(_note);
63356       }
63357       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
63358       link2.exit().remove();
63359       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
63360         return d;
63361       }).call(svgIcon("#iD-icon-out-link", "inline"));
63362       linkEnter.append("span").call(_t.append("note.report"));
63363     }
63364     noteReport.note = function(val) {
63365       if (!arguments.length)
63366         return _note;
63367       _note = val;
63368       return noteReport;
63369     };
63370     return noteReport;
63371   }
63372
63373   // modules/ui/note_editor.js
63374   function uiNoteEditor(context) {
63375     var dispatch10 = dispatch_default("change");
63376     var noteComments = uiNoteComments(context);
63377     var noteHeader = uiNoteHeader();
63378     var _note;
63379     var _newNote;
63380     function noteEditor(selection2) {
63381       var header = selection2.selectAll(".header").data([0]);
63382       var headerEnter = header.enter().append("div").attr("class", "header fillL");
63383       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
63384         context.enter(modeBrowse(context));
63385       }).call(svgIcon("#iD-icon-close"));
63386       headerEnter.append("h2").call(_t.append("note.title"));
63387       var body = selection2.selectAll(".body").data([0]);
63388       body = body.enter().append("div").attr("class", "body").merge(body);
63389       var editor = body.selectAll(".note-editor").data([0]);
63390       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
63391       var footer = selection2.selectAll(".footer").data([0]);
63392       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
63393       var osm = services.osm;
63394       if (osm) {
63395         osm.on("change.note-save", function() {
63396           selection2.call(noteEditor);
63397         });
63398       }
63399     }
63400     function noteSaveSection(selection2) {
63401       var isSelected = _note && _note.id === context.selectedNoteID();
63402       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
63403         return d.status + d.id;
63404       });
63405       noteSave.exit().remove();
63406       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
63407       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
63408         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
63409       });
63410       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
63411         return d.newComment;
63412       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
63413       if (!commentTextarea.empty() && _newNote) {
63414         commentTextarea.node().focus();
63415       }
63416       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
63417       function keydown(d3_event) {
63418         if (!(d3_event.keyCode === 13 && d3_event.metaKey))
63419           return;
63420         var osm = services.osm;
63421         if (!osm)
63422           return;
63423         var hasAuth = osm.authenticated();
63424         if (!hasAuth)
63425           return;
63426         if (!_note.newComment)
63427           return;
63428         d3_event.preventDefault();
63429         select_default2(this).on("keydown.note-input", null);
63430         window.setTimeout(function() {
63431           if (_note.isNew()) {
63432             noteSave.selectAll(".save-button").node().focus();
63433             clickSave(_note);
63434           } else {
63435             noteSave.selectAll(".comment-button").node().focus();
63436             clickComment(_note);
63437           }
63438         }, 10);
63439       }
63440       function changeInput() {
63441         var input = select_default2(this);
63442         var val = input.property("value").trim() || void 0;
63443         _note = _note.update({ newComment: val });
63444         var osm = services.osm;
63445         if (osm) {
63446           osm.replaceNote(_note);
63447         }
63448         noteSave.call(noteSaveButtons);
63449       }
63450     }
63451     function userDetails(selection2) {
63452       var detailSection = selection2.selectAll(".detail-section").data([0]);
63453       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
63454       var osm = services.osm;
63455       if (!osm)
63456         return;
63457       var hasAuth = osm.authenticated();
63458       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
63459       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
63460       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
63461       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
63462       authEnter.append("span").call(_t.append("note.login"));
63463       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) {
63464         d3_event.preventDefault();
63465         osm.authenticate();
63466       });
63467       authEnter.transition().duration(200).style("opacity", 1);
63468       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
63469       prose.exit().remove();
63470       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
63471       osm.userDetails(function(err, user) {
63472         if (err)
63473           return;
63474         var userLink = select_default2(document.createElement("div"));
63475         if (user.image_url) {
63476           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
63477         }
63478         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
63479         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
63480       });
63481     }
63482     function noteSaveButtons(selection2) {
63483       var osm = services.osm;
63484       var hasAuth = osm && osm.authenticated();
63485       var isSelected = _note && _note.id === context.selectedNoteID();
63486       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
63487         return d.status + d.id;
63488       });
63489       buttonSection.exit().remove();
63490       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
63491       if (_note.isNew()) {
63492         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
63493         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
63494       } else {
63495         buttonEnter.append("button").attr("class", "button status-button action");
63496         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
63497       }
63498       buttonSection = buttonSection.merge(buttonEnter);
63499       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
63500       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
63501       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
63502         var action = d.status === "open" ? "close" : "open";
63503         var andComment = d.newComment ? "_comment" : "";
63504         return _t.html("note." + action + andComment);
63505       }).on("click.status", clickStatus);
63506       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
63507       function isSaveDisabled(d) {
63508         return hasAuth && d.status === "open" && d.newComment ? null : true;
63509       }
63510     }
63511     function clickCancel(d3_event, d) {
63512       this.blur();
63513       var osm = services.osm;
63514       if (osm) {
63515         osm.removeNote(d);
63516       }
63517       context.enter(modeBrowse(context));
63518       dispatch10.call("change");
63519     }
63520     function clickSave(d3_event, d) {
63521       this.blur();
63522       var osm = services.osm;
63523       if (osm) {
63524         osm.postNoteCreate(d, function(err, note) {
63525           dispatch10.call("change", note);
63526         });
63527       }
63528     }
63529     function clickStatus(d3_event, d) {
63530       this.blur();
63531       var osm = services.osm;
63532       if (osm) {
63533         var setStatus = d.status === "open" ? "closed" : "open";
63534         osm.postNoteUpdate(d, setStatus, function(err, note) {
63535           dispatch10.call("change", note);
63536         });
63537       }
63538     }
63539     function clickComment(d3_event, d) {
63540       this.blur();
63541       var osm = services.osm;
63542       if (osm) {
63543         osm.postNoteUpdate(d, d.status, function(err, note) {
63544           dispatch10.call("change", note);
63545         });
63546       }
63547     }
63548     noteEditor.note = function(val) {
63549       if (!arguments.length)
63550         return _note;
63551       _note = val;
63552       return noteEditor;
63553     };
63554     noteEditor.newNote = function(val) {
63555       if (!arguments.length)
63556         return _newNote;
63557       _newNote = val;
63558       return noteEditor;
63559     };
63560     return utilRebind(noteEditor, dispatch10, "on");
63561   }
63562
63563   // modules/ui/source_switch.js
63564   function uiSourceSwitch(context) {
63565     var keys;
63566     function click(d3_event) {
63567       d3_event.preventDefault();
63568       var osm = context.connection();
63569       if (!osm)
63570         return;
63571       if (context.inIntro())
63572         return;
63573       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
63574         return;
63575       var isLive = select_default2(this).classed("live");
63576       isLive = !isLive;
63577       context.enter(modeBrowse(context));
63578       context.history().clearSaved();
63579       context.flush();
63580       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
63581       osm.switch(isLive ? keys[0] : keys[1]);
63582     }
63583     var sourceSwitch = function(selection2) {
63584       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
63585     };
63586     sourceSwitch.keys = function(_) {
63587       if (!arguments.length)
63588         return keys;
63589       keys = _;
63590       return sourceSwitch;
63591     };
63592     return sourceSwitch;
63593   }
63594
63595   // modules/ui/spinner.js
63596   function uiSpinner(context) {
63597     var osm = context.connection();
63598     return function(selection2) {
63599       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
63600       if (osm) {
63601         osm.on("loading.spinner", function() {
63602           img.transition().style("opacity", 1);
63603         }).on("loaded.spinner", function() {
63604           img.transition().style("opacity", 0);
63605         });
63606       }
63607     };
63608   }
63609
63610   // modules/ui/sections/privacy.js
63611   function uiSectionPrivacy(context) {
63612     let section = uiSection("preferences-third-party", context).label(_t.html("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
63613     function renderDisclosureContent(selection2) {
63614       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
63615       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"));
63616       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
63617         d3_event.preventDefault();
63618         corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
63619       });
63620       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
63621       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
63622       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"));
63623     }
63624     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
63625     return section;
63626   }
63627
63628   // modules/ui/splash.js
63629   function uiSplash(context) {
63630     return (selection2) => {
63631       if (context.history().hasRestorableChanges())
63632         return;
63633       let updateMessage = "";
63634       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
63635       let showSplash = !corePreferences("sawSplash");
63636       if (sawPrivacyVersion !== context.privacyVersion) {
63637         updateMessage = _t("splash.privacy_update");
63638         showSplash = true;
63639       }
63640       if (!showSplash)
63641         return;
63642       corePreferences("sawSplash", true);
63643       corePreferences("sawPrivacyVersion", context.privacyVersion);
63644       _mainFileFetcher.get("intro_graph");
63645       let modalSelection = uiModal(selection2);
63646       modalSelection.select(".modal").attr("class", "modal-splash modal");
63647       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
63648       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
63649       let modalSection = introModal.append("div").attr("class", "modal-section");
63650       modalSection.append("p").html(_t.html("splash.text", {
63651         version: context.version,
63652         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
63653         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
63654       }));
63655       modalSection.append("p").html(_t.html("splash.privacy", {
63656         updateMessage,
63657         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
63658       }));
63659       uiSectionPrivacy(context).label(_t.html("splash.privacy_settings")).render(modalSection);
63660       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
63661       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
63662         context.container().call(uiIntro(context));
63663         modalSelection.close();
63664       });
63665       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63666       walkthrough.append("div").call(_t.append("splash.walkthrough"));
63667       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
63668       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
63669       startEditing.append("div").call(_t.append("splash.start"));
63670       modalSelection.select("button.close").attr("class", "hide");
63671     };
63672   }
63673
63674   // modules/ui/status.js
63675   function uiStatus(context) {
63676     var osm = context.connection();
63677     return function(selection2) {
63678       if (!osm)
63679         return;
63680       function update(err, apiStatus) {
63681         selection2.html("");
63682         if (err) {
63683           if (apiStatus === "connectionSwitched") {
63684             return;
63685           } else if (apiStatus === "rateLimited") {
63686             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) {
63687               d3_event.preventDefault();
63688               osm.authenticate();
63689             });
63690           } else {
63691             var throttledRetry = throttle_default(function() {
63692               context.loadTiles(context.projection);
63693               osm.reloadApiStatus();
63694             }, 2e3);
63695             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) {
63696               d3_event.preventDefault();
63697               throttledRetry();
63698             });
63699           }
63700         } else if (apiStatus === "readonly") {
63701           selection2.call(_t.append("osm_api_status.message.readonly"));
63702         } else if (apiStatus === "offline") {
63703           selection2.call(_t.append("osm_api_status.message.offline"));
63704         }
63705         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
63706       }
63707       osm.on("apiStatusChange.uiStatus", update);
63708       context.history().on("storage_error", () => {
63709         selection2.selectAll("span.local-storage-full").remove();
63710         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
63711         selection2.classed("error", true);
63712       });
63713       window.setInterval(function() {
63714         osm.reloadApiStatus();
63715       }, 9e4);
63716       osm.reloadApiStatus();
63717     };
63718   }
63719
63720   // node_modules/osm-community-index/lib/simplify.js
63721   var import_diacritics3 = __toESM(require_diacritics(), 1);
63722   function simplify2(str2) {
63723     if (typeof str2 !== "string")
63724       return "";
63725     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());
63726   }
63727
63728   // node_modules/osm-community-index/lib/resolve_strings.js
63729   function resolveStrings(item, defaults2, localizerFn) {
63730     let itemStrings = Object.assign({}, item.strings);
63731     let defaultStrings = Object.assign({}, defaults2[item.type]);
63732     const anyToken = new RegExp(/(\{\w+\})/, "gi");
63733     if (localizerFn) {
63734       if (itemStrings.community) {
63735         const communityID = simplify2(itemStrings.community);
63736         itemStrings.community = localizerFn(`_communities.${communityID}`);
63737       }
63738       ["name", "description", "extendedDescription"].forEach((prop) => {
63739         if (defaultStrings[prop])
63740           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
63741         if (itemStrings[prop])
63742           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
63743       });
63744     }
63745     let replacements = {
63746       account: item.account,
63747       community: itemStrings.community,
63748       signupUrl: itemStrings.signupUrl,
63749       url: itemStrings.url
63750     };
63751     if (!replacements.signupUrl) {
63752       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
63753     }
63754     if (!replacements.url) {
63755       replacements.url = resolve(itemStrings.url || defaultStrings.url);
63756     }
63757     let resolved = {
63758       name: resolve(itemStrings.name || defaultStrings.name),
63759       url: resolve(itemStrings.url || defaultStrings.url),
63760       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
63761       description: resolve(itemStrings.description || defaultStrings.description),
63762       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
63763     };
63764     resolved.nameHTML = linkify(resolved.url, resolved.name);
63765     resolved.urlHTML = linkify(resolved.url);
63766     resolved.signupUrlHTML = linkify(resolved.signupUrl);
63767     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
63768     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
63769     return resolved;
63770     function resolve(s, addLinks) {
63771       if (!s)
63772         return void 0;
63773       let result = s;
63774       for (let key in replacements) {
63775         const token = `{${key}}`;
63776         const regex = new RegExp(token, "g");
63777         if (regex.test(result)) {
63778           let replacement = replacements[key];
63779           if (!replacement) {
63780             throw new Error(`Cannot resolve token: ${token}`);
63781           } else {
63782             if (addLinks && (key === "signupUrl" || key === "url")) {
63783               replacement = linkify(replacement);
63784             }
63785             result = result.replace(regex, replacement);
63786           }
63787         }
63788       }
63789       const leftovers = result.match(anyToken);
63790       if (leftovers) {
63791         throw new Error(`Cannot resolve tokens: ${leftovers}`);
63792       }
63793       if (addLinks && item.type === "reddit") {
63794         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
63795       }
63796       return result;
63797     }
63798     function linkify(url, text2) {
63799       if (!url)
63800         return void 0;
63801       text2 = text2 || url;
63802       return `<a target="_blank" href="${url}">${text2}</a>`;
63803     }
63804   }
63805
63806   // modules/ui/success.js
63807   var _oci = null;
63808   function uiSuccess(context) {
63809     const MAXEVENTS = 2;
63810     const dispatch10 = dispatch_default("cancel");
63811     let _changeset2;
63812     let _location;
63813     ensureOSMCommunityIndex();
63814     function ensureOSMCommunityIndex() {
63815       const data = _mainFileFetcher;
63816       return Promise.all([
63817         data.get("oci_features"),
63818         data.get("oci_resources"),
63819         data.get("oci_defaults")
63820       ]).then((vals) => {
63821         if (_oci)
63822           return _oci;
63823         if (vals[0] && Array.isArray(vals[0].features)) {
63824           _mainLocations.mergeCustomGeoJSON(vals[0]);
63825         }
63826         let ociResources = Object.values(vals[1].resources);
63827         if (ociResources.length) {
63828           return _mainLocations.mergeLocationSets(ociResources).then(() => {
63829             _oci = {
63830               resources: ociResources,
63831               defaults: vals[2].defaults
63832             };
63833             return _oci;
63834           });
63835         } else {
63836           _oci = {
63837             resources: [],
63838             defaults: vals[2].defaults
63839           };
63840           return _oci;
63841         }
63842       });
63843     }
63844     function parseEventDate(when) {
63845       if (!when)
63846         return;
63847       let raw = when.trim();
63848       if (!raw)
63849         return;
63850       if (!/Z$/.test(raw)) {
63851         raw += "Z";
63852       }
63853       const parsed = new Date(raw);
63854       return new Date(parsed.toUTCString().substr(0, 25));
63855     }
63856     function success(selection2) {
63857       let header = selection2.append("div").attr("class", "header fillL");
63858       header.append("h2").call(_t.append("success.just_edited"));
63859       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
63860       let body = selection2.append("div").attr("class", "body save-success fillL");
63861       let summary = body.append("div").attr("class", "save-summary");
63862       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
63863       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"));
63864       let osm = context.connection();
63865       if (!osm)
63866         return;
63867       let changesetURL = osm.changesetURL(_changeset2.id);
63868       let table = summary.append("table").attr("class", "summary-table");
63869       let row = table.append("tr").attr("class", "summary-row");
63870       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");
63871       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
63872       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
63873       summaryDetail.append("div").html(_t.html("success.changeset_id", {
63874         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
63875       }));
63876       ensureOSMCommunityIndex().then((oci) => {
63877         const loc = context.map().center();
63878         const validLocations = _mainLocations.locationsAt(loc);
63879         let communities = [];
63880         oci.resources.forEach((resource) => {
63881           let area = validLocations[resource.locationSetID];
63882           if (!area)
63883             return;
63884           const localizer = (stringID) => _t.html(`community.${stringID}`);
63885           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
63886           communities.push({
63887             area,
63888             order: resource.order || 0,
63889             resource
63890           });
63891         });
63892         communities.sort((a, b) => a.area - b.area || b.order - a.order);
63893         body.call(showCommunityLinks, communities.map((c) => c.resource));
63894       });
63895     }
63896     function showCommunityLinks(selection2, resources) {
63897       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
63898       communityLinks.append("h3").call(_t.append("success.like_osm"));
63899       let table = communityLinks.append("table").attr("class", "community-table");
63900       let row = table.selectAll(".community-row").data(resources);
63901       let rowEnter = row.enter().append("tr").attr("class", "community-row");
63902       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}`);
63903       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
63904       communityDetail.each(showCommunityDetails);
63905       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"));
63906     }
63907     function showCommunityDetails(d) {
63908       let selection2 = select_default2(this);
63909       let communityID = d.id;
63910       selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
63911       selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
63912       if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
63913         selection2.append("div").call(uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.more")).content(showMore));
63914       }
63915       let nextEvents = (d.events || []).map((event) => {
63916         event.date = parseEventDate(event.when);
63917         return event;
63918       }).filter((event) => {
63919         const t = event.date.getTime();
63920         const now3 = new Date().setHours(0, 0, 0, 0);
63921         return !isNaN(t) && t >= now3;
63922       }).sort((a, b) => {
63923         return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
63924       }).slice(0, MAXEVENTS);
63925       if (nextEvents.length) {
63926         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);
63927       }
63928       function showMore(selection3) {
63929         let more = selection3.selectAll(".community-more").data([0]);
63930         let moreEnter = more.enter().append("div").attr("class", "community-more");
63931         if (d.resolved.extendedDescriptionHTML) {
63932           moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
63933         }
63934         if (d.languageCodes && d.languageCodes.length) {
63935           const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
63936           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
63937         }
63938       }
63939       function showNextEvents(selection3) {
63940         let events = selection3.append("div").attr("class", "community-events");
63941         let item = events.selectAll(".community-event").data(nextEvents);
63942         let itemEnter = item.enter().append("div").attr("class", "community-event");
63943         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
63944           let name2 = d2.name;
63945           if (d2.i18n && d2.id) {
63946             name2 = _t(`community.${communityID}.events.${d2.id}.name`, { default: name2 });
63947           }
63948           return name2;
63949         });
63950         itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
63951           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
63952           if (d2.date.getHours() || d2.date.getMinutes()) {
63953             options2.hour = "numeric";
63954             options2.minute = "numeric";
63955           }
63956           return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
63957         });
63958         itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
63959           let where = d2.where;
63960           if (d2.i18n && d2.id) {
63961             where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
63962           }
63963           return where;
63964         });
63965         itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
63966           let description2 = d2.description;
63967           if (d2.i18n && d2.id) {
63968             description2 = _t(`community.${communityID}.events.${d2.id}.description`, { default: description2 });
63969           }
63970           return description2;
63971         });
63972       }
63973     }
63974     success.changeset = function(val) {
63975       if (!arguments.length)
63976         return _changeset2;
63977       _changeset2 = val;
63978       return success;
63979     };
63980     success.location = function(val) {
63981       if (!arguments.length)
63982         return _location;
63983       _location = val;
63984       return success;
63985     };
63986     return utilRebind(success, dispatch10, "on");
63987   }
63988
63989   // modules/ui/version.js
63990   var sawVersion = null;
63991   var isNewVersion = false;
63992   var isNewUser = false;
63993   function uiVersion(context) {
63994     var currVersion = context.version;
63995     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
63996     if (sawVersion === null && matchedVersion !== null) {
63997       if (corePreferences("sawVersion")) {
63998         isNewUser = false;
63999         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
64000       } else {
64001         isNewUser = true;
64002         isNewVersion = true;
64003       }
64004       corePreferences("sawVersion", currVersion);
64005       sawVersion = currVersion;
64006     }
64007     return function(selection2) {
64008       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
64009       if (isNewVersion && !isNewUser) {
64010         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")));
64011       }
64012     };
64013   }
64014
64015   // modules/ui/zoom.js
64016   function uiZoom(context) {
64017     var zooms = [{
64018       id: "zoom-in",
64019       icon: "iD-icon-plus",
64020       title: _t.html("zoom.in"),
64021       action: zoomIn,
64022       disabled: function() {
64023         return !context.map().canZoomIn();
64024       },
64025       disabledTitle: _t.html("zoom.disabled.in"),
64026       key: "+"
64027     }, {
64028       id: "zoom-out",
64029       icon: "iD-icon-minus",
64030       title: _t.html("zoom.out"),
64031       action: zoomOut,
64032       disabled: function() {
64033         return !context.map().canZoomOut();
64034       },
64035       disabledTitle: _t.html("zoom.disabled.out"),
64036       key: "-"
64037     }];
64038     function zoomIn(d3_event) {
64039       if (d3_event.shiftKey)
64040         return;
64041       d3_event.preventDefault();
64042       context.map().zoomIn();
64043     }
64044     function zoomOut(d3_event) {
64045       if (d3_event.shiftKey)
64046         return;
64047       d3_event.preventDefault();
64048       context.map().zoomOut();
64049     }
64050     function zoomInFurther(d3_event) {
64051       if (d3_event.shiftKey)
64052         return;
64053       d3_event.preventDefault();
64054       context.map().zoomInFurther();
64055     }
64056     function zoomOutFurther(d3_event) {
64057       if (d3_event.shiftKey)
64058         return;
64059       d3_event.preventDefault();
64060       context.map().zoomOutFurther();
64061     }
64062     return function(selection2) {
64063       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
64064         if (d.disabled()) {
64065           return d.disabledTitle;
64066         }
64067         return d.title;
64068       }).keys(function(d) {
64069         return [d.key];
64070       });
64071       var lastPointerUpType;
64072       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
64073         return d.id;
64074       }).on("pointerup.editor", function(d3_event) {
64075         lastPointerUpType = d3_event.pointerType;
64076       }).on("click.editor", function(d3_event, d) {
64077         if (!d.disabled()) {
64078           d.action(d3_event);
64079         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64080           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
64081         }
64082         lastPointerUpType = null;
64083       }).call(tooltipBehavior);
64084       buttons.each(function(d) {
64085         select_default2(this).call(svgIcon("#" + d.icon, "light"));
64086       });
64087       utilKeybinding.plusKeys.forEach(function(key) {
64088         context.keybinding().on([key], zoomIn);
64089         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
64090       });
64091       utilKeybinding.minusKeys.forEach(function(key) {
64092         context.keybinding().on([key], zoomOut);
64093         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
64094       });
64095       function updateButtonStates() {
64096         buttons.classed("disabled", function(d) {
64097           return d.disabled();
64098         }).each(function() {
64099           var selection3 = select_default2(this);
64100           if (!selection3.select(".tooltip.in").empty()) {
64101             selection3.call(tooltipBehavior.updateContent);
64102           }
64103         });
64104       }
64105       updateButtonStates();
64106       context.map().on("move.uiZoom", updateButtonStates);
64107     };
64108   }
64109
64110   // modules/ui/sections/raw_tag_editor.js
64111   function uiSectionRawTagEditor(id2, context) {
64112     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
64113       var count = Object.keys(_tags).filter(function(d) {
64114         return d;
64115       }).length;
64116       return _t.html("inspector.title_count", { title: { html: _t.html("inspector.tags") }, count });
64117     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
64118     var taginfo = services.taginfo;
64119     var dispatch10 = dispatch_default("change");
64120     var availableViews = [
64121       { id: "list", icon: "#fas-th-list" },
64122       { id: "text", icon: "#fas-i-cursor" }
64123     ];
64124     var _tagView = corePreferences("raw-tag-editor-view") || "list";
64125     var _readOnlyTags = [];
64126     var _orderedKeys = [];
64127     var _showBlank = false;
64128     var _pendingChange = null;
64129     var _state;
64130     var _presets;
64131     var _tags;
64132     var _entityIDs;
64133     var _didInteract = false;
64134     function interacted() {
64135       _didInteract = true;
64136     }
64137     function renderDisclosureContent(wrap2) {
64138       _orderedKeys = _orderedKeys.filter(function(key) {
64139         return _tags[key] !== void 0;
64140       });
64141       var all = Object.keys(_tags).sort();
64142       var missingKeys = utilArrayDifference(all, _orderedKeys);
64143       for (var i2 in missingKeys) {
64144         _orderedKeys.push(missingKeys[i2]);
64145       }
64146       var rowData = _orderedKeys.map(function(key, i3) {
64147         return { index: i3, key, value: _tags[key] };
64148       });
64149       if (!rowData.length || _showBlank) {
64150         _showBlank = false;
64151         rowData.push({ index: rowData.length, key: "", value: "" });
64152       }
64153       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
64154       options2.exit().remove();
64155       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
64156       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
64157         return d.id;
64158       }).enter();
64159       optionEnter.append("button").attr("class", function(d) {
64160         return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
64161       }).attr("aria-selected", function(d) {
64162         return _tagView === d.id;
64163       }).attr("role", "tab").attr("title", function(d) {
64164         return _t("icons." + d.id);
64165       }).on("click", function(d3_event, d) {
64166         _tagView = d.id;
64167         corePreferences("raw-tag-editor-view", d.id);
64168         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
64169           return datum2 === d;
64170         }).attr("aria-selected", function(datum2) {
64171           return datum2 === d;
64172         });
64173         wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
64174         wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
64175       }).each(function(d) {
64176         select_default2(this).call(svgIcon(d.icon));
64177       });
64178       var textData = rowsToText(rowData);
64179       var textarea = wrap2.selectAll(".tag-text").data([0]);
64180       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);
64181       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
64182       var list = wrap2.selectAll(".tag-list").data([0]);
64183       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
64184       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
64185       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);
64186       addRowEnter.append("div").attr("class", "space-value");
64187       addRowEnter.append("div").attr("class", "space-buttons");
64188       var items = list.selectAll(".tag-row").data(rowData, function(d) {
64189         return d.key;
64190       });
64191       items.exit().each(unbind).remove();
64192       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
64193       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
64194       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);
64195       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);
64196       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
64197       items = items.merge(itemsEnter).sort(function(a, b) {
64198         return a.index - b.index;
64199       });
64200       items.each(function(d) {
64201         var row = select_default2(this);
64202         var key = row.select("input.key");
64203         var value = row.select("input.value");
64204         if (_entityIDs && taginfo && _state !== "hover") {
64205           bindTypeahead(key, value);
64206         }
64207         var referenceOptions = { key: d.key };
64208         if (typeof d.value === "string") {
64209           referenceOptions.value = d.value;
64210         }
64211         var reference = uiTagReference(referenceOptions, context);
64212         if (_state === "hover") {
64213           reference.showing(false);
64214         }
64215         row.select(".inner-wrap").call(reference.button);
64216         row.call(reference.body);
64217         row.select("button.remove");
64218       });
64219       items.selectAll("input.key").attr("title", function(d) {
64220         return d.key;
64221       }).call(utilGetSetValue, function(d) {
64222         return d.key;
64223       }).attr("readonly", function(d) {
64224         return isReadOnly(d) || null;
64225       });
64226       items.selectAll("input.value").attr("title", function(d) {
64227         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
64228       }).classed("mixed", function(d) {
64229         return Array.isArray(d.value);
64230       }).attr("placeholder", function(d) {
64231         return typeof d.value === "string" ? null : _t("inspector.multiple_values");
64232       }).call(utilGetSetValue, function(d) {
64233         return typeof d.value === "string" ? d.value : "";
64234       }).attr("readonly", function(d) {
64235         return isReadOnly(d) || null;
64236       });
64237       items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
64238     }
64239     function isReadOnly(d) {
64240       for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
64241         if (d.key.match(_readOnlyTags[i2]) !== null) {
64242           return true;
64243         }
64244       }
64245       return false;
64246     }
64247     function setTextareaHeight() {
64248       if (_tagView !== "text")
64249         return;
64250       var selection2 = select_default2(this);
64251       var matches = selection2.node().value.match(/\n/g);
64252       var lineCount = 2 + Number(matches && matches.length);
64253       var lineHeight = 20;
64254       selection2.style("height", lineCount * lineHeight + "px");
64255     }
64256     function stringify3(s) {
64257       return JSON.stringify(s).slice(1, -1);
64258     }
64259     function unstringify(s) {
64260       var leading = "";
64261       var trailing = "";
64262       if (s.length < 1 || s.charAt(0) !== '"') {
64263         leading = '"';
64264       }
64265       if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
64266         trailing = '"';
64267       }
64268       return JSON.parse(leading + s + trailing);
64269     }
64270     function rowsToText(rows) {
64271       var str2 = rows.filter(function(row) {
64272         return row.key && row.key.trim() !== "";
64273       }).map(function(row) {
64274         var rawVal = row.value;
64275         if (typeof rawVal !== "string")
64276           rawVal = "*";
64277         var val = rawVal ? stringify3(rawVal) : "";
64278         return stringify3(row.key) + "=" + val;
64279       }).join("\n");
64280       if (_state !== "hover" && str2.length) {
64281         return str2 + "\n";
64282       }
64283       return str2;
64284     }
64285     function textChanged() {
64286       var newText = this.value.trim();
64287       var newTags = {};
64288       newText.split("\n").forEach(function(row) {
64289         var m = row.match(/^\s*([^=]+)=(.*)$/);
64290         if (m !== null) {
64291           var k = context.cleanTagKey(unstringify(m[1].trim()));
64292           var v = context.cleanTagValue(unstringify(m[2].trim()));
64293           newTags[k] = v;
64294         }
64295       });
64296       var tagDiff = utilTagDiff(_tags, newTags);
64297       if (!tagDiff.length)
64298         return;
64299       _pendingChange = _pendingChange || {};
64300       tagDiff.forEach(function(change) {
64301         if (isReadOnly({ key: change.key }))
64302           return;
64303         if (change.newVal === "*" && typeof change.oldVal !== "string")
64304           return;
64305         if (change.type === "-") {
64306           _pendingChange[change.key] = void 0;
64307         } else if (change.type === "+") {
64308           _pendingChange[change.key] = change.newVal || "";
64309         }
64310       });
64311       if (Object.keys(_pendingChange).length === 0) {
64312         _pendingChange = null;
64313         return;
64314       }
64315       scheduleChange();
64316     }
64317     function pushMore(d3_event) {
64318       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
64319         addTag();
64320       }
64321     }
64322     function bindTypeahead(key, value) {
64323       if (isReadOnly(key.datum()))
64324         return;
64325       if (Array.isArray(value.datum().value)) {
64326         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
64327           var keyString = utilGetSetValue(key);
64328           if (!_tags[keyString])
64329             return;
64330           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
64331             return {
64332               value: tagValue,
64333               title: tagValue
64334             };
64335           });
64336           callback(data);
64337         }));
64338         return;
64339       }
64340       var geometry = context.graph().geometry(_entityIDs[0]);
64341       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
64342         taginfo.keys({
64343           debounce: true,
64344           geometry,
64345           query: value2
64346         }, function(err, data) {
64347           if (!err) {
64348             var filtered = data.filter(function(d) {
64349               return _tags[d.value] === void 0;
64350             });
64351             callback(sort(value2, filtered));
64352           }
64353         });
64354       }));
64355       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
64356         taginfo.values({
64357           debounce: true,
64358           key: utilGetSetValue(key),
64359           geometry,
64360           query: value2
64361         }, function(err, data) {
64362           if (!err)
64363             callback(sort(value2, data));
64364         });
64365       }));
64366       function sort(value2, data) {
64367         var sameletter = [];
64368         var other = [];
64369         for (var i2 = 0; i2 < data.length; i2++) {
64370           if (data[i2].value.substring(0, value2.length) === value2) {
64371             sameletter.push(data[i2]);
64372           } else {
64373             other.push(data[i2]);
64374           }
64375         }
64376         return sameletter.concat(other);
64377       }
64378     }
64379     function unbind() {
64380       var row = select_default2(this);
64381       row.selectAll("input.key").call(uiCombobox.off, context);
64382       row.selectAll("input.value").call(uiCombobox.off, context);
64383     }
64384     function keyChange(d3_event, d) {
64385       if (select_default2(this).attr("readonly"))
64386         return;
64387       var kOld = d.key;
64388       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
64389         return;
64390       var kNew = context.cleanTagKey(this.value.trim());
64391       if (isReadOnly({ key: kNew })) {
64392         this.value = kOld;
64393         return;
64394       }
64395       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
64396         this.value = kOld;
64397         section.selection().selectAll(".tag-list input.value").each(function(d2) {
64398           if (d2.key === kNew) {
64399             var input = select_default2(this).node();
64400             input.focus();
64401             input.select();
64402           }
64403         });
64404         return;
64405       }
64406       _pendingChange = _pendingChange || {};
64407       if (kOld) {
64408         if (kOld === kNew)
64409           return;
64410         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
64411         _pendingChange[kOld] = void 0;
64412       } else {
64413         let row = this.parentNode.parentNode;
64414         let inputVal = select_default2(row).selectAll("input.value");
64415         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
64416         _pendingChange[kNew] = vNew;
64417         utilGetSetValue(inputVal, vNew);
64418       }
64419       var existingKeyIndex = _orderedKeys.indexOf(kOld);
64420       if (existingKeyIndex !== -1)
64421         _orderedKeys[existingKeyIndex] = kNew;
64422       d.key = kNew;
64423       this.value = kNew;
64424       scheduleChange();
64425     }
64426     function valueChange(d3_event, d) {
64427       if (isReadOnly(d))
64428         return;
64429       if (typeof d.value !== "string" && !this.value)
64430         return;
64431       if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
64432         return;
64433       _pendingChange = _pendingChange || {};
64434       _pendingChange[d.key] = context.cleanTagValue(this.value);
64435       scheduleChange();
64436     }
64437     function removeTag(d3_event, d) {
64438       if (isReadOnly(d))
64439         return;
64440       if (d.key === "") {
64441         _showBlank = false;
64442         section.reRender();
64443       } else {
64444         _orderedKeys = _orderedKeys.filter(function(key) {
64445           return key !== d.key;
64446         });
64447         _pendingChange = _pendingChange || {};
64448         _pendingChange[d.key] = void 0;
64449         scheduleChange();
64450       }
64451     }
64452     function addTag() {
64453       window.setTimeout(function() {
64454         _showBlank = true;
64455         section.reRender();
64456         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
64457       }, 20);
64458     }
64459     function scheduleChange() {
64460       var entityIDs = _entityIDs;
64461       window.setTimeout(function() {
64462         if (!_pendingChange)
64463           return;
64464         dispatch10.call("change", this, entityIDs, _pendingChange);
64465         _pendingChange = null;
64466       }, 10);
64467     }
64468     section.state = function(val) {
64469       if (!arguments.length)
64470         return _state;
64471       if (_state !== val) {
64472         _orderedKeys = [];
64473         _state = val;
64474       }
64475       return section;
64476     };
64477     section.presets = function(val) {
64478       if (!arguments.length)
64479         return _presets;
64480       _presets = val;
64481       if (_presets && _presets.length && _presets[0].isFallback()) {
64482         section.disclosureExpanded(true);
64483       } else if (!_didInteract) {
64484         section.disclosureExpanded(null);
64485       }
64486       return section;
64487     };
64488     section.tags = function(val) {
64489       if (!arguments.length)
64490         return _tags;
64491       _tags = val;
64492       return section;
64493     };
64494     section.entityIDs = function(val) {
64495       if (!arguments.length)
64496         return _entityIDs;
64497       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
64498         _entityIDs = val;
64499         _orderedKeys = [];
64500       }
64501       return section;
64502     };
64503     section.readOnlyTags = function(val) {
64504       if (!arguments.length)
64505         return _readOnlyTags;
64506       _readOnlyTags = val;
64507       return section;
64508     };
64509     return utilRebind(section, dispatch10, "on");
64510   }
64511
64512   // modules/ui/data_editor.js
64513   function uiDataEditor(context) {
64514     var dataHeader = uiDataHeader();
64515     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
64516     var _datum;
64517     function dataEditor(selection2) {
64518       var header = selection2.selectAll(".header").data([0]);
64519       var headerEnter = header.enter().append("div").attr("class", "header fillL");
64520       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
64521         context.enter(modeBrowse(context));
64522       }).call(svgIcon("#iD-icon-close"));
64523       headerEnter.append("h2").call(_t.append("map_data.title"));
64524       var body = selection2.selectAll(".body").data([0]);
64525       body = body.enter().append("div").attr("class", "body").merge(body);
64526       var editor = body.selectAll(".data-editor").data([0]);
64527       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
64528       var rte = body.selectAll(".raw-tag-editor").data([0]);
64529       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);
64530     }
64531     dataEditor.datum = function(val) {
64532       if (!arguments.length)
64533         return _datum;
64534       _datum = val;
64535       return this;
64536     };
64537     return dataEditor;
64538   }
64539
64540   // modules/ui/osmose_details.js
64541   function uiOsmoseDetails(context) {
64542     let _qaItem;
64543     function issueString(d, type3) {
64544       if (!d)
64545         return "";
64546       const s = services.osmose.getStrings(d.itemType);
64547       return type3 in s ? s[type3] : "";
64548     }
64549     function osmoseDetails(selection2) {
64550       const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64551       details.exit().remove();
64552       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
64553       if (issueString(_qaItem, "detail")) {
64554         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64555         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
64556         div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64557       }
64558       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
64559       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
64560       if (issueString(_qaItem, "fix")) {
64561         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64562         div.append("h4").call(_t.append("QA.osmose.fix_title"));
64563         div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64564       }
64565       if (issueString(_qaItem, "trap")) {
64566         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
64567         div.append("h4").call(_t.append("QA.osmose.trap_title"));
64568         div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64569       }
64570       const thisItem = _qaItem;
64571       services.osmose.loadIssueDetail(_qaItem).then((d) => {
64572         if (!d.elems || d.elems.length === 0)
64573           return;
64574         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
64575           return;
64576         if (d.detail) {
64577           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
64578           detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
64579         }
64580         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
64581         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() {
64582           const link2 = select_default2(this);
64583           const entityID = this.textContent;
64584           const entity = context.hasEntity(entityID);
64585           link2.on("mouseenter", () => {
64586             utilHighlightEntities([entityID], true, context);
64587           }).on("mouseleave", () => {
64588             utilHighlightEntities([entityID], false, context);
64589           }).on("click", (d3_event) => {
64590             d3_event.preventDefault();
64591             utilHighlightEntities([entityID], false, context);
64592             const osmlayer = context.layers().layer("osm");
64593             if (!osmlayer.enabled()) {
64594               osmlayer.enabled(true);
64595             }
64596             context.map().centerZoom(d.loc, 20);
64597             if (entity) {
64598               context.enter(modeSelect(context, [entityID]));
64599             } else {
64600               context.loadEntity(entityID, (err, result) => {
64601                 if (err)
64602                   return;
64603                 const entity2 = result.data.find((e) => e.id === entityID);
64604                 if (entity2)
64605                   context.enter(modeSelect(context, [entityID]));
64606               });
64607             }
64608           });
64609           if (entity) {
64610             let name2 = utilDisplayName(entity);
64611             if (!name2) {
64612               const preset = _mainPresetIndex.match(entity, context.graph());
64613               name2 = preset && !preset.isFallback() && preset.name();
64614             }
64615             if (name2) {
64616               this.innerText = name2;
64617             }
64618           }
64619         });
64620         context.features().forceVisible(d.elems);
64621         context.map().pan([0, 0]);
64622       }).catch((err) => {
64623         console.log(err);
64624       });
64625     }
64626     osmoseDetails.issue = function(val) {
64627       if (!arguments.length)
64628         return _qaItem;
64629       _qaItem = val;
64630       return osmoseDetails;
64631     };
64632     return osmoseDetails;
64633   }
64634
64635   // modules/ui/osmose_header.js
64636   function uiOsmoseHeader() {
64637     let _qaItem;
64638     function issueTitle(d) {
64639       const unknown = _t("inspector.unknown");
64640       if (!d)
64641         return unknown;
64642       const s = services.osmose.getStrings(d.itemType);
64643       return "title" in s ? s.title : unknown;
64644     }
64645     function osmoseHeader(selection2) {
64646       const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64647       header.exit().remove();
64648       const headerEnter = header.enter().append("div").attr("class", "qa-header");
64649       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}`);
64650       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");
64651       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 : "");
64652       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
64653     }
64654     osmoseHeader.issue = function(val) {
64655       if (!arguments.length)
64656         return _qaItem;
64657       _qaItem = val;
64658       return osmoseHeader;
64659     };
64660     return osmoseHeader;
64661   }
64662
64663   // modules/ui/view_on_osmose.js
64664   function uiViewOnOsmose() {
64665     let _qaItem;
64666     function viewOnOsmose(selection2) {
64667       let url;
64668       if (services.osmose && _qaItem instanceof QAItem) {
64669         url = services.osmose.itemURL(_qaItem);
64670       }
64671       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
64672       link2.exit().remove();
64673       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"));
64674       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
64675     }
64676     viewOnOsmose.what = function(val) {
64677       if (!arguments.length)
64678         return _qaItem;
64679       _qaItem = val;
64680       return viewOnOsmose;
64681     };
64682     return viewOnOsmose;
64683   }
64684
64685   // modules/ui/osmose_editor.js
64686   function uiOsmoseEditor(context) {
64687     const dispatch10 = dispatch_default("change");
64688     const qaDetails = uiOsmoseDetails(context);
64689     const qaHeader = uiOsmoseHeader(context);
64690     let _qaItem;
64691     function osmoseEditor(selection2) {
64692       const header = selection2.selectAll(".header").data([0]);
64693       const headerEnter = header.enter().append("div").attr("class", "header fillL");
64694       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
64695       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
64696       let body = selection2.selectAll(".body").data([0]);
64697       body = body.enter().append("div").attr("class", "body").merge(body);
64698       let editor = body.selectAll(".qa-editor").data([0]);
64699       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
64700       const footer = selection2.selectAll(".footer").data([0]);
64701       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
64702     }
64703     function osmoseSaveSection(selection2) {
64704       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64705       const isShown = _qaItem && isSelected;
64706       let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
64707       saveSection.exit().remove();
64708       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
64709       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
64710     }
64711     function qaSaveButtons(selection2) {
64712       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64713       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
64714       buttonSection.exit().remove();
64715       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64716       buttonEnter.append("button").attr("class", "button close-button action");
64717       buttonEnter.append("button").attr("class", "button ignore-button action");
64718       buttonSection = buttonSection.merge(buttonEnter);
64719       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
64720         this.blur();
64721         const qaService = services.osmose;
64722         if (qaService) {
64723           d.newStatus = "done";
64724           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64725         }
64726       });
64727       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
64728         this.blur();
64729         const qaService = services.osmose;
64730         if (qaService) {
64731           d.newStatus = "false";
64732           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64733         }
64734       });
64735     }
64736     osmoseEditor.error = function(val) {
64737       if (!arguments.length)
64738         return _qaItem;
64739       _qaItem = val;
64740       return osmoseEditor;
64741     };
64742     return utilRebind(osmoseEditor, dispatch10, "on");
64743   }
64744
64745   // modules/ui/sidebar.js
64746   function uiSidebar(context) {
64747     var inspector = uiInspector(context);
64748     var dataEditor = uiDataEditor(context);
64749     var noteEditor = uiNoteEditor(context);
64750     var improveOsmEditor = uiImproveOsmEditor(context);
64751     var keepRightEditor = uiKeepRightEditor(context);
64752     var osmoseEditor = uiOsmoseEditor(context);
64753     var _current;
64754     var _wasData = false;
64755     var _wasNote = false;
64756     var _wasQaItem = false;
64757     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
64758     function sidebar(selection2) {
64759       var container = context.container();
64760       var minWidth = 240;
64761       var sidebarWidth;
64762       var containerWidth;
64763       var dragOffset;
64764       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
64765       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
64766       var downPointerId, lastClientX, containerLocGetter;
64767       function pointerdown(d3_event) {
64768         if (downPointerId)
64769           return;
64770         if ("button" in d3_event && d3_event.button !== 0)
64771           return;
64772         downPointerId = d3_event.pointerId || "mouse";
64773         lastClientX = d3_event.clientX;
64774         containerLocGetter = utilFastMouse(container.node());
64775         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
64776         sidebarWidth = selection2.node().getBoundingClientRect().width;
64777         containerWidth = container.node().getBoundingClientRect().width;
64778         var widthPct = sidebarWidth / containerWidth * 100;
64779         selection2.style("width", widthPct + "%").style("max-width", "85%");
64780         resizer.classed("dragging", true);
64781         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
64782           d3_event2.preventDefault();
64783         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
64784       }
64785       function pointermove(d3_event) {
64786         if (downPointerId !== (d3_event.pointerId || "mouse"))
64787           return;
64788         d3_event.preventDefault();
64789         var dx = d3_event.clientX - lastClientX;
64790         lastClientX = d3_event.clientX;
64791         var isRTL = _mainLocalizer.textDirection() === "rtl";
64792         var scaleX = isRTL ? 0 : 1;
64793         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
64794         var x = containerLocGetter(d3_event)[0] - dragOffset;
64795         sidebarWidth = isRTL ? containerWidth - x : x;
64796         var isCollapsed = selection2.classed("collapsed");
64797         var shouldCollapse = sidebarWidth < minWidth;
64798         selection2.classed("collapsed", shouldCollapse);
64799         if (shouldCollapse) {
64800           if (!isCollapsed) {
64801             selection2.style(xMarginProperty, "-400px").style("width", "400px");
64802             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
64803           }
64804         } else {
64805           var widthPct = sidebarWidth / containerWidth * 100;
64806           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
64807           if (isCollapsed) {
64808             context.ui().onResize([-sidebarWidth * scaleX, 0]);
64809           } else {
64810             context.ui().onResize([-dx * scaleX, 0]);
64811           }
64812         }
64813       }
64814       function pointerup(d3_event) {
64815         if (downPointerId !== (d3_event.pointerId || "mouse"))
64816           return;
64817         downPointerId = null;
64818         resizer.classed("dragging", false);
64819         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
64820       }
64821       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
64822       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
64823       var hoverModeSelect = function(targets) {
64824         context.container().selectAll(".feature-list-item button").classed("hover", false);
64825         if (context.selectedIDs().length > 1 && targets && targets.length) {
64826           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
64827             return targets.indexOf(node) !== -1;
64828           });
64829           if (!elements.empty()) {
64830             elements.classed("hover", true);
64831           }
64832         }
64833       };
64834       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
64835       function hover(targets) {
64836         var datum2 = targets && targets.length && targets[0];
64837         if (datum2 && datum2.__featurehash__) {
64838           _wasData = true;
64839           sidebar.show(dataEditor.datum(datum2));
64840           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64841         } else if (datum2 instanceof osmNote) {
64842           if (context.mode().id === "drag-note")
64843             return;
64844           _wasNote = true;
64845           var osm = services.osm;
64846           if (osm) {
64847             datum2 = osm.getNote(datum2.id);
64848           }
64849           sidebar.show(noteEditor.note(datum2));
64850           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64851         } else if (datum2 instanceof QAItem) {
64852           _wasQaItem = true;
64853           var errService = services[datum2.service];
64854           if (errService) {
64855             datum2 = errService.getError(datum2.id);
64856           }
64857           var errEditor;
64858           if (datum2.service === "keepRight") {
64859             errEditor = keepRightEditor;
64860           } else if (datum2.service === "osmose") {
64861             errEditor = osmoseEditor;
64862           } else {
64863             errEditor = improveOsmEditor;
64864           }
64865           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
64866             return d.id === datum2.id;
64867           });
64868           sidebar.show(errEditor.error(datum2));
64869           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
64870         } else if (!_current && datum2 instanceof osmEntity) {
64871           featureListWrap.classed("inspector-hidden", true);
64872           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
64873           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
64874             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
64875             inspectorWrap.call(inspector);
64876           }
64877         } else if (!_current) {
64878           featureListWrap.classed("inspector-hidden", false);
64879           inspectorWrap.classed("inspector-hidden", true);
64880           inspector.state("hide");
64881         } else if (_wasData || _wasNote || _wasQaItem) {
64882           _wasNote = false;
64883           _wasData = false;
64884           _wasQaItem = false;
64885           context.container().selectAll(".note").classed("hover", false);
64886           context.container().selectAll(".qaItem").classed("hover", false);
64887           sidebar.hide();
64888         }
64889       }
64890       sidebar.hover = throttle_default(hover, 200);
64891       sidebar.intersects = function(extent) {
64892         var rect = selection2.node().getBoundingClientRect();
64893         return extent.intersects([
64894           context.projection.invert([0, rect.height]),
64895           context.projection.invert([rect.width, 0])
64896         ]);
64897       };
64898       sidebar.select = function(ids, newFeature) {
64899         sidebar.hide();
64900         if (ids && ids.length) {
64901           var entity = ids.length === 1 && context.entity(ids[0]);
64902           if (entity && newFeature && selection2.classed("collapsed")) {
64903             var extent = entity.extent(context.graph());
64904             sidebar.expand(sidebar.intersects(extent));
64905           }
64906           featureListWrap.classed("inspector-hidden", true);
64907           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
64908           inspector.state("select").entityIDs(ids).newFeature(newFeature);
64909           inspectorWrap.call(inspector);
64910         } else {
64911           inspector.state("hide");
64912         }
64913       };
64914       sidebar.showPresetList = function() {
64915         inspector.showList();
64916       };
64917       sidebar.show = function(component, element) {
64918         featureListWrap.classed("inspector-hidden", true);
64919         inspectorWrap.classed("inspector-hidden", true);
64920         if (_current)
64921           _current.remove();
64922         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
64923       };
64924       sidebar.hide = function() {
64925         featureListWrap.classed("inspector-hidden", false);
64926         inspectorWrap.classed("inspector-hidden", true);
64927         if (_current)
64928           _current.remove();
64929         _current = null;
64930       };
64931       sidebar.expand = function(moveMap) {
64932         if (selection2.classed("collapsed")) {
64933           sidebar.toggle(moveMap);
64934         }
64935       };
64936       sidebar.collapse = function(moveMap) {
64937         if (!selection2.classed("collapsed")) {
64938           sidebar.toggle(moveMap);
64939         }
64940       };
64941       sidebar.toggle = function(moveMap) {
64942         if (context.inIntro())
64943           return;
64944         var isCollapsed = selection2.classed("collapsed");
64945         var isCollapsing = !isCollapsed;
64946         var isRTL = _mainLocalizer.textDirection() === "rtl";
64947         var scaleX = isRTL ? 0 : 1;
64948         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
64949         sidebarWidth = selection2.node().getBoundingClientRect().width;
64950         selection2.style("width", sidebarWidth + "px");
64951         var startMargin, endMargin, lastMargin;
64952         if (isCollapsing) {
64953           startMargin = lastMargin = 0;
64954           endMargin = -sidebarWidth;
64955         } else {
64956           startMargin = lastMargin = -sidebarWidth;
64957           endMargin = 0;
64958         }
64959         if (!isCollapsing) {
64960           selection2.classed("collapsed", isCollapsing);
64961         }
64962         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
64963           var i2 = number_default(startMargin, endMargin);
64964           return function(t) {
64965             var dx = lastMargin - Math.round(i2(t));
64966             lastMargin = lastMargin - dx;
64967             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
64968           };
64969         }).on("end", function() {
64970           if (isCollapsing) {
64971             selection2.classed("collapsed", isCollapsing);
64972           }
64973           if (!isCollapsing) {
64974             var containerWidth2 = container.node().getBoundingClientRect().width;
64975             var widthPct = sidebarWidth / containerWidth2 * 100;
64976             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
64977           }
64978         });
64979       };
64980       resizer.on("dblclick", function(d3_event) {
64981         d3_event.preventDefault();
64982         if (d3_event.sourceEvent) {
64983           d3_event.sourceEvent.preventDefault();
64984         }
64985         sidebar.toggle();
64986       });
64987       context.map().on("crossEditableZoom.sidebar", function(within) {
64988         if (!within && !selection2.select(".inspector-hover").empty()) {
64989           hover([]);
64990         }
64991       });
64992     }
64993     sidebar.showPresetList = function() {
64994     };
64995     sidebar.hover = function() {
64996     };
64997     sidebar.hover.cancel = function() {
64998     };
64999     sidebar.intersects = function() {
65000     };
65001     sidebar.select = function() {
65002     };
65003     sidebar.show = function() {
65004     };
65005     sidebar.hide = function() {
65006     };
65007     sidebar.expand = function() {
65008     };
65009     sidebar.collapse = function() {
65010     };
65011     sidebar.toggle = function() {
65012     };
65013     return sidebar;
65014   }
65015
65016   // modules/modes/draw_area.js
65017   function modeDrawArea(context, wayID, startGraph, button) {
65018     var mode = {
65019       button,
65020       id: "draw-area"
65021     };
65022     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
65023       context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.areas"))();
65024     });
65025     mode.wayID = wayID;
65026     mode.enter = function() {
65027       context.install(behavior);
65028     };
65029     mode.exit = function() {
65030       context.uninstall(behavior);
65031     };
65032     mode.selectedIDs = function() {
65033       return [wayID];
65034     };
65035     mode.activeID = function() {
65036       return behavior && behavior.activeID() || [];
65037     };
65038     return mode;
65039   }
65040
65041   // modules/modes/add_area.js
65042   function modeAddArea(context, mode) {
65043     mode.id = "add-area";
65044     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
65045     var defaultTags = { area: "yes" };
65046     if (mode.preset)
65047       defaultTags = mode.preset.setTags(defaultTags, "area");
65048     function actionClose(wayId) {
65049       return function(graph) {
65050         return graph.replace(graph.entity(wayId).close());
65051       };
65052     }
65053     function start2(loc) {
65054       var startGraph = context.graph();
65055       var node = osmNode({ loc });
65056       var way = osmWay({ tags: defaultTags });
65057       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
65058       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65059     }
65060     function startFromWay(loc, edge) {
65061       var startGraph = context.graph();
65062       var node = osmNode({ loc });
65063       var way = osmWay({ tags: defaultTags });
65064       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id), actionAddMidpoint({ loc, edge }, node));
65065       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65066     }
65067     function startFromNode(node) {
65068       var startGraph = context.graph();
65069       var way = osmWay({ tags: defaultTags });
65070       context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
65071       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
65072     }
65073     mode.enter = function() {
65074       context.install(behavior);
65075     };
65076     mode.exit = function() {
65077       context.uninstall(behavior);
65078     };
65079     return mode;
65080   }
65081
65082   // modules/modes/add_line.js
65083   function modeAddLine(context, mode) {
65084     mode.id = "add-line";
65085     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
65086     var defaultTags = {};
65087     if (mode.preset)
65088       defaultTags = mode.preset.setTags(defaultTags, "line");
65089     function start2(loc) {
65090       var startGraph = context.graph();
65091       var node = osmNode({ loc });
65092       var way = osmWay({ tags: defaultTags });
65093       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id));
65094       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65095     }
65096     function startFromWay(loc, edge) {
65097       var startGraph = context.graph();
65098       var node = osmNode({ loc });
65099       var way = osmWay({ tags: defaultTags });
65100       context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionAddMidpoint({ loc, edge }, node));
65101       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65102     }
65103     function startFromNode(node) {
65104       var startGraph = context.graph();
65105       var way = osmWay({ tags: defaultTags });
65106       context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id));
65107       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
65108     }
65109     mode.enter = function() {
65110       context.install(behavior);
65111     };
65112     mode.exit = function() {
65113       context.uninstall(behavior);
65114     };
65115     return mode;
65116   }
65117
65118   // modules/modes/add_point.js
65119   function modeAddPoint(context, mode) {
65120     mode.id = "add-point";
65121     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
65122     var defaultTags = {};
65123     if (mode.preset)
65124       defaultTags = mode.preset.setTags(defaultTags, "point");
65125     function add(loc) {
65126       var node = osmNode({ loc, tags: defaultTags });
65127       context.perform(actionAddEntity(node), _t("operations.add.annotation.point"));
65128       enterSelectMode(node);
65129     }
65130     function addWay(loc, edge) {
65131       var node = osmNode({ tags: defaultTags });
65132       context.perform(actionAddMidpoint({ loc, edge }, node), _t("operations.add.annotation.vertex"));
65133       enterSelectMode(node);
65134     }
65135     function enterSelectMode(node) {
65136       context.enter(modeSelect(context, [node.id]).newFeature(true));
65137     }
65138     function addNode(node) {
65139       if (Object.keys(defaultTags).length === 0) {
65140         enterSelectMode(node);
65141         return;
65142       }
65143       var tags = Object.assign({}, node.tags);
65144       for (var key in defaultTags) {
65145         tags[key] = defaultTags[key];
65146       }
65147       context.perform(actionChangeTags(node.id, tags), _t("operations.add.annotation.point"));
65148       enterSelectMode(node);
65149     }
65150     function cancel() {
65151       context.enter(modeBrowse(context));
65152     }
65153     mode.enter = function() {
65154       context.install(behavior);
65155     };
65156     mode.exit = function() {
65157       context.uninstall(behavior);
65158     };
65159     return mode;
65160   }
65161
65162   // modules/modes/select_note.js
65163   function modeSelectNote(context, selectedNoteID) {
65164     var mode = {
65165       id: "select-note",
65166       button: "browse"
65167     };
65168     var _keybinding = utilKeybinding("select-note");
65169     var _noteEditor = uiNoteEditor(context).on("change", function() {
65170       context.map().pan([0, 0]);
65171       var note = checkSelectedID();
65172       if (!note)
65173         return;
65174       context.ui().sidebar.show(_noteEditor.note(note));
65175     });
65176     var _behaviors = [
65177       behaviorBreathe(context),
65178       behaviorHover(context),
65179       behaviorSelect(context),
65180       behaviorLasso(context),
65181       modeDragNode(context).behavior,
65182       modeDragNote(context).behavior
65183     ];
65184     var _newFeature = false;
65185     function checkSelectedID() {
65186       if (!services.osm)
65187         return;
65188       var note = services.osm.getNote(selectedNoteID);
65189       if (!note) {
65190         context.enter(modeBrowse(context));
65191       }
65192       return note;
65193     }
65194     function selectNote(d3_event, drawn) {
65195       if (!checkSelectedID())
65196         return;
65197       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
65198       if (selection2.empty()) {
65199         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
65200         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
65201           context.enter(modeBrowse(context));
65202         }
65203       } else {
65204         selection2.classed("selected", true);
65205         context.selectedNoteID(selectedNoteID);
65206       }
65207     }
65208     function esc() {
65209       if (context.container().select(".combobox").size())
65210         return;
65211       context.enter(modeBrowse(context));
65212     }
65213     mode.zoomToSelected = function() {
65214       if (!services.osm)
65215         return;
65216       var note = services.osm.getNote(selectedNoteID);
65217       if (note) {
65218         context.map().centerZoomEase(note.loc, 20);
65219       }
65220     };
65221     mode.newFeature = function(val) {
65222       if (!arguments.length)
65223         return _newFeature;
65224       _newFeature = val;
65225       return mode;
65226     };
65227     mode.enter = function() {
65228       var note = checkSelectedID();
65229       if (!note)
65230         return;
65231       _behaviors.forEach(context.install);
65232       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
65233       select_default2(document).call(_keybinding);
65234       selectNote();
65235       var sidebar = context.ui().sidebar;
65236       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
65237       sidebar.expand(sidebar.intersects(note.extent()));
65238       context.map().on("drawn.select", selectNote);
65239     };
65240     mode.exit = function() {
65241       _behaviors.forEach(context.uninstall);
65242       select_default2(document).call(_keybinding.unbind);
65243       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
65244       context.map().on("drawn.select", null);
65245       context.ui().sidebar.hide();
65246       context.selectedNoteID(null);
65247     };
65248     return mode;
65249   }
65250
65251   // modules/modes/add_note.js
65252   function modeAddNote(context) {
65253     var mode = {
65254       id: "add-note",
65255       button: "note",
65256       description: _t.html("modes.add_note.description"),
65257       key: _t("modes.add_note.key")
65258     };
65259     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
65260     function add(loc) {
65261       var osm = services.osm;
65262       if (!osm)
65263         return;
65264       var note = osmNote({ loc, status: "open", comments: [] });
65265       osm.replaceNote(note);
65266       context.map().pan([0, 0]);
65267       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
65268     }
65269     function cancel() {
65270       context.enter(modeBrowse(context));
65271     }
65272     mode.enter = function() {
65273       context.install(behavior);
65274     };
65275     mode.exit = function() {
65276       context.uninstall(behavior);
65277     };
65278     return mode;
65279   }
65280
65281   // modules/modes/save.js
65282   function modeSave(context) {
65283     var mode = { id: "save" };
65284     var keybinding = utilKeybinding("modeSave");
65285     var commit = uiCommit(context).on("cancel", cancel);
65286     var _conflictsUi;
65287     var _location;
65288     var _success;
65289     var uploader = context.uploader().on("saveStarted.modeSave", function() {
65290       keybindingOff();
65291     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
65292       cancel();
65293     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
65294     function cancel() {
65295       context.enter(modeBrowse(context));
65296     }
65297     function showProgress(num, total) {
65298       var modal = context.container().select(".loading-modal .modal-section");
65299       var progress = modal.selectAll(".progress").data([0]);
65300       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
65301     }
65302     function showConflicts(changeset, conflicts, origChanges) {
65303       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
65304       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
65305       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
65306         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65307         selection2.remove();
65308         keybindingOn();
65309         uploader.cancelConflictResolution();
65310       }).on("save", function() {
65311         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65312         selection2.remove();
65313         uploader.processResolvedConflicts(changeset);
65314       });
65315       selection2.call(_conflictsUi);
65316     }
65317     function showErrors(errors) {
65318       keybindingOn();
65319       var selection2 = uiConfirm(context.container());
65320       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
65321       addErrors(selection2, errors);
65322       selection2.okButton();
65323     }
65324     function addErrors(selection2, data) {
65325       var message = selection2.select(".modal-section.message-text");
65326       var items = message.selectAll(".error-container").data(data);
65327       var enter = items.enter().append("div").attr("class", "error-container");
65328       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
65329         return d.msg || _t("save.unknown_error_details");
65330       }).on("click", function(d3_event) {
65331         d3_event.preventDefault();
65332         var error = select_default2(this);
65333         var detail = select_default2(this.nextElementSibling);
65334         var exp2 = error.classed("expanded");
65335         detail.style("display", exp2 ? "none" : "block");
65336         error.classed("expanded", !exp2);
65337       });
65338       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
65339       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
65340         return d.details || [];
65341       }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
65342         return d;
65343       });
65344       items.exit().remove();
65345     }
65346     function showSuccess(changeset) {
65347       commit.reset();
65348       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
65349         context.ui().sidebar.hide();
65350       });
65351       context.enter(modeBrowse(context).sidebar(ui));
65352     }
65353     function keybindingOn() {
65354       select_default2(document).call(keybinding.on("\u238B", cancel, true));
65355     }
65356     function keybindingOff() {
65357       select_default2(document).call(keybinding.unbind);
65358     }
65359     function prepareForSuccess() {
65360       _success = uiSuccess(context);
65361       _location = null;
65362       if (!services.geocoder)
65363         return;
65364       services.geocoder.reverse(context.map().center(), function(err, result) {
65365         if (err || !result || !result.address)
65366           return;
65367         var addr = result.address;
65368         var place = addr && (addr.town || addr.city || addr.county) || "";
65369         var region = addr && (addr.state || addr.country) || "";
65370         var separator = place && region ? _t("success.thank_you_where.separator") : "";
65371         _location = _t("success.thank_you_where.format", { place, separator, region });
65372       });
65373     }
65374     mode.selectedIDs = function() {
65375       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
65376     };
65377     mode.enter = function() {
65378       context.ui().sidebar.expand();
65379       function done() {
65380         context.ui().sidebar.show(commit);
65381       }
65382       keybindingOn();
65383       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
65384       var osm = context.connection();
65385       if (!osm) {
65386         cancel();
65387         return;
65388       }
65389       if (osm.authenticated()) {
65390         done();
65391       } else {
65392         osm.authenticate(function(err) {
65393           if (err) {
65394             cancel();
65395           } else {
65396             done();
65397           }
65398         });
65399       }
65400     };
65401     mode.exit = function() {
65402       keybindingOff();
65403       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
65404       context.ui().sidebar.hide();
65405     };
65406     return mode;
65407   }
65408
65409   // modules/modes/select_error.js
65410   function modeSelectError(context, selectedErrorID, selectedErrorService) {
65411     var mode = {
65412       id: "select-error",
65413       button: "browse"
65414     };
65415     var keybinding = utilKeybinding("select-error");
65416     var errorService = services[selectedErrorService];
65417     var errorEditor;
65418     switch (selectedErrorService) {
65419       case "improveOSM":
65420         errorEditor = uiImproveOsmEditor(context).on("change", function() {
65421           context.map().pan([0, 0]);
65422           var error = checkSelectedID();
65423           if (!error)
65424             return;
65425           context.ui().sidebar.show(errorEditor.error(error));
65426         });
65427         break;
65428       case "keepRight":
65429         errorEditor = uiKeepRightEditor(context).on("change", function() {
65430           context.map().pan([0, 0]);
65431           var error = checkSelectedID();
65432           if (!error)
65433             return;
65434           context.ui().sidebar.show(errorEditor.error(error));
65435         });
65436         break;
65437       case "osmose":
65438         errorEditor = uiOsmoseEditor(context).on("change", function() {
65439           context.map().pan([0, 0]);
65440           var error = checkSelectedID();
65441           if (!error)
65442             return;
65443           context.ui().sidebar.show(errorEditor.error(error));
65444         });
65445         break;
65446     }
65447     var behaviors = [
65448       behaviorBreathe(context),
65449       behaviorHover(context),
65450       behaviorSelect(context),
65451       behaviorLasso(context),
65452       modeDragNode(context).behavior,
65453       modeDragNote(context).behavior
65454     ];
65455     function checkSelectedID() {
65456       if (!errorService)
65457         return;
65458       var error = errorService.getError(selectedErrorID);
65459       if (!error) {
65460         context.enter(modeBrowse(context));
65461       }
65462       return error;
65463     }
65464     mode.zoomToSelected = function() {
65465       if (!errorService)
65466         return;
65467       var error = errorService.getError(selectedErrorID);
65468       if (error) {
65469         context.map().centerZoomEase(error.loc, 20);
65470       }
65471     };
65472     mode.enter = function() {
65473       var error = checkSelectedID();
65474       if (!error)
65475         return;
65476       behaviors.forEach(context.install);
65477       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
65478       select_default2(document).call(keybinding);
65479       selectError();
65480       var sidebar = context.ui().sidebar;
65481       sidebar.show(errorEditor.error(error));
65482       context.map().on("drawn.select-error", selectError);
65483       function selectError(d3_event, drawn) {
65484         if (!checkSelectedID())
65485           return;
65486         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
65487         if (selection2.empty()) {
65488           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
65489           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
65490             context.enter(modeBrowse(context));
65491           }
65492         } else {
65493           selection2.classed("selected", true);
65494           context.selectedErrorID(selectedErrorID);
65495         }
65496       }
65497       function esc() {
65498         if (context.container().select(".combobox").size())
65499           return;
65500         context.enter(modeBrowse(context));
65501       }
65502     };
65503     mode.exit = function() {
65504       behaviors.forEach(context.uninstall);
65505       select_default2(document).call(keybinding.unbind);
65506       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
65507       context.map().on("drawn.select-error", null);
65508       context.ui().sidebar.hide();
65509       context.selectedErrorID(null);
65510       context.features().forceVisible([]);
65511     };
65512     return mode;
65513   }
65514
65515   // modules/ui/tools/modes.js
65516   function uiToolDrawModes(context) {
65517     var tool = {
65518       id: "old_modes",
65519       label: _t.html("toolbar.add_feature")
65520     };
65521     var modes = [
65522       modeAddPoint(context, {
65523         title: _t.html("modes.add_point.title"),
65524         button: "point",
65525         description: _t.html("modes.add_point.description"),
65526         preset: _mainPresetIndex.item("point"),
65527         key: "1"
65528       }),
65529       modeAddLine(context, {
65530         title: _t.html("modes.add_line.title"),
65531         button: "line",
65532         description: _t.html("modes.add_line.description"),
65533         preset: _mainPresetIndex.item("line"),
65534         key: "2"
65535       }),
65536       modeAddArea(context, {
65537         title: _t.html("modes.add_area.title"),
65538         button: "area",
65539         description: _t.html("modes.add_area.description"),
65540         preset: _mainPresetIndex.item("area"),
65541         key: "3"
65542       })
65543     ];
65544     function enabled(_mode) {
65545       return osmEditable();
65546     }
65547     function osmEditable() {
65548       return context.editable();
65549     }
65550     modes.forEach(function(mode) {
65551       context.keybinding().on(mode.key, function() {
65552         if (!enabled(mode))
65553           return;
65554         if (mode.id === context.mode().id) {
65555           context.enter(modeBrowse(context));
65556         } else {
65557           context.enter(mode);
65558         }
65559       });
65560     });
65561     tool.render = function(selection2) {
65562       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
65563       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65564       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
65565       context.on("enter.modes", update);
65566       update();
65567       function update() {
65568         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
65569           return d.id;
65570         });
65571         buttons.exit().remove();
65572         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
65573           return d.id + " add-button bar-button";
65574         }).on("click.mode-buttons", function(d3_event, d) {
65575           if (!enabled(d))
65576             return;
65577           var currMode = context.mode().id;
65578           if (/^draw/.test(currMode))
65579             return;
65580           if (d.id === currMode) {
65581             context.enter(modeBrowse(context));
65582           } else {
65583             context.enter(d);
65584           }
65585         }).call(uiTooltip().placement("bottom").title(function(d) {
65586           return d.description;
65587         }).keys(function(d) {
65588           return [d.key];
65589         }).scrollContainer(context.container().select(".top-toolbar")));
65590         buttonsEnter.each(function(d) {
65591           select_default2(this).call(svgIcon("#iD-icon-" + d.button));
65592         });
65593         buttonsEnter.append("span").attr("class", "label").html(function(mode) {
65594           return mode.title;
65595         });
65596         if (buttons.enter().size() || buttons.exit().size()) {
65597           context.ui().checkOverflow(".top-toolbar", true);
65598         }
65599         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
65600           return !enabled(d);
65601         }).classed("disabled", function(d) {
65602           return !enabled(d);
65603         }).attr("aria-pressed", function(d) {
65604           return context.mode() && context.mode().button === d.button;
65605         }).classed("active", function(d) {
65606           return context.mode() && context.mode().button === d.button;
65607         });
65608       }
65609     };
65610     return tool;
65611   }
65612
65613   // modules/ui/tools/notes.js
65614   function uiToolNotes(context) {
65615     var tool = {
65616       id: "notes",
65617       label: _t.html("modes.add_note.label")
65618     };
65619     var mode = modeAddNote(context);
65620     function enabled() {
65621       return notesEnabled() && notesEditable();
65622     }
65623     function notesEnabled() {
65624       var noteLayer = context.layers().layer("notes");
65625       return noteLayer && noteLayer.enabled();
65626     }
65627     function notesEditable() {
65628       var mode2 = context.mode();
65629       return context.map().notesEditable() && mode2 && mode2.id !== "save";
65630     }
65631     context.keybinding().on(mode.key, function() {
65632       if (!enabled())
65633         return;
65634       if (mode.id === context.mode().id) {
65635         context.enter(modeBrowse(context));
65636       } else {
65637         context.enter(mode);
65638       }
65639     });
65640     tool.render = function(selection2) {
65641       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65642       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
65643       context.on("enter.notes", update);
65644       update();
65645       function update() {
65646         var showNotes = notesEnabled();
65647         var data = showNotes ? [mode] : [];
65648         var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
65649           return d.id;
65650         });
65651         buttons.exit().remove();
65652         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
65653           return d.id + " add-button bar-button";
65654         }).on("click.notes", function(d3_event, d) {
65655           if (!enabled())
65656             return;
65657           var currMode = context.mode().id;
65658           if (/^draw/.test(currMode))
65659             return;
65660           if (d.id === currMode) {
65661             context.enter(modeBrowse(context));
65662           } else {
65663             context.enter(d);
65664           }
65665         }).call(uiTooltip().placement("bottom").title(function(d) {
65666           return d.description;
65667         }).keys(function(d) {
65668           return [d.key];
65669         }).scrollContainer(context.container().select(".top-toolbar")));
65670         buttonsEnter.each(function(d) {
65671           select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
65672         });
65673         if (buttons.enter().size() || buttons.exit().size()) {
65674           context.ui().checkOverflow(".top-toolbar", true);
65675         }
65676         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
65677           return !enabled();
65678         }).attr("aria-disabled", function() {
65679           return !enabled();
65680         }).classed("active", function(d) {
65681           return context.mode() && context.mode().button === d.button;
65682         }).attr("aria-pressed", function(d) {
65683           return context.mode() && context.mode().button === d.button;
65684         });
65685       }
65686     };
65687     tool.uninstall = function() {
65688       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
65689       context.map().on("move.notes", null).on("drawn.notes", null);
65690     };
65691     return tool;
65692   }
65693
65694   // modules/ui/tools/save.js
65695   function uiToolSave(context) {
65696     var tool = {
65697       id: "save",
65698       label: _t.html("save.title")
65699     };
65700     var button = null;
65701     var tooltipBehavior = null;
65702     var history = context.history();
65703     var key = uiCmd("\u2318S");
65704     var _numChanges = 0;
65705     function isSaving() {
65706       var mode = context.mode();
65707       return mode && mode.id === "save";
65708     }
65709     function isDisabled() {
65710       return _numChanges === 0 || isSaving();
65711     }
65712     function save(d3_event) {
65713       d3_event.preventDefault();
65714       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
65715         context.enter(modeSave(context));
65716       }
65717     }
65718     function bgColor(numChanges) {
65719       var step;
65720       if (numChanges === 0) {
65721         return null;
65722       } else if (numChanges <= 50) {
65723         step = numChanges / 50;
65724         return rgb_default("#fff", "#ff8")(step);
65725       } else {
65726         step = Math.min((numChanges - 50) / 50, 1);
65727         return rgb_default("#ff8", "#f88")(step);
65728       }
65729     }
65730     function updateCount() {
65731       var val = history.difference().summary().length;
65732       if (val === _numChanges)
65733         return;
65734       _numChanges = val;
65735       if (tooltipBehavior) {
65736         tooltipBehavior.title(_t.html(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
65737       }
65738       if (button) {
65739         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
65740         button.select("span.count").text(_numChanges);
65741       }
65742     }
65743     tool.render = function(selection2) {
65744       tooltipBehavior = uiTooltip().placement("bottom").title(_t.html("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
65745       var lastPointerUpType;
65746       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
65747         lastPointerUpType = d3_event.pointerType;
65748       }).on("click", function(d3_event) {
65749         save(d3_event);
65750         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
65751           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.html("save.no_changes"))();
65752         }
65753         lastPointerUpType = null;
65754       }).call(tooltipBehavior);
65755       button.call(svgIcon("#iD-icon-save"));
65756       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
65757       updateCount();
65758       context.keybinding().on(key, save, true);
65759       context.history().on("change.save", updateCount);
65760       context.on("enter.save", function() {
65761         if (button) {
65762           button.classed("disabled", isDisabled());
65763           if (isSaving()) {
65764             button.call(tooltipBehavior.hide);
65765           }
65766         }
65767       });
65768     };
65769     tool.uninstall = function() {
65770       context.keybinding().off(key, true);
65771       context.history().on("change.save", null);
65772       context.on("enter.save", null);
65773       button = null;
65774       tooltipBehavior = null;
65775     };
65776     return tool;
65777   }
65778
65779   // modules/ui/tools/sidebar_toggle.js
65780   function uiToolSidebarToggle(context) {
65781     var tool = {
65782       id: "sidebar_toggle",
65783       label: _t.html("toolbar.inspect")
65784     };
65785     tool.render = function(selection2) {
65786       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
65787         context.ui().sidebar.toggle();
65788       }).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")));
65789     };
65790     return tool;
65791   }
65792
65793   // modules/ui/tools/undo_redo.js
65794   function uiToolUndoRedo(context) {
65795     var tool = {
65796       id: "undo_redo",
65797       label: _t.html("toolbar.undo_redo")
65798     };
65799     var commands = [{
65800       id: "undo",
65801       cmd: uiCmd("\u2318Z"),
65802       action: function() {
65803         context.undo();
65804       },
65805       annotation: function() {
65806         return context.history().undoAnnotation();
65807       },
65808       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
65809     }, {
65810       id: "redo",
65811       cmd: uiCmd("\u2318\u21E7Z"),
65812       action: function() {
65813         context.redo();
65814       },
65815       annotation: function() {
65816         return context.history().redoAnnotation();
65817       },
65818       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
65819     }];
65820     function editable() {
65821       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(true);
65822     }
65823     tool.render = function(selection2) {
65824       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
65825         return d.annotation() ? _t.html(d.id + ".tooltip", { action: d.annotation() }) : _t.html(d.id + ".nothing");
65826       }).keys(function(d) {
65827         return [d.cmd];
65828       }).scrollContainer(context.container().select(".top-toolbar"));
65829       var lastPointerUpType;
65830       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
65831         return "disabled " + d.id + "-button bar-button";
65832       }).on("pointerup", function(d3_event) {
65833         lastPointerUpType = d3_event.pointerType;
65834       }).on("click", function(d3_event, d) {
65835         d3_event.preventDefault();
65836         var annotation = d.annotation();
65837         if (editable() && annotation) {
65838           d.action();
65839         }
65840         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
65841           var text2 = annotation ? _t.html(d.id + ".tooltip", { action: annotation }) : _t.html(d.id + ".nothing");
65842           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(text2)();
65843         }
65844         lastPointerUpType = null;
65845       }).call(tooltipBehavior);
65846       buttons.each(function(d) {
65847         select_default2(this).call(svgIcon("#" + d.icon));
65848       });
65849       context.keybinding().on(commands[0].cmd, function(d3_event) {
65850         d3_event.preventDefault();
65851         if (editable())
65852           commands[0].action();
65853       }).on(commands[1].cmd, function(d3_event) {
65854         d3_event.preventDefault();
65855         if (editable())
65856           commands[1].action();
65857       });
65858       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65859       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
65860       context.history().on("change.undo_redo", function(difference) {
65861         if (difference)
65862           update();
65863       });
65864       context.on("enter.undo_redo", update);
65865       function update() {
65866         buttons.classed("disabled", function(d) {
65867           return !editable() || !d.annotation();
65868         }).each(function() {
65869           var selection3 = select_default2(this);
65870           if (!selection3.select(".tooltip.in").empty()) {
65871             selection3.call(tooltipBehavior.updateContent);
65872           }
65873         });
65874       }
65875     };
65876     tool.uninstall = function() {
65877       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
65878       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
65879       context.history().on("change.undo_redo", null);
65880       context.on("enter.undo_redo", null);
65881     };
65882     return tool;
65883   }
65884
65885   // modules/ui/top_toolbar.js
65886   function uiTopToolbar(context) {
65887     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
65888     function notesEnabled() {
65889       var noteLayer = context.layers().layer("notes");
65890       return noteLayer && noteLayer.enabled();
65891     }
65892     function topToolbar(bar) {
65893       bar.on("wheel.topToolbar", function(d3_event) {
65894         if (!d3_event.deltaX) {
65895           bar.node().scrollLeft += d3_event.deltaY;
65896         }
65897       });
65898       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
65899       context.layers().on("change.topToolbar", debouncedUpdate);
65900       update();
65901       function update() {
65902         var tools = [
65903           sidebarToggle,
65904           "spacer",
65905           modes
65906         ];
65907         tools.push("spacer");
65908         if (notesEnabled()) {
65909           tools = tools.concat([notes, "spacer"]);
65910         }
65911         tools = tools.concat([undoRedo, save]);
65912         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
65913           return d.id || d;
65914         });
65915         toolbarItems.exit().each(function(d) {
65916           if (d.uninstall) {
65917             d.uninstall();
65918           }
65919         }).remove();
65920         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
65921           var classes = "toolbar-item " + (d.id || d).replace("_", "-");
65922           if (d.klass)
65923             classes += " " + d.klass;
65924           return classes;
65925         });
65926         var actionableItems = itemsEnter.filter(function(d) {
65927           return d !== "spacer";
65928         });
65929         actionableItems.append("div").attr("class", "item-content").each(function(d) {
65930           select_default2(this).call(d.render, bar);
65931         });
65932         actionableItems.append("div").attr("class", "item-label").html(function(d) {
65933           return d.label;
65934         });
65935       }
65936     }
65937     return topToolbar;
65938   }
65939
65940   // modules/ui/zoom_to_selection.js
65941   function uiZoomToSelection(context) {
65942     function isDisabled() {
65943       var mode = context.mode();
65944       return !mode || !mode.zoomToSelected;
65945     }
65946     var _lastPointerUpType;
65947     function pointerup(d3_event) {
65948       _lastPointerUpType = d3_event.pointerType;
65949     }
65950     function click(d3_event) {
65951       d3_event.preventDefault();
65952       if (isDisabled()) {
65953         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
65954           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.html("inspector.zoom_to.no_selection"))();
65955         }
65956       } else {
65957         var mode = context.mode();
65958         if (mode && mode.zoomToSelected) {
65959           mode.zoomToSelected();
65960         }
65961       }
65962       _lastPointerUpType = null;
65963     }
65964     return function(selection2) {
65965       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
65966         if (isDisabled()) {
65967           return _t.html("inspector.zoom_to.no_selection");
65968         }
65969         return _t.html("inspector.zoom_to.title");
65970       }).keys([_t("inspector.zoom_to.key")]);
65971       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
65972       function setEnabledState() {
65973         button.classed("disabled", isDisabled());
65974         if (!button.select(".tooltip.in").empty()) {
65975           button.call(tooltipBehavior.updateContent);
65976         }
65977       }
65978       context.on("enter.uiZoomToSelection", setEnabledState);
65979       setEnabledState();
65980     };
65981   }
65982
65983   // modules/ui/pane.js
65984   function uiPane(id2, context) {
65985     var _key;
65986     var _label = "";
65987     var _description = "";
65988     var _iconName = "";
65989     var _sections;
65990     var _paneSelection = select_default2(null);
65991     var _paneTooltip;
65992     var pane = {
65993       id: id2
65994     };
65995     pane.label = function(val) {
65996       if (!arguments.length)
65997         return _label;
65998       _label = val;
65999       return pane;
66000     };
66001     pane.key = function(val) {
66002       if (!arguments.length)
66003         return _key;
66004       _key = val;
66005       return pane;
66006     };
66007     pane.description = function(val) {
66008       if (!arguments.length)
66009         return _description;
66010       _description = val;
66011       return pane;
66012     };
66013     pane.iconName = function(val) {
66014       if (!arguments.length)
66015         return _iconName;
66016       _iconName = val;
66017       return pane;
66018     };
66019     pane.sections = function(val) {
66020       if (!arguments.length)
66021         return _sections;
66022       _sections = val;
66023       return pane;
66024     };
66025     pane.selection = function() {
66026       return _paneSelection;
66027     };
66028     function hidePane() {
66029       context.ui().togglePanes();
66030     }
66031     pane.togglePane = function(d3_event) {
66032       if (d3_event)
66033         d3_event.preventDefault();
66034       _paneTooltip.hide();
66035       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
66036     };
66037     pane.renderToggleButton = function(selection2) {
66038       if (!_paneTooltip) {
66039         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(_description).keys([_key]);
66040       }
66041       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
66042     };
66043     pane.renderContent = function(selection2) {
66044       if (_sections) {
66045         _sections.forEach(function(section) {
66046           selection2.call(section.render);
66047         });
66048       }
66049     };
66050     pane.renderPane = function(selection2) {
66051       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
66052       var heading = _paneSelection.append("div").attr("class", "pane-heading");
66053       heading.append("h2").html(_label);
66054       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
66055       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
66056       if (_key) {
66057         context.keybinding().on(_key, pane.togglePane);
66058       }
66059     };
66060     return pane;
66061   }
66062
66063   // modules/ui/sections/background_display_options.js
66064   function uiSectionBackgroundDisplayOptions(context) {
66065     var section = uiSection("background-display-options", context).label(_t.html("background.display_options")).disclosureContent(renderDisclosureContent);
66066     var _storedOpacity = corePreferences("background-opacity");
66067     var _minVal = 0;
66068     var _maxVal = 3;
66069     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
66070     var _options = {
66071       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
66072       contrast: 1,
66073       saturation: 1,
66074       sharpness: 1
66075     };
66076     function clamp3(x, min3, max3) {
66077       return Math.max(min3, Math.min(x, max3));
66078     }
66079     function updateValue(d, val) {
66080       val = clamp3(val, _minVal, _maxVal);
66081       _options[d] = val;
66082       context.background()[d](val);
66083       if (d === "brightness") {
66084         corePreferences("background-opacity", val);
66085       }
66086       section.reRender();
66087     }
66088     function renderDisclosureContent(selection2) {
66089       var container = selection2.selectAll(".display-options-container").data([0]);
66090       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
66091       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
66092         return "display-control display-control-" + d;
66093       });
66094       slidersEnter.html(function(d) {
66095         return _t.html("background." + d);
66096       }).append("span").attr("class", function(d) {
66097         return "display-option-value display-option-value-" + d;
66098       });
66099       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
66100       sildersControlEnter.append("input").attr("class", function(d) {
66101         return "display-option-input display-option-input-" + d;
66102       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
66103         var val = select_default2(this).property("value");
66104         if (!val && d3_event && d3_event.target) {
66105           val = d3_event.target.value;
66106         }
66107         updateValue(d, val);
66108       });
66109       sildersControlEnter.append("button").attr("title", function(d) {
66110         return `${_t("background.reset")} ${_t("background." + d)}`;
66111       }).attr("class", function(d) {
66112         return "display-option-reset display-option-reset-" + d;
66113       }).on("click", function(d3_event, d) {
66114         if (d3_event.button !== 0)
66115           return;
66116         updateValue(d, 1);
66117       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
66118       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
66119         d3_event.preventDefault();
66120         for (var i2 = 0; i2 < _sliders.length; i2++) {
66121           updateValue(_sliders[i2], 1);
66122         }
66123       });
66124       container = containerEnter.merge(container);
66125       container.selectAll(".display-option-input").property("value", function(d) {
66126         return _options[d];
66127       });
66128       container.selectAll(".display-option-value").text(function(d) {
66129         return Math.floor(_options[d] * 100) + "%";
66130       });
66131       container.selectAll(".display-option-reset").classed("disabled", function(d) {
66132         return _options[d] === 1;
66133       });
66134       if (containerEnter.size() && _options.brightness !== 1) {
66135         context.background().brightness(_options.brightness);
66136       }
66137     }
66138     return section;
66139   }
66140
66141   // modules/ui/settings/custom_background.js
66142   function uiSettingsCustomBackground() {
66143     var dispatch10 = dispatch_default("change");
66144     function render(selection2) {
66145       var _origSettings = {
66146         template: corePreferences("background-custom-template")
66147       };
66148       var _currSettings = {
66149         template: corePreferences("background-custom-template")
66150       };
66151       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
66152       var modal = uiConfirm(selection2).okButton();
66153       modal.classed("settings-modal settings-custom-background", true);
66154       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
66155       var textSection = modal.select(".modal-section.message-text");
66156       var instructions = `${_t.html("settings.custom_background.instructions.info")}
66157
66158 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
66159 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
66160 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
66161 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
66162 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
66163
66164 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
66165 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
66166 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
66167 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
66168 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
66169 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
66170
66171 #### ${_t.html("settings.custom_background.instructions.example")}
66172 \`${example}\``;
66173       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
66174       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
66175       var buttonSection = modal.select(".modal-section.buttons");
66176       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
66177       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
66178       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
66179       function isSaveDisabled() {
66180         return null;
66181       }
66182       function clickCancel() {
66183         textSection.select(".field-template").property("value", _origSettings.template);
66184         corePreferences("background-custom-template", _origSettings.template);
66185         this.blur();
66186         modal.close();
66187       }
66188       function clickSave() {
66189         _currSettings.template = textSection.select(".field-template").property("value");
66190         corePreferences("background-custom-template", _currSettings.template);
66191         this.blur();
66192         modal.close();
66193         dispatch10.call("change", this, _currSettings);
66194       }
66195     }
66196     return utilRebind(render, dispatch10, "on");
66197   }
66198
66199   // modules/ui/sections/background_list.js
66200   function uiSectionBackgroundList(context) {
66201     var _backgroundList = select_default2(null);
66202     var _customSource = context.background().findSource("custom");
66203     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
66204     var section = uiSection("background-list", context).label(_t.html("background.backgrounds")).disclosureContent(renderDisclosureContent);
66205     function previousBackgroundID() {
66206       return corePreferences("background-last-used-toggle");
66207     }
66208     function renderDisclosureContent(selection2) {
66209       var container = selection2.selectAll(".layer-background-list").data([0]);
66210       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
66211       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
66212       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"));
66213       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66214         d3_event.preventDefault();
66215         uiMapInMap.toggle();
66216       });
66217       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
66218       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"));
66219       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66220         d3_event.preventDefault();
66221         context.ui().info.toggle("background");
66222       });
66223       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
66224       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"));
66225       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
66226         d3_event.preventDefault();
66227         context.ui().info.toggle("location");
66228       });
66229       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
66230       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"));
66231       _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
66232         chooseBackground(d);
66233       }, function(d) {
66234         return !d.isHidden() && !d.overlay;
66235       });
66236     }
66237     function setTooltips(selection2) {
66238       selection2.each(function(d, i2, nodes) {
66239         var item = select_default2(this).select("label");
66240         var span = item.select("span");
66241         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
66242         var description2 = d.description();
66243         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
66244         item.call(uiTooltip().destroyAny);
66245         if (d.id === previousBackgroundID()) {
66246           item.call(uiTooltip().placement(placement).title("<div>" + _t.html("background.switch") + "</div>").keys([uiCmd("\u2318" + _t("background.key"))]));
66247         } else if (description2 || isOverflowing) {
66248           item.call(uiTooltip().placement(placement).title(description2 || d.label()));
66249         }
66250       });
66251     }
66252     function drawListItems(layerList, type3, change, filter2) {
66253       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
66254         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
66255       });
66256       var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
66257         return d.id + "---" + i2;
66258       });
66259       layerLinks.exit().remove();
66260       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
66261         return d.id === "custom";
66262       }).classed("best", function(d) {
66263         return d.best();
66264       });
66265       var label = enter.append("label");
66266       label.append("input").attr("type", type3).attr("name", "background-layer").attr("value", function(d) {
66267         return d.id;
66268       }).on("change", change);
66269       label.append("span").html(function(d) {
66270         return d.label();
66271       });
66272       enter.filter(function(d) {
66273         return d.id === "custom";
66274       }).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) {
66275         d3_event.preventDefault();
66276         editCustom();
66277       }).call(svgIcon("#iD-icon-more"));
66278       enter.filter(function(d) {
66279         return d.best();
66280       }).append("div").attr("class", "best").call(uiTooltip().title(_t.html("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).append("span").html("&#9733;");
66281       layerList.call(updateLayerSelections);
66282     }
66283     function updateLayerSelections(selection2) {
66284       function active(d) {
66285         return context.background().showsLayer(d);
66286       }
66287       selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
66288         return d.id === previousBackgroundID();
66289       }).call(setTooltips).selectAll("input").property("checked", active);
66290     }
66291     function chooseBackground(d) {
66292       if (d.id === "custom" && !d.template()) {
66293         return editCustom();
66294       }
66295       var previousBackground = context.background().baseLayerSource();
66296       corePreferences("background-last-used-toggle", previousBackground.id);
66297       corePreferences("background-last-used", d.id);
66298       context.background().baseLayerSource(d);
66299     }
66300     function customChanged(d) {
66301       if (d && d.template) {
66302         _customSource.template(d.template);
66303         chooseBackground(_customSource);
66304       } else {
66305         _customSource.template("");
66306         chooseBackground(context.background().findSource("none"));
66307       }
66308     }
66309     function editCustom() {
66310       context.container().call(_settingsCustomBackground);
66311     }
66312     context.background().on("change.background_list", function() {
66313       _backgroundList.call(updateLayerSelections);
66314     });
66315     context.map().on("move.background_list", debounce_default(function() {
66316       window.requestIdleCallback(section.reRender);
66317     }, 1e3));
66318     return section;
66319   }
66320
66321   // modules/ui/sections/background_offset.js
66322   function uiSectionBackgroundOffset(context) {
66323     var section = uiSection("background-offset", context).label(_t.html("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
66324     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
66325     var _directions = [
66326       ["top", [0, -0.5]],
66327       ["left", [-0.5, 0]],
66328       ["right", [0.5, 0]],
66329       ["bottom", [0, 0.5]]
66330     ];
66331     function updateValue() {
66332       var meters = geoOffsetToMeters(context.background().offset());
66333       var x = +meters[0].toFixed(2);
66334       var y = +meters[1].toFixed(2);
66335       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
66336       context.container().selectAll(".nudge-reset").classed("disabled", function() {
66337         return x === 0 && y === 0;
66338       });
66339     }
66340     function resetOffset() {
66341       context.background().offset([0, 0]);
66342       updateValue();
66343     }
66344     function nudge(d) {
66345       context.background().nudge(d, context.map().zoom());
66346       updateValue();
66347     }
66348     function inputOffset() {
66349       var input = select_default2(this);
66350       var d = input.node().value;
66351       if (d === "")
66352         return resetOffset();
66353       d = d.replace(/;/g, ",").split(",").map(function(n2) {
66354         return !isNaN(n2) && n2;
66355       });
66356       if (d.length !== 2 || !d[0] || !d[1]) {
66357         input.classed("error", true);
66358         return;
66359       }
66360       context.background().offset(geoMetersToOffset(d));
66361       updateValue();
66362     }
66363     function dragOffset(d3_event) {
66364       if (d3_event.button !== 0)
66365         return;
66366       var origin = [d3_event.clientX, d3_event.clientY];
66367       var pointerId = d3_event.pointerId || "mouse";
66368       context.container().append("div").attr("class", "nudge-surface");
66369       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
66370       if (_pointerPrefix === "pointer") {
66371         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
66372       }
66373       function pointermove(d3_event2) {
66374         if (pointerId !== (d3_event2.pointerId || "mouse"))
66375           return;
66376         var latest = [d3_event2.clientX, d3_event2.clientY];
66377         var d = [
66378           -(origin[0] - latest[0]) / 4,
66379           -(origin[1] - latest[1]) / 4
66380         ];
66381         origin = latest;
66382         nudge(d);
66383       }
66384       function pointerup(d3_event2) {
66385         if (pointerId !== (d3_event2.pointerId || "mouse"))
66386           return;
66387         if (d3_event2.button !== 0)
66388           return;
66389         context.container().selectAll(".nudge-surface").remove();
66390         select_default2(window).on(".drag-bg-offset", null);
66391       }
66392     }
66393     function renderDisclosureContent(selection2) {
66394       var container = selection2.selectAll(".nudge-container").data([0]);
66395       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
66396       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
66397       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
66398       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
66399       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
66400       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
66401         return _t(`background.nudge.${d[0]}`);
66402       }).attr("class", function(d) {
66403         return d[0] + " nudge";
66404       }).on("click", function(d3_event, d) {
66405         nudge(d[1]);
66406       });
66407       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
66408         d3_event.preventDefault();
66409         resetOffset();
66410       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
66411       updateValue();
66412     }
66413     context.background().on("change.backgroundOffset-update", updateValue);
66414     return section;
66415   }
66416
66417   // modules/ui/sections/overlay_list.js
66418   function uiSectionOverlayList(context) {
66419     var section = uiSection("overlay-list", context).label(_t.html("background.overlays")).disclosureContent(renderDisclosureContent);
66420     var _overlayList = select_default2(null);
66421     function setTooltips(selection2) {
66422       selection2.each(function(d, i2, nodes) {
66423         var item = select_default2(this).select("label");
66424         var span = item.select("span");
66425         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
66426         var description2 = d.description();
66427         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
66428         item.call(uiTooltip().destroyAny);
66429         if (description2 || isOverflowing) {
66430           item.call(uiTooltip().placement(placement).title(description2 || d.name()));
66431         }
66432       });
66433     }
66434     function updateLayerSelections(selection2) {
66435       function active(d) {
66436         return context.background().showsLayer(d);
66437       }
66438       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
66439     }
66440     function chooseOverlay(d3_event, d) {
66441       d3_event.preventDefault();
66442       context.background().toggleOverlayLayer(d);
66443       _overlayList.call(updateLayerSelections);
66444       document.activeElement.blur();
66445     }
66446     function drawListItems(layerList, type3, change, filter2) {
66447       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
66448       var layerLinks = layerList.selectAll("li").data(sources, function(d) {
66449         return d.name();
66450       });
66451       layerLinks.exit().remove();
66452       var enter = layerLinks.enter().append("li");
66453       var label = enter.append("label");
66454       label.append("input").attr("type", type3).attr("name", "layers").on("change", change);
66455       label.append("span").html(function(d) {
66456         return d.label();
66457       });
66458       layerList.selectAll("li").sort(sortSources);
66459       layerList.call(updateLayerSelections);
66460       function sortSources(a, b) {
66461         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
66462       }
66463     }
66464     function renderDisclosureContent(selection2) {
66465       var container = selection2.selectAll(".layer-overlay-list").data([0]);
66466       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
66467       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
66468         return !d.isHidden() && d.overlay;
66469       });
66470     }
66471     context.map().on("move.overlay_list", debounce_default(function() {
66472       window.requestIdleCallback(section.reRender);
66473     }, 1e3));
66474     return section;
66475   }
66476
66477   // modules/ui/panes/background.js
66478   function uiPaneBackground(context) {
66479     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.html("background.title")).description(_t.html("background.description")).iconName("iD-icon-layers").sections([
66480       uiSectionBackgroundList(context),
66481       uiSectionOverlayList(context),
66482       uiSectionBackgroundDisplayOptions(context),
66483       uiSectionBackgroundOffset(context)
66484     ]);
66485     return backgroundPane;
66486   }
66487
66488   // modules/ui/panes/help.js
66489   function uiPaneHelp(context) {
66490     var docKeys = [
66491       ["help", [
66492         "welcome",
66493         "open_data_h",
66494         "open_data",
66495         "before_start_h",
66496         "before_start",
66497         "open_source_h",
66498         "open_source",
66499         "open_source_help"
66500       ]],
66501       ["overview", [
66502         "navigation_h",
66503         "navigation_drag",
66504         "navigation_zoom",
66505         "features_h",
66506         "features",
66507         "nodes_ways"
66508       ]],
66509       ["editing", [
66510         "select_h",
66511         "select_left_click",
66512         "select_right_click",
66513         "select_space",
66514         "multiselect_h",
66515         "multiselect",
66516         "multiselect_shift_click",
66517         "multiselect_lasso",
66518         "undo_redo_h",
66519         "undo_redo",
66520         "save_h",
66521         "save",
66522         "save_validation",
66523         "upload_h",
66524         "upload",
66525         "backups_h",
66526         "backups",
66527         "keyboard_h",
66528         "keyboard"
66529       ]],
66530       ["feature_editor", [
66531         "intro",
66532         "definitions",
66533         "type_h",
66534         "type",
66535         "type_picker",
66536         "fields_h",
66537         "fields_all_fields",
66538         "fields_example",
66539         "fields_add_field",
66540         "tags_h",
66541         "tags_all_tags",
66542         "tags_resources"
66543       ]],
66544       ["points", [
66545         "intro",
66546         "add_point_h",
66547         "add_point",
66548         "add_point_finish",
66549         "move_point_h",
66550         "move_point",
66551         "delete_point_h",
66552         "delete_point",
66553         "delete_point_command"
66554       ]],
66555       ["lines", [
66556         "intro",
66557         "add_line_h",
66558         "add_line",
66559         "add_line_draw",
66560         "add_line_continue",
66561         "add_line_finish",
66562         "modify_line_h",
66563         "modify_line_dragnode",
66564         "modify_line_addnode",
66565         "connect_line_h",
66566         "connect_line",
66567         "connect_line_display",
66568         "connect_line_drag",
66569         "connect_line_tag",
66570         "disconnect_line_h",
66571         "disconnect_line_command",
66572         "move_line_h",
66573         "move_line_command",
66574         "move_line_connected",
66575         "delete_line_h",
66576         "delete_line",
66577         "delete_line_command"
66578       ]],
66579       ["areas", [
66580         "intro",
66581         "point_or_area_h",
66582         "point_or_area",
66583         "add_area_h",
66584         "add_area_command",
66585         "add_area_draw",
66586         "add_area_continue",
66587         "add_area_finish",
66588         "square_area_h",
66589         "square_area_command",
66590         "modify_area_h",
66591         "modify_area_dragnode",
66592         "modify_area_addnode",
66593         "delete_area_h",
66594         "delete_area",
66595         "delete_area_command"
66596       ]],
66597       ["relations", [
66598         "intro",
66599         "edit_relation_h",
66600         "edit_relation",
66601         "edit_relation_add",
66602         "edit_relation_delete",
66603         "maintain_relation_h",
66604         "maintain_relation",
66605         "relation_types_h",
66606         "multipolygon_h",
66607         "multipolygon",
66608         "multipolygon_create",
66609         "multipolygon_merge",
66610         "turn_restriction_h",
66611         "turn_restriction",
66612         "turn_restriction_field",
66613         "turn_restriction_editing",
66614         "route_h",
66615         "route",
66616         "route_add",
66617         "boundary_h",
66618         "boundary",
66619         "boundary_add"
66620       ]],
66621       ["operations", [
66622         "intro",
66623         "intro_2",
66624         "straighten",
66625         "orthogonalize",
66626         "circularize",
66627         "move",
66628         "rotate",
66629         "reflect",
66630         "continue",
66631         "reverse",
66632         "disconnect",
66633         "split",
66634         "extract",
66635         "merge",
66636         "delete",
66637         "downgrade",
66638         "copy_paste"
66639       ]],
66640       ["notes", [
66641         "intro",
66642         "add_note_h",
66643         "add_note",
66644         "place_note",
66645         "move_note",
66646         "update_note_h",
66647         "update_note",
66648         "save_note_h",
66649         "save_note"
66650       ]],
66651       ["imagery", [
66652         "intro",
66653         "sources_h",
66654         "choosing",
66655         "sources",
66656         "offsets_h",
66657         "offset",
66658         "offset_change"
66659       ]],
66660       ["streetlevel", [
66661         "intro",
66662         "using_h",
66663         "using",
66664         "photos",
66665         "viewer"
66666       ]],
66667       ["gps", [
66668         "intro",
66669         "survey",
66670         "using_h",
66671         "using",
66672         "tracing",
66673         "upload"
66674       ]],
66675       ["qa", [
66676         "intro",
66677         "tools_h",
66678         "tools",
66679         "issues_h",
66680         "issues"
66681       ]]
66682     ];
66683     var headings = {
66684       "help.help.open_data_h": 3,
66685       "help.help.before_start_h": 3,
66686       "help.help.open_source_h": 3,
66687       "help.overview.navigation_h": 3,
66688       "help.overview.features_h": 3,
66689       "help.editing.select_h": 3,
66690       "help.editing.multiselect_h": 3,
66691       "help.editing.undo_redo_h": 3,
66692       "help.editing.save_h": 3,
66693       "help.editing.upload_h": 3,
66694       "help.editing.backups_h": 3,
66695       "help.editing.keyboard_h": 3,
66696       "help.feature_editor.type_h": 3,
66697       "help.feature_editor.fields_h": 3,
66698       "help.feature_editor.tags_h": 3,
66699       "help.points.add_point_h": 3,
66700       "help.points.move_point_h": 3,
66701       "help.points.delete_point_h": 3,
66702       "help.lines.add_line_h": 3,
66703       "help.lines.modify_line_h": 3,
66704       "help.lines.connect_line_h": 3,
66705       "help.lines.disconnect_line_h": 3,
66706       "help.lines.move_line_h": 3,
66707       "help.lines.delete_line_h": 3,
66708       "help.areas.point_or_area_h": 3,
66709       "help.areas.add_area_h": 3,
66710       "help.areas.square_area_h": 3,
66711       "help.areas.modify_area_h": 3,
66712       "help.areas.delete_area_h": 3,
66713       "help.relations.edit_relation_h": 3,
66714       "help.relations.maintain_relation_h": 3,
66715       "help.relations.relation_types_h": 2,
66716       "help.relations.multipolygon_h": 3,
66717       "help.relations.turn_restriction_h": 3,
66718       "help.relations.route_h": 3,
66719       "help.relations.boundary_h": 3,
66720       "help.notes.add_note_h": 3,
66721       "help.notes.update_note_h": 3,
66722       "help.notes.save_note_h": 3,
66723       "help.imagery.sources_h": 3,
66724       "help.imagery.offsets_h": 3,
66725       "help.streetlevel.using_h": 3,
66726       "help.gps.using_h": 3,
66727       "help.qa.tools_h": 3,
66728       "help.qa.issues_h": 3
66729     };
66730     var docs = docKeys.map(function(key) {
66731       var helpkey = "help." + key[0];
66732       var helpPaneReplacements = { version: context.version };
66733       var text2 = key[1].reduce(function(all, part) {
66734         var subkey = helpkey + "." + part;
66735         var depth = headings[subkey];
66736         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
66737         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
66738       }, "");
66739       return {
66740         title: _t.html(helpkey + ".title"),
66741         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
66742       };
66743     });
66744     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.html("help.title")).description(_t.html("help.title")).iconName("iD-icon-help");
66745     helpPane.renderContent = function(content) {
66746       function clickHelp(d, i2) {
66747         var rtl = _mainLocalizer.textDirection() === "rtl";
66748         content.property("scrollTop", 0);
66749         helpPane.selection().select(".pane-heading h2").html(d.title);
66750         body.html(d.content);
66751         body.selectAll("a").attr("target", "_blank");
66752         menuItems.classed("selected", function(m) {
66753           return m.title === d.title;
66754         });
66755         nav.html("");
66756         if (rtl) {
66757           nav.call(drawNext).call(drawPrevious);
66758         } else {
66759           nav.call(drawPrevious).call(drawNext);
66760         }
66761         function drawNext(selection2) {
66762           if (i2 < docs.length - 1) {
66763             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
66764               d3_event.preventDefault();
66765               clickHelp(docs[i2 + 1], i2 + 1);
66766             });
66767             nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
66768           }
66769         }
66770         function drawPrevious(selection2) {
66771           if (i2 > 0) {
66772             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
66773               d3_event.preventDefault();
66774               clickHelp(docs[i2 - 1], i2 - 1);
66775             });
66776             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
66777           }
66778         }
66779       }
66780       function clickWalkthrough(d3_event) {
66781         d3_event.preventDefault();
66782         if (context.inIntro())
66783           return;
66784         context.container().call(uiIntro(context));
66785         context.ui().togglePanes();
66786       }
66787       function clickShortcuts(d3_event) {
66788         d3_event.preventDefault();
66789         context.container().call(context.ui().shortcuts, true);
66790       }
66791       var toc = content.append("ul").attr("class", "toc");
66792       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
66793         return d.title;
66794       }).on("click", function(d3_event, d) {
66795         d3_event.preventDefault();
66796         clickHelp(d, docs.indexOf(d));
66797       });
66798       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);
66799       shortcuts.append("div").call(_t.append("shortcuts.title"));
66800       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
66801       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
66802       walkthrough.append("div").call(_t.append("splash.walkthrough"));
66803       var helpContent = content.append("div").attr("class", "left-content");
66804       var body = helpContent.append("div").attr("class", "body");
66805       var nav = helpContent.append("div").attr("class", "nav");
66806       clickHelp(docs[0], 0);
66807     };
66808     return helpPane;
66809   }
66810
66811   // modules/ui/sections/validation_issues.js
66812   function uiSectionValidationIssues(id2, severity, context) {
66813     var _issues = [];
66814     var section = uiSection(id2, context).label(function() {
66815       if (!_issues)
66816         return "";
66817       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
66818       return _t.html("inspector.title_count", { title: { html: _t.html("issues." + severity + "s.list_title") }, count: issueCountText });
66819     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
66820       return _issues && _issues.length;
66821     });
66822     function getOptions() {
66823       return {
66824         what: corePreferences("validate-what") || "edited",
66825         where: corePreferences("validate-where") || "all"
66826       };
66827     }
66828     function reloadIssues() {
66829       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
66830     }
66831     function renderDisclosureContent(selection2) {
66832       var center = context.map().center();
66833       var graph = context.graph();
66834       var issues = _issues.map(function withDistance(issue) {
66835         var extent = issue.extent(graph);
66836         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
66837         return Object.assign(issue, { dist });
66838       }).sort(function byDistance(a, b) {
66839         return a.dist - b.dist;
66840       });
66841       issues = issues.slice(0, 1e3);
66842       selection2.call(drawIssuesList, issues);
66843     }
66844     function drawIssuesList(selection2, issues) {
66845       var list = selection2.selectAll(".issues-list").data([0]);
66846       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
66847       var items = list.selectAll("li").data(issues, function(d) {
66848         return d.key;
66849       });
66850       items.exit().remove();
66851       var itemsEnter = items.enter().append("li").attr("class", function(d) {
66852         return "issue severity-" + d.severity;
66853       });
66854       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
66855         context.validator().focusIssue(d);
66856       }).on("mouseover", function(d3_event, d) {
66857         utilHighlightEntities(d.entityIds, true, context);
66858       }).on("mouseout", function(d3_event, d) {
66859         utilHighlightEntities(d.entityIds, false, context);
66860       });
66861       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
66862       textEnter.append("span").attr("class", "issue-icon").each(function(d) {
66863         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
66864         select_default2(this).call(svgIcon(iconName));
66865       });
66866       textEnter.append("span").attr("class", "issue-message");
66867       items = items.merge(itemsEnter).order();
66868       items.selectAll(".issue-message").html(function(d) {
66869         return d.message(context);
66870       });
66871     }
66872     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
66873       window.requestIdleCallback(function() {
66874         reloadIssues();
66875         section.reRender();
66876       });
66877     });
66878     context.map().on("move.uiSectionValidationIssues" + id2, debounce_default(function() {
66879       window.requestIdleCallback(function() {
66880         if (getOptions().where === "visible") {
66881           reloadIssues();
66882         }
66883         section.reRender();
66884       });
66885     }, 1e3));
66886     return section;
66887   }
66888
66889   // modules/ui/sections/validation_options.js
66890   function uiSectionValidationOptions(context) {
66891     var section = uiSection("issues-options", context).content(renderContent);
66892     function renderContent(selection2) {
66893       var container = selection2.selectAll(".issues-options-container").data([0]);
66894       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
66895       var data = [
66896         { key: "what", values: ["edited", "all"] },
66897         { key: "where", values: ["visible", "all"] }
66898       ];
66899       var options2 = container.selectAll(".issues-option").data(data, function(d) {
66900         return d.key;
66901       });
66902       var optionsEnter = options2.enter().append("div").attr("class", function(d) {
66903         return "issues-option issues-option-" + d.key;
66904       });
66905       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
66906         return _t.html("issues.options." + d.key + ".title");
66907       });
66908       var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
66909         return d.values.map(function(val) {
66910           return { value: val, key: d.key };
66911         });
66912       }).enter().append("label");
66913       valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
66914         return "issues-option-" + d.key;
66915       }).attr("value", function(d) {
66916         return d.value;
66917       }).property("checked", function(d) {
66918         return getOptions()[d.key] === d.value;
66919       }).on("change", function(d3_event, d) {
66920         updateOptionValue(d3_event, d.key, d.value);
66921       });
66922       valuesEnter.append("span").html(function(d) {
66923         return _t.html("issues.options." + d.key + "." + d.value);
66924       });
66925     }
66926     function getOptions() {
66927       return {
66928         what: corePreferences("validate-what") || "edited",
66929         where: corePreferences("validate-where") || "all"
66930       };
66931     }
66932     function updateOptionValue(d3_event, d, val) {
66933       if (!val && d3_event && d3_event.target) {
66934         val = d3_event.target.value;
66935       }
66936       corePreferences("validate-" + d, val);
66937       context.validator().validate();
66938     }
66939     return section;
66940   }
66941
66942   // modules/ui/sections/validation_rules.js
66943   function uiSectionValidationRules(context) {
66944     var MINSQUARE = 0;
66945     var MAXSQUARE = 20;
66946     var DEFAULTSQUARE = 5;
66947     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(_t.html("issues.rules.title"));
66948     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
66949       return key !== "maprules";
66950     }).sort(function(key1, key2) {
66951       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
66952     });
66953     function renderDisclosureContent(selection2) {
66954       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
66955       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
66956       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
66957       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
66958       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
66959         d3_event.preventDefault();
66960         context.validator().disableRules(_ruleKeys);
66961       });
66962       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
66963         d3_event.preventDefault();
66964         context.validator().disableRules([]);
66965       });
66966       container = container.merge(containerEnter);
66967       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
66968     }
66969     function drawListItems(selection2, data, type3, name2, change, active) {
66970       var items = selection2.selectAll("li").data(data);
66971       items.exit().remove();
66972       var enter = items.enter().append("li");
66973       if (name2 === "rule") {
66974         enter.call(uiTooltip().title(function(d) {
66975           return _t.html("issues." + d + ".tip");
66976         }).placement("top"));
66977       }
66978       var label = enter.append("label");
66979       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
66980       label.append("span").html(function(d) {
66981         var params = {};
66982         if (d === "unsquare_way") {
66983           params.val = { html: '<span class="square-degrees"></span>' };
66984         }
66985         return _t.html("issues." + d + ".title", params);
66986       });
66987       items = items.merge(enter);
66988       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
66989       var degStr = corePreferences("validate-square-degrees");
66990       if (degStr === null) {
66991         degStr = DEFAULTSQUARE.toString();
66992       }
66993       var span = items.selectAll(".square-degrees");
66994       var input = span.selectAll(".square-degrees-input").data([0]);
66995       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) {
66996         d3_event.preventDefault();
66997         d3_event.stopPropagation();
66998         this.select();
66999       }).on("keyup", function(d3_event) {
67000         if (d3_event.keyCode === 13) {
67001           this.blur();
67002           this.select();
67003         }
67004       }).on("blur", changeSquare).merge(input).property("value", degStr);
67005     }
67006     function changeSquare() {
67007       var input = select_default2(this);
67008       var degStr = utilGetSetValue(input).trim();
67009       var degNum = parseFloat(degStr, 10);
67010       if (!isFinite(degNum)) {
67011         degNum = DEFAULTSQUARE;
67012       } else if (degNum > MAXSQUARE) {
67013         degNum = MAXSQUARE;
67014       } else if (degNum < MINSQUARE) {
67015         degNum = MINSQUARE;
67016       }
67017       degNum = Math.round(degNum * 10) / 10;
67018       degStr = degNum.toString();
67019       input.property("value", degStr);
67020       corePreferences("validate-square-degrees", degStr);
67021       context.validator().revalidateUnsquare();
67022     }
67023     function isRuleEnabled(d) {
67024       return context.validator().isRuleEnabled(d);
67025     }
67026     function toggleRule(d3_event, d) {
67027       context.validator().toggleRule(d);
67028     }
67029     context.validator().on("validated.uiSectionValidationRules", function() {
67030       window.requestIdleCallback(section.reRender);
67031     });
67032     return section;
67033   }
67034
67035   // modules/ui/sections/validation_status.js
67036   function uiSectionValidationStatus(context) {
67037     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
67038       var issues = context.validator().getIssues(getOptions());
67039       return issues.length === 0;
67040     });
67041     function getOptions() {
67042       return {
67043         what: corePreferences("validate-what") || "edited",
67044         where: corePreferences("validate-where") || "all"
67045       };
67046     }
67047     function renderContent(selection2) {
67048       var box = selection2.selectAll(".box").data([0]);
67049       var boxEnter = box.enter().append("div").attr("class", "box");
67050       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
67051       var noIssuesMessage = boxEnter.append("span");
67052       noIssuesMessage.append("strong").attr("class", "message");
67053       noIssuesMessage.append("br");
67054       noIssuesMessage.append("span").attr("class", "details");
67055       renderIgnoredIssuesReset(selection2);
67056       setNoIssuesText(selection2);
67057     }
67058     function renderIgnoredIssuesReset(selection2) {
67059       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
67060       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
67061       resetIgnored.exit().remove();
67062       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
67063       resetIgnoredEnter.append("a").attr("href", "#");
67064       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
67065       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
67066       resetIgnored.on("click", function(d3_event) {
67067         d3_event.preventDefault();
67068         context.validator().resetIgnoredIssues();
67069       });
67070     }
67071     function setNoIssuesText(selection2) {
67072       var opts = getOptions();
67073       function checkForHiddenIssues(cases) {
67074         for (var type3 in cases) {
67075           var hiddenOpts = cases[type3];
67076           var hiddenIssues = context.validator().getIssues(hiddenOpts);
67077           if (hiddenIssues.length) {
67078             selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues." + type3, { count: hiddenIssues.length.toString() }));
67079             return;
67080           }
67081         }
67082         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
67083       }
67084       var messageType;
67085       if (opts.what === "edited" && opts.where === "visible") {
67086         messageType = "edits_in_view";
67087         checkForHiddenIssues({
67088           elsewhere: { what: "edited", where: "all" },
67089           everything_else: { what: "all", where: "visible" },
67090           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
67091           everything_else_elsewhere: { what: "all", where: "all" },
67092           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
67093           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
67094           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
67095         });
67096       } else if (opts.what === "edited" && opts.where === "all") {
67097         messageType = "edits";
67098         checkForHiddenIssues({
67099           everything_else: { what: "all", where: "all" },
67100           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
67101           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
67102         });
67103       } else if (opts.what === "all" && opts.where === "visible") {
67104         messageType = "everything_in_view";
67105         checkForHiddenIssues({
67106           elsewhere: { what: "all", where: "all" },
67107           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
67108           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
67109           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
67110           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
67111         });
67112       } else if (opts.what === "all" && opts.where === "all") {
67113         messageType = "everything";
67114         checkForHiddenIssues({
67115           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
67116           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
67117         });
67118       }
67119       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
67120         messageType = "no_edits";
67121       }
67122       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
67123     }
67124     context.validator().on("validated.uiSectionValidationStatus", function() {
67125       window.requestIdleCallback(section.reRender);
67126     });
67127     context.map().on("move.uiSectionValidationStatus", debounce_default(function() {
67128       window.requestIdleCallback(section.reRender);
67129     }, 1e3));
67130     return section;
67131   }
67132
67133   // modules/ui/panes/issues.js
67134   function uiPaneIssues(context) {
67135     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.html("issues.title")).description(_t.html("issues.title")).iconName("iD-icon-alert").sections([
67136       uiSectionValidationOptions(context),
67137       uiSectionValidationStatus(context),
67138       uiSectionValidationIssues("issues-errors", "error", context),
67139       uiSectionValidationIssues("issues-warnings", "warning", context),
67140       uiSectionValidationRules(context)
67141     ]);
67142     return issuesPane;
67143   }
67144
67145   // modules/ui/settings/custom_data.js
67146   function uiSettingsCustomData(context) {
67147     var dispatch10 = dispatch_default("change");
67148     function render(selection2) {
67149       var dataLayer = context.layers().layer("data");
67150       var _origSettings = {
67151         fileList: dataLayer && dataLayer.fileList() || null,
67152         url: corePreferences("settings-custom-data-url")
67153       };
67154       var _currSettings = {
67155         fileList: dataLayer && dataLayer.fileList() || null,
67156         url: corePreferences("settings-custom-data-url")
67157       };
67158       var modal = uiConfirm(selection2).okButton();
67159       modal.classed("settings-modal settings-custom-data", true);
67160       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
67161       var textSection = modal.select(".modal-section.message-text");
67162       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
67163       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) {
67164         var files = d3_event.target.files;
67165         if (files && files.length) {
67166           _currSettings.url = "";
67167           textSection.select(".field-url").property("value", "");
67168           _currSettings.fileList = files;
67169         } else {
67170           _currSettings.fileList = null;
67171         }
67172       });
67173       textSection.append("h4").call(_t.append("settings.custom_data.or"));
67174       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
67175       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
67176       var buttonSection = modal.select(".modal-section.buttons");
67177       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
67178       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
67179       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
67180       function isSaveDisabled() {
67181         return null;
67182       }
67183       function clickCancel() {
67184         textSection.select(".field-url").property("value", _origSettings.url);
67185         corePreferences("settings-custom-data-url", _origSettings.url);
67186         this.blur();
67187         modal.close();
67188       }
67189       function clickSave() {
67190         _currSettings.url = textSection.select(".field-url").property("value").trim();
67191         if (_currSettings.url) {
67192           _currSettings.fileList = null;
67193         }
67194         if (_currSettings.fileList) {
67195           _currSettings.url = "";
67196         }
67197         corePreferences("settings-custom-data-url", _currSettings.url);
67198         this.blur();
67199         modal.close();
67200         dispatch10.call("change", this, _currSettings);
67201       }
67202     }
67203     return utilRebind(render, dispatch10, "on");
67204   }
67205
67206   // modules/ui/sections/data_layers.js
67207   function uiSectionDataLayers(context) {
67208     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
67209     var layers = context.layers();
67210     var section = uiSection("data-layers", context).label(_t.html("map_data.data_layers")).disclosureContent(renderDisclosureContent);
67211     function renderDisclosureContent(selection2) {
67212       var container = selection2.selectAll(".data-layer-container").data([0]);
67213       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
67214     }
67215     function showsLayer(which) {
67216       var layer = layers.layer(which);
67217       if (layer) {
67218         return layer.enabled();
67219       }
67220       return false;
67221     }
67222     function setLayer(which, enabled) {
67223       var mode = context.mode();
67224       if (mode && /^draw/.test(mode.id))
67225         return;
67226       var layer = layers.layer(which);
67227       if (layer) {
67228         layer.enabled(enabled);
67229         if (!enabled && (which === "osm" || which === "notes")) {
67230           context.enter(modeBrowse(context));
67231         }
67232       }
67233     }
67234     function toggleLayer(which) {
67235       setLayer(which, !showsLayer(which));
67236     }
67237     function drawOsmItems(selection2) {
67238       var osmKeys = ["osm", "notes"];
67239       var osmLayers = layers.all().filter(function(obj) {
67240         return osmKeys.indexOf(obj.id) !== -1;
67241       });
67242       var ul = selection2.selectAll(".layer-list-osm").data([0]);
67243       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
67244       var li = ul.selectAll(".list-item").data(osmLayers);
67245       li.exit().remove();
67246       var liEnter = li.enter().append("li").attr("class", function(d) {
67247         return "list-item list-item-" + d.id;
67248       });
67249       var labelEnter = liEnter.append("label").each(function(d) {
67250         if (d.id === "osm") {
67251           select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom"));
67252         } else {
67253           select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
67254         }
67255       });
67256       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67257         toggleLayer(d.id);
67258       });
67259       labelEnter.append("span").html(function(d) {
67260         return _t.html("map_data.layers." + d.id + ".title");
67261       });
67262       li.merge(liEnter).classed("active", function(d) {
67263         return d.layer.enabled();
67264       }).selectAll("input").property("checked", function(d) {
67265         return d.layer.enabled();
67266       });
67267     }
67268     function drawQAItems(selection2) {
67269       var qaKeys = ["keepRight", "improveOSM", "osmose"];
67270       var qaLayers = layers.all().filter(function(obj) {
67271         return qaKeys.indexOf(obj.id) !== -1;
67272       });
67273       var ul = selection2.selectAll(".layer-list-qa").data([0]);
67274       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
67275       var li = ul.selectAll(".list-item").data(qaLayers);
67276       li.exit().remove();
67277       var liEnter = li.enter().append("li").attr("class", function(d) {
67278         return "list-item list-item-" + d.id;
67279       });
67280       var labelEnter = liEnter.append("label").each(function(d) {
67281         select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
67282       });
67283       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67284         toggleLayer(d.id);
67285       });
67286       labelEnter.append("span").html(function(d) {
67287         return _t.html("map_data.layers." + d.id + ".title");
67288       });
67289       li.merge(liEnter).classed("active", function(d) {
67290         return d.layer.enabled();
67291       }).selectAll("input").property("checked", function(d) {
67292         return d.layer.enabled();
67293       });
67294     }
67295     function drawVectorItems(selection2) {
67296       var dataLayer = layers.layer("data");
67297       var vtData = [
67298         {
67299           name: "Detroit Neighborhoods/Parks",
67300           src: "neighborhoods-parks",
67301           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
67302           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"
67303         },
67304         {
67305           name: "Detroit Composite POIs",
67306           src: "composite-poi",
67307           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
67308           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"
67309         },
67310         {
67311           name: "Detroit All-The-Places POIs",
67312           src: "alltheplaces-poi",
67313           tooltip: "Public domain business location data created by web scrapers.",
67314           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"
67315         }
67316       ];
67317       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
67318       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
67319       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
67320       container.exit().remove();
67321       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
67322       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
67323       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
67324       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");
67325       container = container.merge(containerEnter);
67326       var ul = container.selectAll(".layer-list-vectortile");
67327       var li = ul.selectAll(".list-item").data(vtData);
67328       li.exit().remove();
67329       var liEnter = li.enter().append("li").attr("class", function(d) {
67330         return "list-item list-item-" + d.src;
67331       });
67332       var labelEnter = liEnter.append("label").each(function(d) {
67333         select_default2(this).call(uiTooltip().title(d.tooltip).placement("top"));
67334       });
67335       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
67336       labelEnter.append("span").text(function(d) {
67337         return d.name;
67338       });
67339       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
67340       function isVTLayerSelected(d) {
67341         return dataLayer && dataLayer.template() === d.template;
67342       }
67343       function selectVTLayer(d3_event, d) {
67344         corePreferences("settings-custom-data-url", d.template);
67345         if (dataLayer) {
67346           dataLayer.template(d.template, d.src);
67347           dataLayer.enabled(true);
67348         }
67349       }
67350     }
67351     function drawCustomDataItems(selection2) {
67352       var dataLayer = layers.layer("data");
67353       var hasData = dataLayer && dataLayer.hasData();
67354       var showsData = hasData && dataLayer.enabled();
67355       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
67356       ul.exit().remove();
67357       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
67358       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
67359       var labelEnter = liEnter.append("label").call(uiTooltip().title(_t.html("map_data.layers.custom.tooltip")).placement("top"));
67360       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
67361         toggleLayer("data");
67362       });
67363       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
67364       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) {
67365         d3_event.preventDefault();
67366         editCustom();
67367       }).call(svgIcon("#iD-icon-more"));
67368       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) {
67369         if (select_default2(this).classed("disabled"))
67370           return;
67371         d3_event.preventDefault();
67372         d3_event.stopPropagation();
67373         dataLayer.fitZoom();
67374       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
67375       ul = ul.merge(ulEnter);
67376       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
67377       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
67378     }
67379     function editCustom() {
67380       context.container().call(settingsCustomData);
67381     }
67382     function customChanged(d) {
67383       var dataLayer = layers.layer("data");
67384       if (d && d.url) {
67385         dataLayer.url(d.url);
67386       } else if (d && d.fileList) {
67387         dataLayer.fileList(d.fileList);
67388       }
67389     }
67390     function drawPanelItems(selection2) {
67391       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
67392       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"));
67393       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67394         d3_event.preventDefault();
67395         context.ui().info.toggle("history");
67396       });
67397       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
67398       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"));
67399       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67400         d3_event.preventDefault();
67401         context.ui().info.toggle("measurement");
67402       });
67403       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
67404     }
67405     context.layers().on("change.uiSectionDataLayers", section.reRender);
67406     context.map().on("move.uiSectionDataLayers", debounce_default(function() {
67407       window.requestIdleCallback(section.reRender);
67408     }, 1e3));
67409     return section;
67410   }
67411
67412   // modules/ui/sections/map_features.js
67413   function uiSectionMapFeatures(context) {
67414     var _features = context.features().keys();
67415     var section = uiSection("map-features", context).label(_t.html("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67416     function renderDisclosureContent(selection2) {
67417       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
67418       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
67419       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
67420       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
67421       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
67422         d3_event.preventDefault();
67423         context.features().disableAll();
67424       });
67425       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
67426         d3_event.preventDefault();
67427         context.features().enableAll();
67428       });
67429       container = container.merge(containerEnter);
67430       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
67431     }
67432     function drawListItems(selection2, data, type3, name2, change, active) {
67433       var items = selection2.selectAll("li").data(data);
67434       items.exit().remove();
67435       var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
67436         var tip = _t.html(name2 + "." + d + ".tooltip");
67437         if (autoHiddenFeature(d)) {
67438           var msg = showsLayer("osm") ? _t.html("map_data.autohidden") : _t.html("map_data.osmhidden");
67439           tip += "<div>" + msg + "</div>";
67440         }
67441         return tip;
67442       }).placement("top"));
67443       var label = enter.append("label");
67444       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
67445       label.append("span").html(function(d) {
67446         return _t.html(name2 + "." + d + ".description");
67447       });
67448       items = items.merge(enter);
67449       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
67450     }
67451     function autoHiddenFeature(d) {
67452       return context.features().autoHidden(d);
67453     }
67454     function showsFeature(d) {
67455       return context.features().enabled(d);
67456     }
67457     function clickFeature(d3_event, d) {
67458       context.features().toggle(d);
67459     }
67460     function showsLayer(id2) {
67461       var layer = context.layers().layer(id2);
67462       return layer && layer.enabled();
67463     }
67464     context.features().on("change.map_features", section.reRender);
67465     return section;
67466   }
67467
67468   // modules/ui/sections/map_style_options.js
67469   function uiSectionMapStyleOptions(context) {
67470     var section = uiSection("fill-area", context).label(_t.html("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67471     function renderDisclosureContent(selection2) {
67472       var container = selection2.selectAll(".layer-fill-list").data([0]);
67473       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
67474       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
67475       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
67476         return context.surface().classed("highlight-edited");
67477       });
67478     }
67479     function drawListItems(selection2, data, type3, name2, change, active) {
67480       var items = selection2.selectAll("li").data(data);
67481       items.exit().remove();
67482       var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
67483         return _t.html(name2 + "." + d + ".tooltip");
67484       }).keys(function(d) {
67485         var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
67486         if (d === "highlight_edits")
67487           key = _t("map_data.highlight_edits.key");
67488         return key ? [key] : null;
67489       }).placement("top"));
67490       var label = enter.append("label");
67491       label.append("input").attr("type", type3).attr("name", name2).on("change", change);
67492       label.append("span").html(function(d) {
67493         return _t.html(name2 + "." + d + ".description");
67494       });
67495       items = items.merge(enter);
67496       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
67497     }
67498     function isActiveFill(d) {
67499       return context.map().activeAreaFill() === d;
67500     }
67501     function toggleHighlightEdited(d3_event) {
67502       d3_event.preventDefault();
67503       context.map().toggleHighlightEdited();
67504     }
67505     function setFill(d3_event, d) {
67506       context.map().activeAreaFill(d);
67507     }
67508     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
67509     return section;
67510   }
67511
67512   // modules/ui/sections/photo_overlays.js
67513   function uiSectionPhotoOverlays(context) {
67514     var layers = context.layers();
67515     var section = uiSection("photo-overlays", context).label(_t.html("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67516     function renderDisclosureContent(selection2) {
67517       var container = selection2.selectAll(".photo-overlay-container").data([0]);
67518       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
67519     }
67520     function drawPhotoItems(selection2) {
67521       var photoKeys = context.photos().overlayLayerIDs();
67522       var photoLayers = layers.all().filter(function(obj) {
67523         return photoKeys.indexOf(obj.id) !== -1;
67524       });
67525       var data = photoLayers.filter(function(obj) {
67526         return obj.layer.supported();
67527       });
67528       function layerSupported(d) {
67529         return d.layer && d.layer.supported();
67530       }
67531       function layerEnabled(d) {
67532         return layerSupported(d) && d.layer.enabled();
67533       }
67534       var ul = selection2.selectAll(".layer-list-photos").data([0]);
67535       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
67536       var li = ul.selectAll(".list-item-photos").data(data);
67537       li.exit().remove();
67538       var liEnter = li.enter().append("li").attr("class", function(d) {
67539         var classes = "list-item-photos list-item-" + d.id;
67540         if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
67541           classes += " indented";
67542         }
67543         return classes;
67544       });
67545       var labelEnter = liEnter.append("label").each(function(d) {
67546         var titleID;
67547         if (d.id === "mapillary-signs")
67548           titleID = "mapillary.signs.tooltip";
67549         else if (d.id === "mapillary")
67550           titleID = "mapillary_images.tooltip";
67551         else if (d.id === "kartaview")
67552           titleID = "kartaview_images.tooltip";
67553         else
67554           titleID = d.id.replace(/-/g, "_") + ".tooltip";
67555         select_default2(this).call(uiTooltip().title(_t.html(titleID)).placement("top"));
67556       });
67557       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67558         toggleLayer(d.id);
67559       });
67560       labelEnter.append("span").html(function(d) {
67561         var id2 = d.id;
67562         if (id2 === "mapillary-signs")
67563           id2 = "photo_overlays.traffic_signs";
67564         return _t.html(id2.replace(/-/g, "_") + ".title");
67565       });
67566       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
67567     }
67568     function drawPhotoTypeItems(selection2) {
67569       var data = context.photos().allPhotoTypes();
67570       function typeEnabled(d) {
67571         return context.photos().showsPhotoType(d);
67572       }
67573       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
67574       ul.exit().remove();
67575       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
67576       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
67577       li.exit().remove();
67578       var liEnter = li.enter().append("li").attr("class", function(d) {
67579         return "list-item-photo-types list-item-" + d;
67580       });
67581       var labelEnter = liEnter.append("label").each(function(d) {
67582         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.photo_type." + d + ".tooltip")).placement("top"));
67583       });
67584       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
67585         context.photos().togglePhotoType(d);
67586       });
67587       labelEnter.append("span").html(function(d) {
67588         return _t.html("photo_overlays.photo_type." + d + ".title");
67589       });
67590       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
67591     }
67592     function drawDateFilter(selection2) {
67593       var data = context.photos().dateFilters();
67594       function filterEnabled(d) {
67595         return context.photos().dateFilterValue(d);
67596       }
67597       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
67598       ul.exit().remove();
67599       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
67600       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
67601       li.exit().remove();
67602       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
67603       var labelEnter = liEnter.append("label").each(function(d) {
67604         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.date_filter." + d + ".tooltip")).placement("top"));
67605       });
67606       labelEnter.append("span").html(function(d) {
67607         return _t.html("photo_overlays.date_filter." + d + ".title");
67608       });
67609       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
67610         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
67611       }).on("change", function(d3_event, d) {
67612         var value = utilGetSetValue(select_default2(this)).trim();
67613         context.photos().setDateFilter(d, value, true);
67614         li.selectAll("input").each(function(d2) {
67615           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
67616         });
67617       });
67618       li = li.merge(liEnter).classed("active", filterEnabled);
67619     }
67620     function drawUsernameFilter(selection2) {
67621       function filterEnabled() {
67622         return context.photos().usernames();
67623       }
67624       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
67625       ul.exit().remove();
67626       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
67627       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
67628       li.exit().remove();
67629       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
67630       var labelEnter = liEnter.append("label").each(function() {
67631         select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.username_filter.tooltip")).placement("top"));
67632       });
67633       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
67634       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
67635         var value = select_default2(this).property("value");
67636         context.photos().setUsernameFilter(value, true);
67637         select_default2(this).property("value", usernameValue);
67638       });
67639       li.merge(liEnter).classed("active", filterEnabled);
67640       function usernameValue() {
67641         var usernames = context.photos().usernames();
67642         if (usernames)
67643           return usernames.join("; ");
67644         return usernames;
67645       }
67646     }
67647     function toggleLayer(which) {
67648       setLayer(which, !showsLayer(which));
67649     }
67650     function showsLayer(which) {
67651       var layer = layers.layer(which);
67652       if (layer) {
67653         return layer.enabled();
67654       }
67655       return false;
67656     }
67657     function setLayer(which, enabled) {
67658       var layer = layers.layer(which);
67659       if (layer) {
67660         layer.enabled(enabled);
67661       }
67662     }
67663     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
67664     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
67665     return section;
67666   }
67667
67668   // modules/ui/panes/map_data.js
67669   function uiPaneMapData(context) {
67670     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([
67671       uiSectionDataLayers(context),
67672       uiSectionPhotoOverlays(context),
67673       uiSectionMapStyleOptions(context),
67674       uiSectionMapFeatures(context)
67675     ]);
67676     return mapDataPane;
67677   }
67678
67679   // modules/ui/panes/preferences.js
67680   function uiPanePreferences(context) {
67681     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.html("preferences.title")).description(_t.html("preferences.description")).iconName("fas-user-cog").sections([
67682       uiSectionPrivacy(context)
67683     ]);
67684     return preferencesPane;
67685   }
67686
67687   // modules/ui/init.js
67688   function uiInit(context) {
67689     var _initCounter = 0;
67690     var _needWidth = {};
67691     var _lastPointerType;
67692     function render(container) {
67693       container.on("click.ui", function(d3_event) {
67694         if (d3_event.button !== 0)
67695           return;
67696         if (!d3_event.composedPath)
67697           return;
67698         var isOkayTarget = d3_event.composedPath().some(function(node) {
67699           return node.nodeType === 1 && (node.nodeName === "INPUT" || node.nodeName === "LABEL" || node.nodeName === "A");
67700         });
67701         if (isOkayTarget)
67702           return;
67703         d3_event.preventDefault();
67704       });
67705       var detected = utilDetect();
67706       if ("GestureEvent" in window && !detected.isMobileWebKit) {
67707         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
67708           d3_event.preventDefault();
67709         });
67710       }
67711       if ("PointerEvent" in window) {
67712         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
67713           var pointerType = d3_event.pointerType || "mouse";
67714           if (_lastPointerType !== pointerType) {
67715             _lastPointerType = pointerType;
67716             container.attr("pointer", pointerType);
67717           }
67718         }, true);
67719       } else {
67720         _lastPointerType = "mouse";
67721         container.attr("pointer", "mouse");
67722       }
67723       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
67724       container.call(uiFullScreen(context));
67725       var map2 = context.map();
67726       map2.redrawEnable(false);
67727       map2.on("hitMinZoom.ui", function() {
67728         ui.flash.iconName("#iD-icon-no").label(_t.html("cannot_zoom"))();
67729       });
67730       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
67731       container.append("div").attr("class", "sidebar").call(ui.sidebar);
67732       var content = container.append("div").attr("class", "main-content active");
67733       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
67734       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
67735       var overMap = content.append("div").attr("class", "over-map");
67736       overMap.append("div").attr("class", "select-trap").text("t");
67737       overMap.call(uiMapInMap(context)).call(uiNotice(context));
67738       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
67739       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
67740       var controls = controlsWrap.append("div").attr("class", "map-controls");
67741       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
67742       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
67743       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
67744       controlsWrap.on("wheel.mapControls", function(d3_event) {
67745         if (!d3_event.deltaX) {
67746           controlsWrap.node().scrollTop += d3_event.deltaY;
67747         }
67748       });
67749       var panes = overMap.append("div").attr("class", "map-panes");
67750       var uiPanes = [
67751         uiPaneBackground(context),
67752         uiPaneMapData(context),
67753         uiPaneIssues(context),
67754         uiPanePreferences(context),
67755         uiPaneHelp(context)
67756       ];
67757       uiPanes.forEach(function(pane) {
67758         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
67759         panes.call(pane.renderPane);
67760       });
67761       ui.info = uiInfo(context);
67762       overMap.call(ui.info);
67763       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
67764       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
67765       var about = content.append("div").attr("class", "map-footer");
67766       about.append("div").attr("class", "api-status").call(uiStatus(context));
67767       var footer = about.append("div").attr("class", "map-footer-bar fillD");
67768       footer.append("div").attr("class", "flash-wrap footer-hide");
67769       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
67770       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
67771       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
67772       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
67773       var apiConnections = context.apiConnections();
67774       if (apiConnections && apiConnections.length > 1) {
67775         aboutList.append("li").attr("class", "source-switch").call(uiSourceSwitch(context).keys(apiConnections));
67776       }
67777       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
67778       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
67779       var issueLinks = aboutList.append("li");
67780       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"));
67781       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"));
67782       aboutList.append("li").attr("class", "version").call(uiVersion(context));
67783       if (!context.embed()) {
67784         aboutList.call(uiAccount(context));
67785       }
67786       ui.onResize();
67787       map2.redrawEnable(true);
67788       ui.hash = behaviorHash(context);
67789       ui.hash();
67790       if (!ui.hash.hadHash) {
67791         map2.centerZoom([0, 0], 2);
67792       }
67793       window.onbeforeunload = function() {
67794         return context.save();
67795       };
67796       window.onunload = function() {
67797         context.history().unlock();
67798       };
67799       select_default2(window).on("resize.editor", function() {
67800         ui.onResize();
67801       });
67802       var panPixels = 80;
67803       context.keybinding().on("\u232B", function(d3_event) {
67804         d3_event.preventDefault();
67805       }).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) {
67806         if (d3_event) {
67807           d3_event.stopImmediatePropagation();
67808           d3_event.preventDefault();
67809         }
67810         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
67811         if (previousBackground) {
67812           var currentBackground = context.background().baseLayerSource();
67813           corePreferences("background-last-used-toggle", currentBackground.id);
67814           corePreferences("background-last-used", previousBackground.id);
67815           context.background().baseLayerSource(previousBackground);
67816         }
67817       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
67818         d3_event.preventDefault();
67819         d3_event.stopPropagation();
67820         context.map().toggleWireframe();
67821       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
67822         d3_event.preventDefault();
67823         d3_event.stopPropagation();
67824         var mode = context.mode();
67825         if (mode && /^draw/.test(mode.id))
67826           return;
67827         var layer = context.layers().layer("osm");
67828         if (layer) {
67829           layer.enabled(!layer.enabled());
67830           if (!layer.enabled()) {
67831             context.enter(modeBrowse(context));
67832           }
67833         }
67834       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
67835         d3_event.preventDefault();
67836         context.map().toggleHighlightEdited();
67837       });
67838       context.on("enter.editor", function(entered) {
67839         container.classed("mode-" + entered.id, true);
67840       }).on("exit.editor", function(exited) {
67841         container.classed("mode-" + exited.id, false);
67842       });
67843       context.enter(modeBrowse(context));
67844       if (!_initCounter++) {
67845         if (!ui.hash.startWalkthrough) {
67846           context.container().call(uiSplash(context)).call(uiRestore(context));
67847         }
67848         context.container().call(ui.shortcuts);
67849       }
67850       var osm = context.connection();
67851       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
67852       if (osm && auth) {
67853         osm.on("authLoading.ui", function() {
67854           context.container().call(auth);
67855         }).on("authDone.ui", function() {
67856           auth.close();
67857         });
67858       }
67859       _initCounter++;
67860       if (ui.hash.startWalkthrough) {
67861         ui.hash.startWalkthrough = false;
67862         context.container().call(uiIntro(context));
67863       }
67864       function pan(d) {
67865         return function(d3_event) {
67866           if (d3_event.shiftKey)
67867             return;
67868           if (context.container().select(".combobox").size())
67869             return;
67870           d3_event.preventDefault();
67871           context.map().pan(d, 100);
67872         };
67873       }
67874     }
67875     let ui = {};
67876     let _loadPromise;
67877     ui.ensureLoaded = () => {
67878       if (_loadPromise)
67879         return _loadPromise;
67880       return _loadPromise = Promise.all([
67881         _mainLocalizer.ensureLoaded(),
67882         _mainPresetIndex.ensureLoaded()
67883       ]).then(() => {
67884         if (!context.container().empty())
67885           render(context.container());
67886       }).catch((err) => console.error(err));
67887     };
67888     ui.restart = function() {
67889       context.keybinding().clear();
67890       _loadPromise = null;
67891       context.container().selectAll("*").remove();
67892       ui.ensureLoaded();
67893     };
67894     ui.lastPointerType = function() {
67895       return _lastPointerType;
67896     };
67897     ui.svgDefs = svgDefs(context);
67898     ui.flash = uiFlash(context);
67899     ui.sidebar = uiSidebar(context);
67900     ui.photoviewer = uiPhotoviewer(context);
67901     ui.shortcuts = uiShortcuts(context);
67902     ui.onResize = function(withPan) {
67903       var map2 = context.map();
67904       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
67905       utilGetDimensions(context.container().select(".sidebar"), true);
67906       if (withPan !== void 0) {
67907         map2.redrawEnable(false);
67908         map2.pan(withPan);
67909         map2.redrawEnable(true);
67910       }
67911       map2.dimensions(mapDimensions);
67912       ui.photoviewer.onMapResize();
67913       ui.checkOverflow(".top-toolbar");
67914       ui.checkOverflow(".map-footer-bar");
67915       var resizeWindowEvent = document.createEvent("Event");
67916       resizeWindowEvent.initEvent("resizeWindow", true, true);
67917       document.dispatchEvent(resizeWindowEvent);
67918     };
67919     ui.checkOverflow = function(selector, reset) {
67920       if (reset) {
67921         delete _needWidth[selector];
67922       }
67923       var selection2 = context.container().select(selector);
67924       if (selection2.empty())
67925         return;
67926       var scrollWidth = selection2.property("scrollWidth");
67927       var clientWidth = selection2.property("clientWidth");
67928       var needed = _needWidth[selector] || scrollWidth;
67929       if (scrollWidth > clientWidth) {
67930         selection2.classed("narrow", true);
67931         if (!_needWidth[selector]) {
67932           _needWidth[selector] = scrollWidth;
67933         }
67934       } else if (scrollWidth >= needed) {
67935         selection2.classed("narrow", false);
67936       }
67937     };
67938     ui.togglePanes = function(showPane) {
67939       var hidePanes = context.container().selectAll(".map-pane.shown");
67940       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
67941       hidePanes.classed("shown", false).classed("hide", true);
67942       context.container().selectAll(".map-pane-control button").classed("active", false);
67943       if (showPane) {
67944         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
67945         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
67946         showPane.classed("shown", true).classed("hide", false);
67947         if (hidePanes.empty()) {
67948           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
67949         } else {
67950           showPane.style(side, "0px");
67951         }
67952       } else {
67953         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
67954           select_default2(this).classed("shown", false).classed("hide", true);
67955         });
67956       }
67957     };
67958     var _editMenu = uiEditMenu(context);
67959     ui.editMenu = function() {
67960       return _editMenu;
67961     };
67962     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
67963       ui.closeEditMenu();
67964       if (!operations && context.mode().operations)
67965         operations = context.mode().operations();
67966       if (!operations || !operations.length)
67967         return;
67968       if (!context.map().editableDataEnabled())
67969         return;
67970       var surfaceNode = context.surface().node();
67971       if (surfaceNode.focus) {
67972         surfaceNode.focus();
67973       }
67974       operations.forEach(function(operation) {
67975         if (operation.point)
67976           operation.point(anchorPoint);
67977       });
67978       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
67979       context.map().supersurface.call(_editMenu);
67980     };
67981     ui.closeEditMenu = function() {
67982       context.map().supersurface.select(".edit-menu").remove();
67983     };
67984     var _saveLoading = select_default2(null);
67985     context.uploader().on("saveStarted.ui", function() {
67986       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
67987       context.container().call(_saveLoading);
67988     }).on("saveEnded.ui", function() {
67989       _saveLoading.close();
67990       _saveLoading = select_default2(null);
67991     });
67992     return ui;
67993   }
67994
67995   // modules/core/context.js
67996   function coreContext() {
67997     const dispatch10 = dispatch_default("enter", "exit", "change");
67998     let context = utilRebind({}, dispatch10, "on");
67999     let _deferred2 = /* @__PURE__ */ new Set();
68000     context.version = "2.21.0";
68001     context.privacyVersion = "20201202";
68002     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
68003     context.changeset = null;
68004     let _defaultChangesetComment = context.initialHashParams.comment;
68005     let _defaultChangesetSource = context.initialHashParams.source;
68006     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
68007     context.defaultChangesetComment = function(val) {
68008       if (!arguments.length)
68009         return _defaultChangesetComment;
68010       _defaultChangesetComment = val;
68011       return context;
68012     };
68013     context.defaultChangesetSource = function(val) {
68014       if (!arguments.length)
68015         return _defaultChangesetSource;
68016       _defaultChangesetSource = val;
68017       return context;
68018     };
68019     context.defaultChangesetHashtags = function(val) {
68020       if (!arguments.length)
68021         return _defaultChangesetHashtags;
68022       _defaultChangesetHashtags = val;
68023       return context;
68024     };
68025     let _setsDocumentTitle = true;
68026     context.setsDocumentTitle = function(val) {
68027       if (!arguments.length)
68028         return _setsDocumentTitle;
68029       _setsDocumentTitle = val;
68030       return context;
68031     };
68032     let _documentTitleBase = document.title;
68033     context.documentTitleBase = function(val) {
68034       if (!arguments.length)
68035         return _documentTitleBase;
68036       _documentTitleBase = val;
68037       return context;
68038     };
68039     let _ui;
68040     context.ui = () => _ui;
68041     context.lastPointerType = () => _ui.lastPointerType();
68042     let _keybinding = utilKeybinding("context");
68043     context.keybinding = () => _keybinding;
68044     select_default2(document).call(_keybinding);
68045     let _connection = services.osm;
68046     let _history;
68047     let _validator;
68048     let _uploader;
68049     context.connection = () => _connection;
68050     context.history = () => _history;
68051     context.validator = () => _validator;
68052     context.uploader = () => _uploader;
68053     context.preauth = (options2) => {
68054       if (_connection) {
68055         _connection.switch(options2);
68056       }
68057       return context;
68058     };
68059     let _apiConnections;
68060     context.apiConnections = function(val) {
68061       if (!arguments.length)
68062         return _apiConnections;
68063       _apiConnections = val;
68064       return context;
68065     };
68066     context.locale = function(locale2) {
68067       if (!arguments.length)
68068         return _mainLocalizer.localeCode();
68069       _mainLocalizer.preferredLocaleCodes(locale2);
68070       return context;
68071     };
68072     function afterLoad(cid, callback) {
68073       return (err, result) => {
68074         if (err) {
68075           if (err.status === 400 || err.status === 401 || err.status === 403) {
68076             if (_connection) {
68077               _connection.logout();
68078             }
68079           }
68080           if (typeof callback === "function") {
68081             callback(err);
68082           }
68083           return;
68084         } else if (_connection && _connection.getConnectionId() !== cid) {
68085           if (typeof callback === "function") {
68086             callback({ message: "Connection Switched", status: -1 });
68087           }
68088           return;
68089         } else {
68090           _history.merge(result.data, result.extent);
68091           if (typeof callback === "function") {
68092             callback(err, result);
68093           }
68094           return;
68095         }
68096       };
68097     }
68098     context.loadTiles = (projection2, callback) => {
68099       const handle = window.requestIdleCallback(() => {
68100         _deferred2.delete(handle);
68101         if (_connection && context.editableDataEnabled()) {
68102           const cid = _connection.getConnectionId();
68103           _connection.loadTiles(projection2, afterLoad(cid, callback));
68104         }
68105       });
68106       _deferred2.add(handle);
68107     };
68108     context.loadTileAtLoc = (loc, callback) => {
68109       const handle = window.requestIdleCallback(() => {
68110         _deferred2.delete(handle);
68111         if (_connection && context.editableDataEnabled()) {
68112           const cid = _connection.getConnectionId();
68113           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
68114         }
68115       });
68116       _deferred2.add(handle);
68117     };
68118     context.loadEntity = (entityID, callback) => {
68119       if (_connection) {
68120         const cid = _connection.getConnectionId();
68121         _connection.loadEntity(entityID, afterLoad(cid, callback));
68122         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
68123       }
68124     };
68125     context.zoomToEntity = (entityID, zoomTo) => {
68126       context.loadEntity(entityID, (err, result) => {
68127         if (err)
68128           return;
68129         if (zoomTo !== false) {
68130           const entity = result.data.find((e) => e.id === entityID);
68131           if (entity) {
68132             _map.zoomTo(entity);
68133           }
68134         }
68135       });
68136       _map.on("drawn.zoomToEntity", () => {
68137         if (!context.hasEntity(entityID))
68138           return;
68139         _map.on("drawn.zoomToEntity", null);
68140         context.on("enter.zoomToEntity", null);
68141         context.enter(modeSelect(context, [entityID]));
68142       });
68143       context.on("enter.zoomToEntity", () => {
68144         if (_mode.id !== "browse") {
68145           _map.on("drawn.zoomToEntity", null);
68146           context.on("enter.zoomToEntity", null);
68147         }
68148       });
68149     };
68150     let _minEditableZoom = 16;
68151     context.minEditableZoom = function(val) {
68152       if (!arguments.length)
68153         return _minEditableZoom;
68154       _minEditableZoom = val;
68155       if (_connection) {
68156         _connection.tileZoom(val);
68157       }
68158       return context;
68159     };
68160     context.maxCharsForTagKey = () => 255;
68161     context.maxCharsForTagValue = () => 255;
68162     context.maxCharsForRelationRole = () => 255;
68163     function cleanOsmString(val, maxChars) {
68164       if (val === void 0 || val === null) {
68165         val = "";
68166       } else {
68167         val = val.toString();
68168       }
68169       val = val.trim();
68170       if (val.normalize)
68171         val = val.normalize("NFC");
68172       return utilUnicodeCharsTruncated(val, maxChars);
68173     }
68174     context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey());
68175     context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue());
68176     context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole());
68177     let _inIntro = false;
68178     context.inIntro = function(val) {
68179       if (!arguments.length)
68180         return _inIntro;
68181       _inIntro = val;
68182       return context;
68183     };
68184     context.save = () => {
68185       if (_inIntro || context.container().select(".modal").size())
68186         return;
68187       let canSave;
68188       if (_mode && _mode.id === "save") {
68189         canSave = false;
68190         if (services.osm && services.osm.isChangesetInflight()) {
68191           _history.clearSaved();
68192           return;
68193         }
68194       } else {
68195         canSave = context.selectedIDs().every((id2) => {
68196           const entity = context.hasEntity(id2);
68197           return entity && !entity.isDegenerate();
68198         });
68199       }
68200       if (canSave) {
68201         _history.save();
68202       }
68203       if (_history.hasChanges()) {
68204         return _t("save.unsaved_changes");
68205       }
68206     };
68207     context.debouncedSave = debounce_default(context.save, 350);
68208     function withDebouncedSave(fn) {
68209       return function() {
68210         const result = fn.apply(_history, arguments);
68211         context.debouncedSave();
68212         return result;
68213       };
68214     }
68215     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
68216     context.entity = (id2) => _history.graph().entity(id2);
68217     let _mode;
68218     context.mode = () => _mode;
68219     context.enter = (newMode) => {
68220       if (_mode) {
68221         _mode.exit();
68222         dispatch10.call("exit", this, _mode);
68223       }
68224       _mode = newMode;
68225       _mode.enter();
68226       dispatch10.call("enter", this, _mode);
68227     };
68228     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
68229     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
68230     let _selectedNoteID;
68231     context.selectedNoteID = function(noteID) {
68232       if (!arguments.length)
68233         return _selectedNoteID;
68234       _selectedNoteID = noteID;
68235       return context;
68236     };
68237     let _selectedErrorID;
68238     context.selectedErrorID = function(errorID) {
68239       if (!arguments.length)
68240         return _selectedErrorID;
68241       _selectedErrorID = errorID;
68242       return context;
68243     };
68244     context.install = (behavior) => context.surface().call(behavior);
68245     context.uninstall = (behavior) => context.surface().call(behavior.off);
68246     let _copyGraph;
68247     context.copyGraph = () => _copyGraph;
68248     let _copyIDs = [];
68249     context.copyIDs = function(val) {
68250       if (!arguments.length)
68251         return _copyIDs;
68252       _copyIDs = val;
68253       _copyGraph = _history.graph();
68254       return context;
68255     };
68256     let _copyLonLat;
68257     context.copyLonLat = function(val) {
68258       if (!arguments.length)
68259         return _copyLonLat;
68260       _copyLonLat = val;
68261       return context;
68262     };
68263     let _background;
68264     context.background = () => _background;
68265     let _features;
68266     context.features = () => _features;
68267     context.hasHiddenConnections = (id2) => {
68268       const graph = _history.graph();
68269       const entity = graph.entity(id2);
68270       return _features.hasHiddenConnections(entity, graph);
68271     };
68272     let _photos;
68273     context.photos = () => _photos;
68274     let _map;
68275     context.map = () => _map;
68276     context.layers = () => _map.layers();
68277     context.surface = () => _map.surface;
68278     context.editableDataEnabled = () => _map.editableDataEnabled();
68279     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
68280     context.editable = () => {
68281       const mode = context.mode();
68282       if (!mode || mode.id === "save")
68283         return false;
68284       return _map.editableDataEnabled();
68285     };
68286     let _debugFlags = {
68287       tile: false,
68288       collision: false,
68289       imagery: false,
68290       target: false,
68291       downloaded: false
68292     };
68293     context.debugFlags = () => _debugFlags;
68294     context.getDebug = (flag) => flag && _debugFlags[flag];
68295     context.setDebug = function(flag, val) {
68296       if (arguments.length === 1)
68297         val = true;
68298       _debugFlags[flag] = val;
68299       dispatch10.call("change");
68300       return context;
68301     };
68302     let _container = select_default2(null);
68303     context.container = function(val) {
68304       if (!arguments.length)
68305         return _container;
68306       _container = val;
68307       _container.classed("ideditor", true);
68308       return context;
68309     };
68310     context.containerNode = function(val) {
68311       if (!arguments.length)
68312         return context.container().node();
68313       context.container(select_default2(val));
68314       return context;
68315     };
68316     let _embed;
68317     context.embed = function(val) {
68318       if (!arguments.length)
68319         return _embed;
68320       _embed = val;
68321       return context;
68322     };
68323     let _assetPath = "";
68324     context.assetPath = function(val) {
68325       if (!arguments.length)
68326         return _assetPath;
68327       _assetPath = val;
68328       _mainFileFetcher.assetPath(val);
68329       return context;
68330     };
68331     let _assetMap = {};
68332     context.assetMap = function(val) {
68333       if (!arguments.length)
68334         return _assetMap;
68335       _assetMap = val;
68336       _mainFileFetcher.assetMap(val);
68337       return context;
68338     };
68339     context.asset = (val) => {
68340       if (/^http(s)?:\/\//i.test(val))
68341         return val;
68342       const filename = _assetPath + val;
68343       return _assetMap[filename] || filename;
68344     };
68345     context.imagePath = (val) => context.asset(`img/${val}`);
68346     context.reset = context.flush = () => {
68347       context.debouncedSave.cancel();
68348       Array.from(_deferred2).forEach((handle) => {
68349         window.cancelIdleCallback(handle);
68350         _deferred2.delete(handle);
68351       });
68352       Object.values(services).forEach((service) => {
68353         if (service && typeof service.reset === "function") {
68354           service.reset(context);
68355         }
68356       });
68357       context.changeset = null;
68358       _validator.reset();
68359       _features.reset();
68360       _history.reset();
68361       _uploader.reset();
68362       context.container().select(".inspector-wrap *").remove();
68363       return context;
68364     };
68365     context.projection = geoRawMercator();
68366     context.curtainProjection = geoRawMercator();
68367     context.init = () => {
68368       instantiateInternal();
68369       initializeDependents();
68370       return context;
68371       function instantiateInternal() {
68372         _history = coreHistory(context);
68373         context.graph = _history.graph;
68374         context.pauseChangeDispatch = _history.pauseChangeDispatch;
68375         context.resumeChangeDispatch = _history.resumeChangeDispatch;
68376         context.perform = withDebouncedSave(_history.perform);
68377         context.replace = withDebouncedSave(_history.replace);
68378         context.pop = withDebouncedSave(_history.pop);
68379         context.overwrite = withDebouncedSave(_history.overwrite);
68380         context.undo = withDebouncedSave(_history.undo);
68381         context.redo = withDebouncedSave(_history.redo);
68382         _validator = coreValidator(context);
68383         _uploader = coreUploader(context);
68384         _background = rendererBackground(context);
68385         _features = rendererFeatures(context);
68386         _map = rendererMap(context);
68387         _photos = rendererPhotos(context);
68388         _ui = uiInit(context);
68389       }
68390       function initializeDependents() {
68391         if (context.initialHashParams.presets) {
68392           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
68393         }
68394         if (context.initialHashParams.locale) {
68395           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
68396         }
68397         _mainLocalizer.ensureLoaded();
68398         _background.ensureLoaded();
68399         _mainPresetIndex.ensureLoaded();
68400         Object.values(services).forEach((service) => {
68401           if (service && typeof service.init === "function") {
68402             service.init();
68403           }
68404         });
68405         _map.init();
68406         _validator.init();
68407         _features.init();
68408         if (services.maprules && context.initialHashParams.maprules) {
68409           json_default(context.initialHashParams.maprules).then((mapcss) => {
68410             services.maprules.init();
68411             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
68412           }).catch(() => {
68413           });
68414         }
68415         if (!context.container().empty()) {
68416           _ui.ensureLoaded().then(() => {
68417             _photos.init();
68418           });
68419         }
68420       }
68421     };
68422     return context;
68423   }
68424
68425   // modules/services/nsi.js
68426   var _nsiStatus = "loading";
68427   var _nsi = {};
68428   var buildingPreset = {
68429     "building/commercial": true,
68430     "building/government": true,
68431     "building/hotel": true,
68432     "building/retail": true,
68433     "building/office": true,
68434     "building/supermarket": true,
68435     "building/yes": true
68436   };
68437   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
68438   var notBranches = /(coop|express|wireless|factory|outlet)/i;
68439   function setNsiSources() {
68440     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
68441     const v = (0, import_vparse2.default)(nsiVersion);
68442     const vMinor = `${v.major}.${v.minor}`;
68443     const sources = {
68444       "nsi_data": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/nsi.min.json`,
68445       "nsi_dissolved": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/dissolved.min.json`,
68446       "nsi_features": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/featureCollection.min.json`,
68447       "nsi_generics": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/genericWords.min.json`,
68448       "nsi_presets": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/presets/nsi-id-presets.min.json`,
68449       "nsi_replacements": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/replacements.min.json`,
68450       "nsi_trees": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/trees.min.json`
68451     };
68452     let fileMap = _mainFileFetcher.fileMap();
68453     for (const k in sources) {
68454       if (!fileMap[k])
68455         fileMap[k] = sources[k];
68456     }
68457   }
68458   function loadNsiPresets() {
68459     return Promise.all([
68460       _mainFileFetcher.get("nsi_presets"),
68461       _mainFileFetcher.get("nsi_features")
68462     ]).then((vals) => {
68463       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
68464       _mainPresetIndex.merge({
68465         presets: vals[0].presets,
68466         featureCollection: vals[1]
68467       });
68468     });
68469   }
68470   function loadNsiData() {
68471     return Promise.all([
68472       _mainFileFetcher.get("nsi_data"),
68473       _mainFileFetcher.get("nsi_dissolved"),
68474       _mainFileFetcher.get("nsi_replacements"),
68475       _mainFileFetcher.get("nsi_trees")
68476     ]).then((vals) => {
68477       _nsi = {
68478         data: vals[0].nsi,
68479         dissolved: vals[1].dissolved,
68480         replacements: vals[2].replacements,
68481         trees: vals[3].trees,
68482         kvt: /* @__PURE__ */ new Map(),
68483         qids: /* @__PURE__ */ new Map(),
68484         ids: /* @__PURE__ */ new Map()
68485       };
68486       _nsi.matcher = new Matcher();
68487       _nsi.matcher.buildMatchIndex(_nsi.data);
68488       _nsi.matcher.buildLocationIndex(_nsi.data, _mainLocations.loco());
68489       Object.keys(_nsi.data).forEach((tkv) => {
68490         const category = _nsi.data[tkv];
68491         const parts = tkv.split("/", 3);
68492         const t = parts[0];
68493         const k = parts[1];
68494         const v = parts[2];
68495         let vmap = _nsi.kvt.get(k);
68496         if (!vmap) {
68497           vmap = /* @__PURE__ */ new Map();
68498           _nsi.kvt.set(k, vmap);
68499         }
68500         vmap.set(v, t);
68501         const tree = _nsi.trees[t];
68502         const mainTag = tree.mainTag;
68503         const items = category.items || [];
68504         items.forEach((item) => {
68505           item.tkv = tkv;
68506           item.mainTag = mainTag;
68507           _nsi.ids.set(item.id, item);
68508           const wd = item.tags[mainTag];
68509           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
68510           if (wd)
68511             _nsi.qids.set(wd, wd);
68512           if (wp && wd)
68513             _nsi.qids.set(wp, wd);
68514         });
68515       });
68516     });
68517   }
68518   function gatherKVs(tags) {
68519     let primary = /* @__PURE__ */ new Set();
68520     let alternate = /* @__PURE__ */ new Set();
68521     Object.keys(tags).forEach((osmkey) => {
68522       const osmvalue = tags[osmkey];
68523       if (!osmvalue)
68524         return;
68525       if (osmkey === "route_master")
68526         osmkey = "route";
68527       const vmap = _nsi.kvt.get(osmkey);
68528       if (!vmap)
68529         return;
68530       if (vmap.get(osmvalue)) {
68531         primary.add(`${osmkey}/${osmvalue}`);
68532       } else if (osmvalue === "yes") {
68533         alternate.add(`${osmkey}/${osmvalue}`);
68534       }
68535     });
68536     const preset = _mainPresetIndex.matchTags(tags, "area");
68537     if (buildingPreset[preset.id]) {
68538       alternate.add("building/yes");
68539     }
68540     return { primary, alternate };
68541   }
68542   function identifyTree(tags) {
68543     let unknown;
68544     let t;
68545     Object.keys(tags).forEach((osmkey) => {
68546       if (t)
68547         return;
68548       const osmvalue = tags[osmkey];
68549       if (!osmvalue)
68550         return;
68551       if (osmkey === "route_master")
68552         osmkey = "route";
68553       const vmap = _nsi.kvt.get(osmkey);
68554       if (!vmap)
68555         return;
68556       if (osmvalue === "yes") {
68557         unknown = "unknown";
68558       } else {
68559         t = vmap.get(osmvalue);
68560       }
68561     });
68562     return t || unknown || null;
68563   }
68564   function gatherNames(tags) {
68565     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
68566     let primary = /* @__PURE__ */ new Set();
68567     let alternate = /* @__PURE__ */ new Set();
68568     let foundSemi = false;
68569     let testNameFragments = false;
68570     let patterns2;
68571     let t = identifyTree(tags);
68572     if (!t)
68573       return empty2;
68574     if (t === "transit") {
68575       patterns2 = {
68576         primary: /^network$/i,
68577         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
68578       };
68579     } else if (t === "flags") {
68580       patterns2 = {
68581         primary: /^(flag:name|flag:name:\w+)$/i,
68582         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
68583       };
68584     } else if (t === "brands") {
68585       testNameFragments = true;
68586       patterns2 = {
68587         primary: /^(name|name:\w+)$/i,
68588         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
68589       };
68590     } else if (t === "operators") {
68591       testNameFragments = true;
68592       patterns2 = {
68593         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
68594         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
68595       };
68596     } else {
68597       testNameFragments = true;
68598       patterns2 = {
68599         primary: /^(name|name:\w+)$/i,
68600         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
68601       };
68602     }
68603     if (tags.name && testNameFragments) {
68604       const nameParts = tags.name.split(/[\s\-\/,.]/);
68605       for (let split = nameParts.length; split > 0; split--) {
68606         const name2 = nameParts.slice(0, split).join(" ");
68607         primary.add(name2);
68608       }
68609     }
68610     Object.keys(tags).forEach((osmkey) => {
68611       const osmvalue = tags[osmkey];
68612       if (!osmvalue)
68613         return;
68614       if (isNamelike(osmkey, "primary")) {
68615         if (/;/.test(osmvalue)) {
68616           foundSemi = true;
68617         } else {
68618           primary.add(osmvalue);
68619           alternate.delete(osmvalue);
68620         }
68621       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
68622         if (/;/.test(osmvalue)) {
68623           foundSemi = true;
68624         } else {
68625           alternate.add(osmvalue);
68626         }
68627       }
68628     });
68629     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
68630       const osmvalue = tags.country;
68631       if (/;/.test(osmvalue)) {
68632         foundSemi = true;
68633       } else {
68634         alternate.add(osmvalue);
68635       }
68636     }
68637     if (foundSemi) {
68638       return empty2;
68639     } else {
68640       return { primary, alternate };
68641     }
68642     function isNamelike(osmkey, which) {
68643       if (osmkey === "old_name")
68644         return false;
68645       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
68646     }
68647   }
68648   function gatherTuples(tryKVs, tryNames) {
68649     let tuples = [];
68650     ["primary", "alternate"].forEach((whichName) => {
68651       const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
68652       arr.forEach((n2) => {
68653         ["primary", "alternate"].forEach((whichKV) => {
68654           tryKVs[whichKV].forEach((kv) => {
68655             const parts = kv.split("/", 2);
68656             const k = parts[0];
68657             const v = parts[1];
68658             tuples.push({ k, v, n: n2 });
68659           });
68660         });
68661       });
68662     });
68663     return tuples;
68664   }
68665   function _upgradeTags(tags, loc) {
68666     let newTags = Object.assign({}, tags);
68667     let changed = false;
68668     Object.keys(newTags).forEach((osmkey) => {
68669       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
68670       if (matchTag) {
68671         const prefix = matchTag[1] || "";
68672         const wd = newTags[osmkey];
68673         const replace = _nsi.replacements[wd];
68674         if (replace && replace.wikidata !== void 0) {
68675           changed = true;
68676           if (replace.wikidata) {
68677             newTags[osmkey] = replace.wikidata;
68678           } else {
68679             delete newTags[osmkey];
68680           }
68681         }
68682         if (replace && replace.wikipedia !== void 0) {
68683           changed = true;
68684           const wpkey = `${prefix}wikipedia`;
68685           if (replace.wikipedia) {
68686             newTags[wpkey] = replace.wikipedia;
68687           } else {
68688             delete newTags[wpkey];
68689           }
68690         }
68691       }
68692     });
68693     const isRouteMaster = tags.type === "route_master";
68694     const tryKVs = gatherKVs(tags);
68695     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
68696       return changed ? { newTags, matched: null } : null;
68697     }
68698     const tryNames = gatherNames(tags);
68699     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
68700     if (foundQID)
68701       tryNames.primary.add(foundQID);
68702     if (!tryNames.primary.size && !tryNames.alternate.size) {
68703       return changed ? { newTags, matched: null } : null;
68704     }
68705     const tuples = gatherTuples(tryKVs, tryNames);
68706     let foundPrimary = false;
68707     let bestItem;
68708     for (let i2 = 0; i2 < tuples.length && !foundPrimary; i2++) {
68709       const tuple = tuples[i2];
68710       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
68711       if (!hits || !hits.length)
68712         continue;
68713       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
68714         break;
68715       for (let j2 = 0; j2 < hits.length; j2++) {
68716         const hit = hits[j2];
68717         const isPrimary = hits[j2].match === "primary";
68718         const itemID = hit.itemID;
68719         if (_nsi.dissolved[itemID])
68720           continue;
68721         const item = _nsi.ids.get(itemID);
68722         if (!item)
68723           continue;
68724         const mainTag = item.mainTag;
68725         const itemQID = item.tags[mainTag];
68726         const notQID = newTags[`not:${mainTag}`];
68727         if (!itemQID || itemQID === notQID || newTags.office && !item.tags.office) {
68728           continue;
68729         }
68730         if (!bestItem || isPrimary) {
68731           bestItem = item;
68732           if (isPrimary) {
68733             foundPrimary = true;
68734           }
68735           break;
68736         }
68737       }
68738     }
68739     if (bestItem) {
68740       const itemID = bestItem.id;
68741       const item = JSON.parse(JSON.stringify(bestItem));
68742       const tkv = item.tkv;
68743       const parts = tkv.split("/", 3);
68744       const k = parts[1];
68745       const v = parts[2];
68746       const category = _nsi.data[tkv];
68747       const properties = category.properties || {};
68748       let preserveTags = item.preserveTags || properties.preserveTags || [];
68749       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
68750         if (k !== osmkey)
68751           preserveTags.push(`^${osmkey}$`);
68752       });
68753       const regexes = preserveTags.map((s) => new RegExp(s, "i"));
68754       let keepTags = {};
68755       Object.keys(newTags).forEach((osmkey) => {
68756         if (regexes.some((regex) => regex.test(osmkey))) {
68757           keepTags[osmkey] = newTags[osmkey];
68758         }
68759       });
68760       _nsi.kvt.forEach((vmap, k2) => {
68761         if (newTags[k2] === "yes")
68762           delete newTags[k2];
68763       });
68764       if (foundQID) {
68765         delete newTags.wikipedia;
68766         delete newTags.wikidata;
68767       }
68768       Object.assign(newTags, item.tags, keepTags);
68769       if (isRouteMaster) {
68770         newTags.route_master = newTags.route;
68771         delete newTags.route;
68772       }
68773       const origName = tags.name;
68774       const newName = newTags.name;
68775       if (newName && origName && newName !== origName && !newTags.branch) {
68776         const newNames = gatherNames(newTags);
68777         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
68778         const isMoved = newSet.has(origName);
68779         if (!isMoved) {
68780           const nameParts = origName.split(/[\s\-\/,.]/);
68781           for (let split = nameParts.length; split > 0; split--) {
68782             const name2 = nameParts.slice(0, split).join(" ");
68783             const branch = nameParts.slice(split).join(" ");
68784             const nameHits = _nsi.matcher.match(k, v, name2, loc);
68785             if (!nameHits || !nameHits.length)
68786               continue;
68787             if (nameHits.some((hit) => hit.itemID === itemID)) {
68788               if (branch) {
68789                 if (notBranches.test(branch)) {
68790                   newTags.name = origName;
68791                 } else {
68792                   const branchHits = _nsi.matcher.match(k, v, branch, loc);
68793                   if (branchHits && branchHits.length) {
68794                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
68795                       return null;
68796                     }
68797                   } else {
68798                     newTags.branch = branch;
68799                   }
68800                 }
68801               }
68802               break;
68803             }
68804           }
68805         }
68806       }
68807       return { newTags, matched: item };
68808     }
68809     return changed ? { newTags, matched: null } : null;
68810   }
68811   function _isGenericName(tags) {
68812     const n2 = tags.name;
68813     if (!n2)
68814       return false;
68815     const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
68816     const tryKVs = gatherKVs(tags);
68817     if (!tryKVs.primary.size && !tryKVs.alternate.size)
68818       return false;
68819     const tuples = gatherTuples(tryKVs, tryNames);
68820     for (let i2 = 0; i2 < tuples.length; i2++) {
68821       const tuple = tuples[i2];
68822       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
68823       if (hits && hits.length && hits[0].match === "excludeGeneric")
68824         return true;
68825     }
68826     return false;
68827   }
68828   var nsi_default = {
68829     init: () => {
68830       setNsiSources();
68831       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => delay(100)).then(() => _mainLocations.mergeLocationSets([])).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
68832       function delay(msec) {
68833         return new Promise((resolve) => {
68834           window.setTimeout(resolve, msec);
68835         });
68836       }
68837     },
68838     reset: () => {
68839     },
68840     status: () => _nsiStatus,
68841     isGenericName: (tags) => _isGenericName(tags),
68842     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
68843     cache: () => _nsi
68844   };
68845
68846   // modules/services/kartaview.js
68847   var import_rbush8 = __toESM(require_rbush_min());
68848   var apibase2 = "https://kartaview.org";
68849   var maxResults = 1e3;
68850   var tileZoom = 14;
68851   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
68852   var dispatch6 = dispatch_default("loadedImages");
68853   var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
68854   var _oscCache;
68855   var _oscSelectedImage;
68856   var _loadViewerPromise2;
68857   function abortRequest4(controller) {
68858     controller.abort();
68859   }
68860   function maxPageAtZoom(z) {
68861     if (z < 15)
68862       return 2;
68863     if (z === 15)
68864       return 5;
68865     if (z === 16)
68866       return 10;
68867     if (z === 17)
68868       return 20;
68869     if (z === 18)
68870       return 40;
68871     if (z > 18)
68872       return 80;
68873   }
68874   function loadTiles2(which, url, projection2) {
68875     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
68876     var tiles = tiler4.getTiles(projection2);
68877     var cache = _oscCache[which];
68878     Object.keys(cache.inflight).forEach(function(k) {
68879       var wanted = tiles.find(function(tile) {
68880         return k.indexOf(tile.id + ",") === 0;
68881       });
68882       if (!wanted) {
68883         abortRequest4(cache.inflight[k]);
68884         delete cache.inflight[k];
68885       }
68886     });
68887     tiles.forEach(function(tile) {
68888       loadNextTilePage(which, currZoom, url, tile);
68889     });
68890   }
68891   function loadNextTilePage(which, currZoom, url, tile) {
68892     var cache = _oscCache[which];
68893     var bbox = tile.extent.bbox();
68894     var maxPages = maxPageAtZoom(currZoom);
68895     var nextPage = cache.nextPage[tile.id] || 1;
68896     var params = utilQsString({
68897       ipp: maxResults,
68898       page: nextPage,
68899       bbTopLeft: [bbox.maxY, bbox.minX].join(","),
68900       bbBottomRight: [bbox.minY, bbox.maxX].join(",")
68901     }, true);
68902     if (nextPage > maxPages)
68903       return;
68904     var id2 = tile.id + "," + String(nextPage);
68905     if (cache.loaded[id2] || cache.inflight[id2])
68906       return;
68907     var controller = new AbortController();
68908     cache.inflight[id2] = controller;
68909     var options2 = {
68910       method: "POST",
68911       signal: controller.signal,
68912       body: params,
68913       headers: { "Content-Type": "application/x-www-form-urlencoded" }
68914     };
68915     json_default(url, options2).then(function(data) {
68916       cache.loaded[id2] = true;
68917       delete cache.inflight[id2];
68918       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
68919         throw new Error("No Data");
68920       }
68921       var features2 = data.currentPageItems.map(function(item) {
68922         var loc = [+item.lng, +item.lat];
68923         var d;
68924         if (which === "images") {
68925           d = {
68926             loc,
68927             key: item.id,
68928             ca: +item.heading,
68929             captured_at: item.shot_date || item.date_added,
68930             captured_by: item.username,
68931             imagePath: item.lth_name,
68932             sequence_id: item.sequence_id,
68933             sequence_index: +item.sequence_index
68934           };
68935           var seq = _oscCache.sequences[d.sequence_id];
68936           if (!seq) {
68937             seq = { rotation: 0, images: [] };
68938             _oscCache.sequences[d.sequence_id] = seq;
68939           }
68940           seq.images[d.sequence_index] = d;
68941           _oscCache.images.forImageKey[d.key] = d;
68942         }
68943         return {
68944           minX: loc[0],
68945           minY: loc[1],
68946           maxX: loc[0],
68947           maxY: loc[1],
68948           data: d
68949         };
68950       });
68951       cache.rtree.load(features2);
68952       if (data.currentPageItems.length === maxResults) {
68953         cache.nextPage[tile.id] = nextPage + 1;
68954         loadNextTilePage(which, currZoom, url, tile);
68955       } else {
68956         cache.nextPage[tile.id] = Infinity;
68957       }
68958       if (which === "images") {
68959         dispatch6.call("loadedImages");
68960       }
68961     }).catch(function() {
68962       cache.loaded[id2] = true;
68963       delete cache.inflight[id2];
68964     });
68965   }
68966   function partitionViewport2(projection2) {
68967     var z = geoScaleToZoom(projection2.scale());
68968     var z2 = Math.ceil(z * 2) / 2 + 2.5;
68969     var tiler8 = utilTiler().zoomExtent([z2, z2]);
68970     return tiler8.getTiles(projection2).map(function(tile) {
68971       return tile.extent;
68972     });
68973   }
68974   function searchLimited2(limit, projection2, rtree) {
68975     limit = limit || 5;
68976     return partitionViewport2(projection2).reduce(function(result, extent) {
68977       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
68978         return d.data;
68979       });
68980       return found.length ? result.concat(found) : result;
68981     }, []);
68982   }
68983   var kartaview_default = {
68984     init: function() {
68985       if (!_oscCache) {
68986         this.reset();
68987       }
68988       this.event = utilRebind(this, dispatch6, "on");
68989     },
68990     reset: function() {
68991       if (_oscCache) {
68992         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
68993       }
68994       _oscCache = {
68995         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
68996         sequences: {}
68997       };
68998       _oscSelectedImage = null;
68999     },
69000     images: function(projection2) {
69001       var limit = 5;
69002       return searchLimited2(limit, projection2, _oscCache.images.rtree);
69003     },
69004     sequences: function(projection2) {
69005       var viewport = projection2.clipExtent();
69006       var min3 = [viewport[0][0], viewport[1][1]];
69007       var max3 = [viewport[1][0], viewport[0][1]];
69008       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
69009       var sequenceKeys = {};
69010       _oscCache.images.rtree.search(bbox).forEach(function(d) {
69011         sequenceKeys[d.data.sequence_id] = true;
69012       });
69013       var lineStrings = [];
69014       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
69015         var seq = _oscCache.sequences[sequenceKey];
69016         var images = seq && seq.images;
69017         if (images) {
69018           lineStrings.push({
69019             type: "LineString",
69020             coordinates: images.map(function(d) {
69021               return d.loc;
69022             }).filter(Boolean),
69023             properties: {
69024               captured_at: images[0] ? images[0].captured_at : null,
69025               captured_by: images[0] ? images[0].captured_by : null,
69026               key: sequenceKey
69027             }
69028           });
69029         }
69030       });
69031       return lineStrings;
69032     },
69033     cachedImage: function(imageKey) {
69034       return _oscCache.images.forImageKey[imageKey];
69035     },
69036     loadImages: function(projection2) {
69037       var url = apibase2 + "/1.0/list/nearby-photos/";
69038       loadTiles2("images", url, projection2);
69039     },
69040     ensureViewerLoaded: function(context) {
69041       if (_loadViewerPromise2)
69042         return _loadViewerPromise2;
69043       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
69044       var that = this;
69045       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
69046       wrapEnter.append("div").attr("class", "photo-attribution fillD");
69047       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
69048       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
69049       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
69050       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
69051       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
69052       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
69053       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
69054         imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
69055       });
69056       function zoomPan(d3_event) {
69057         var t = d3_event.transform;
69058         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
69059       }
69060       function rotate(deg) {
69061         return function() {
69062           if (!_oscSelectedImage)
69063             return;
69064           var sequenceKey = _oscSelectedImage.sequence_id;
69065           var sequence = _oscCache.sequences[sequenceKey];
69066           if (!sequence)
69067             return;
69068           var r = sequence.rotation || 0;
69069           r += deg;
69070           if (r > 180)
69071             r -= 360;
69072           if (r < -180)
69073             r += 360;
69074           sequence.rotation = r;
69075           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
69076           wrap3.transition().duration(100).call(imgZoom.transform, identity2);
69077           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
69078         };
69079       }
69080       function step(stepBy) {
69081         return function() {
69082           if (!_oscSelectedImage)
69083             return;
69084           var sequenceKey = _oscSelectedImage.sequence_id;
69085           var sequence = _oscCache.sequences[sequenceKey];
69086           if (!sequence)
69087             return;
69088           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
69089           var nextImage = sequence.images[nextIndex];
69090           if (!nextImage)
69091             return;
69092           context.map().centerEase(nextImage.loc);
69093           that.selectImage(context, nextImage.key);
69094         };
69095       }
69096       _loadViewerPromise2 = Promise.resolve();
69097       return _loadViewerPromise2;
69098     },
69099     showViewer: function(context) {
69100       var viewer = context.container().select(".photoviewer").classed("hide", false);
69101       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
69102       if (isHidden) {
69103         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
69104         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
69105       }
69106       return this;
69107     },
69108     hideViewer: function(context) {
69109       _oscSelectedImage = null;
69110       this.updateUrlImage(null);
69111       var viewer = context.container().select(".photoviewer");
69112       if (!viewer.empty())
69113         viewer.datum(null);
69114       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
69115       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
69116       return this.setStyles(context, null, true);
69117     },
69118     selectImage: function(context, imageKey) {
69119       var d = this.cachedImage(imageKey);
69120       _oscSelectedImage = d;
69121       this.updateUrlImage(imageKey);
69122       var viewer = context.container().select(".photoviewer");
69123       if (!viewer.empty())
69124         viewer.datum(d);
69125       this.setStyles(context, null, true);
69126       context.container().selectAll(".icon-sign").classed("currentView", false);
69127       if (!d)
69128         return this;
69129       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
69130       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
69131       var attribution = wrap2.selectAll(".photo-attribution").text("");
69132       wrap2.transition().duration(100).call(imgZoom.transform, identity2);
69133       imageWrap.selectAll(".kartaview-image").remove();
69134       if (d) {
69135         var sequence = _oscCache.sequences[d.sequence_id];
69136         var r = sequence && sequence.rotation || 0;
69137         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
69138         if (d.captured_by) {
69139           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
69140           attribution.append("span").text("|");
69141         }
69142         if (d.captured_at) {
69143           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
69144           attribution.append("span").text("|");
69145         }
69146         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");
69147       }
69148       return this;
69149       function localeDateString2(s) {
69150         if (!s)
69151           return null;
69152         var options2 = { day: "numeric", month: "short", year: "numeric" };
69153         var d2 = new Date(s);
69154         if (isNaN(d2.getTime()))
69155           return null;
69156         return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
69157       }
69158     },
69159     getSelectedImage: function() {
69160       return _oscSelectedImage;
69161     },
69162     getSequenceKeyForImage: function(d) {
69163       return d && d.sequence_id;
69164     },
69165     setStyles: function(context, hovered, reset) {
69166       if (reset) {
69167         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
69168         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
69169       }
69170       var hoveredImageKey = hovered && hovered.key;
69171       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
69172       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
69173       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
69174         return d.key;
69175       }) || [];
69176       var viewer = context.container().select(".photoviewer");
69177       var selected = viewer.empty() ? void 0 : viewer.datum();
69178       var selectedImageKey = selected && selected.key;
69179       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
69180       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
69181       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
69182         return d.key;
69183       }) || [];
69184       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
69185       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
69186         return highlightedImageKeys.indexOf(d.key) !== -1;
69187       }).classed("hovered", function(d) {
69188         return d.key === hoveredImageKey;
69189       }).classed("currentView", function(d) {
69190         return d.key === selectedImageKey;
69191       });
69192       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
69193         return d.properties.key === hoveredSequenceKey;
69194       }).classed("currentView", function(d) {
69195         return d.properties.key === selectedSequenceKey;
69196       });
69197       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
69198       function viewfieldPath() {
69199         var d = this.parentNode.__data__;
69200         if (d.pano && d.key !== selectedImageKey) {
69201           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
69202         } else {
69203           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
69204         }
69205       }
69206       return this;
69207     },
69208     updateUrlImage: function(imageKey) {
69209       if (!window.mocha) {
69210         var hash = utilStringQs(window.location.hash);
69211         if (imageKey) {
69212           hash.photo = "kartaview/" + imageKey;
69213         } else {
69214           delete hash.photo;
69215         }
69216         window.location.replace("#" + utilQsString(hash, true));
69217       }
69218     },
69219     cache: function() {
69220       return _oscCache;
69221     }
69222   };
69223
69224   // node_modules/osm-auth/src/osm-auth.mjs
69225   var import_store = __toESM(require_store_legacy(), 1);
69226   function osmAuth(o) {
69227     var oauth2 = {};
69228     oauth2.authenticated = function() {
69229       return !!token("oauth2_access_token");
69230     };
69231     oauth2.logout = function() {
69232       token("oauth2_access_token", "");
69233       token("oauth_token", "");
69234       token("oauth_token_secret", "");
69235       token("oauth_request_token_secret", "");
69236       return oauth2;
69237     };
69238     oauth2.authenticate = function(callback) {
69239       if (oauth2.authenticated()) {
69240         callback(null, oauth2);
69241         return;
69242       }
69243       oauth2.logout();
69244       var url = o.url + "/oauth2/authorize?" + utilQsString2({
69245         client_id: o.client_id,
69246         redirect_uri: o.redirect_uri,
69247         response_type: "code",
69248         scope: o.scope
69249       });
69250       if (!o.singlepage) {
69251         var w = 600;
69252         var h = 550;
69253         var settings = [
69254           ["width", w],
69255           ["height", h],
69256           ["left", screen.width / 2 - w / 2],
69257           ["top", screen.height / 2 - h / 2]
69258         ].map(function(x) {
69259           return x.join("=");
69260         }).join(",");
69261         var popup = window.open("about:blank", "oauth_window", settings);
69262         oauth2.popupWindow = popup;
69263         popup.location = url;
69264         if (!popup) {
69265           var error = new Error("Popup was blocked");
69266           error.status = "popup-blocked";
69267           throw error;
69268         }
69269       }
69270       window.authComplete = function(url2) {
69271         var params = utilStringQs2(url2.split("?")[1]);
69272         getAccessToken(params.code);
69273         delete window.authComplete;
69274       };
69275       function getAccessToken(auth_code) {
69276         var url2 = o.url + "/oauth2/token?" + utilQsString2({
69277           client_id: o.client_id,
69278           grant_type: "authorization_code",
69279           code: auth_code,
69280           redirect_uri: o.redirect_uri,
69281           client_secret: o.client_secret
69282         });
69283         oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
69284         o.loading();
69285       }
69286       function accessTokenDone(err, xhr) {
69287         o.done();
69288         if (err) {
69289           callback(err);
69290           return;
69291         }
69292         var access_token = JSON.parse(xhr.response);
69293         token("oauth2_access_token", access_token.access_token);
69294         callback(null, oauth2);
69295       }
69296     };
69297     oauth2.bringPopupWindowToFront = function() {
69298       var broughtPopupToFront = false;
69299       try {
69300         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
69301           oauth2.popupWindow.focus();
69302           broughtPopupToFront = true;
69303         }
69304       } catch (err) {
69305       }
69306       return broughtPopupToFront;
69307     };
69308     oauth2.bootstrapToken = function(auth_code, callback) {
69309       function getAccessToken(auth_code2) {
69310         var url = o.url + "/oauth2/token?" + utilQsString2({
69311           client_id: o.client_id,
69312           grant_type: "authorization_code",
69313           code: auth_code2,
69314           redirect_uri: o.redirect_uri,
69315           client_secret: o.client_secret
69316         });
69317         oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
69318         o.loading();
69319       }
69320       function accessTokenDone(err, xhr) {
69321         o.done();
69322         if (err) {
69323           callback(err);
69324           return;
69325         }
69326         var access_token = JSON.parse(xhr.response);
69327         token("oauth2_access_token", access_token.access_token);
69328         callback(null, oauth2);
69329       }
69330       getAccessToken(auth_code);
69331     };
69332     oauth2.xhr = function(options2, callback) {
69333       if (oauth2.authenticated()) {
69334         return run();
69335       } else {
69336         if (o.auto) {
69337           oauth2.authenticate(run);
69338           return;
69339         } else {
69340           callback("not authenticated", null);
69341           return;
69342         }
69343       }
69344       function run() {
69345         var url = options2.prefix !== false ? o.url + options2.path : options2.path;
69346         return oauth2.rawxhr(options2.method, url, token("oauth2_access_token"), options2.content, options2.headers, done);
69347       }
69348       function done(err, xhr) {
69349         if (err) {
69350           callback(err);
69351         } else if (xhr.responseXML) {
69352           callback(err, xhr.responseXML);
69353         } else {
69354           callback(err, xhr.response);
69355         }
69356       }
69357     };
69358     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
69359       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
69360       if (access_token) {
69361         headers.Authorization = "Bearer " + access_token;
69362       }
69363       var xhr = new XMLHttpRequest();
69364       xhr.onreadystatechange = function() {
69365         if (xhr.readyState === 4 && xhr.status !== 0) {
69366           if (/^20\d$/.test(xhr.status)) {
69367             callback(null, xhr);
69368           } else {
69369             callback(xhr, null);
69370           }
69371         }
69372       };
69373       xhr.onerror = function(e) {
69374         callback(e, null);
69375       };
69376       xhr.open(method, url, true);
69377       for (var h in headers)
69378         xhr.setRequestHeader(h, headers[h]);
69379       xhr.send(data);
69380       return xhr;
69381     };
69382     oauth2.preauth = function(val) {
69383       if (val && val.access_token) {
69384         token("oauth2_access_token", val.access_token);
69385       }
69386       return oauth2;
69387     };
69388     oauth2.options = function(val) {
69389       if (!arguments.length)
69390         return o;
69391       o = val;
69392       o.url = o.url || "https://www.openstreetmap.org";
69393       o.auto = o.auto || false;
69394       o.singlepage = o.singlepage || false;
69395       o.loading = o.loading || function() {
69396       };
69397       o.done = o.done || function() {
69398       };
69399       return oauth2.preauth(o);
69400     };
69401     var token;
69402     if (import_store.default.enabled) {
69403       token = function(x, y) {
69404         if (arguments.length === 1)
69405           return import_store.default.get(o.url + x);
69406         else if (arguments.length === 2)
69407           return import_store.default.set(o.url + x, y);
69408       };
69409     } else {
69410       var storage = {};
69411       token = function(x, y) {
69412         if (arguments.length === 1)
69413           return storage[o.url + x];
69414         else if (arguments.length === 2)
69415           return storage[o.url + x] = y;
69416       };
69417     }
69418     oauth2.options(o);
69419     return oauth2;
69420   }
69421   function utilQsString2(obj) {
69422     return Object.keys(obj).sort().map(function(key) {
69423       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
69424     }).join("&");
69425   }
69426   function utilStringQs2(str2) {
69427     var i2 = 0;
69428     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
69429       i2++;
69430     str2 = str2.slice(i2);
69431     return str2.split("&").reduce(function(obj, pair2) {
69432       var parts = pair2.split("=");
69433       if (parts.length === 2) {
69434         obj[parts[0]] = decodeURIComponent(parts[1]);
69435       }
69436       return obj;
69437     }, {});
69438   }
69439
69440   // modules/services/osm.js
69441   var import_rbush9 = __toESM(require_rbush_min());
69442   var tiler5 = utilTiler();
69443   var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
69444   var urlroot = "https://www.openstreetmap.org";
69445   var redirectPath = window.location.origin + window.location.pathname;
69446   var oauth = osmAuth({
69447     url: urlroot,
69448     client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
69449     client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q",
69450     scope: "read_prefs write_prefs write_api read_gpx write_notes",
69451     redirect_uri: redirectPath + "land.html",
69452     loading: authLoading,
69453     done: authDone
69454   });
69455   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
69456   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
69457   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
69458   var _userCache = { toLoad: {}, user: {} };
69459   var _cachedApiStatus;
69460   var _changeset = {};
69461   var _deferred = /* @__PURE__ */ new Set();
69462   var _connectionID = 1;
69463   var _tileZoom4 = 16;
69464   var _noteZoom = 12;
69465   var _rateLimitError;
69466   var _userChangesets;
69467   var _userDetails;
69468   var _off;
69469   var _maxWayNodes = 2e3;
69470   function authLoading() {
69471     dispatch7.call("authLoading");
69472   }
69473   function authDone() {
69474     dispatch7.call("authDone");
69475   }
69476   function abortRequest5(controllerOrXHR) {
69477     if (controllerOrXHR) {
69478       controllerOrXHR.abort();
69479     }
69480   }
69481   function hasInflightRequests(cache) {
69482     return Object.keys(cache.inflight).length;
69483   }
69484   function abortUnwantedRequests4(cache, visibleTiles) {
69485     Object.keys(cache.inflight).forEach(function(k) {
69486       if (cache.toLoad[k])
69487         return;
69488       if (visibleTiles.find(function(tile) {
69489         return k === tile.id;
69490       }))
69491         return;
69492       abortRequest5(cache.inflight[k]);
69493       delete cache.inflight[k];
69494     });
69495   }
69496   function getLoc(attrs) {
69497     var lon = attrs.lon && attrs.lon.value;
69498     var lat = attrs.lat && attrs.lat.value;
69499     return [parseFloat(lon), parseFloat(lat)];
69500   }
69501   function getNodes(obj) {
69502     var elems = obj.getElementsByTagName("nd");
69503     var nodes = new Array(elems.length);
69504     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69505       nodes[i2] = "n" + elems[i2].attributes.ref.value;
69506     }
69507     return nodes;
69508   }
69509   function getNodesJSON(obj) {
69510     var elems = obj.nodes;
69511     var nodes = new Array(elems.length);
69512     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69513       nodes[i2] = "n" + elems[i2];
69514     }
69515     return nodes;
69516   }
69517   function getTags(obj) {
69518     var elems = obj.getElementsByTagName("tag");
69519     var tags = {};
69520     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69521       var attrs = elems[i2].attributes;
69522       tags[attrs.k.value] = attrs.v.value;
69523     }
69524     return tags;
69525   }
69526   function getMembers(obj) {
69527     var elems = obj.getElementsByTagName("member");
69528     var members = new Array(elems.length);
69529     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69530       var attrs = elems[i2].attributes;
69531       members[i2] = {
69532         id: attrs.type.value[0] + attrs.ref.value,
69533         type: attrs.type.value,
69534         role: attrs.role.value
69535       };
69536     }
69537     return members;
69538   }
69539   function getMembersJSON(obj) {
69540     var elems = obj.members;
69541     var members = new Array(elems.length);
69542     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
69543       var attrs = elems[i2];
69544       members[i2] = {
69545         id: attrs.type[0] + attrs.ref,
69546         type: attrs.type,
69547         role: attrs.role
69548       };
69549     }
69550     return members;
69551   }
69552   function getVisible(attrs) {
69553     return !attrs.visible || attrs.visible.value !== "false";
69554   }
69555   function parseComments(comments) {
69556     var parsedComments = [];
69557     for (var i2 = 0; i2 < comments.length; i2++) {
69558       var comment = comments[i2];
69559       if (comment.nodeName === "comment") {
69560         var childNodes = comment.childNodes;
69561         var parsedComment = {};
69562         for (var j2 = 0; j2 < childNodes.length; j2++) {
69563           var node = childNodes[j2];
69564           var nodeName = node.nodeName;
69565           if (nodeName === "#text")
69566             continue;
69567           parsedComment[nodeName] = node.textContent;
69568           if (nodeName === "uid") {
69569             var uid = node.textContent;
69570             if (uid && !_userCache.user[uid]) {
69571               _userCache.toLoad[uid] = true;
69572             }
69573           }
69574         }
69575         if (parsedComment) {
69576           parsedComments.push(parsedComment);
69577         }
69578       }
69579     }
69580     return parsedComments;
69581   }
69582   function encodeNoteRtree(note) {
69583     return {
69584       minX: note.loc[0],
69585       minY: note.loc[1],
69586       maxX: note.loc[0],
69587       maxY: note.loc[1],
69588       data: note
69589     };
69590   }
69591   var jsonparsers = {
69592     node: function nodeData(obj, uid) {
69593       return new osmNode({
69594         id: uid,
69595         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69596         version: obj.version && obj.version.toString(),
69597         changeset: obj.changeset && obj.changeset.toString(),
69598         timestamp: obj.timestamp,
69599         user: obj.user,
69600         uid: obj.uid && obj.uid.toString(),
69601         loc: [parseFloat(obj.lon), parseFloat(obj.lat)],
69602         tags: obj.tags
69603       });
69604     },
69605     way: function wayData(obj, uid) {
69606       return new osmWay({
69607         id: uid,
69608         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69609         version: obj.version && obj.version.toString(),
69610         changeset: obj.changeset && obj.changeset.toString(),
69611         timestamp: obj.timestamp,
69612         user: obj.user,
69613         uid: obj.uid && obj.uid.toString(),
69614         tags: obj.tags,
69615         nodes: getNodesJSON(obj)
69616       });
69617     },
69618     relation: function relationData(obj, uid) {
69619       return new osmRelation({
69620         id: uid,
69621         visible: typeof obj.visible === "boolean" ? obj.visible : true,
69622         version: obj.version && obj.version.toString(),
69623         changeset: obj.changeset && obj.changeset.toString(),
69624         timestamp: obj.timestamp,
69625         user: obj.user,
69626         uid: obj.uid && obj.uid.toString(),
69627         tags: obj.tags,
69628         members: getMembersJSON(obj)
69629       });
69630     },
69631     user: function parseUser(obj, uid) {
69632       return {
69633         id: uid,
69634         display_name: obj.display_name,
69635         account_created: obj.account_created,
69636         image_url: obj.img && obj.img.href,
69637         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
69638         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
69639       };
69640     }
69641   };
69642   function parseJSON(payload, callback, options2) {
69643     options2 = Object.assign({ skipSeen: true }, options2);
69644     if (!payload) {
69645       return callback({ message: "No JSON", status: -1 });
69646     }
69647     var json = payload;
69648     if (typeof json !== "object")
69649       json = JSON.parse(payload);
69650     if (!json.elements)
69651       return callback({ message: "No JSON", status: -1 });
69652     var children2 = json.elements;
69653     var handle = window.requestIdleCallback(function() {
69654       _deferred.delete(handle);
69655       var results = [];
69656       var result;
69657       for (var i2 = 0; i2 < children2.length; i2++) {
69658         result = parseChild(children2[i2]);
69659         if (result)
69660           results.push(result);
69661       }
69662       callback(null, results);
69663     });
69664     _deferred.add(handle);
69665     function parseChild(child) {
69666       var parser3 = jsonparsers[child.type];
69667       if (!parser3)
69668         return null;
69669       var uid;
69670       uid = osmEntity.id.fromOSM(child.type, child.id);
69671       if (options2.skipSeen) {
69672         if (_tileCache.seen[uid])
69673           return null;
69674         _tileCache.seen[uid] = true;
69675       }
69676       return parser3(child, uid);
69677     }
69678   }
69679   function parseUserJSON(payload, callback, options2) {
69680     options2 = Object.assign({ skipSeen: true }, options2);
69681     if (!payload) {
69682       return callback({ message: "No JSON", status: -1 });
69683     }
69684     var json = payload;
69685     if (typeof json !== "object")
69686       json = JSON.parse(payload);
69687     if (!json.users && !json.user)
69688       return callback({ message: "No JSON", status: -1 });
69689     var objs = json.users || [json];
69690     var handle = window.requestIdleCallback(function() {
69691       _deferred.delete(handle);
69692       var results = [];
69693       var result;
69694       for (var i2 = 0; i2 < objs.length; i2++) {
69695         result = parseObj(objs[i2]);
69696         if (result)
69697           results.push(result);
69698       }
69699       callback(null, results);
69700     });
69701     _deferred.add(handle);
69702     function parseObj(obj) {
69703       var uid = obj.user.id && obj.user.id.toString();
69704       if (options2.skipSeen && _userCache.user[uid]) {
69705         delete _userCache.toLoad[uid];
69706         return null;
69707       }
69708       var user = jsonparsers.user(obj.user, uid);
69709       _userCache.user[uid] = user;
69710       delete _userCache.toLoad[uid];
69711       return user;
69712     }
69713   }
69714   var parsers = {
69715     node: function nodeData2(obj, uid) {
69716       var attrs = obj.attributes;
69717       return new osmNode({
69718         id: uid,
69719         visible: getVisible(attrs),
69720         version: attrs.version.value,
69721         changeset: attrs.changeset && attrs.changeset.value,
69722         timestamp: attrs.timestamp && attrs.timestamp.value,
69723         user: attrs.user && attrs.user.value,
69724         uid: attrs.uid && attrs.uid.value,
69725         loc: getLoc(attrs),
69726         tags: getTags(obj)
69727       });
69728     },
69729     way: function wayData2(obj, uid) {
69730       var attrs = obj.attributes;
69731       return new osmWay({
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         tags: getTags(obj),
69740         nodes: getNodes(obj)
69741       });
69742     },
69743     relation: function relationData2(obj, uid) {
69744       var attrs = obj.attributes;
69745       return new osmRelation({
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         members: getMembers(obj)
69755       });
69756     },
69757     note: function parseNote(obj, uid) {
69758       var attrs = obj.attributes;
69759       var childNodes = obj.childNodes;
69760       var props = {};
69761       props.id = uid;
69762       props.loc = getLoc(attrs);
69763       var coincident = false;
69764       var epsilon3 = 1e-5;
69765       do {
69766         if (coincident) {
69767           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
69768         }
69769         var bbox = geoExtent(props.loc).bbox();
69770         coincident = _noteCache.rtree.search(bbox).length;
69771       } while (coincident);
69772       for (var i2 = 0; i2 < childNodes.length; i2++) {
69773         var node = childNodes[i2];
69774         var nodeName = node.nodeName;
69775         if (nodeName === "#text")
69776           continue;
69777         if (nodeName === "comments") {
69778           props[nodeName] = parseComments(node.childNodes);
69779         } else {
69780           props[nodeName] = node.textContent;
69781         }
69782       }
69783       var note = new osmNote(props);
69784       var item = encodeNoteRtree(note);
69785       _noteCache.note[note.id] = note;
69786       _noteCache.rtree.insert(item);
69787       return note;
69788     },
69789     user: function parseUser2(obj, uid) {
69790       var attrs = obj.attributes;
69791       var user = {
69792         id: uid,
69793         display_name: attrs.display_name && attrs.display_name.value,
69794         account_created: attrs.account_created && attrs.account_created.value,
69795         changesets_count: "0",
69796         active_blocks: "0"
69797       };
69798       var img = obj.getElementsByTagName("img");
69799       if (img && img[0] && img[0].getAttribute("href")) {
69800         user.image_url = img[0].getAttribute("href");
69801       }
69802       var changesets = obj.getElementsByTagName("changesets");
69803       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
69804         user.changesets_count = changesets[0].getAttribute("count");
69805       }
69806       var blocks = obj.getElementsByTagName("blocks");
69807       if (blocks && blocks[0]) {
69808         var received = blocks[0].getElementsByTagName("received");
69809         if (received && received[0] && received[0].getAttribute("active")) {
69810           user.active_blocks = received[0].getAttribute("active");
69811         }
69812       }
69813       _userCache.user[uid] = user;
69814       delete _userCache.toLoad[uid];
69815       return user;
69816     }
69817   };
69818   function parseXML(xml, callback, options2) {
69819     options2 = Object.assign({ skipSeen: true }, options2);
69820     if (!xml || !xml.childNodes) {
69821       return callback({ message: "No XML", status: -1 });
69822     }
69823     var root3 = xml.childNodes[0];
69824     var children2 = root3.childNodes;
69825     var handle = window.requestIdleCallback(function() {
69826       _deferred.delete(handle);
69827       var results = [];
69828       var result;
69829       for (var i2 = 0; i2 < children2.length; i2++) {
69830         result = parseChild(children2[i2]);
69831         if (result)
69832           results.push(result);
69833       }
69834       callback(null, results);
69835     });
69836     _deferred.add(handle);
69837     function parseChild(child) {
69838       var parser3 = parsers[child.nodeName];
69839       if (!parser3)
69840         return null;
69841       var uid;
69842       if (child.nodeName === "user") {
69843         uid = child.attributes.id.value;
69844         if (options2.skipSeen && _userCache.user[uid]) {
69845           delete _userCache.toLoad[uid];
69846           return null;
69847         }
69848       } else if (child.nodeName === "note") {
69849         uid = child.getElementsByTagName("id")[0].textContent;
69850       } else {
69851         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
69852         if (options2.skipSeen) {
69853           if (_tileCache.seen[uid])
69854             return null;
69855           _tileCache.seen[uid] = true;
69856         }
69857       }
69858       return parser3(child, uid);
69859     }
69860   }
69861   function updateRtree4(item, replace) {
69862     _noteCache.rtree.remove(item, function isEql(a, b) {
69863       return a.data.id === b.data.id;
69864     });
69865     if (replace) {
69866       _noteCache.rtree.insert(item);
69867     }
69868   }
69869   function wrapcb(thisArg, callback, cid) {
69870     return function(err, result) {
69871       if (err) {
69872         if (err.status === 400 || err.status === 401 || err.status === 403) {
69873           thisArg.logout();
69874         }
69875         return callback.call(thisArg, err);
69876       } else if (thisArg.getConnectionId() !== cid) {
69877         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
69878       } else {
69879         return callback.call(thisArg, err, result);
69880       }
69881     };
69882   }
69883   var osm_default = {
69884     init: function() {
69885       utilRebind(this, dispatch7, "on");
69886     },
69887     reset: function() {
69888       Array.from(_deferred).forEach(function(handle) {
69889         window.cancelIdleCallback(handle);
69890         _deferred.delete(handle);
69891       });
69892       _connectionID++;
69893       _userChangesets = void 0;
69894       _userDetails = void 0;
69895       _rateLimitError = void 0;
69896       Object.values(_tileCache.inflight).forEach(abortRequest5);
69897       Object.values(_noteCache.inflight).forEach(abortRequest5);
69898       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
69899       if (_changeset.inflight)
69900         abortRequest5(_changeset.inflight);
69901       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
69902       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
69903       _userCache = { toLoad: {}, user: {} };
69904       _cachedApiStatus = void 0;
69905       _changeset = {};
69906       return this;
69907     },
69908     getConnectionId: function() {
69909       return _connectionID;
69910     },
69911     getUrlRoot: function() {
69912       return urlroot;
69913     },
69914     changesetURL: function(changesetID) {
69915       return urlroot + "/changeset/" + changesetID;
69916     },
69917     changesetsURL: function(center, zoom) {
69918       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
69919       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
69920     },
69921     entityURL: function(entity) {
69922       return urlroot + "/" + entity.type + "/" + entity.osmId();
69923     },
69924     historyURL: function(entity) {
69925       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
69926     },
69927     userURL: function(username) {
69928       return urlroot + "/user/" + encodeURIComponent(username);
69929     },
69930     noteURL: function(note) {
69931       return urlroot + "/note/" + note.id;
69932     },
69933     noteReportURL: function(note) {
69934       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
69935     },
69936     loadFromAPI: function(path, callback, options2) {
69937       options2 = Object.assign({ skipSeen: true }, options2);
69938       var that = this;
69939       var cid = _connectionID;
69940       function done(err, payload) {
69941         if (that.getConnectionId() !== cid) {
69942           if (callback)
69943             callback({ message: "Connection Switched", status: -1 });
69944           return;
69945         }
69946         var isAuthenticated = that.authenticated();
69947         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
69948           that.logout();
69949           that.loadFromAPI(path, callback, options2);
69950         } else {
69951           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
69952             _rateLimitError = err;
69953             dispatch7.call("change");
69954             that.reloadApiStatus();
69955           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
69956             that.reloadApiStatus();
69957           }
69958           if (callback) {
69959             if (err) {
69960               return callback(err);
69961             } else {
69962               if (path.indexOf(".json") !== -1) {
69963                 return parseJSON(payload, callback, options2);
69964               } else {
69965                 return parseXML(payload, callback, options2);
69966               }
69967             }
69968           }
69969         }
69970       }
69971       if (this.authenticated()) {
69972         return oauth.xhr({ method: "GET", path }, done);
69973       } else {
69974         var url = urlroot + path;
69975         var controller = new AbortController();
69976         var fn;
69977         if (path.indexOf(".json") !== -1) {
69978           fn = json_default;
69979         } else {
69980           fn = xml_default;
69981         }
69982         fn(url, { signal: controller.signal }).then(function(data) {
69983           done(null, data);
69984         }).catch(function(err) {
69985           if (err.name === "AbortError")
69986             return;
69987           var match = err.message.match(/^\d{3}/);
69988           if (match) {
69989             done({ status: +match[0], statusText: err.message });
69990           } else {
69991             done(err.message);
69992           }
69993         });
69994         return controller;
69995       }
69996     },
69997     loadEntity: function(id2, callback) {
69998       var type3 = osmEntity.id.type(id2);
69999       var osmID = osmEntity.id.toOSM(id2);
70000       var options2 = { skipSeen: false };
70001       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + (type3 !== "node" ? "/full" : "") + ".json", function(err, entities) {
70002         if (callback)
70003           callback(err, { data: entities });
70004       }, options2);
70005     },
70006     loadEntityVersion: function(id2, version2, callback) {
70007       var type3 = osmEntity.id.type(id2);
70008       var osmID = osmEntity.id.toOSM(id2);
70009       var options2 = { skipSeen: false };
70010       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/" + version2 + ".json", function(err, entities) {
70011         if (callback)
70012           callback(err, { data: entities });
70013       }, options2);
70014     },
70015     loadEntityRelations: function(id2, callback) {
70016       var type3 = osmEntity.id.type(id2);
70017       var osmID = osmEntity.id.toOSM(id2);
70018       var options2 = { skipSeen: false };
70019       this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/relations.json", function(err, entities) {
70020         if (callback)
70021           callback(err, { data: entities });
70022       }, options2);
70023     },
70024     loadMultiple: function(ids, callback) {
70025       var that = this;
70026       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
70027       Object.keys(groups).forEach(function(k) {
70028         var type3 = k + "s";
70029         var osmIDs = groups[k].map(function(id2) {
70030           return osmEntity.id.toOSM(id2);
70031         });
70032         var options2 = { skipSeen: false };
70033         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
70034           that.loadFromAPI("/api/0.6/" + type3 + ".json?" + type3 + "=" + arr.join(), function(err, entities) {
70035             if (callback)
70036               callback(err, { data: entities });
70037           }, options2);
70038         });
70039       });
70040     },
70041     putChangeset: function(changeset, changes, callback) {
70042       var cid = _connectionID;
70043       if (_changeset.inflight) {
70044         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
70045       } else if (_changeset.open) {
70046         return createdChangeset.call(this, null, _changeset.open);
70047       } else {
70048         var options2 = {
70049           method: "PUT",
70050           path: "/api/0.6/changeset/create",
70051           headers: { "Content-Type": "text/xml" },
70052           content: JXON.stringify(changeset.asJXON())
70053         };
70054         _changeset.inflight = oauth.xhr(options2, wrapcb(this, createdChangeset, cid));
70055       }
70056       function createdChangeset(err, changesetID) {
70057         _changeset.inflight = null;
70058         if (err) {
70059           return callback(err, changeset);
70060         }
70061         _changeset.open = changesetID;
70062         changeset = changeset.update({ id: changesetID });
70063         var options3 = {
70064           method: "POST",
70065           path: "/api/0.6/changeset/" + changesetID + "/upload",
70066           headers: { "Content-Type": "text/xml" },
70067           content: JXON.stringify(changeset.osmChangeJXON(changes))
70068         };
70069         _changeset.inflight = oauth.xhr(options3, wrapcb(this, uploadedChangeset, cid));
70070       }
70071       function uploadedChangeset(err) {
70072         _changeset.inflight = null;
70073         if (err)
70074           return callback(err, changeset);
70075         window.setTimeout(function() {
70076           callback(null, changeset);
70077         }, 2500);
70078         _changeset.open = null;
70079         if (this.getConnectionId() === cid) {
70080           oauth.xhr({
70081             method: "PUT",
70082             path: "/api/0.6/changeset/" + changeset.id + "/close",
70083             headers: { "Content-Type": "text/xml" }
70084           }, function() {
70085             return true;
70086           });
70087         }
70088       }
70089     },
70090     loadUsers: function(uids, callback) {
70091       var toLoad = [];
70092       var cached = [];
70093       utilArrayUniq(uids).forEach(function(uid) {
70094         if (_userCache.user[uid]) {
70095           delete _userCache.toLoad[uid];
70096           cached.push(_userCache.user[uid]);
70097         } else {
70098           toLoad.push(uid);
70099         }
70100       });
70101       if (cached.length || !this.authenticated()) {
70102         callback(void 0, cached);
70103         if (!this.authenticated())
70104           return;
70105       }
70106       utilArrayChunk(toLoad, 150).forEach(function(arr) {
70107         oauth.xhr({ method: "GET", path: "/api/0.6/users.json?users=" + arr.join() }, wrapcb(this, done, _connectionID));
70108       }.bind(this));
70109       function done(err, payload) {
70110         if (err)
70111           return callback(err);
70112         var options2 = { skipSeen: true };
70113         return parseUserJSON(payload, function(err2, results) {
70114           if (err2)
70115             return callback(err2);
70116           return callback(void 0, results);
70117         }, options2);
70118       }
70119     },
70120     loadUser: function(uid, callback) {
70121       if (_userCache.user[uid] || !this.authenticated()) {
70122         delete _userCache.toLoad[uid];
70123         return callback(void 0, _userCache.user[uid]);
70124       }
70125       oauth.xhr({ method: "GET", path: "/api/0.6/user/" + uid + ".json" }, wrapcb(this, done, _connectionID));
70126       function done(err, payload) {
70127         if (err)
70128           return callback(err);
70129         var options2 = { skipSeen: true };
70130         return parseUserJSON(payload, function(err2, results) {
70131           if (err2)
70132             return callback(err2);
70133           return callback(void 0, results[0]);
70134         }, options2);
70135       }
70136     },
70137     userDetails: function(callback) {
70138       if (_userDetails) {
70139         return callback(void 0, _userDetails);
70140       }
70141       oauth.xhr({ method: "GET", path: "/api/0.6/user/details.json" }, wrapcb(this, done, _connectionID));
70142       function done(err, payload) {
70143         if (err)
70144           return callback(err);
70145         var options2 = { skipSeen: false };
70146         return parseUserJSON(payload, function(err2, results) {
70147           if (err2)
70148             return callback(err2);
70149           _userDetails = results[0];
70150           return callback(void 0, _userDetails);
70151         }, options2);
70152       }
70153     },
70154     userChangesets: function(callback) {
70155       if (_userChangesets) {
70156         return callback(void 0, _userChangesets);
70157       }
70158       this.userDetails(wrapcb(this, gotDetails, _connectionID));
70159       function gotDetails(err, user) {
70160         if (err) {
70161           return callback(err);
70162         }
70163         oauth.xhr({ method: "GET", path: "/api/0.6/changesets?user=" + user.id }, wrapcb(this, done, _connectionID));
70164       }
70165       function done(err, xml) {
70166         if (err) {
70167           return callback(err);
70168         }
70169         _userChangesets = Array.prototype.map.call(xml.getElementsByTagName("changeset"), function(changeset) {
70170           return { tags: getTags(changeset) };
70171         }).filter(function(changeset) {
70172           var comment = changeset.tags.comment;
70173           return comment && comment !== "";
70174         });
70175         return callback(void 0, _userChangesets);
70176       }
70177     },
70178     status: function(callback) {
70179       var url = urlroot + "/api/capabilities";
70180       var errback = wrapcb(this, done, _connectionID);
70181       xml_default(url).then(function(data) {
70182         errback(null, data);
70183       }).catch(function(err) {
70184         errback(err.message);
70185       });
70186       function done(err, xml) {
70187         if (err) {
70188           return callback(err, null);
70189         }
70190         var elements = xml.getElementsByTagName("blacklist");
70191         var regexes = [];
70192         for (var i2 = 0; i2 < elements.length; i2++) {
70193           var regexString = elements[i2].getAttribute("regex");
70194           if (regexString) {
70195             try {
70196               var regex = new RegExp(regexString);
70197               regexes.push(regex);
70198             } catch (e) {
70199             }
70200           }
70201         }
70202         if (regexes.length) {
70203           _imageryBlocklists = regexes;
70204         }
70205         if (_rateLimitError) {
70206           return callback(_rateLimitError, "rateLimited");
70207         } else {
70208           var waynodes = xml.getElementsByTagName("waynodes");
70209           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
70210           if (maxWayNodes && isFinite(maxWayNodes))
70211             _maxWayNodes = maxWayNodes;
70212           var apiStatus = xml.getElementsByTagName("status");
70213           var val = apiStatus[0].getAttribute("api");
70214           return callback(void 0, val);
70215         }
70216       }
70217     },
70218     reloadApiStatus: function() {
70219       if (!this.throttledReloadApiStatus) {
70220         var that = this;
70221         this.throttledReloadApiStatus = throttle_default(function() {
70222           that.status(function(err, status) {
70223             if (status !== _cachedApiStatus) {
70224               _cachedApiStatus = status;
70225               dispatch7.call("apiStatusChange", that, err, status);
70226             }
70227           });
70228         }, 500);
70229       }
70230       this.throttledReloadApiStatus();
70231     },
70232     maxWayNodes: function() {
70233       return _maxWayNodes;
70234     },
70235     loadTiles: function(projection2, callback) {
70236       if (_off)
70237         return;
70238       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
70239       var hadRequests = hasInflightRequests(_tileCache);
70240       abortUnwantedRequests4(_tileCache, tiles);
70241       if (hadRequests && !hasInflightRequests(_tileCache)) {
70242         dispatch7.call("loaded");
70243       }
70244       tiles.forEach(function(tile) {
70245         this.loadTile(tile, callback);
70246       }, this);
70247     },
70248     loadTile: function(tile, callback) {
70249       if (_off)
70250         return;
70251       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
70252         return;
70253       if (!hasInflightRequests(_tileCache)) {
70254         dispatch7.call("loading");
70255       }
70256       var path = "/api/0.6/map.json?bbox=";
70257       var options2 = { skipSeen: true };
70258       _tileCache.inflight[tile.id] = this.loadFromAPI(path + tile.extent.toParam(), tileCallback, options2);
70259       function tileCallback(err, parsed) {
70260         delete _tileCache.inflight[tile.id];
70261         if (!err) {
70262           delete _tileCache.toLoad[tile.id];
70263           _tileCache.loaded[tile.id] = true;
70264           var bbox = tile.extent.bbox();
70265           bbox.id = tile.id;
70266           _tileCache.rtree.insert(bbox);
70267         }
70268         if (callback) {
70269           callback(err, Object.assign({ data: parsed }, tile));
70270         }
70271         if (!hasInflightRequests(_tileCache)) {
70272           dispatch7.call("loaded");
70273         }
70274       }
70275     },
70276     isDataLoaded: function(loc) {
70277       var bbox = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
70278       return _tileCache.rtree.collides(bbox);
70279     },
70280     loadTileAtLoc: function(loc, callback) {
70281       if (Object.keys(_tileCache.toLoad).length > 50)
70282         return;
70283       var k = geoZoomToScale(_tileZoom4 + 1);
70284       var offset = geoRawMercator().scale(k)(loc);
70285       var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
70286       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
70287       tiles.forEach(function(tile) {
70288         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
70289           return;
70290         _tileCache.toLoad[tile.id] = true;
70291         this.loadTile(tile, callback);
70292       }, this);
70293     },
70294     loadNotes: function(projection2, noteOptions) {
70295       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
70296       if (_off)
70297         return;
70298       var that = this;
70299       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
70300       var throttleLoadUsers = throttle_default(function() {
70301         var uids = Object.keys(_userCache.toLoad);
70302         if (!uids.length)
70303           return;
70304         that.loadUsers(uids, function() {
70305         });
70306       }, 750);
70307       var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
70308       abortUnwantedRequests4(_noteCache, tiles);
70309       tiles.forEach(function(tile) {
70310         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
70311           return;
70312         var options2 = { skipSeen: false };
70313         _noteCache.inflight[tile.id] = that.loadFromAPI(path + tile.extent.toParam(), function(err) {
70314           delete _noteCache.inflight[tile.id];
70315           if (!err) {
70316             _noteCache.loaded[tile.id] = true;
70317           }
70318           throttleLoadUsers();
70319           dispatch7.call("loadedNotes");
70320         }, options2);
70321       });
70322     },
70323     postNoteCreate: function(note, callback) {
70324       if (!this.authenticated()) {
70325         return callback({ message: "Not Authenticated", status: -3 }, note);
70326       }
70327       if (_noteCache.inflightPost[note.id]) {
70328         return callback({ message: "Note update already inflight", status: -2 }, note);
70329       }
70330       if (!note.loc[0] || !note.loc[1] || !note.newComment)
70331         return;
70332       var comment = note.newComment;
70333       if (note.newCategory && note.newCategory !== "None") {
70334         comment += " #" + note.newCategory;
70335       }
70336       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
70337       _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
70338       function done(err, xml) {
70339         delete _noteCache.inflightPost[note.id];
70340         if (err) {
70341           return callback(err);
70342         }
70343         this.removeNote(note);
70344         var options2 = { skipSeen: false };
70345         return parseXML(xml, function(err2, results) {
70346           if (err2) {
70347             return callback(err2);
70348           } else {
70349             return callback(void 0, results[0]);
70350           }
70351         }, options2);
70352       }
70353     },
70354     postNoteUpdate: function(note, newStatus, callback) {
70355       if (!this.authenticated()) {
70356         return callback({ message: "Not Authenticated", status: -3 }, note);
70357       }
70358       if (_noteCache.inflightPost[note.id]) {
70359         return callback({ message: "Note update already inflight", status: -2 }, note);
70360       }
70361       var action;
70362       if (note.status !== "closed" && newStatus === "closed") {
70363         action = "close";
70364       } else if (note.status !== "open" && newStatus === "open") {
70365         action = "reopen";
70366       } else {
70367         action = "comment";
70368         if (!note.newComment)
70369           return;
70370       }
70371       var path = "/api/0.6/notes/" + note.id + "/" + action;
70372       if (note.newComment) {
70373         path += "?" + utilQsString({ text: note.newComment });
70374       }
70375       _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
70376       function done(err, xml) {
70377         delete _noteCache.inflightPost[note.id];
70378         if (err) {
70379           return callback(err);
70380         }
70381         this.removeNote(note);
70382         if (action === "close") {
70383           _noteCache.closed[note.id] = true;
70384         } else if (action === "reopen") {
70385           delete _noteCache.closed[note.id];
70386         }
70387         var options2 = { skipSeen: false };
70388         return parseXML(xml, function(err2, results) {
70389           if (err2) {
70390             return callback(err2);
70391           } else {
70392             return callback(void 0, results[0]);
70393           }
70394         }, options2);
70395       }
70396     },
70397     switch: function(newOptions) {
70398       urlroot = newOptions.url;
70399       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
70400       oauth.options(Object.assign(oldOptions, newOptions));
70401       this.reset();
70402       this.userChangesets(function() {
70403       });
70404       dispatch7.call("change");
70405       return this;
70406     },
70407     toggle: function(val) {
70408       _off = !val;
70409       return this;
70410     },
70411     isChangesetInflight: function() {
70412       return !!_changeset.inflight;
70413     },
70414     caches: function(obj) {
70415       function cloneCache(source) {
70416         var target = {};
70417         Object.keys(source).forEach(function(k) {
70418           if (k === "rtree") {
70419             target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
70420           } else if (k === "note") {
70421             target.note = {};
70422             Object.keys(source.note).forEach(function(id2) {
70423               target.note[id2] = osmNote(source.note[id2]);
70424             });
70425           } else {
70426             target[k] = JSON.parse(JSON.stringify(source[k]));
70427           }
70428         });
70429         return target;
70430       }
70431       if (!arguments.length) {
70432         return {
70433           tile: cloneCache(_tileCache),
70434           note: cloneCache(_noteCache),
70435           user: cloneCache(_userCache)
70436         };
70437       }
70438       if (obj === "get") {
70439         return {
70440           tile: _tileCache,
70441           note: _noteCache,
70442           user: _userCache
70443         };
70444       }
70445       if (obj.tile) {
70446         _tileCache = obj.tile;
70447         _tileCache.inflight = {};
70448       }
70449       if (obj.note) {
70450         _noteCache = obj.note;
70451         _noteCache.inflight = {};
70452         _noteCache.inflightPost = {};
70453       }
70454       if (obj.user) {
70455         _userCache = obj.user;
70456       }
70457       return this;
70458     },
70459     logout: function() {
70460       _userChangesets = void 0;
70461       _userDetails = void 0;
70462       oauth.logout();
70463       dispatch7.call("change");
70464       return this;
70465     },
70466     authenticated: function() {
70467       return oauth.authenticated();
70468     },
70469     authenticate: function(callback) {
70470       var that = this;
70471       var cid = _connectionID;
70472       _userChangesets = void 0;
70473       _userDetails = void 0;
70474       function done(err, res) {
70475         if (err) {
70476           if (callback)
70477             callback(err);
70478           return;
70479         }
70480         if (that.getConnectionId() !== cid) {
70481           if (callback)
70482             callback({ message: "Connection Switched", status: -1 });
70483           return;
70484         }
70485         _rateLimitError = void 0;
70486         dispatch7.call("change");
70487         if (callback)
70488           callback(err, res);
70489         that.userChangesets(function() {
70490         });
70491       }
70492       oauth.authenticate(done);
70493     },
70494     imageryBlocklists: function() {
70495       return _imageryBlocklists;
70496     },
70497     tileZoom: function(val) {
70498       if (!arguments.length)
70499         return _tileZoom4;
70500       _tileZoom4 = val;
70501       return this;
70502     },
70503     notes: function(projection2) {
70504       var viewport = projection2.clipExtent();
70505       var min3 = [viewport[0][0], viewport[1][1]];
70506       var max3 = [viewport[1][0], viewport[0][1]];
70507       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
70508       return _noteCache.rtree.search(bbox).map(function(d) {
70509         return d.data;
70510       });
70511     },
70512     getNote: function(id2) {
70513       return _noteCache.note[id2];
70514     },
70515     removeNote: function(note) {
70516       if (!(note instanceof osmNote) || !note.id)
70517         return;
70518       delete _noteCache.note[note.id];
70519       updateRtree4(encodeNoteRtree(note), false);
70520     },
70521     replaceNote: function(note) {
70522       if (!(note instanceof osmNote) || !note.id)
70523         return;
70524       _noteCache.note[note.id] = note;
70525       updateRtree4(encodeNoteRtree(note), true);
70526       return note;
70527     },
70528     getClosedIDs: function() {
70529       return Object.keys(_noteCache.closed).sort();
70530     }
70531   };
70532
70533   // modules/services/osm_wikibase.js
70534   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
70535   var _inflight2 = {};
70536   var _wikibaseCache = {};
70537   var _localeIDs = { en: false };
70538   var debouncedRequest = debounce_default(request, 500, { leading: false });
70539   function request(url, callback) {
70540     if (_inflight2[url])
70541       return;
70542     var controller = new AbortController();
70543     _inflight2[url] = controller;
70544     json_default(url, { signal: controller.signal }).then(function(result) {
70545       delete _inflight2[url];
70546       if (callback)
70547         callback(null, result);
70548     }).catch(function(err) {
70549       delete _inflight2[url];
70550       if (err.name === "AbortError")
70551         return;
70552       if (callback)
70553         callback(err.message);
70554     });
70555   }
70556   var osm_wikibase_default = {
70557     init: function() {
70558       _inflight2 = {};
70559       _wikibaseCache = {};
70560       _localeIDs = {};
70561     },
70562     reset: function() {
70563       Object.values(_inflight2).forEach(function(controller) {
70564         controller.abort();
70565       });
70566       _inflight2 = {};
70567     },
70568     claimToValue: function(entity, property, langCode) {
70569       if (!entity.claims[property])
70570         return void 0;
70571       var locale2 = _localeIDs[langCode];
70572       var preferredPick, localePick;
70573       entity.claims[property].forEach(function(stmt) {
70574         if (!preferredPick && stmt.rank === "preferred") {
70575           preferredPick = stmt;
70576         }
70577         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
70578           localePick = stmt;
70579         }
70580       });
70581       var result = localePick || preferredPick;
70582       if (result) {
70583         var datavalue = result.mainsnak.datavalue;
70584         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
70585       } else {
70586         return void 0;
70587       }
70588     },
70589     monolingualClaimToValueObj: function(entity, property) {
70590       if (!entity || !entity.claims[property])
70591         return void 0;
70592       return entity.claims[property].reduce(function(acc, obj) {
70593         var value = obj.mainsnak.datavalue.value;
70594         acc[value.language] = value.text;
70595         return acc;
70596       }, {});
70597     },
70598     toSitelink: function(key, value) {
70599       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
70600       return result.replace(/_/g, " ").trim();
70601     },
70602     getEntity: function(params, callback) {
70603       var doRequest = params.debounce ? debouncedRequest : request;
70604       var that = this;
70605       var titles = [];
70606       var result = {};
70607       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
70608       var keySitelink = params.key ? this.toSitelink(params.key) : false;
70609       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
70610       var localeSitelink;
70611       if (params.langCodes) {
70612         params.langCodes.forEach(function(langCode) {
70613           if (_localeIDs[langCode] === void 0) {
70614             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
70615             titles.push(localeSitelink);
70616           }
70617         });
70618       }
70619       if (rtypeSitelink) {
70620         if (_wikibaseCache[rtypeSitelink]) {
70621           result.rtype = _wikibaseCache[rtypeSitelink];
70622         } else {
70623           titles.push(rtypeSitelink);
70624         }
70625       }
70626       if (keySitelink) {
70627         if (_wikibaseCache[keySitelink]) {
70628           result.key = _wikibaseCache[keySitelink];
70629         } else {
70630           titles.push(keySitelink);
70631         }
70632       }
70633       if (tagSitelink) {
70634         if (_wikibaseCache[tagSitelink]) {
70635           result.tag = _wikibaseCache[tagSitelink];
70636         } else {
70637           titles.push(tagSitelink);
70638         }
70639       }
70640       if (!titles.length) {
70641         return callback(null, result);
70642       }
70643       var obj = {
70644         action: "wbgetentities",
70645         sites: "wiki",
70646         titles: titles.join("|"),
70647         languages: params.langCodes.join("|"),
70648         languagefallback: 1,
70649         origin: "*",
70650         format: "json"
70651       };
70652       var url = apibase3 + "?" + utilQsString(obj);
70653       doRequest(url, function(err, d) {
70654         if (err) {
70655           callback(err);
70656         } else if (!d.success || d.error) {
70657           callback(d.error.messages.map(function(v) {
70658             return v.html["*"];
70659           }).join("<br>"));
70660         } else {
70661           var localeID = false;
70662           Object.values(d.entities).forEach(function(res) {
70663             if (res.missing !== "") {
70664               var title = res.sitelinks.wiki.title;
70665               if (title === rtypeSitelink) {
70666                 _wikibaseCache[rtypeSitelink] = res;
70667                 result.rtype = res;
70668               } else if (title === keySitelink) {
70669                 _wikibaseCache[keySitelink] = res;
70670                 result.key = res;
70671               } else if (title === tagSitelink) {
70672                 _wikibaseCache[tagSitelink] = res;
70673                 result.tag = res;
70674               } else if (title === localeSitelink) {
70675                 localeID = res.id;
70676               } else {
70677                 console.log("Unexpected title " + title);
70678               }
70679             }
70680           });
70681           if (localeSitelink) {
70682             that.addLocale(params.langCodes[0], localeID);
70683           }
70684           callback(null, result);
70685         }
70686       });
70687     },
70688     getDocs: function(params, callback) {
70689       var that = this;
70690       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
70691         return code.toLowerCase();
70692       });
70693       params.langCodes = langCodes;
70694       this.getEntity(params, function(err, data) {
70695         if (err) {
70696           callback(err);
70697           return;
70698         }
70699         var entity = data.rtype || data.tag || data.key;
70700         if (!entity) {
70701           callback("No entity");
70702           return;
70703         }
70704         var i2;
70705         var description2;
70706         for (i2 in langCodes) {
70707           let code2 = langCodes[i2];
70708           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
70709             description2 = entity.descriptions[code2];
70710             break;
70711           }
70712         }
70713         if (!description2 && Object.values(entity.descriptions).length)
70714           description2 = Object.values(entity.descriptions)[0];
70715         var result = {
70716           title: entity.title,
70717           description: description2 ? description2.value : "",
70718           descriptionLocaleCode: description2 ? description2.language : "",
70719           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
70720         };
70721         if (entity.claims) {
70722           var imageroot;
70723           var image = that.claimToValue(entity, "P4", langCodes[0]);
70724           if (image) {
70725             imageroot = "https://commons.wikimedia.org/w/index.php";
70726           } else {
70727             image = that.claimToValue(entity, "P28", langCodes[0]);
70728             if (image) {
70729               imageroot = "https://wiki.openstreetmap.org/w/index.php";
70730             }
70731           }
70732           if (imageroot && image) {
70733             result.imageURL = imageroot + "?" + utilQsString({
70734               title: "Special:Redirect/file/" + image,
70735               width: 400
70736             });
70737           }
70738         }
70739         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
70740         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
70741         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
70742         var wikis = [rtypeWiki, tagWiki, keyWiki];
70743         for (i2 in wikis) {
70744           var wiki = wikis[i2];
70745           for (var j2 in langCodes) {
70746             var code = langCodes[j2];
70747             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
70748             var info = getWikiInfo(wiki, code, referenceId);
70749             if (info) {
70750               result.wiki = info;
70751               break;
70752             }
70753           }
70754           if (result.wiki)
70755             break;
70756         }
70757         callback(null, result);
70758         function getWikiInfo(wiki2, langCode, tKey) {
70759           if (wiki2 && wiki2[langCode]) {
70760             return {
70761               title: wiki2[langCode],
70762               text: tKey,
70763               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
70764             };
70765           }
70766         }
70767       });
70768     },
70769     addLocale: function(langCode, qid) {
70770       _localeIDs[langCode] = qid;
70771     },
70772     apibase: function(val) {
70773       if (!arguments.length)
70774         return apibase3;
70775       apibase3 = val;
70776       return this;
70777     }
70778   };
70779
70780   // modules/services/streetside.js
70781   var import_rbush10 = __toESM(require_rbush_min());
70782
70783   // modules/util/jsonp_request.js
70784   var jsonpCache = {};
70785   window.jsonpCache = jsonpCache;
70786   function jsonpRequest(url, callback) {
70787     var request3 = {
70788       abort: function() {
70789       }
70790     };
70791     if (window.JSONP_FIX) {
70792       if (window.JSONP_DELAY === 0) {
70793         callback(window.JSONP_FIX);
70794       } else {
70795         var t = window.setTimeout(function() {
70796           callback(window.JSONP_FIX);
70797         }, window.JSONP_DELAY || 0);
70798         request3.abort = function() {
70799           window.clearTimeout(t);
70800         };
70801       }
70802       return request3;
70803     }
70804     function rand() {
70805       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
70806       var c = "";
70807       var i2 = -1;
70808       while (++i2 < 15)
70809         c += chars.charAt(Math.floor(Math.random() * 52));
70810       return c;
70811     }
70812     function create2(url2) {
70813       var e = url2.match(/callback=(\w+)/);
70814       var c = e ? e[1] : rand();
70815       jsonpCache[c] = function(data) {
70816         if (jsonpCache[c]) {
70817           callback(data);
70818         }
70819         finalize();
70820       };
70821       function finalize() {
70822         delete jsonpCache[c];
70823         script.remove();
70824       }
70825       request3.abort = finalize;
70826       return "jsonpCache." + c;
70827     }
70828     var cb = create2(url);
70829     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
70830     return request3;
70831   }
70832
70833   // modules/services/streetside.js
70834   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
70835   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
70836   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
70837   var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
70838   var pannellumViewerJS = "pannellum-streetside/pannellum.js";
70839   var maxResults2 = 2e3;
70840   var tileZoom2 = 16.5;
70841   var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
70842   var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
70843   var minHfov = 10;
70844   var maxHfov = 90;
70845   var defaultHfov = 45;
70846   var _hires = false;
70847   var _resolution = 512;
70848   var _currScene = 0;
70849   var _ssCache;
70850   var _pannellumViewer;
70851   var _sceneOptions = {
70852     showFullscreenCtrl: false,
70853     autoLoad: true,
70854     compass: true,
70855     yaw: 0,
70856     minHfov,
70857     maxHfov,
70858     hfov: defaultHfov,
70859     type: "cubemap",
70860     cubeMap: []
70861   };
70862   var _loadViewerPromise3;
70863   function abortRequest6(i2) {
70864     i2.abort();
70865   }
70866   function localeTimestamp(s) {
70867     if (!s)
70868       return null;
70869     const options2 = { day: "numeric", month: "short", year: "numeric" };
70870     const d = new Date(s);
70871     if (isNaN(d.getTime()))
70872       return null;
70873     return d.toLocaleString(_mainLocalizer.localeCode(), options2);
70874   }
70875   function loadTiles3(which, url, projection2, margin) {
70876     const tiles = tiler6.margin(margin).getTiles(projection2);
70877     const cache = _ssCache[which];
70878     Object.keys(cache.inflight).forEach((k) => {
70879       const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
70880       if (!wanted) {
70881         abortRequest6(cache.inflight[k]);
70882         delete cache.inflight[k];
70883       }
70884     });
70885     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
70886   }
70887   function loadNextTilePage2(which, url, tile) {
70888     const cache = _ssCache[which];
70889     const nextPage = cache.nextPage[tile.id] || 0;
70890     const id2 = tile.id + "," + String(nextPage);
70891     if (cache.loaded[id2] || cache.inflight[id2])
70892       return;
70893     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
70894       cache.loaded[id2] = true;
70895       delete cache.inflight[id2];
70896       if (!bubbles)
70897         return;
70898       bubbles.shift();
70899       const features2 = bubbles.map((bubble) => {
70900         if (cache.points[bubble.id])
70901           return null;
70902         const loc = [bubble.lo, bubble.la];
70903         const d = {
70904           loc,
70905           key: bubble.id,
70906           ca: bubble.he,
70907           captured_at: bubble.cd,
70908           captured_by: "microsoft",
70909           pr: bubble.pr,
70910           ne: bubble.ne,
70911           pano: true,
70912           sequenceKey: null
70913         };
70914         cache.points[bubble.id] = d;
70915         if (bubble.pr === void 0) {
70916           cache.leaders.push(bubble.id);
70917         }
70918         return {
70919           minX: loc[0],
70920           minY: loc[1],
70921           maxX: loc[0],
70922           maxY: loc[1],
70923           data: d
70924         };
70925       }).filter(Boolean);
70926       cache.rtree.load(features2);
70927       connectSequences();
70928       if (which === "bubbles") {
70929         dispatch8.call("loadedImages");
70930       }
70931     });
70932   }
70933   function connectSequences() {
70934     let cache = _ssCache.bubbles;
70935     let keepLeaders = [];
70936     for (let i2 = 0; i2 < cache.leaders.length; i2++) {
70937       let bubble = cache.points[cache.leaders[i2]];
70938       let seen = {};
70939       let sequence = { key: bubble.key, bubbles: [] };
70940       let complete = false;
70941       do {
70942         sequence.bubbles.push(bubble);
70943         seen[bubble.key] = true;
70944         if (bubble.ne === void 0) {
70945           complete = true;
70946         } else {
70947           bubble = cache.points[bubble.ne];
70948         }
70949       } while (bubble && !seen[bubble.key] && !complete);
70950       if (complete) {
70951         _ssCache.sequences[sequence.key] = sequence;
70952         for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
70953           sequence.bubbles[j2].sequenceKey = sequence.key;
70954         }
70955         sequence.geojson = {
70956           type: "LineString",
70957           properties: {
70958             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
70959             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
70960             key: sequence.key
70961           },
70962           coordinates: sequence.bubbles.map((d) => d.loc)
70963         };
70964       } else {
70965         keepLeaders.push(cache.leaders[i2]);
70966       }
70967     }
70968     cache.leaders = keepLeaders;
70969   }
70970   function getBubbles(url, tile, callback) {
70971     let rect = tile.extent.rectangle();
70972     let urlForRequest = url + utilQsString({
70973       n: rect[3],
70974       s: rect[1],
70975       e: rect[2],
70976       w: rect[0],
70977       c: maxResults2,
70978       appkey: bubbleAppKey,
70979       jsCallback: "{callback}"
70980     });
70981     return jsonpRequest(urlForRequest, (data) => {
70982       if (!data || data.error) {
70983         callback(null);
70984       } else {
70985         callback(data);
70986       }
70987     });
70988   }
70989   function partitionViewport3(projection2) {
70990     let z = geoScaleToZoom(projection2.scale());
70991     let z2 = Math.ceil(z * 2) / 2 + 2.5;
70992     let tiler8 = utilTiler().zoomExtent([z2, z2]);
70993     return tiler8.getTiles(projection2).map((tile) => tile.extent);
70994   }
70995   function searchLimited3(limit, projection2, rtree) {
70996     limit = limit || 5;
70997     return partitionViewport3(projection2).reduce((result, extent) => {
70998       let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
70999       return found.length ? result.concat(found) : result;
71000     }, []);
71001   }
71002   function loadImage(imgInfo) {
71003     return new Promise((resolve) => {
71004       let img = new Image();
71005       img.onload = () => {
71006         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
71007         let ctx = canvas.getContext("2d");
71008         ctx.drawImage(img, imgInfo.x, imgInfo.y);
71009         resolve({ imgInfo, status: "ok" });
71010       };
71011       img.onerror = () => {
71012         resolve({ data: imgInfo, status: "error" });
71013       };
71014       img.setAttribute("crossorigin", "");
71015       img.src = imgInfo.url;
71016     });
71017   }
71018   function loadCanvas(imageGroup) {
71019     return Promise.all(imageGroup.map(loadImage)).then((data) => {
71020       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
71021       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
71022       let face = data[0].imgInfo.face;
71023       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
71024       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
71025     });
71026   }
71027   function loadFaces(faceGroup) {
71028     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
71029       return { status: "loadFaces done" };
71030     });
71031   }
71032   function setupCanvas(selection2, reset) {
71033     if (reset) {
71034       selection2.selectAll("#ideditor-stitcher-canvases").remove();
71035     }
71036     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);
71037   }
71038   function qkToXY(qk) {
71039     let x = 0;
71040     let y = 0;
71041     let scale = 256;
71042     for (let i2 = qk.length; i2 > 0; i2--) {
71043       const key = qk[i2 - 1];
71044       x += +(key === "1" || key === "3") * scale;
71045       y += +(key === "2" || key === "3") * scale;
71046       scale *= 2;
71047     }
71048     return [x, y];
71049   }
71050   function getQuadKeys() {
71051     let dim = _resolution / 256;
71052     let quadKeys;
71053     if (dim === 16) {
71054       quadKeys = [
71055         "0000",
71056         "0001",
71057         "0010",
71058         "0011",
71059         "0100",
71060         "0101",
71061         "0110",
71062         "0111",
71063         "1000",
71064         "1001",
71065         "1010",
71066         "1011",
71067         "1100",
71068         "1101",
71069         "1110",
71070         "1111",
71071         "0002",
71072         "0003",
71073         "0012",
71074         "0013",
71075         "0102",
71076         "0103",
71077         "0112",
71078         "0113",
71079         "1002",
71080         "1003",
71081         "1012",
71082         "1013",
71083         "1102",
71084         "1103",
71085         "1112",
71086         "1113",
71087         "0020",
71088         "0021",
71089         "0030",
71090         "0031",
71091         "0120",
71092         "0121",
71093         "0130",
71094         "0131",
71095         "1020",
71096         "1021",
71097         "1030",
71098         "1031",
71099         "1120",
71100         "1121",
71101         "1130",
71102         "1131",
71103         "0022",
71104         "0023",
71105         "0032",
71106         "0033",
71107         "0122",
71108         "0123",
71109         "0132",
71110         "0133",
71111         "1022",
71112         "1023",
71113         "1032",
71114         "1033",
71115         "1122",
71116         "1123",
71117         "1132",
71118         "1133",
71119         "0200",
71120         "0201",
71121         "0210",
71122         "0211",
71123         "0300",
71124         "0301",
71125         "0310",
71126         "0311",
71127         "1200",
71128         "1201",
71129         "1210",
71130         "1211",
71131         "1300",
71132         "1301",
71133         "1310",
71134         "1311",
71135         "0202",
71136         "0203",
71137         "0212",
71138         "0213",
71139         "0302",
71140         "0303",
71141         "0312",
71142         "0313",
71143         "1202",
71144         "1203",
71145         "1212",
71146         "1213",
71147         "1302",
71148         "1303",
71149         "1312",
71150         "1313",
71151         "0220",
71152         "0221",
71153         "0230",
71154         "0231",
71155         "0320",
71156         "0321",
71157         "0330",
71158         "0331",
71159         "1220",
71160         "1221",
71161         "1230",
71162         "1231",
71163         "1320",
71164         "1321",
71165         "1330",
71166         "1331",
71167         "0222",
71168         "0223",
71169         "0232",
71170         "0233",
71171         "0322",
71172         "0323",
71173         "0332",
71174         "0333",
71175         "1222",
71176         "1223",
71177         "1232",
71178         "1233",
71179         "1322",
71180         "1323",
71181         "1332",
71182         "1333",
71183         "2000",
71184         "2001",
71185         "2010",
71186         "2011",
71187         "2100",
71188         "2101",
71189         "2110",
71190         "2111",
71191         "3000",
71192         "3001",
71193         "3010",
71194         "3011",
71195         "3100",
71196         "3101",
71197         "3110",
71198         "3111",
71199         "2002",
71200         "2003",
71201         "2012",
71202         "2013",
71203         "2102",
71204         "2103",
71205         "2112",
71206         "2113",
71207         "3002",
71208         "3003",
71209         "3012",
71210         "3013",
71211         "3102",
71212         "3103",
71213         "3112",
71214         "3113",
71215         "2020",
71216         "2021",
71217         "2030",
71218         "2031",
71219         "2120",
71220         "2121",
71221         "2130",
71222         "2131",
71223         "3020",
71224         "3021",
71225         "3030",
71226         "3031",
71227         "3120",
71228         "3121",
71229         "3130",
71230         "3131",
71231         "2022",
71232         "2023",
71233         "2032",
71234         "2033",
71235         "2122",
71236         "2123",
71237         "2132",
71238         "2133",
71239         "3022",
71240         "3023",
71241         "3032",
71242         "3033",
71243         "3122",
71244         "3123",
71245         "3132",
71246         "3133",
71247         "2200",
71248         "2201",
71249         "2210",
71250         "2211",
71251         "2300",
71252         "2301",
71253         "2310",
71254         "2311",
71255         "3200",
71256         "3201",
71257         "3210",
71258         "3211",
71259         "3300",
71260         "3301",
71261         "3310",
71262         "3311",
71263         "2202",
71264         "2203",
71265         "2212",
71266         "2213",
71267         "2302",
71268         "2303",
71269         "2312",
71270         "2313",
71271         "3202",
71272         "3203",
71273         "3212",
71274         "3213",
71275         "3302",
71276         "3303",
71277         "3312",
71278         "3313",
71279         "2220",
71280         "2221",
71281         "2230",
71282         "2231",
71283         "2320",
71284         "2321",
71285         "2330",
71286         "2331",
71287         "3220",
71288         "3221",
71289         "3230",
71290         "3231",
71291         "3320",
71292         "3321",
71293         "3330",
71294         "3331",
71295         "2222",
71296         "2223",
71297         "2232",
71298         "2233",
71299         "2322",
71300         "2323",
71301         "2332",
71302         "2333",
71303         "3222",
71304         "3223",
71305         "3232",
71306         "3233",
71307         "3322",
71308         "3323",
71309         "3332",
71310         "3333"
71311       ];
71312     } else if (dim === 8) {
71313       quadKeys = [
71314         "000",
71315         "001",
71316         "010",
71317         "011",
71318         "100",
71319         "101",
71320         "110",
71321         "111",
71322         "002",
71323         "003",
71324         "012",
71325         "013",
71326         "102",
71327         "103",
71328         "112",
71329         "113",
71330         "020",
71331         "021",
71332         "030",
71333         "031",
71334         "120",
71335         "121",
71336         "130",
71337         "131",
71338         "022",
71339         "023",
71340         "032",
71341         "033",
71342         "122",
71343         "123",
71344         "132",
71345         "133",
71346         "200",
71347         "201",
71348         "210",
71349         "211",
71350         "300",
71351         "301",
71352         "310",
71353         "311",
71354         "202",
71355         "203",
71356         "212",
71357         "213",
71358         "302",
71359         "303",
71360         "312",
71361         "313",
71362         "220",
71363         "221",
71364         "230",
71365         "231",
71366         "320",
71367         "321",
71368         "330",
71369         "331",
71370         "222",
71371         "223",
71372         "232",
71373         "233",
71374         "322",
71375         "323",
71376         "332",
71377         "333"
71378       ];
71379     } else if (dim === 4) {
71380       quadKeys = [
71381         "00",
71382         "01",
71383         "10",
71384         "11",
71385         "02",
71386         "03",
71387         "12",
71388         "13",
71389         "20",
71390         "21",
71391         "30",
71392         "31",
71393         "22",
71394         "23",
71395         "32",
71396         "33"
71397       ];
71398     } else {
71399       quadKeys = [
71400         "0",
71401         "1",
71402         "2",
71403         "3"
71404       ];
71405     }
71406     return quadKeys;
71407   }
71408   var streetside_default = {
71409     init: function() {
71410       if (!_ssCache) {
71411         this.reset();
71412       }
71413       this.event = utilRebind(this, dispatch8, "on");
71414     },
71415     reset: function() {
71416       if (_ssCache) {
71417         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
71418       }
71419       _ssCache = {
71420         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
71421         sequences: {}
71422       };
71423     },
71424     bubbles: function(projection2) {
71425       const limit = 5;
71426       return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
71427     },
71428     cachedImage: function(imageKey) {
71429       return _ssCache.bubbles.points[imageKey];
71430     },
71431     sequences: function(projection2) {
71432       const viewport = projection2.clipExtent();
71433       const min3 = [viewport[0][0], viewport[1][1]];
71434       const max3 = [viewport[1][0], viewport[0][1]];
71435       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
71436       let seen = {};
71437       let results = [];
71438       _ssCache.bubbles.rtree.search(bbox).forEach((d) => {
71439         const key = d.data.sequenceKey;
71440         if (key && !seen[key]) {
71441           seen[key] = true;
71442           results.push(_ssCache.sequences[key].geojson);
71443         }
71444       });
71445       return results;
71446     },
71447     loadBubbles: function(projection2, margin) {
71448       if (margin === void 0)
71449         margin = 2;
71450       loadTiles3("bubbles", bubbleApi, projection2, margin);
71451     },
71452     viewer: function() {
71453       return _pannellumViewer;
71454     },
71455     initViewer: function() {
71456       if (!window.pannellum)
71457         return;
71458       if (_pannellumViewer)
71459         return;
71460       _currScene += 1;
71461       const sceneID = _currScene.toString();
71462       const options2 = {
71463         "default": { firstScene: sceneID },
71464         scenes: {}
71465       };
71466       options2.scenes[sceneID] = _sceneOptions;
71467       _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
71468     },
71469     ensureViewerLoaded: function(context) {
71470       if (_loadViewerPromise3)
71471         return _loadViewerPromise3;
71472       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
71473       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
71474       let that = this;
71475       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71476       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
71477         select_default2(window).on(pointerPrefix + "move.streetside", () => {
71478           dispatch8.call("viewerChanged");
71479         }, true);
71480       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
71481         select_default2(window).on(pointerPrefix + "move.streetside", null);
71482         let t = timer((elapsed) => {
71483           dispatch8.call("viewerChanged");
71484           if (elapsed > 2e3) {
71485             t.stop();
71486           }
71487         });
71488       }).append("div").attr("class", "photo-attribution fillD");
71489       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
71490       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
71491       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
71492       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
71493       context.ui().photoviewer.on("resize.streetside", () => {
71494         if (_pannellumViewer) {
71495           _pannellumViewer.resize();
71496         }
71497       });
71498       _loadViewerPromise3 = new Promise((resolve, reject) => {
71499         let loadedCount = 0;
71500         function loaded() {
71501           loadedCount += 1;
71502           if (loadedCount === 2)
71503             resolve();
71504         }
71505         const head = select_default2("head");
71506         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() {
71507           reject();
71508         });
71509         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() {
71510           reject();
71511         });
71512       }).catch(function() {
71513         _loadViewerPromise3 = null;
71514       });
71515       return _loadViewerPromise3;
71516       function step(stepBy) {
71517         return () => {
71518           let viewer = context.container().select(".photoviewer");
71519           let selected = viewer.empty() ? void 0 : viewer.datum();
71520           if (!selected)
71521             return;
71522           let nextID = stepBy === 1 ? selected.ne : selected.pr;
71523           let yaw = _pannellumViewer.getYaw();
71524           let ca = selected.ca + yaw;
71525           let origin = selected.loc;
71526           const meters = 35;
71527           let p1 = [
71528             origin[0] + geoMetersToLon(meters / 5, origin[1]),
71529             origin[1]
71530           ];
71531           let p2 = [
71532             origin[0] + geoMetersToLon(meters / 2, origin[1]),
71533             origin[1] + geoMetersToLat(meters)
71534           ];
71535           let p3 = [
71536             origin[0] - geoMetersToLon(meters / 2, origin[1]),
71537             origin[1] + geoMetersToLat(meters)
71538           ];
71539           let p4 = [
71540             origin[0] - geoMetersToLon(meters / 5, origin[1]),
71541             origin[1]
71542           ];
71543           let poly = [p1, p2, p3, p4, p1];
71544           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
71545           poly = geoRotate(poly, -angle2, origin);
71546           let extent = poly.reduce((extent2, point) => {
71547             return extent2.extend(geoExtent(point));
71548           }, geoExtent());
71549           let minDist = Infinity;
71550           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
71551             if (d.data.key === selected.key)
71552               return;
71553             if (!geoPointInPolygon(d.data.loc, poly))
71554               return;
71555             let dist = geoVecLength(d.data.loc, selected.loc);
71556             let theta = selected.ca - d.data.ca;
71557             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
71558             if (minTheta > 20) {
71559               dist += 5;
71560             }
71561             if (dist < minDist) {
71562               nextID = d.data.key;
71563               minDist = dist;
71564             }
71565           });
71566           let nextBubble = nextID && that.cachedImage(nextID);
71567           if (!nextBubble)
71568             return;
71569           context.map().centerEase(nextBubble.loc);
71570           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
71571         };
71572       }
71573     },
71574     yaw: function(yaw) {
71575       if (typeof yaw !== "number")
71576         return yaw;
71577       _sceneOptions.yaw = yaw;
71578       return this;
71579     },
71580     showViewer: function(context) {
71581       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
71582       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
71583       if (isHidden) {
71584         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
71585         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
71586       }
71587       return this;
71588     },
71589     hideViewer: function(context) {
71590       let viewer = context.container().select(".photoviewer");
71591       if (!viewer.empty())
71592         viewer.datum(null);
71593       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
71594       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
71595       this.updateUrlImage(null);
71596       return this.setStyles(context, null, true);
71597     },
71598     selectImage: function(context, key) {
71599       let that = this;
71600       let d = this.cachedImage(key);
71601       let viewer = context.container().select(".photoviewer");
71602       if (!viewer.empty())
71603         viewer.datum(d);
71604       this.setStyles(context, null, true);
71605       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
71606       let attribution = wrap2.selectAll(".photo-attribution").html("");
71607       wrap2.selectAll(".pnlm-load-box").style("display", "block");
71608       if (!d)
71609         return this;
71610       this.updateUrlImage(key);
71611       _sceneOptions.northOffset = d.ca;
71612       let line1 = attribution.append("div").attr("class", "attribution-row");
71613       const hiresDomId = utilUniqueDomId("streetside-hires");
71614       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
71615       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
71616         d3_event.stopPropagation();
71617         _hires = !_hires;
71618         _resolution = _hires ? 1024 : 512;
71619         wrap2.call(setupCanvas, true);
71620         let viewstate = {
71621           yaw: _pannellumViewer.getYaw(),
71622           pitch: _pannellumViewer.getPitch(),
71623           hfov: _pannellumViewer.getHfov()
71624         };
71625         _sceneOptions = Object.assign(_sceneOptions, viewstate);
71626         that.selectImage(context, d.key).showViewer(context);
71627       });
71628       label.append("span").call(_t.append("streetside.hires"));
71629       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
71630       if (d.captured_by) {
71631         const yyyy = new Date().getFullYear();
71632         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
71633         captureInfo.append("span").text("|");
71634       }
71635       if (d.captured_at) {
71636         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
71637       }
71638       let line2 = attribution.append("div").attr("class", "attribution-row");
71639       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"));
71640       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"));
71641       let bubbleIdQuadKey = d.key.toString(4);
71642       const paddingNeeded = 16 - bubbleIdQuadKey.length;
71643       for (let i2 = 0; i2 < paddingNeeded; i2++) {
71644         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
71645       }
71646       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
71647       const imgUrlSuffix = ".jpg?g=6338&n=z";
71648       const faceKeys = ["01", "02", "03", "10", "11", "12"];
71649       let quadKeys = getQuadKeys();
71650       let faces = faceKeys.map((faceKey) => {
71651         return quadKeys.map((quadKey) => {
71652           const xy = qkToXY(quadKey);
71653           return {
71654             face: faceKey,
71655             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
71656             x: xy[0],
71657             y: xy[1]
71658           };
71659         });
71660       });
71661       loadFaces(faces).then(function() {
71662         if (!_pannellumViewer) {
71663           that.initViewer();
71664         } else {
71665           _currScene += 1;
71666           let sceneID = _currScene.toString();
71667           _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
71668           if (_currScene > 2) {
71669             sceneID = (_currScene - 1).toString();
71670             _pannellumViewer.removeScene(sceneID);
71671           }
71672         }
71673       });
71674       return this;
71675     },
71676     getSequenceKeyForBubble: function(d) {
71677       return d && d.sequenceKey;
71678     },
71679     setStyles: function(context, hovered, reset) {
71680       if (reset) {
71681         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
71682         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
71683       }
71684       let hoveredBubbleKey = hovered && hovered.key;
71685       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
71686       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
71687       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
71688       let viewer = context.container().select(".photoviewer");
71689       let selected = viewer.empty() ? void 0 : viewer.datum();
71690       let selectedBubbleKey = selected && selected.key;
71691       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
71692       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
71693       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
71694       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
71695       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);
71696       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
71697       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
71698       function viewfieldPath() {
71699         let d = this.parentNode.__data__;
71700         if (d.pano && d.key !== selectedBubbleKey) {
71701           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
71702         } else {
71703           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
71704         }
71705       }
71706       return this;
71707     },
71708     updateUrlImage: function(imageKey) {
71709       if (!window.mocha) {
71710         var hash = utilStringQs(window.location.hash);
71711         if (imageKey) {
71712           hash.photo = "streetside/" + imageKey;
71713         } else {
71714           delete hash.photo;
71715         }
71716         window.location.replace("#" + utilQsString(hash, true));
71717       }
71718     },
71719     cache: function() {
71720       return _ssCache;
71721     }
71722   };
71723
71724   // modules/services/taginfo.js
71725   var apibase4 = "https://taginfo.openstreetmap.org/api/4/";
71726   var _inflight3 = {};
71727   var _popularKeys = {};
71728   var _taginfoCache = {};
71729   var tag_sorts = {
71730     point: "count_nodes",
71731     vertex: "count_nodes",
71732     area: "count_ways",
71733     line: "count_ways"
71734   };
71735   var tag_sort_members = {
71736     point: "count_node_members",
71737     vertex: "count_node_members",
71738     area: "count_way_members",
71739     line: "count_way_members",
71740     relation: "count_relation_members"
71741   };
71742   var tag_filters = {
71743     point: "nodes",
71744     vertex: "nodes",
71745     area: "ways",
71746     line: "ways"
71747   };
71748   var tag_members_fractions = {
71749     point: "count_node_members_fraction",
71750     vertex: "count_node_members_fraction",
71751     area: "count_way_members_fraction",
71752     line: "count_way_members_fraction",
71753     relation: "count_relation_members_fraction"
71754   };
71755   function sets(params, n2, o) {
71756     if (params.geometry && o[params.geometry]) {
71757       params[n2] = o[params.geometry];
71758     }
71759     return params;
71760   }
71761   function setFilter(params) {
71762     return sets(params, "filter", tag_filters);
71763   }
71764   function setSort(params) {
71765     return sets(params, "sortname", tag_sorts);
71766   }
71767   function setSortMembers(params) {
71768     return sets(params, "sortname", tag_sort_members);
71769   }
71770   function clean(params) {
71771     return utilObjectOmit(params, ["geometry", "debounce"]);
71772   }
71773   function filterKeys(type3) {
71774     var count_type = type3 ? "count_" + type3 : "count_all";
71775     return function(d) {
71776       return parseFloat(d[count_type]) > 2500 || d.in_wiki;
71777     };
71778   }
71779   function filterMultikeys(prefix) {
71780     return function(d) {
71781       var re2 = new RegExp("^" + prefix + "(.*)$");
71782       var matches = d.key.match(re2) || [];
71783       return matches.length === 2 && matches[1].indexOf(":") === -1;
71784     };
71785   }
71786   function filterValues(allowUpperCase) {
71787     return function(d) {
71788       if (d.value.match(/[;,]/) !== null)
71789         return false;
71790       if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
71791         return false;
71792       return parseFloat(d.fraction) > 0;
71793     };
71794   }
71795   function filterRoles(geometry) {
71796     return function(d) {
71797       if (d.role === "")
71798         return false;
71799       if (d.role.match(/[A-Z*;,]/) !== null)
71800         return false;
71801       return parseFloat(d[tag_members_fractions[geometry]]) > 0;
71802     };
71803   }
71804   function valKey(d) {
71805     return {
71806       value: d.key,
71807       title: d.key
71808     };
71809   }
71810   function valKeyDescription(d) {
71811     var obj = {
71812       value: d.value,
71813       title: d.description || d.value
71814     };
71815     if (d.count) {
71816       obj.count = d.count;
71817     }
71818     return obj;
71819   }
71820   function roleKey(d) {
71821     return {
71822       value: d.role,
71823       title: d.role
71824     };
71825   }
71826   function sortKeys(a, b) {
71827     return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
71828   }
71829   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
71830   function request2(url, params, exactMatch, callback, loaded) {
71831     if (_inflight3[url])
71832       return;
71833     if (checkCache(url, params, exactMatch, callback))
71834       return;
71835     var controller = new AbortController();
71836     _inflight3[url] = controller;
71837     json_default(url, { signal: controller.signal }).then(function(result) {
71838       delete _inflight3[url];
71839       if (loaded)
71840         loaded(null, result);
71841     }).catch(function(err) {
71842       delete _inflight3[url];
71843       if (err.name === "AbortError")
71844         return;
71845       if (loaded)
71846         loaded(err.message);
71847     });
71848   }
71849   function checkCache(url, params, exactMatch, callback) {
71850     var rp = params.rp || 25;
71851     var testQuery = params.query || "";
71852     var testUrl = url;
71853     do {
71854       var hit = _taginfoCache[testUrl];
71855       if (hit && (url === testUrl || hit.length < rp)) {
71856         callback(null, hit);
71857         return true;
71858       }
71859       if (exactMatch || !testQuery.length)
71860         return false;
71861       testQuery = testQuery.slice(0, -1);
71862       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
71863     } while (testQuery.length >= 0);
71864     return false;
71865   }
71866   var taginfo_default = {
71867     init: function() {
71868       _inflight3 = {};
71869       _taginfoCache = {};
71870       _popularKeys = {
71871         postal_code: true,
71872         full_name: true,
71873         loc_name: true,
71874         reg_name: true,
71875         short_name: true,
71876         sorting_name: true,
71877         artist_name: true,
71878         nat_name: true,
71879         long_name: true,
71880         "bridge:name": true
71881       };
71882       var params = {
71883         rp: 100,
71884         sortname: "values_all",
71885         sortorder: "desc",
71886         page: 1,
71887         debounce: false,
71888         lang: _mainLocalizer.languageCode()
71889       };
71890       this.keys(params, function(err, data) {
71891         if (err)
71892           return;
71893         data.forEach(function(d) {
71894           if (d.value === "opening_hours")
71895             return;
71896           _popularKeys[d.value] = true;
71897         });
71898       });
71899     },
71900     reset: function() {
71901       Object.values(_inflight3).forEach(function(controller) {
71902         controller.abort();
71903       });
71904       _inflight3 = {};
71905     },
71906     keys: function(params, callback) {
71907       var doRequest = params.debounce ? debouncedRequest2 : request2;
71908       params = clean(setSort(params));
71909       params = Object.assign({
71910         rp: 10,
71911         sortname: "count_all",
71912         sortorder: "desc",
71913         page: 1,
71914         lang: _mainLocalizer.languageCode()
71915       }, params);
71916       var url = apibase4 + "keys/all?" + utilQsString(params);
71917       doRequest(url, params, false, callback, function(err, d) {
71918         if (err) {
71919           callback(err);
71920         } else {
71921           var f2 = filterKeys(params.filter);
71922           var result = d.data.filter(f2).sort(sortKeys).map(valKey);
71923           _taginfoCache[url] = result;
71924           callback(null, result);
71925         }
71926       });
71927     },
71928     multikeys: function(params, callback) {
71929       var doRequest = params.debounce ? debouncedRequest2 : request2;
71930       params = clean(setSort(params));
71931       params = Object.assign({
71932         rp: 25,
71933         sortname: "count_all",
71934         sortorder: "desc",
71935         page: 1,
71936         lang: _mainLocalizer.languageCode()
71937       }, params);
71938       var prefix = params.query;
71939       var url = apibase4 + "keys/all?" + utilQsString(params);
71940       doRequest(url, params, true, callback, function(err, d) {
71941         if (err) {
71942           callback(err);
71943         } else {
71944           var f2 = filterMultikeys(prefix);
71945           var result = d.data.filter(f2).map(valKey);
71946           _taginfoCache[url] = result;
71947           callback(null, result);
71948         }
71949       });
71950     },
71951     values: function(params, callback) {
71952       var key = params.key;
71953       if (key && _popularKeys[key]) {
71954         callback(null, []);
71955         return;
71956       }
71957       var doRequest = params.debounce ? debouncedRequest2 : request2;
71958       params = clean(setSort(setFilter(params)));
71959       params = Object.assign({
71960         rp: 25,
71961         sortname: "count_all",
71962         sortorder: "desc",
71963         page: 1,
71964         lang: _mainLocalizer.languageCode()
71965       }, params);
71966       var url = apibase4 + "key/values?" + utilQsString(params);
71967       doRequest(url, params, false, callback, function(err, d) {
71968         if (err) {
71969           callback(err);
71970         } else {
71971           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/;
71972           var allowUpperCase = re2.test(params.key);
71973           var f2 = filterValues(allowUpperCase);
71974           var result = d.data.filter(f2).map(valKeyDescription);
71975           _taginfoCache[url] = result;
71976           callback(null, result);
71977         }
71978       });
71979     },
71980     roles: function(params, callback) {
71981       var doRequest = params.debounce ? debouncedRequest2 : request2;
71982       var geometry = params.geometry;
71983       params = clean(setSortMembers(params));
71984       params = Object.assign({
71985         rp: 25,
71986         sortname: "count_all_members",
71987         sortorder: "desc",
71988         page: 1,
71989         lang: _mainLocalizer.languageCode()
71990       }, params);
71991       var url = apibase4 + "relation/roles?" + utilQsString(params);
71992       doRequest(url, params, true, callback, function(err, d) {
71993         if (err) {
71994           callback(err);
71995         } else {
71996           var f2 = filterRoles(geometry);
71997           var result = d.data.filter(f2).map(roleKey);
71998           _taginfoCache[url] = result;
71999           callback(null, result);
72000         }
72001       });
72002     },
72003     docs: function(params, callback) {
72004       var doRequest = params.debounce ? debouncedRequest2 : request2;
72005       params = clean(setSort(params));
72006       var path = "key/wiki_pages?";
72007       if (params.value) {
72008         path = "tag/wiki_pages?";
72009       } else if (params.rtype) {
72010         path = "relation/wiki_pages?";
72011       }
72012       var url = apibase4 + path + utilQsString(params);
72013       doRequest(url, params, true, callback, function(err, d) {
72014         if (err) {
72015           callback(err);
72016         } else {
72017           _taginfoCache[url] = d.data;
72018           callback(null, d.data);
72019         }
72020       });
72021     },
72022     apibase: function(_) {
72023       if (!arguments.length)
72024         return apibase4;
72025       apibase4 = _;
72026       return this;
72027     }
72028   };
72029
72030   // modules/services/vector_tile.js
72031   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
72032
72033   // node_modules/@turf/helpers/dist/es/index.js
72034   var earthRadius = 63710088e-1;
72035   var factors = {
72036     centimeters: earthRadius * 100,
72037     centimetres: earthRadius * 100,
72038     degrees: earthRadius / 111325,
72039     feet: earthRadius * 3.28084,
72040     inches: earthRadius * 39.37,
72041     kilometers: earthRadius / 1e3,
72042     kilometres: earthRadius / 1e3,
72043     meters: earthRadius,
72044     metres: earthRadius,
72045     miles: earthRadius / 1609.344,
72046     millimeters: earthRadius * 1e3,
72047     millimetres: earthRadius * 1e3,
72048     nauticalmiles: earthRadius / 1852,
72049     radians: 1,
72050     yards: earthRadius * 1.0936
72051   };
72052   var unitsFactors = {
72053     centimeters: 100,
72054     centimetres: 100,
72055     degrees: 1 / 111325,
72056     feet: 3.28084,
72057     inches: 39.37,
72058     kilometers: 1 / 1e3,
72059     kilometres: 1 / 1e3,
72060     meters: 1,
72061     metres: 1,
72062     miles: 1 / 1609.344,
72063     millimeters: 1e3,
72064     millimetres: 1e3,
72065     nauticalmiles: 1 / 1852,
72066     radians: 1 / earthRadius,
72067     yards: 1.0936133
72068   };
72069   function feature2(geom, properties, options2) {
72070     if (options2 === void 0) {
72071       options2 = {};
72072     }
72073     var feat = { type: "Feature" };
72074     if (options2.id === 0 || options2.id) {
72075       feat.id = options2.id;
72076     }
72077     if (options2.bbox) {
72078       feat.bbox = options2.bbox;
72079     }
72080     feat.properties = properties || {};
72081     feat.geometry = geom;
72082     return feat;
72083   }
72084   function polygon(coordinates, properties, options2) {
72085     if (options2 === void 0) {
72086       options2 = {};
72087     }
72088     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
72089       var ring = coordinates_1[_i];
72090       if (ring.length < 4) {
72091         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
72092       }
72093       for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
72094         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
72095           throw new Error("First and last Position are not equivalent.");
72096         }
72097       }
72098     }
72099     var geom = {
72100       type: "Polygon",
72101       coordinates
72102     };
72103     return feature2(geom, properties, options2);
72104   }
72105   function lineString(coordinates, properties, options2) {
72106     if (options2 === void 0) {
72107       options2 = {};
72108     }
72109     if (coordinates.length < 2) {
72110       throw new Error("coordinates must be an array of two or more positions");
72111     }
72112     var geom = {
72113       type: "LineString",
72114       coordinates
72115     };
72116     return feature2(geom, properties, options2);
72117   }
72118   function multiLineString(coordinates, properties, options2) {
72119     if (options2 === void 0) {
72120       options2 = {};
72121     }
72122     var geom = {
72123       type: "MultiLineString",
72124       coordinates
72125     };
72126     return feature2(geom, properties, options2);
72127   }
72128   function multiPolygon(coordinates, properties, options2) {
72129     if (options2 === void 0) {
72130       options2 = {};
72131     }
72132     var geom = {
72133       type: "MultiPolygon",
72134       coordinates
72135     };
72136     return feature2(geom, properties, options2);
72137   }
72138
72139   // node_modules/@turf/invariant/dist/es/index.js
72140   function getGeom(geojson) {
72141     if (geojson.type === "Feature") {
72142       return geojson.geometry;
72143     }
72144     return geojson;
72145   }
72146
72147   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
72148   function lineclip(points, bbox, result) {
72149     var len = points.length, codeA = bitCode(points[0], bbox), part = [], i2, codeB, lastCode;
72150     var a;
72151     var b;
72152     if (!result)
72153       result = [];
72154     for (i2 = 1; i2 < len; i2++) {
72155       a = points[i2 - 1];
72156       b = points[i2];
72157       codeB = lastCode = bitCode(b, bbox);
72158       while (true) {
72159         if (!(codeA | codeB)) {
72160           part.push(a);
72161           if (codeB !== lastCode) {
72162             part.push(b);
72163             if (i2 < len - 1) {
72164               result.push(part);
72165               part = [];
72166             }
72167           } else if (i2 === len - 1) {
72168             part.push(b);
72169           }
72170           break;
72171         } else if (codeA & codeB) {
72172           break;
72173         } else if (codeA) {
72174           a = intersect(a, b, codeA, bbox);
72175           codeA = bitCode(a, bbox);
72176         } else {
72177           b = intersect(a, b, codeB, bbox);
72178           codeB = bitCode(b, bbox);
72179         }
72180       }
72181       codeA = lastCode;
72182     }
72183     if (part.length)
72184       result.push(part);
72185     return result;
72186   }
72187   function polygonclip(points, bbox) {
72188     var result, edge, prev, prevInside, i2, p, inside;
72189     for (edge = 1; edge <= 8; edge *= 2) {
72190       result = [];
72191       prev = points[points.length - 1];
72192       prevInside = !(bitCode(prev, bbox) & edge);
72193       for (i2 = 0; i2 < points.length; i2++) {
72194         p = points[i2];
72195         inside = !(bitCode(p, bbox) & edge);
72196         if (inside !== prevInside)
72197           result.push(intersect(prev, p, edge, bbox));
72198         if (inside)
72199           result.push(p);
72200         prev = p;
72201         prevInside = inside;
72202       }
72203       points = result;
72204       if (!points.length)
72205         break;
72206     }
72207     return result;
72208   }
72209   function intersect(a, b, edge, bbox) {
72210     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;
72211   }
72212   function bitCode(p, bbox) {
72213     var code = 0;
72214     if (p[0] < bbox[0])
72215       code |= 1;
72216     else if (p[0] > bbox[2])
72217       code |= 2;
72218     if (p[1] < bbox[1])
72219       code |= 4;
72220     else if (p[1] > bbox[3])
72221       code |= 8;
72222     return code;
72223   }
72224
72225   // node_modules/@turf/bbox-clip/dist/es/index.js
72226   function bboxClip(feature3, bbox) {
72227     var geom = getGeom(feature3);
72228     var type3 = geom.type;
72229     var properties = feature3.type === "Feature" ? feature3.properties : {};
72230     var coords = geom.coordinates;
72231     switch (type3) {
72232       case "LineString":
72233       case "MultiLineString": {
72234         var lines_1 = [];
72235         if (type3 === "LineString") {
72236           coords = [coords];
72237         }
72238         coords.forEach(function(line) {
72239           lineclip(line, bbox, lines_1);
72240         });
72241         if (lines_1.length === 1) {
72242           return lineString(lines_1[0], properties);
72243         }
72244         return multiLineString(lines_1, properties);
72245       }
72246       case "Polygon":
72247         return polygon(clipPolygon(coords, bbox), properties);
72248       case "MultiPolygon":
72249         return multiPolygon(coords.map(function(poly) {
72250           return clipPolygon(poly, bbox);
72251         }), properties);
72252       default:
72253         throw new Error("geometry " + type3 + " not supported");
72254     }
72255   }
72256   function clipPolygon(rings, bbox) {
72257     var outRings = [];
72258     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
72259       var ring = rings_1[_i];
72260       var clipped = polygonclip(ring, bbox);
72261       if (clipped.length > 0) {
72262         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
72263           clipped.push(clipped[0]);
72264         }
72265         if (clipped.length >= 4) {
72266           outRings.push(clipped);
72267         }
72268       }
72269     }
72270     return outRings;
72271   }
72272
72273   // modules/services/vector_tile.js
72274   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
72275   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
72276   var import_pbf2 = __toESM(require_pbf());
72277   var import_vector_tile2 = __toESM(require_vector_tile());
72278   var tiler7 = utilTiler().tileSize(512).margin(1);
72279   var dispatch9 = dispatch_default("loadedData");
72280   var _vtCache;
72281   function abortRequest7(controller) {
72282     controller.abort();
72283   }
72284   function vtToGeoJSON(data, tile, mergeCache) {
72285     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
72286     var layers = Object.keys(vectorTile.layers);
72287     if (!Array.isArray(layers)) {
72288       layers = [layers];
72289     }
72290     var features2 = [];
72291     layers.forEach(function(layerID) {
72292       var layer = vectorTile.layers[layerID];
72293       if (layer) {
72294         for (var i2 = 0; i2 < layer.length; i2++) {
72295           var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
72296           var geometry = feature3.geometry;
72297           if (geometry.type === "Polygon") {
72298             geometry.type = "MultiPolygon";
72299             geometry.coordinates = [geometry.coordinates];
72300           }
72301           var isClipped = false;
72302           if (geometry.type === "MultiPolygon") {
72303             var featureClip = bboxClip(feature3, tile.extent.rectangle());
72304             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
72305               isClipped = true;
72306             }
72307             if (!feature3.geometry.coordinates.length)
72308               continue;
72309             if (!feature3.geometry.coordinates[0].length)
72310               continue;
72311           }
72312           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
72313           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
72314           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
72315           feature3.__featurehash__ = featurehash;
72316           feature3.__propertyhash__ = propertyhash;
72317           features2.push(feature3);
72318           if (isClipped && geometry.type === "MultiPolygon") {
72319             var merged = mergeCache[propertyhash];
72320             if (merged && merged.length) {
72321               var other = merged[0];
72322               var coords = import_polygon_clipping2.default.union(feature3.geometry.coordinates, other.geometry.coordinates);
72323               if (!coords || !coords.length) {
72324                 continue;
72325               }
72326               merged.push(feature3);
72327               for (var j2 = 0; j2 < merged.length; j2++) {
72328                 merged[j2].geometry.coordinates = coords;
72329                 merged[j2].__featurehash__ = featurehash;
72330               }
72331             } else {
72332               mergeCache[propertyhash] = [feature3];
72333             }
72334           }
72335         }
72336       }
72337     });
72338     return features2;
72339   }
72340   function loadTile2(source, tile) {
72341     if (source.loaded[tile.id] || source.inflight[tile.id])
72342       return;
72343     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) {
72344       var subdomains = r.split(",");
72345       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
72346     });
72347     var controller = new AbortController();
72348     source.inflight[tile.id] = controller;
72349     fetch(url, { signal: controller.signal }).then(function(response) {
72350       if (!response.ok) {
72351         throw new Error(response.status + " " + response.statusText);
72352       }
72353       source.loaded[tile.id] = [];
72354       delete source.inflight[tile.id];
72355       return response.arrayBuffer();
72356     }).then(function(data) {
72357       if (!data) {
72358         throw new Error("No Data");
72359       }
72360       var z = tile.xyz[2];
72361       if (!source.canMerge[z]) {
72362         source.canMerge[z] = {};
72363       }
72364       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
72365       dispatch9.call("loadedData");
72366     }).catch(function() {
72367       source.loaded[tile.id] = [];
72368       delete source.inflight[tile.id];
72369     });
72370   }
72371   var vector_tile_default = {
72372     init: function() {
72373       if (!_vtCache) {
72374         this.reset();
72375       }
72376       this.event = utilRebind(this, dispatch9, "on");
72377     },
72378     reset: function() {
72379       for (var sourceID in _vtCache) {
72380         var source = _vtCache[sourceID];
72381         if (source && source.inflight) {
72382           Object.values(source.inflight).forEach(abortRequest7);
72383         }
72384       }
72385       _vtCache = {};
72386     },
72387     addSource: function(sourceID, template) {
72388       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
72389       return _vtCache[sourceID];
72390     },
72391     data: function(sourceID, projection2) {
72392       var source = _vtCache[sourceID];
72393       if (!source)
72394         return [];
72395       var tiles = tiler7.getTiles(projection2);
72396       var seen = {};
72397       var results = [];
72398       for (var i2 = 0; i2 < tiles.length; i2++) {
72399         var features2 = source.loaded[tiles[i2].id];
72400         if (!features2 || !features2.length)
72401           continue;
72402         for (var j2 = 0; j2 < features2.length; j2++) {
72403           var feature3 = features2[j2];
72404           var hash = feature3.__featurehash__;
72405           if (seen[hash])
72406             continue;
72407           seen[hash] = true;
72408           results.push(Object.assign({}, feature3));
72409         }
72410       }
72411       return results;
72412     },
72413     loadTiles: function(sourceID, template, projection2) {
72414       var source = _vtCache[sourceID];
72415       if (!source) {
72416         source = this.addSource(sourceID, template);
72417       }
72418       var tiles = tiler7.getTiles(projection2);
72419       Object.keys(source.inflight).forEach(function(k) {
72420         var wanted = tiles.find(function(tile) {
72421           return k === tile.id;
72422         });
72423         if (!wanted) {
72424           abortRequest7(source.inflight[k]);
72425           delete source.inflight[k];
72426         }
72427       });
72428       tiles.forEach(function(tile) {
72429         loadTile2(source, tile);
72430       });
72431     },
72432     cache: function() {
72433       return _vtCache;
72434     }
72435   };
72436
72437   // modules/services/wikidata.js
72438   var apibase5 = "https://www.wikidata.org/w/api.php?";
72439   var _wikidataCache = {};
72440   var wikidata_default = {
72441     init: function() {
72442     },
72443     reset: function() {
72444       _wikidataCache = {};
72445     },
72446     itemsForSearchQuery: function(query, callback) {
72447       if (!query) {
72448         if (callback)
72449           callback("No query", {});
72450         return;
72451       }
72452       var lang = this.languagesToQuery()[0];
72453       var url = apibase5 + utilQsString({
72454         action: "wbsearchentities",
72455         format: "json",
72456         formatversion: 2,
72457         search: query,
72458         type: "item",
72459         language: lang,
72460         uselang: lang,
72461         limit: 10,
72462         origin: "*"
72463       });
72464       json_default(url).then(function(result) {
72465         if (result && result.error) {
72466           throw new Error(result.error);
72467         }
72468         if (callback)
72469           callback(null, result.search || {});
72470       }).catch(function(err) {
72471         if (callback)
72472           callback(err.message, {});
72473       });
72474     },
72475     itemsByTitle: function(lang, title, callback) {
72476       if (!title) {
72477         if (callback)
72478           callback("No title", {});
72479         return;
72480       }
72481       lang = lang || "en";
72482       var url = apibase5 + utilQsString({
72483         action: "wbgetentities",
72484         format: "json",
72485         formatversion: 2,
72486         sites: lang.replace(/-/g, "_") + "wiki",
72487         titles: title,
72488         languages: "en",
72489         origin: "*"
72490       });
72491       json_default(url).then(function(result) {
72492         if (result && result.error) {
72493           throw new Error(result.error);
72494         }
72495         if (callback)
72496           callback(null, result.entities || {});
72497       }).catch(function(err) {
72498         if (callback)
72499           callback(err.message, {});
72500       });
72501     },
72502     languagesToQuery: function() {
72503       return _mainLocalizer.localeCodes().map(function(code) {
72504         return code.toLowerCase();
72505       }).filter(function(code) {
72506         return code !== "en-us";
72507       });
72508     },
72509     entityByQID: function(qid, callback) {
72510       if (!qid) {
72511         callback("No qid", {});
72512         return;
72513       }
72514       if (_wikidataCache[qid]) {
72515         if (callback)
72516           callback(null, _wikidataCache[qid]);
72517         return;
72518       }
72519       var langs = this.languagesToQuery();
72520       var url = apibase5 + utilQsString({
72521         action: "wbgetentities",
72522         format: "json",
72523         formatversion: 2,
72524         ids: qid,
72525         props: "labels|descriptions|claims|sitelinks",
72526         sitefilter: langs.map(function(d) {
72527           return d + "wiki";
72528         }).join("|"),
72529         languages: langs.join("|"),
72530         languagefallback: 1,
72531         origin: "*"
72532       });
72533       json_default(url).then(function(result) {
72534         if (result && result.error) {
72535           throw new Error(result.error);
72536         }
72537         if (callback)
72538           callback(null, result.entities[qid] || {});
72539       }).catch(function(err) {
72540         if (callback)
72541           callback(err.message, {});
72542       });
72543     },
72544     getDocs: function(params, callback) {
72545       var langs = this.languagesToQuery();
72546       this.entityByQID(params.qid, function(err, entity) {
72547         if (err || !entity) {
72548           callback(err || "No entity");
72549           return;
72550         }
72551         var i2;
72552         var description2;
72553         for (i2 in langs) {
72554           let code = langs[i2];
72555           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
72556             description2 = entity.descriptions[code];
72557             break;
72558           }
72559         }
72560         if (!description2 && Object.values(entity.descriptions).length)
72561           description2 = Object.values(entity.descriptions)[0];
72562         var result = {
72563           title: entity.id,
72564           description: description2 ? description2.value : "",
72565           descriptionLocaleCode: description2 ? description2.language : "",
72566           editURL: "https://www.wikidata.org/wiki/" + entity.id
72567         };
72568         if (entity.claims) {
72569           var imageroot = "https://commons.wikimedia.org/w/index.php";
72570           var props = ["P154", "P18"];
72571           var prop, image;
72572           for (i2 = 0; i2 < props.length; i2++) {
72573             prop = entity.claims[props[i2]];
72574             if (prop && Object.keys(prop).length > 0) {
72575               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
72576               if (image) {
72577                 result.imageURL = imageroot + "?" + utilQsString({
72578                   title: "Special:Redirect/file/" + image,
72579                   width: 400
72580                 });
72581                 break;
72582               }
72583             }
72584           }
72585         }
72586         if (entity.sitelinks) {
72587           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
72588           for (i2 = 0; i2 < langs.length; i2++) {
72589             var w = langs[i2] + "wiki";
72590             if (entity.sitelinks[w]) {
72591               var title = entity.sitelinks[w].title;
72592               var tKey = "inspector.wiki_reference";
72593               if (!englishLocale && langs[i2] === "en") {
72594                 tKey = "inspector.wiki_en_reference";
72595               }
72596               result.wiki = {
72597                 title,
72598                 text: tKey,
72599                 url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
72600               };
72601               break;
72602             }
72603           }
72604         }
72605         callback(null, result);
72606       });
72607     }
72608   };
72609
72610   // modules/services/wikipedia.js
72611   var endpoint = "https://en.wikipedia.org/w/api.php?";
72612   var wikipedia_default = {
72613     init: function() {
72614     },
72615     reset: function() {
72616     },
72617     search: function(lang, query, callback) {
72618       if (!query) {
72619         if (callback)
72620           callback("No Query", []);
72621         return;
72622       }
72623       lang = lang || "en";
72624       var url = endpoint.replace("en", lang) + utilQsString({
72625         action: "query",
72626         list: "search",
72627         srlimit: "10",
72628         srinfo: "suggestion",
72629         format: "json",
72630         origin: "*",
72631         srsearch: query
72632       });
72633       json_default(url).then(function(result) {
72634         if (result && result.error) {
72635           throw new Error(result.error);
72636         } else if (!result || !result.query || !result.query.search) {
72637           throw new Error("No Results");
72638         }
72639         if (callback) {
72640           var titles = result.query.search.map(function(d) {
72641             return d.title;
72642           });
72643           callback(null, titles);
72644         }
72645       }).catch(function(err) {
72646         if (callback)
72647           callback(err, []);
72648       });
72649     },
72650     suggestions: function(lang, query, callback) {
72651       if (!query) {
72652         if (callback)
72653           callback("", []);
72654         return;
72655       }
72656       lang = lang || "en";
72657       var url = endpoint.replace("en", lang) + utilQsString({
72658         action: "opensearch",
72659         namespace: 0,
72660         suggest: "",
72661         format: "json",
72662         origin: "*",
72663         search: query
72664       });
72665       json_default(url).then(function(result) {
72666         if (result && result.error) {
72667           throw new Error(result.error);
72668         } else if (!result || result.length < 2) {
72669           throw new Error("No Results");
72670         }
72671         if (callback)
72672           callback(null, result[1] || []);
72673       }).catch(function(err) {
72674         if (callback)
72675           callback(err.message, []);
72676       });
72677     },
72678     translations: function(lang, title, callback) {
72679       if (!title) {
72680         if (callback)
72681           callback("No Title");
72682         return;
72683       }
72684       var url = endpoint.replace("en", lang) + utilQsString({
72685         action: "query",
72686         prop: "langlinks",
72687         format: "json",
72688         origin: "*",
72689         lllimit: 500,
72690         titles: title
72691       });
72692       json_default(url).then(function(result) {
72693         if (result && result.error) {
72694           throw new Error(result.error);
72695         } else if (!result || !result.query || !result.query.pages) {
72696           throw new Error("No Results");
72697         }
72698         if (callback) {
72699           var list = result.query.pages[Object.keys(result.query.pages)[0]];
72700           var translations = {};
72701           if (list && list.langlinks) {
72702             list.langlinks.forEach(function(d) {
72703               translations[d.lang] = d["*"];
72704             });
72705           }
72706           callback(null, translations);
72707         }
72708       }).catch(function(err) {
72709         if (callback)
72710           callback(err.message);
72711       });
72712     }
72713   };
72714
72715   // modules/services/index.js
72716   var services = {
72717     geocoder: nominatim_default,
72718     keepRight: keepRight_default,
72719     improveOSM: improveOSM_default,
72720     osmose: osmose_default,
72721     mapillary: mapillary_default,
72722     nsi: nsi_default,
72723     kartaview: kartaview_default,
72724     osm: osm_default,
72725     osmWikibase: osm_wikibase_default,
72726     maprules: maprules_default,
72727     streetside: streetside_default,
72728     taginfo: taginfo_default,
72729     vectorTile: vector_tile_default,
72730     wikidata: wikidata_default,
72731     wikipedia: wikipedia_default
72732   };
72733
72734   // modules/modes/drag_note.js
72735   function modeDragNote(context) {
72736     var mode = {
72737       id: "drag-note",
72738       button: "browse"
72739     };
72740     var edit2 = behaviorEdit(context);
72741     var _nudgeInterval;
72742     var _lastLoc;
72743     var _note;
72744     function startNudge(d3_event, nudge) {
72745       if (_nudgeInterval)
72746         window.clearInterval(_nudgeInterval);
72747       _nudgeInterval = window.setInterval(function() {
72748         context.map().pan(nudge);
72749         doMove(d3_event, nudge);
72750       }, 50);
72751     }
72752     function stopNudge() {
72753       if (_nudgeInterval) {
72754         window.clearInterval(_nudgeInterval);
72755         _nudgeInterval = null;
72756       }
72757     }
72758     function origin(note) {
72759       return context.projection(note.loc);
72760     }
72761     function start2(d3_event, note) {
72762       _note = note;
72763       var osm = services.osm;
72764       if (osm) {
72765         _note = osm.getNote(_note.id);
72766       }
72767       context.surface().selectAll(".note-" + _note.id).classed("active", true);
72768       context.perform(actionNoop());
72769       context.enter(mode);
72770       context.selectedNoteID(_note.id);
72771     }
72772     function move(d3_event, entity, point) {
72773       d3_event.stopPropagation();
72774       _lastLoc = context.projection.invert(point);
72775       doMove(d3_event);
72776       var nudge = geoViewportEdge(point, context.map().dimensions());
72777       if (nudge) {
72778         startNudge(d3_event, nudge);
72779       } else {
72780         stopNudge();
72781       }
72782     }
72783     function doMove(d3_event, nudge) {
72784       nudge = nudge || [0, 0];
72785       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
72786       var currMouse = geoVecSubtract(currPoint, nudge);
72787       var loc = context.projection.invert(currMouse);
72788       _note = _note.move(loc);
72789       var osm = services.osm;
72790       if (osm) {
72791         osm.replaceNote(_note);
72792       }
72793       context.replace(actionNoop());
72794     }
72795     function end() {
72796       context.replace(actionNoop());
72797       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
72798     }
72799     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);
72800     mode.enter = function() {
72801       context.install(edit2);
72802     };
72803     mode.exit = function() {
72804       context.ui().sidebar.hover.cancel();
72805       context.uninstall(edit2);
72806       context.surface().selectAll(".active").classed("active", false);
72807       stopNudge();
72808     };
72809     mode.behavior = drag;
72810     return mode;
72811   }
72812
72813   // modules/modes/select_data.js
72814   function modeSelectData(context, selectedDatum) {
72815     var mode = {
72816       id: "select-data",
72817       button: "browse"
72818     };
72819     var keybinding = utilKeybinding("select-data");
72820     var dataEditor = uiDataEditor(context);
72821     var behaviors = [
72822       behaviorBreathe(context),
72823       behaviorHover(context),
72824       behaviorSelect(context),
72825       behaviorLasso(context),
72826       modeDragNode(context).behavior,
72827       modeDragNote(context).behavior
72828     ];
72829     function selectData(d3_event, drawn) {
72830       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
72831       if (selection2.empty()) {
72832         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
72833         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
72834           context.enter(modeBrowse(context));
72835         }
72836       } else {
72837         selection2.classed("selected", true);
72838       }
72839     }
72840     function esc() {
72841       if (context.container().select(".combobox").size())
72842         return;
72843       context.enter(modeBrowse(context));
72844     }
72845     mode.zoomToSelected = function() {
72846       var extent = geoExtent(bounds_default(selectedDatum));
72847       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
72848     };
72849     mode.enter = function() {
72850       behaviors.forEach(context.install);
72851       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
72852       select_default2(document).call(keybinding);
72853       selectData();
72854       var sidebar = context.ui().sidebar;
72855       sidebar.show(dataEditor.datum(selectedDatum));
72856       var extent = geoExtent(bounds_default(selectedDatum));
72857       sidebar.expand(sidebar.intersects(extent));
72858       context.map().on("drawn.select-data", selectData);
72859     };
72860     mode.exit = function() {
72861       behaviors.forEach(context.uninstall);
72862       select_default2(document).call(keybinding.unbind);
72863       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
72864       context.map().on("drawn.select-data", null);
72865       context.ui().sidebar.hide();
72866     };
72867     return mode;
72868   }
72869
72870   // modules/behavior/select.js
72871   function behaviorSelect(context) {
72872     var _tolerancePx = 4;
72873     var _lastMouseEvent = null;
72874     var _showMenu = false;
72875     var _downPointers = {};
72876     var _longPressTimeout = null;
72877     var _lastInteractionType = null;
72878     var _multiselectionPointerId = null;
72879     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72880     function keydown(d3_event) {
72881       if (d3_event.keyCode === 32) {
72882         var activeNode = document.activeElement;
72883         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
72884           return;
72885       }
72886       if (d3_event.keyCode === 93 || d3_event.keyCode === 32) {
72887         d3_event.preventDefault();
72888       }
72889       if (d3_event.repeat)
72890         return;
72891       cancelLongPress();
72892       if (d3_event.shiftKey) {
72893         context.surface().classed("behavior-multiselect", true);
72894       }
72895       if (d3_event.keyCode === 32) {
72896         if (!_downPointers.spacebar && _lastMouseEvent) {
72897           cancelLongPress();
72898           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
72899           _downPointers.spacebar = {
72900             firstEvent: _lastMouseEvent,
72901             lastEvent: _lastMouseEvent
72902           };
72903         }
72904       }
72905     }
72906     function keyup(d3_event) {
72907       cancelLongPress();
72908       if (!d3_event.shiftKey) {
72909         context.surface().classed("behavior-multiselect", false);
72910       }
72911       if (d3_event.keyCode === 93) {
72912         d3_event.preventDefault();
72913         _lastInteractionType = "menukey";
72914         contextmenu(d3_event);
72915       } else if (d3_event.keyCode === 32) {
72916         var pointer = _downPointers.spacebar;
72917         if (pointer) {
72918           delete _downPointers.spacebar;
72919           if (pointer.done)
72920             return;
72921           d3_event.preventDefault();
72922           _lastInteractionType = "spacebar";
72923           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
72924         }
72925       }
72926     }
72927     function pointerdown(d3_event) {
72928       var id2 = (d3_event.pointerId || "mouse").toString();
72929       cancelLongPress();
72930       if (d3_event.buttons && d3_event.buttons !== 1)
72931         return;
72932       context.ui().closeEditMenu();
72933       _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
72934       _downPointers[id2] = {
72935         firstEvent: d3_event,
72936         lastEvent: d3_event
72937       };
72938     }
72939     function didLongPress(id2, interactionType) {
72940       var pointer = _downPointers[id2];
72941       if (!pointer)
72942         return;
72943       for (var i2 in _downPointers) {
72944         _downPointers[i2].done = true;
72945       }
72946       _longPressTimeout = null;
72947       _lastInteractionType = interactionType;
72948       _showMenu = true;
72949       click(pointer.firstEvent, pointer.lastEvent, id2);
72950     }
72951     function pointermove(d3_event) {
72952       var id2 = (d3_event.pointerId || "mouse").toString();
72953       if (_downPointers[id2]) {
72954         _downPointers[id2].lastEvent = d3_event;
72955       }
72956       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
72957         _lastMouseEvent = d3_event;
72958         if (_downPointers.spacebar) {
72959           _downPointers.spacebar.lastEvent = d3_event;
72960         }
72961       }
72962     }
72963     function pointerup(d3_event) {
72964       var id2 = (d3_event.pointerId || "mouse").toString();
72965       var pointer = _downPointers[id2];
72966       if (!pointer)
72967         return;
72968       delete _downPointers[id2];
72969       if (_multiselectionPointerId === id2) {
72970         _multiselectionPointerId = null;
72971       }
72972       if (pointer.done)
72973         return;
72974       click(pointer.firstEvent, d3_event, id2);
72975     }
72976     function pointercancel(d3_event) {
72977       var id2 = (d3_event.pointerId || "mouse").toString();
72978       if (!_downPointers[id2])
72979         return;
72980       delete _downPointers[id2];
72981       if (_multiselectionPointerId === id2) {
72982         _multiselectionPointerId = null;
72983       }
72984     }
72985     function contextmenu(d3_event) {
72986       d3_event.preventDefault();
72987       if (!+d3_event.clientX && !+d3_event.clientY) {
72988         if (_lastMouseEvent) {
72989           d3_event.sourceEvent = _lastMouseEvent;
72990         } else {
72991           return;
72992         }
72993       } else {
72994         _lastMouseEvent = d3_event;
72995         _lastInteractionType = "rightclick";
72996       }
72997       _showMenu = true;
72998       click(d3_event, d3_event);
72999     }
73000     function click(firstEvent, lastEvent, pointerId) {
73001       cancelLongPress();
73002       var mapNode = context.container().select(".main-map").node();
73003       var pointGetter = utilFastMouse(mapNode);
73004       var p1 = pointGetter(firstEvent);
73005       var p2 = pointGetter(lastEvent);
73006       var dist = geoVecLength(p1, p2);
73007       if (dist > _tolerancePx || !mapContains(lastEvent)) {
73008         resetProperties();
73009         return;
73010       }
73011       var targetDatum = lastEvent.target.__data__;
73012       var multiselectEntityId;
73013       if (!_multiselectionPointerId) {
73014         var selectPointerInfo = pointerDownOnSelection(pointerId);
73015         if (selectPointerInfo) {
73016           _multiselectionPointerId = selectPointerInfo.pointerId;
73017           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
73018           _downPointers[selectPointerInfo.pointerId].done = true;
73019         }
73020       }
73021       var isMultiselect = context.mode().id === "select" && (lastEvent && lastEvent.shiftKey || context.surface().select(".lasso").node() || _multiselectionPointerId && !multiselectEntityId);
73022       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
73023       function mapContains(event) {
73024         var rect = mapNode.getBoundingClientRect();
73025         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
73026       }
73027       function pointerDownOnSelection(skipPointerId) {
73028         var mode = context.mode();
73029         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
73030         for (var pointerId2 in _downPointers) {
73031           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
73032             continue;
73033           var pointerInfo = _downPointers[pointerId2];
73034           var p12 = pointGetter(pointerInfo.firstEvent);
73035           var p22 = pointGetter(pointerInfo.lastEvent);
73036           if (geoVecLength(p12, p22) > _tolerancePx)
73037             continue;
73038           var datum2 = pointerInfo.firstEvent.target.__data__;
73039           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
73040           if (context.graph().hasEntity(entity.id)) {
73041             return {
73042               pointerId: pointerId2,
73043               entityId: entity.id,
73044               selected: selectedIDs.indexOf(entity.id) !== -1
73045             };
73046           }
73047         }
73048         return null;
73049       }
73050     }
73051     function processClick(datum2, isMultiselect, point, alsoSelectId) {
73052       var mode = context.mode();
73053       var showMenu = _showMenu;
73054       var interactionType = _lastInteractionType;
73055       var entity = datum2 && datum2.properties && datum2.properties.entity;
73056       if (entity)
73057         datum2 = entity;
73058       if (datum2 && datum2.type === "midpoint") {
73059         datum2 = datum2.parents[0];
73060       }
73061       var newMode;
73062       if (datum2 instanceof osmEntity) {
73063         var selectedIDs = context.selectedIDs();
73064         context.selectedNoteID(null);
73065         context.selectedErrorID(null);
73066         if (!isMultiselect) {
73067           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
73068             if (alsoSelectId === datum2.id)
73069               alsoSelectId = null;
73070             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
73071             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
73072             context.enter(newMode);
73073           }
73074         } else {
73075           if (selectedIDs.indexOf(datum2.id) !== -1) {
73076             if (!showMenu) {
73077               selectedIDs = selectedIDs.filter(function(id2) {
73078                 return id2 !== datum2.id;
73079               });
73080               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
73081               context.enter(newMode);
73082             }
73083           } else {
73084             selectedIDs = selectedIDs.concat([datum2.id]);
73085             newMode = mode.selectedIDs(selectedIDs);
73086             context.enter(newMode);
73087           }
73088         }
73089       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
73090         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
73091       } else if (datum2 instanceof osmNote && !isMultiselect) {
73092         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
73093       } else if (datum2 instanceof QAItem && !isMultiselect) {
73094         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
73095       } else {
73096         context.selectedNoteID(null);
73097         context.selectedErrorID(null);
73098         if (!isMultiselect && mode.id !== "browse") {
73099           context.enter(modeBrowse(context));
73100         }
73101       }
73102       context.ui().closeEditMenu();
73103       if (showMenu)
73104         context.ui().showEditMenu(point, interactionType);
73105       resetProperties();
73106     }
73107     function cancelLongPress() {
73108       if (_longPressTimeout)
73109         window.clearTimeout(_longPressTimeout);
73110       _longPressTimeout = null;
73111     }
73112     function resetProperties() {
73113       cancelLongPress();
73114       _showMenu = false;
73115       _lastInteractionType = null;
73116     }
73117     function behavior(selection2) {
73118       resetProperties();
73119       _lastMouseEvent = context.map().lastPointerEvent();
73120       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) {
73121         var e = d3_event;
73122         if (+e.clientX === 0 && +e.clientY === 0) {
73123           d3_event.preventDefault();
73124         }
73125       });
73126       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
73127     }
73128     behavior.off = function(selection2) {
73129       cancelLongPress();
73130       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);
73131       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
73132       context.surface().classed("behavior-multiselect", false);
73133     };
73134     return behavior;
73135   }
73136
73137   // modules/operations/index.js
73138   var operations_exports = {};
73139   __export(operations_exports, {
73140     operationCircularize: () => operationCircularize,
73141     operationContinue: () => operationContinue,
73142     operationCopy: () => operationCopy,
73143     operationDelete: () => operationDelete,
73144     operationDisconnect: () => operationDisconnect,
73145     operationDowngrade: () => operationDowngrade,
73146     operationExtract: () => operationExtract,
73147     operationMerge: () => operationMerge,
73148     operationMove: () => operationMove,
73149     operationOrthogonalize: () => operationOrthogonalize,
73150     operationPaste: () => operationPaste,
73151     operationReflectLong: () => operationReflectLong,
73152     operationReflectShort: () => operationReflectShort,
73153     operationReverse: () => operationReverse,
73154     operationRotate: () => operationRotate,
73155     operationSplit: () => operationSplit,
73156     operationStraighten: () => operationStraighten
73157   });
73158
73159   // modules/operations/continue.js
73160   function operationContinue(context, selectedIDs) {
73161     var _entities = selectedIDs.map(function(id2) {
73162       return context.graph().entity(id2);
73163     });
73164     var _geometries = Object.assign({ line: [], vertex: [] }, utilArrayGroupBy(_entities, function(entity) {
73165       return entity.geometry(context.graph());
73166     }));
73167     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
73168     function candidateWays() {
73169       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
73170         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
73171       }) : [];
73172     }
73173     var _candidates = candidateWays();
73174     var operation = function() {
73175       var candidate = _candidates[0];
73176       context.enter(modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true));
73177     };
73178     operation.relatedEntityIds = function() {
73179       return _candidates.length ? [_candidates[0].id] : [];
73180     };
73181     operation.available = function() {
73182       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
73183     };
73184     operation.disabled = function() {
73185       if (_candidates.length === 0) {
73186         return "not_eligible";
73187       } else if (_candidates.length > 1) {
73188         return "multiple";
73189       }
73190       return false;
73191     };
73192     operation.tooltip = function() {
73193       var disable = operation.disabled();
73194       return disable ? _t("operations.continue." + disable) : _t("operations.continue.description");
73195     };
73196     operation.annotation = function() {
73197       return _t("operations.continue.annotation.line");
73198     };
73199     operation.id = "continue";
73200     operation.keys = [_t("operations.continue.key")];
73201     operation.title = _t("operations.continue.title");
73202     operation.behavior = behaviorOperation(context).which(operation);
73203     return operation;
73204   }
73205
73206   // modules/operations/copy.js
73207   function operationCopy(context, selectedIDs) {
73208     function getFilteredIdsToCopy() {
73209       return selectedIDs.filter(function(selectedID) {
73210         var entity = context.graph().hasEntity(selectedID);
73211         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
73212       });
73213     }
73214     var operation = function() {
73215       var graph = context.graph();
73216       var selected = groupEntities(getFilteredIdsToCopy(), graph);
73217       var canCopy = [];
73218       var skip = {};
73219       var entity;
73220       var i2;
73221       for (i2 = 0; i2 < selected.relation.length; i2++) {
73222         entity = selected.relation[i2];
73223         if (!skip[entity.id] && entity.isComplete(graph)) {
73224           canCopy.push(entity.id);
73225           skip = getDescendants(entity.id, graph, skip);
73226         }
73227       }
73228       for (i2 = 0; i2 < selected.way.length; i2++) {
73229         entity = selected.way[i2];
73230         if (!skip[entity.id]) {
73231           canCopy.push(entity.id);
73232           skip = getDescendants(entity.id, graph, skip);
73233         }
73234       }
73235       for (i2 = 0; i2 < selected.node.length; i2++) {
73236         entity = selected.node[i2];
73237         if (!skip[entity.id]) {
73238           canCopy.push(entity.id);
73239         }
73240       }
73241       context.copyIDs(canCopy);
73242       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
73243         context.copyLonLat(context.projection.invert(_point));
73244       } else {
73245         context.copyLonLat(null);
73246       }
73247     };
73248     function groupEntities(ids, graph) {
73249       var entities = ids.map(function(id2) {
73250         return graph.entity(id2);
73251       });
73252       return Object.assign({ relation: [], way: [], node: [] }, utilArrayGroupBy(entities, "type"));
73253     }
73254     function getDescendants(id2, graph, descendants) {
73255       var entity = graph.entity(id2);
73256       var children2;
73257       descendants = descendants || {};
73258       if (entity.type === "relation") {
73259         children2 = entity.members.map(function(m) {
73260           return m.id;
73261         });
73262       } else if (entity.type === "way") {
73263         children2 = entity.nodes;
73264       } else {
73265         children2 = [];
73266       }
73267       for (var i2 = 0; i2 < children2.length; i2++) {
73268         if (!descendants[children2[i2]]) {
73269           descendants[children2[i2]] = true;
73270           descendants = getDescendants(children2[i2], graph, descendants);
73271         }
73272       }
73273       return descendants;
73274     }
73275     operation.available = function() {
73276       return getFilteredIdsToCopy().length > 0;
73277     };
73278     operation.disabled = function() {
73279       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
73280       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
73281         return "too_large";
73282       }
73283       return false;
73284     };
73285     operation.availableForKeypress = function() {
73286       var selection2 = window.getSelection && window.getSelection();
73287       return !selection2 || !selection2.toString();
73288     };
73289     operation.tooltip = function() {
73290       var disable = operation.disabled();
73291       return disable ? _t("operations.copy." + disable, { n: selectedIDs.length }) : _t("operations.copy.description", { n: selectedIDs.length });
73292     };
73293     operation.annotation = function() {
73294       return _t("operations.copy.annotation", { n: selectedIDs.length });
73295     };
73296     var _point;
73297     operation.point = function(val) {
73298       _point = val;
73299       return operation;
73300     };
73301     operation.id = "copy";
73302     operation.keys = [uiCmd("\u2318C")];
73303     operation.title = _t("operations.copy.title");
73304     operation.behavior = behaviorOperation(context).which(operation);
73305     return operation;
73306   }
73307
73308   // modules/operations/disconnect.js
73309   function operationDisconnect(context, selectedIDs) {
73310     var _vertexIDs = [];
73311     var _wayIDs = [];
73312     var _otherIDs = [];
73313     var _actions = [];
73314     selectedIDs.forEach(function(id2) {
73315       var entity = context.entity(id2);
73316       if (entity.type === "way") {
73317         _wayIDs.push(id2);
73318       } else if (entity.geometry(context.graph()) === "vertex") {
73319         _vertexIDs.push(id2);
73320       } else {
73321         _otherIDs.push(id2);
73322       }
73323     });
73324     var _coords, _descriptionID = "", _annotationID = "features";
73325     var _disconnectingVertexIds = [];
73326     var _disconnectingWayIds = [];
73327     if (_vertexIDs.length > 0) {
73328       _disconnectingVertexIds = _vertexIDs;
73329       _vertexIDs.forEach(function(vertexID) {
73330         var action = actionDisconnect(vertexID);
73331         if (_wayIDs.length > 0) {
73332           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
73333             var way = context.entity(wayID);
73334             return way.nodes.indexOf(vertexID) !== -1;
73335           });
73336           action.limitWays(waysIDsForVertex);
73337         }
73338         _actions.push(action);
73339         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
73340       });
73341       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
73342         return _wayIDs.indexOf(id2) === -1;
73343       });
73344       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
73345       if (_wayIDs.length === 1) {
73346         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
73347       } else {
73348         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
73349       }
73350     } else if (_wayIDs.length > 0) {
73351       var ways = _wayIDs.map(function(id2) {
73352         return context.entity(id2);
73353       });
73354       var nodes = utilGetAllNodes(_wayIDs, context.graph());
73355       _coords = nodes.map(function(n2) {
73356         return n2.loc;
73357       });
73358       var sharedActions = [];
73359       var sharedNodes = [];
73360       var unsharedActions = [];
73361       var unsharedNodes = [];
73362       nodes.forEach(function(node) {
73363         var action = actionDisconnect(node.id).limitWays(_wayIDs);
73364         if (action.disabled(context.graph()) !== "not_connected") {
73365           var count = 0;
73366           for (var i2 in ways) {
73367             var way = ways[i2];
73368             if (way.nodes.indexOf(node.id) !== -1) {
73369               count += 1;
73370             }
73371             if (count > 1)
73372               break;
73373           }
73374           if (count > 1) {
73375             sharedActions.push(action);
73376             sharedNodes.push(node);
73377           } else {
73378             unsharedActions.push(action);
73379             unsharedNodes.push(node);
73380           }
73381         }
73382       });
73383       _descriptionID += "no_points.";
73384       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
73385       if (sharedActions.length) {
73386         _actions = sharedActions;
73387         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
73388         _descriptionID += "conjoined";
73389         _annotationID = "from_each_other";
73390       } else {
73391         _actions = unsharedActions;
73392         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
73393         if (_wayIDs.length === 1) {
73394           _descriptionID += context.graph().geometry(_wayIDs[0]);
73395         } else {
73396           _descriptionID += "separate";
73397         }
73398       }
73399     }
73400     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
73401     var operation = function() {
73402       context.perform(function(graph) {
73403         return _actions.reduce(function(graph2, action) {
73404           return action(graph2);
73405         }, graph);
73406       }, operation.annotation());
73407       context.validator().validate();
73408     };
73409     operation.relatedEntityIds = function() {
73410       if (_vertexIDs.length) {
73411         return _disconnectingWayIds;
73412       }
73413       return _disconnectingVertexIds;
73414     };
73415     operation.available = function() {
73416       if (_actions.length === 0)
73417         return false;
73418       if (_otherIDs.length !== 0)
73419         return false;
73420       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
73421         return _vertexIDs.some(function(vertexID) {
73422           var way = context.entity(wayID);
73423           return way.nodes.indexOf(vertexID) !== -1;
73424         });
73425       }))
73426         return false;
73427       return true;
73428     };
73429     operation.disabled = function() {
73430       var reason;
73431       for (var actionIndex in _actions) {
73432         reason = _actions[actionIndex].disabled(context.graph());
73433         if (reason)
73434           return reason;
73435       }
73436       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
73437         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
73438       } else if (_coords && someMissing()) {
73439         return "not_downloaded";
73440       } else if (selectedIDs.some(context.hasHiddenConnections)) {
73441         return "connected_to_hidden";
73442       }
73443       return false;
73444       function someMissing() {
73445         if (context.inIntro())
73446           return false;
73447         var osm = context.connection();
73448         if (osm) {
73449           var missing = _coords.filter(function(loc) {
73450             return !osm.isDataLoaded(loc);
73451           });
73452           if (missing.length) {
73453             missing.forEach(function(loc) {
73454               context.loadTileAtLoc(loc);
73455             });
73456             return true;
73457           }
73458         }
73459         return false;
73460       }
73461     };
73462     operation.tooltip = function() {
73463       var disable = operation.disabled();
73464       if (disable) {
73465         return _t("operations.disconnect." + disable);
73466       }
73467       return _t("operations.disconnect.description." + _descriptionID);
73468     };
73469     operation.annotation = function() {
73470       return _t("operations.disconnect.annotation." + _annotationID);
73471     };
73472     operation.id = "disconnect";
73473     operation.keys = [_t("operations.disconnect.key")];
73474     operation.title = _t("operations.disconnect.title");
73475     operation.behavior = behaviorOperation(context).which(operation);
73476     return operation;
73477   }
73478
73479   // modules/operations/downgrade.js
73480   function operationDowngrade(context, selectedIDs) {
73481     var _affectedFeatureCount = 0;
73482     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
73483     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
73484     function downgradeTypeForEntityIDs(entityIds) {
73485       var downgradeType;
73486       _affectedFeatureCount = 0;
73487       for (var i2 in entityIds) {
73488         var entityID = entityIds[i2];
73489         var type3 = downgradeTypeForEntityID(entityID);
73490         if (type3) {
73491           _affectedFeatureCount += 1;
73492           if (downgradeType && type3 !== downgradeType) {
73493             if (downgradeType !== "generic" && type3 !== "generic") {
73494               downgradeType = "building_address";
73495             } else {
73496               downgradeType = "generic";
73497             }
73498           } else {
73499             downgradeType = type3;
73500           }
73501         }
73502       }
73503       return downgradeType;
73504     }
73505     function downgradeTypeForEntityID(entityID) {
73506       var graph = context.graph();
73507       var entity = graph.entity(entityID);
73508       var preset = _mainPresetIndex.match(entity, graph);
73509       if (!preset || preset.isFallback())
73510         return null;
73511       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
73512         return key.match(/^addr:.{1,}/);
73513       })) {
73514         return "address";
73515       }
73516       var geometry = entity.geometry(graph);
73517       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
73518         return "building";
73519       }
73520       if (geometry === "vertex" && Object.keys(entity.tags).length) {
73521         return "generic";
73522       }
73523       return null;
73524     }
73525     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
73526     var addressKeysToKeep = ["source"];
73527     var operation = function() {
73528       context.perform(function(graph) {
73529         for (var i2 in selectedIDs) {
73530           var entityID = selectedIDs[i2];
73531           var type3 = downgradeTypeForEntityID(entityID);
73532           if (!type3)
73533             continue;
73534           var tags = Object.assign({}, graph.entity(entityID).tags);
73535           for (var key in tags) {
73536             if (type3 === "address" && addressKeysToKeep.indexOf(key) !== -1)
73537               continue;
73538             if (type3 === "building") {
73539               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
73540                 continue;
73541             }
73542             if (type3 !== "generic") {
73543               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
73544                 continue;
73545             }
73546             delete tags[key];
73547           }
73548           graph = actionChangeTags(entityID, tags)(graph);
73549         }
73550         return graph;
73551       }, operation.annotation());
73552       context.validator().validate();
73553       context.enter(modeSelect(context, selectedIDs));
73554     };
73555     operation.available = function() {
73556       return _downgradeType;
73557     };
73558     operation.disabled = function() {
73559       if (selectedIDs.some(hasWikidataTag)) {
73560         return "has_wikidata_tag";
73561       }
73562       return false;
73563       function hasWikidataTag(id2) {
73564         var entity = context.entity(id2);
73565         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
73566       }
73567     };
73568     operation.tooltip = function() {
73569       var disable = operation.disabled();
73570       return disable ? _t("operations.downgrade." + disable + "." + _multi) : _t("operations.downgrade.description." + _downgradeType);
73571     };
73572     operation.annotation = function() {
73573       var suffix;
73574       if (_downgradeType === "building_address") {
73575         suffix = "generic";
73576       } else {
73577         suffix = _downgradeType;
73578       }
73579       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
73580     };
73581     operation.id = "downgrade";
73582     operation.keys = [uiCmd("\u232B")];
73583     operation.title = _t("operations.downgrade.title");
73584     operation.behavior = behaviorOperation(context).which(operation);
73585     return operation;
73586   }
73587
73588   // modules/operations/extract.js
73589   function operationExtract(context, selectedIDs) {
73590     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
73591     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
73592       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
73593     }).filter(Boolean));
73594     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
73595     var _extent;
73596     var _actions = selectedIDs.map(function(entityID) {
73597       var graph = context.graph();
73598       var entity = graph.hasEntity(entityID);
73599       if (!entity || !entity.hasInterestingTags())
73600         return null;
73601       if (entity.type === "node" && graph.parentWays(entity).length === 0)
73602         return null;
73603       if (entity.type !== "node") {
73604         var preset = _mainPresetIndex.match(entity, graph);
73605         if (preset.geometry.indexOf("point") === -1)
73606           return null;
73607       }
73608       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
73609       return actionExtract(entityID, context.projection);
73610     }).filter(Boolean);
73611     var operation = function() {
73612       var combinedAction = function(graph) {
73613         _actions.forEach(function(action) {
73614           graph = action(graph);
73615         });
73616         return graph;
73617       };
73618       context.perform(combinedAction, operation.annotation());
73619       var extractedNodeIDs = _actions.map(function(action) {
73620         return action.getExtractedNodeID();
73621       });
73622       context.enter(modeSelect(context, extractedNodeIDs));
73623     };
73624     operation.available = function() {
73625       return _actions.length && selectedIDs.length === _actions.length;
73626     };
73627     operation.disabled = function() {
73628       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
73629         return "too_large";
73630       } else if (selectedIDs.some(function(entityID) {
73631         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
73632       })) {
73633         return "connected_to_hidden";
73634       }
73635       return false;
73636     };
73637     operation.tooltip = function() {
73638       var disableReason = operation.disabled();
73639       if (disableReason) {
73640         return _t("operations.extract." + disableReason + "." + _amount);
73641       } else {
73642         return _t("operations.extract.description." + _geometryID + "." + _amount);
73643       }
73644     };
73645     operation.annotation = function() {
73646       return _t("operations.extract.annotation", { n: selectedIDs.length });
73647     };
73648     operation.id = "extract";
73649     operation.keys = [_t("operations.extract.key")];
73650     operation.title = _t("operations.extract.title");
73651     operation.behavior = behaviorOperation(context).which(operation);
73652     return operation;
73653   }
73654
73655   // modules/operations/merge.js
73656   function operationMerge(context, selectedIDs) {
73657     var _action = getAction();
73658     function getAction() {
73659       var join = actionJoin(selectedIDs);
73660       if (!join.disabled(context.graph()))
73661         return join;
73662       var merge3 = actionMerge(selectedIDs);
73663       if (!merge3.disabled(context.graph()))
73664         return merge3;
73665       var mergePolygon = actionMergePolygon(selectedIDs);
73666       if (!mergePolygon.disabled(context.graph()))
73667         return mergePolygon;
73668       var mergeNodes = actionMergeNodes(selectedIDs);
73669       if (!mergeNodes.disabled(context.graph()))
73670         return mergeNodes;
73671       if (join.disabled(context.graph()) !== "not_eligible")
73672         return join;
73673       if (merge3.disabled(context.graph()) !== "not_eligible")
73674         return merge3;
73675       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
73676         return mergePolygon;
73677       return mergeNodes;
73678     }
73679     var operation = function() {
73680       if (operation.disabled())
73681         return;
73682       context.perform(_action, operation.annotation());
73683       context.validator().validate();
73684       var resultIDs = selectedIDs.filter(context.hasEntity);
73685       if (resultIDs.length > 1) {
73686         var interestingIDs = resultIDs.filter(function(id2) {
73687           return context.entity(id2).hasInterestingTags();
73688         });
73689         if (interestingIDs.length)
73690           resultIDs = interestingIDs;
73691       }
73692       context.enter(modeSelect(context, resultIDs));
73693     };
73694     operation.available = function() {
73695       return selectedIDs.length >= 2;
73696     };
73697     operation.disabled = function() {
73698       var actionDisabled = _action.disabled(context.graph());
73699       if (actionDisabled)
73700         return actionDisabled;
73701       var osm = context.connection();
73702       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
73703         return "too_many_vertices";
73704       }
73705       return false;
73706     };
73707     operation.tooltip = function() {
73708       var disabled = operation.disabled();
73709       if (disabled) {
73710         if (disabled === "conflicting_relations") {
73711           return _t("operations.merge.conflicting_relations");
73712         }
73713         if (disabled === "restriction" || disabled === "connectivity") {
73714           return _t("operations.merge.damage_relation", { relation: _mainPresetIndex.item("type/" + disabled).name() });
73715         }
73716         return _t("operations.merge." + disabled);
73717       }
73718       return _t("operations.merge.description");
73719     };
73720     operation.annotation = function() {
73721       return _t("operations.merge.annotation", { n: selectedIDs.length });
73722     };
73723     operation.id = "merge";
73724     operation.keys = [_t("operations.merge.key")];
73725     operation.title = _t("operations.merge.title");
73726     operation.behavior = behaviorOperation(context).which(operation);
73727     return operation;
73728   }
73729
73730   // modules/operations/paste.js
73731   function operationPaste(context) {
73732     var _pastePoint;
73733     var operation = function() {
73734       if (!_pastePoint)
73735         return;
73736       var oldIDs = context.copyIDs();
73737       if (!oldIDs.length)
73738         return;
73739       var projection2 = context.projection;
73740       var extent = geoExtent();
73741       var oldGraph = context.copyGraph();
73742       var newIDs = [];
73743       var action = actionCopyEntities(oldIDs, oldGraph);
73744       context.perform(action);
73745       var copies = action.copies();
73746       var originals = /* @__PURE__ */ new Set();
73747       Object.values(copies).forEach(function(entity) {
73748         originals.add(entity.id);
73749       });
73750       for (var id2 in copies) {
73751         var oldEntity = oldGraph.entity(id2);
73752         var newEntity = copies[id2];
73753         extent._extend(oldEntity.extent(oldGraph));
73754         var parents = context.graph().parentWays(newEntity);
73755         var parentCopied = parents.some(function(parent) {
73756           return originals.has(parent.id);
73757         });
73758         if (!parentCopied) {
73759           newIDs.push(newEntity.id);
73760         }
73761       }
73762       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
73763       var delta = geoVecSubtract(_pastePoint, copyPoint);
73764       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
73765       context.enter(modeSelect(context, newIDs));
73766     };
73767     operation.point = function(val) {
73768       _pastePoint = val;
73769       return operation;
73770     };
73771     operation.available = function() {
73772       return context.mode().id === "browse";
73773     };
73774     operation.disabled = function() {
73775       return !context.copyIDs().length;
73776     };
73777     operation.tooltip = function() {
73778       var oldGraph = context.copyGraph();
73779       var ids = context.copyIDs();
73780       if (!ids.length) {
73781         return _t("operations.paste.nothing_copied");
73782       }
73783       return _t("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
73784     };
73785     operation.annotation = function() {
73786       var ids = context.copyIDs();
73787       return _t("operations.paste.annotation", { n: ids.length });
73788     };
73789     operation.id = "paste";
73790     operation.keys = [uiCmd("\u2318V")];
73791     operation.title = _t("operations.paste.title");
73792     return operation;
73793   }
73794
73795   // modules/operations/reverse.js
73796   function operationReverse(context, selectedIDs) {
73797     var operation = function() {
73798       context.perform(function combinedReverseAction(graph) {
73799         actions().forEach(function(action) {
73800           graph = action(graph);
73801         });
73802         return graph;
73803       }, operation.annotation());
73804       context.validator().validate();
73805     };
73806     function actions(situation) {
73807       return selectedIDs.map(function(entityID) {
73808         var entity = context.hasEntity(entityID);
73809         if (!entity)
73810           return null;
73811         if (situation === "toolbar") {
73812           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
73813             return null;
73814         }
73815         var geometry = entity.geometry(context.graph());
73816         if (entity.type !== "node" && geometry !== "line")
73817           return null;
73818         var action = actionReverse(entityID);
73819         if (action.disabled(context.graph()))
73820           return null;
73821         return action;
73822       }).filter(Boolean);
73823     }
73824     function reverseTypeID() {
73825       var acts = actions();
73826       var nodeActionCount = acts.filter(function(act) {
73827         var entity = context.hasEntity(act.entityID());
73828         return entity && entity.type === "node";
73829       }).length;
73830       if (nodeActionCount === 0)
73831         return "line";
73832       if (nodeActionCount === acts.length)
73833         return "point";
73834       return "feature";
73835     }
73836     operation.available = function(situation) {
73837       return actions(situation).length > 0;
73838     };
73839     operation.disabled = function() {
73840       return false;
73841     };
73842     operation.tooltip = function() {
73843       return _t("operations.reverse.description." + reverseTypeID());
73844     };
73845     operation.annotation = function() {
73846       var acts = actions();
73847       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
73848     };
73849     operation.id = "reverse";
73850     operation.keys = [_t("operations.reverse.key")];
73851     operation.title = _t("operations.reverse.title");
73852     operation.behavior = behaviorOperation(context).which(operation);
73853     return operation;
73854   }
73855
73856   // modules/operations/split.js
73857   function operationSplit(context, selectedIDs) {
73858     var _vertexIds = selectedIDs.filter(function(id2) {
73859       return context.graph().geometry(id2) === "vertex";
73860     });
73861     var _selectedWayIds = selectedIDs.filter(function(id2) {
73862       var entity = context.graph().hasEntity(id2);
73863       return entity && entity.type === "way";
73864     });
73865     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
73866     var _action = actionSplit(_vertexIds);
73867     var _ways = [];
73868     var _geometry = "feature";
73869     var _waysAmount = "single";
73870     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
73871     if (_isAvailable) {
73872       if (_selectedWayIds.length)
73873         _action.limitWays(_selectedWayIds);
73874       _ways = _action.ways(context.graph());
73875       var geometries = {};
73876       _ways.forEach(function(way) {
73877         geometries[way.geometry(context.graph())] = true;
73878       });
73879       if (Object.keys(geometries).length === 1) {
73880         _geometry = Object.keys(geometries)[0];
73881       }
73882       _waysAmount = _ways.length === 1 ? "single" : "multiple";
73883     }
73884     var operation = function() {
73885       var difference = context.perform(_action, operation.annotation());
73886       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
73887         return context.entity(id2).type === "way";
73888       }));
73889       context.enter(modeSelect(context, idsToSelect));
73890     };
73891     operation.relatedEntityIds = function() {
73892       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
73893     };
73894     operation.available = function() {
73895       return _isAvailable;
73896     };
73897     operation.disabled = function() {
73898       var reason = _action.disabled(context.graph());
73899       if (reason) {
73900         return reason;
73901       } else if (selectedIDs.some(context.hasHiddenConnections)) {
73902         return "connected_to_hidden";
73903       }
73904       return false;
73905     };
73906     operation.tooltip = function() {
73907       var disable = operation.disabled();
73908       if (disable)
73909         return _t("operations.split." + disable);
73910       return _t("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
73911     };
73912     operation.annotation = function() {
73913       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
73914     };
73915     operation.icon = function() {
73916       if (_waysAmount === "multiple") {
73917         return "#iD-operation-split-multiple";
73918       } else {
73919         return "#iD-operation-split";
73920       }
73921     };
73922     operation.id = "split";
73923     operation.keys = [_t("operations.split.key")];
73924     operation.title = _t("operations.split.title");
73925     operation.behavior = behaviorOperation(context).which(operation);
73926     return operation;
73927   }
73928
73929   // modules/operations/straighten.js
73930   function operationStraighten(context, selectedIDs) {
73931     var _wayIDs = selectedIDs.filter(function(id2) {
73932       return id2.charAt(0) === "w";
73933     });
73934     var _nodeIDs = selectedIDs.filter(function(id2) {
73935       return id2.charAt(0) === "n";
73936     });
73937     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
73938     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
73939     var _coords = _nodes.map(function(n2) {
73940       return n2.loc;
73941     });
73942     var _extent = utilTotalExtent(selectedIDs, context.graph());
73943     var _action = chooseAction();
73944     var _geometry;
73945     function chooseAction() {
73946       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
73947         _geometry = "point";
73948         return actionStraightenNodes(_nodeIDs, context.projection);
73949       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
73950         var startNodeIDs = [];
73951         var endNodeIDs = [];
73952         for (var i2 = 0; i2 < selectedIDs.length; i2++) {
73953           var entity = context.entity(selectedIDs[i2]);
73954           if (entity.type === "node") {
73955             continue;
73956           } else if (entity.type !== "way" || entity.isClosed()) {
73957             return null;
73958           }
73959           startNodeIDs.push(entity.first());
73960           endNodeIDs.push(entity.last());
73961         }
73962         startNodeIDs = startNodeIDs.filter(function(n2) {
73963           return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
73964         });
73965         endNodeIDs = endNodeIDs.filter(function(n2) {
73966           return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
73967         });
73968         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
73969           return null;
73970         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
73971           return node.id;
73972         });
73973         if (wayNodeIDs.length <= 2)
73974           return null;
73975         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
73976           return null;
73977         if (_nodeIDs.length) {
73978           _extent = utilTotalExtent(_nodeIDs, context.graph());
73979         }
73980         _geometry = "line";
73981         return actionStraightenWay(selectedIDs, context.projection);
73982       }
73983       return null;
73984     }
73985     function operation() {
73986       if (!_action)
73987         return;
73988       context.perform(_action, operation.annotation());
73989       window.setTimeout(function() {
73990         context.validator().validate();
73991       }, 300);
73992     }
73993     operation.available = function() {
73994       return Boolean(_action);
73995     };
73996     operation.disabled = function() {
73997       var reason = _action.disabled(context.graph());
73998       if (reason) {
73999         return reason;
74000       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
74001         return "too_large";
74002       } else if (someMissing()) {
74003         return "not_downloaded";
74004       } else if (selectedIDs.some(context.hasHiddenConnections)) {
74005         return "connected_to_hidden";
74006       }
74007       return false;
74008       function someMissing() {
74009         if (context.inIntro())
74010           return false;
74011         var osm = context.connection();
74012         if (osm) {
74013           var missing = _coords.filter(function(loc) {
74014             return !osm.isDataLoaded(loc);
74015           });
74016           if (missing.length) {
74017             missing.forEach(function(loc) {
74018               context.loadTileAtLoc(loc);
74019             });
74020             return true;
74021           }
74022         }
74023         return false;
74024       }
74025     };
74026     operation.tooltip = function() {
74027       var disable = operation.disabled();
74028       return disable ? _t("operations.straighten." + disable + "." + _amount) : _t("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
74029     };
74030     operation.annotation = function() {
74031       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
74032     };
74033     operation.id = "straighten";
74034     operation.keys = [_t("operations.straighten.key")];
74035     operation.title = _t("operations.straighten.title");
74036     operation.behavior = behaviorOperation(context).which(operation);
74037     return operation;
74038   }
74039
74040   // modules/modes/select.js
74041   function modeSelect(context, selectedIDs) {
74042     var mode = {
74043       id: "select",
74044       button: "browse"
74045     };
74046     var keybinding = utilKeybinding("select");
74047     var _breatheBehavior = behaviorBreathe(context);
74048     var _modeDragNode = modeDragNode(context);
74049     var _selectBehavior;
74050     var _behaviors = [];
74051     var _operations = [];
74052     var _newFeature = false;
74053     var _follow = false;
74054     var _focusedParentWayId;
74055     var _focusedVertexIds;
74056     function singular() {
74057       if (selectedIDs && selectedIDs.length === 1) {
74058         return context.hasEntity(selectedIDs[0]);
74059       }
74060     }
74061     function selectedEntities() {
74062       return selectedIDs.map(function(id2) {
74063         return context.hasEntity(id2);
74064       }).filter(Boolean);
74065     }
74066     function checkSelectedIDs() {
74067       var ids = [];
74068       if (Array.isArray(selectedIDs)) {
74069         ids = selectedIDs.filter(function(id2) {
74070           return context.hasEntity(id2);
74071         });
74072       }
74073       if (!ids.length) {
74074         context.enter(modeBrowse(context));
74075         return false;
74076       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
74077         context.enter(modeSelect(context, ids));
74078         return false;
74079       }
74080       selectedIDs = ids;
74081       return true;
74082     }
74083     function parentWaysIdsOfSelection(onlyCommonParents) {
74084       var graph = context.graph();
74085       var parents = [];
74086       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
74087         var entity = context.hasEntity(selectedIDs[i2]);
74088         if (!entity || entity.geometry(graph) !== "vertex") {
74089           return [];
74090         }
74091         var currParents = graph.parentWays(entity).map(function(w) {
74092           return w.id;
74093         });
74094         if (!parents.length) {
74095           parents = currParents;
74096           continue;
74097         }
74098         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
74099         if (!parents.length) {
74100           return [];
74101         }
74102       }
74103       return parents;
74104     }
74105     function childNodeIdsOfSelection(onlyCommon) {
74106       var graph = context.graph();
74107       var childs = [];
74108       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
74109         var entity = context.hasEntity(selectedIDs[i2]);
74110         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
74111           return [];
74112         }
74113         var currChilds = graph.childNodes(entity).map(function(node) {
74114           return node.id;
74115         });
74116         if (!childs.length) {
74117           childs = currChilds;
74118           continue;
74119         }
74120         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
74121         if (!childs.length) {
74122           return [];
74123         }
74124       }
74125       return childs;
74126     }
74127     function checkFocusedParent() {
74128       if (_focusedParentWayId) {
74129         var parents = parentWaysIdsOfSelection(true);
74130         if (parents.indexOf(_focusedParentWayId) === -1)
74131           _focusedParentWayId = null;
74132       }
74133     }
74134     function parentWayIdForVertexNavigation() {
74135       var parentIds = parentWaysIdsOfSelection(true);
74136       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
74137         return _focusedParentWayId;
74138       }
74139       return parentIds.length ? parentIds[0] : null;
74140     }
74141     mode.selectedIDs = function(val) {
74142       if (!arguments.length)
74143         return selectedIDs;
74144       selectedIDs = val;
74145       return mode;
74146     };
74147     mode.zoomToSelected = function() {
74148       context.map().zoomToEase(selectedEntities());
74149     };
74150     mode.newFeature = function(val) {
74151       if (!arguments.length)
74152         return _newFeature;
74153       _newFeature = val;
74154       return mode;
74155     };
74156     mode.selectBehavior = function(val) {
74157       if (!arguments.length)
74158         return _selectBehavior;
74159       _selectBehavior = val;
74160       return mode;
74161     };
74162     mode.follow = function(val) {
74163       if (!arguments.length)
74164         return _follow;
74165       _follow = val;
74166       return mode;
74167     };
74168     function loadOperations() {
74169       _operations.forEach(function(operation) {
74170         if (operation.behavior) {
74171           context.uninstall(operation.behavior);
74172         }
74173       });
74174       _operations = Object.values(operations_exports).map(function(o) {
74175         return o(context, selectedIDs);
74176       }).filter(function(o) {
74177         return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
74178       }).concat([
74179         operationCopy(context, selectedIDs),
74180         operationDowngrade(context, selectedIDs),
74181         operationDelete(context, selectedIDs)
74182       ]).filter(function(operation) {
74183         return operation.available();
74184       });
74185       _operations.forEach(function(operation) {
74186         if (operation.behavior) {
74187           context.install(operation.behavior);
74188         }
74189       });
74190       context.ui().closeEditMenu();
74191     }
74192     mode.operations = function() {
74193       return _operations;
74194     };
74195     mode.enter = function() {
74196       if (!checkSelectedIDs())
74197         return;
74198       context.features().forceVisible(selectedIDs);
74199       _modeDragNode.restoreSelectedIDs(selectedIDs);
74200       loadOperations();
74201       if (!_behaviors.length) {
74202         if (!_selectBehavior)
74203           _selectBehavior = behaviorSelect(context);
74204         _behaviors = [
74205           behaviorPaste(context),
74206           _breatheBehavior,
74207           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
74208           _selectBehavior,
74209           behaviorLasso(context),
74210           _modeDragNode.behavior,
74211           modeDragNote(context).behavior
74212         ];
74213       }
74214       _behaviors.forEach(context.install);
74215       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);
74216       select_default2(document).call(keybinding);
74217       context.ui().sidebar.select(selectedIDs, _newFeature);
74218       context.history().on("change.select", function() {
74219         loadOperations();
74220         selectElements();
74221       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
74222       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
74223         selectElements();
74224         _breatheBehavior.restartIfNeeded(context.surface());
74225       });
74226       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
74227       selectElements();
74228       if (_follow) {
74229         var extent = geoExtent();
74230         var graph = context.graph();
74231         selectedIDs.forEach(function(id2) {
74232           var entity = context.entity(id2);
74233           extent._extend(entity.extent(graph));
74234         });
74235         var loc = extent.center();
74236         context.map().centerEase(loc);
74237         _follow = false;
74238       }
74239       function nudgeSelection(delta) {
74240         return function() {
74241           if (!context.map().withinEditableZoom())
74242             return;
74243           var moveOp = operationMove(context, selectedIDs);
74244           if (moveOp.disabled()) {
74245             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip)();
74246           } else {
74247             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
74248             context.validator().validate();
74249           }
74250         };
74251       }
74252       function scaleSelection(factor) {
74253         return function() {
74254           if (!context.map().withinEditableZoom())
74255             return;
74256           let nodes = utilGetAllNodes(selectedIDs, context.graph());
74257           let isUp = factor > 1;
74258           if (nodes.length <= 1)
74259             return;
74260           let extent2 = utilTotalExtent(selectedIDs, context.graph());
74261           function scalingDisabled() {
74262             if (tooSmall()) {
74263               return "too_small";
74264             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
74265               return "too_large";
74266             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
74267               return "not_downloaded";
74268             } else if (selectedIDs.some(context.hasHiddenConnections)) {
74269               return "connected_to_hidden";
74270             }
74271             return false;
74272             function tooSmall() {
74273               if (isUp)
74274                 return false;
74275               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
74276               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
74277               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
74278             }
74279             function someMissing() {
74280               if (context.inIntro())
74281                 return false;
74282               let osm = context.connection();
74283               if (osm) {
74284                 let missing = nodes.filter(function(n2) {
74285                   return !osm.isDataLoaded(n2.loc);
74286                 });
74287                 if (missing.length) {
74288                   missing.forEach(function(loc2) {
74289                     context.loadTileAtLoc(loc2);
74290                   });
74291                   return true;
74292                 }
74293               }
74294               return false;
74295             }
74296             function incompleteRelation(id2) {
74297               let entity = context.entity(id2);
74298               return entity.type === "relation" && !entity.isComplete(context.graph());
74299             }
74300           }
74301           const disabled = scalingDisabled();
74302           if (disabled) {
74303             let multi = selectedIDs.length === 1 ? "single" : "multiple";
74304             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.html("operations.scale." + disabled + "." + multi))();
74305           } else {
74306             const pivot = context.projection(extent2.center());
74307             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
74308             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
74309             context.validator().validate();
74310           }
74311         };
74312       }
74313       function didDoubleUp(d3_event, loc2) {
74314         if (!context.map().withinEditableZoom())
74315           return;
74316         var target = select_default2(d3_event.target);
74317         var datum2 = target.datum();
74318         var entity = datum2 && datum2.properties && datum2.properties.entity;
74319         if (!entity)
74320           return;
74321         if (entity instanceof osmWay && target.classed("target")) {
74322           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
74323           var prev = entity.nodes[choice.index - 1];
74324           var next = entity.nodes[choice.index];
74325           context.perform(actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()), _t("operations.add.annotation.vertex"));
74326           context.validator().validate();
74327         } else if (entity.type === "midpoint") {
74328           context.perform(actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()), _t("operations.add.annotation.vertex"));
74329           context.validator().validate();
74330         }
74331       }
74332       function selectElements() {
74333         if (!checkSelectedIDs())
74334           return;
74335         var surface = context.surface();
74336         surface.selectAll(".selected-member").classed("selected-member", false);
74337         surface.selectAll(".selected").classed("selected", false);
74338         surface.selectAll(".related").classed("related", false);
74339         checkFocusedParent();
74340         if (_focusedParentWayId) {
74341           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
74342         }
74343         if (context.map().withinEditableZoom()) {
74344           surface.selectAll(utilDeepMemberSelector(selectedIDs, context.graph(), true)).classed("selected-member", true);
74345           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
74346         }
74347       }
74348       function esc() {
74349         if (context.container().select(".combobox").size())
74350           return;
74351         context.enter(modeBrowse(context));
74352       }
74353       function firstVertex(d3_event) {
74354         d3_event.preventDefault();
74355         var entity = singular();
74356         var parentId = parentWayIdForVertexNavigation();
74357         var way;
74358         if (entity && entity.type === "way") {
74359           way = entity;
74360         } else if (parentId) {
74361           way = context.entity(parentId);
74362         }
74363         _focusedParentWayId = way && way.id;
74364         if (way) {
74365           context.enter(mode.selectedIDs([way.first()]).follow(true));
74366         }
74367       }
74368       function lastVertex(d3_event) {
74369         d3_event.preventDefault();
74370         var entity = singular();
74371         var parentId = parentWayIdForVertexNavigation();
74372         var way;
74373         if (entity && entity.type === "way") {
74374           way = entity;
74375         } else if (parentId) {
74376           way = context.entity(parentId);
74377         }
74378         _focusedParentWayId = way && way.id;
74379         if (way) {
74380           context.enter(mode.selectedIDs([way.last()]).follow(true));
74381         }
74382       }
74383       function previousVertex(d3_event) {
74384         d3_event.preventDefault();
74385         var parentId = parentWayIdForVertexNavigation();
74386         _focusedParentWayId = parentId;
74387         if (!parentId)
74388           return;
74389         var way = context.entity(parentId);
74390         var length = way.nodes.length;
74391         var curr = way.nodes.indexOf(selectedIDs[0]);
74392         var index = -1;
74393         if (curr > 0) {
74394           index = curr - 1;
74395         } else if (way.isClosed()) {
74396           index = length - 2;
74397         }
74398         if (index !== -1) {
74399           context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
74400         }
74401       }
74402       function nextVertex(d3_event) {
74403         d3_event.preventDefault();
74404         var parentId = parentWayIdForVertexNavigation();
74405         _focusedParentWayId = parentId;
74406         if (!parentId)
74407           return;
74408         var way = context.entity(parentId);
74409         var length = way.nodes.length;
74410         var curr = way.nodes.indexOf(selectedIDs[0]);
74411         var index = -1;
74412         if (curr < length - 1) {
74413           index = curr + 1;
74414         } else if (way.isClosed()) {
74415           index = 0;
74416         }
74417         if (index !== -1) {
74418           context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
74419         }
74420       }
74421       function focusNextParent(d3_event) {
74422         d3_event.preventDefault();
74423         var parents = parentWaysIdsOfSelection(true);
74424         if (!parents || parents.length < 2)
74425           return;
74426         var index = parents.indexOf(_focusedParentWayId);
74427         if (index < 0 || index > parents.length - 2) {
74428           _focusedParentWayId = parents[0];
74429         } else {
74430           _focusedParentWayId = parents[index + 1];
74431         }
74432         var surface = context.surface();
74433         surface.selectAll(".related").classed("related", false);
74434         if (_focusedParentWayId) {
74435           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
74436         }
74437       }
74438       function selectParent(d3_event) {
74439         d3_event.preventDefault();
74440         var currentSelectedIds = mode.selectedIDs();
74441         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
74442         if (!parentIds.length)
74443           return;
74444         context.enter(mode.selectedIDs(parentIds));
74445         _focusedVertexIds = currentSelectedIds;
74446       }
74447       function selectChild(d3_event) {
74448         d3_event.preventDefault();
74449         var currentSelectedIds = mode.selectedIDs();
74450         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
74451         if (!childIds || !childIds.length)
74452           return;
74453         if (currentSelectedIds.length === 1)
74454           _focusedParentWayId = currentSelectedIds[0];
74455         context.enter(mode.selectedIDs(childIds));
74456       }
74457     };
74458     mode.exit = function() {
74459       _newFeature = false;
74460       _focusedVertexIds = null;
74461       _operations.forEach(function(operation) {
74462         if (operation.behavior) {
74463           context.uninstall(operation.behavior);
74464         }
74465       });
74466       _operations = [];
74467       _behaviors.forEach(context.uninstall);
74468       select_default2(document).call(keybinding.unbind);
74469       context.ui().closeEditMenu();
74470       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
74471       var surface = context.surface();
74472       surface.selectAll(".selected-member").classed("selected-member", false);
74473       surface.selectAll(".selected").classed("selected", false);
74474       surface.selectAll(".highlighted").classed("highlighted", false);
74475       surface.selectAll(".related").classed("related", false);
74476       context.map().on("drawn.select", null);
74477       context.ui().sidebar.hide();
74478       context.features().forceVisible([]);
74479       var entity = singular();
74480       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)) {
74481         var deleteAction = actionDeleteRelation(entity.id, true);
74482         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
74483         context.validator().validate();
74484       }
74485     };
74486     return mode;
74487   }
74488
74489   // modules/behavior/lasso.js
74490   function behaviorLasso(context) {
74491     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
74492     var behavior = function(selection2) {
74493       var lasso;
74494       function pointerdown(d3_event) {
74495         var button = 0;
74496         if (d3_event.button === button && d3_event.shiftKey === true) {
74497           lasso = null;
74498           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
74499           d3_event.stopPropagation();
74500         }
74501       }
74502       function pointermove() {
74503         if (!lasso) {
74504           lasso = uiLasso(context);
74505           context.surface().call(lasso);
74506         }
74507         lasso.p(context.map().mouse());
74508       }
74509       function normalize2(a, b) {
74510         return [
74511           [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
74512           [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
74513         ];
74514       }
74515       function lassoed() {
74516         if (!lasso)
74517           return [];
74518         var graph = context.graph();
74519         var limitToNodes;
74520         if (context.map().editableDataEnabled(true) && context.map().isInWideSelection()) {
74521           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
74522         } else if (!context.map().editableDataEnabled()) {
74523           return [];
74524         }
74525         var bounds = lasso.extent().map(context.projection.invert);
74526         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
74527         var intersects = context.history().intersects(extent).filter(function(entity) {
74528           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
74529         });
74530         intersects.sort(function(node1, node2) {
74531           var parents1 = graph.parentWays(node1);
74532           var parents2 = graph.parentWays(node2);
74533           if (parents1.length && parents2.length) {
74534             var sharedParents = utilArrayIntersection(parents1, parents2);
74535             if (sharedParents.length) {
74536               var sharedParentNodes = sharedParents[0].nodes;
74537               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
74538             } else {
74539               return parseFloat(parents1[0].id.slice(1)) - parseFloat(parents2[0].id.slice(1));
74540             }
74541           } else if (parents1.length || parents2.length) {
74542             return parents1.length - parents2.length;
74543           }
74544           return node1.loc[0] - node2.loc[0];
74545         });
74546         return intersects.map(function(entity) {
74547           return entity.id;
74548         });
74549       }
74550       function pointerup() {
74551         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
74552         if (!lasso)
74553           return;
74554         var ids = lassoed();
74555         lasso.close();
74556         if (ids.length) {
74557           context.enter(modeSelect(context, ids));
74558         }
74559       }
74560       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
74561     };
74562     behavior.off = function(selection2) {
74563       selection2.on(_pointerPrefix + "down.lasso", null);
74564     };
74565     return behavior;
74566   }
74567
74568   // modules/modes/browse.js
74569   function modeBrowse(context) {
74570     var mode = {
74571       button: "browse",
74572       id: "browse",
74573       title: _t("modes.browse.title"),
74574       description: _t("modes.browse.description")
74575     };
74576     var sidebar;
74577     var _selectBehavior;
74578     var _behaviors = [];
74579     mode.selectBehavior = function(val) {
74580       if (!arguments.length)
74581         return _selectBehavior;
74582       _selectBehavior = val;
74583       return mode;
74584     };
74585     mode.enter = function() {
74586       if (!_behaviors.length) {
74587         if (!_selectBehavior)
74588           _selectBehavior = behaviorSelect(context);
74589         _behaviors = [
74590           behaviorPaste(context),
74591           behaviorHover(context).on("hover", context.ui().sidebar.hover),
74592           _selectBehavior,
74593           behaviorLasso(context),
74594           modeDragNode(context).behavior,
74595           modeDragNote(context).behavior
74596         ];
74597       }
74598       _behaviors.forEach(context.install);
74599       if (document.activeElement && document.activeElement.blur) {
74600         document.activeElement.blur();
74601       }
74602       if (sidebar) {
74603         context.ui().sidebar.show(sidebar);
74604       } else {
74605         context.ui().sidebar.select(null);
74606       }
74607     };
74608     mode.exit = function() {
74609       context.ui().sidebar.hover.cancel();
74610       _behaviors.forEach(context.uninstall);
74611       if (sidebar) {
74612         context.ui().sidebar.hide();
74613       }
74614     };
74615     mode.sidebar = function(_) {
74616       if (!arguments.length)
74617         return sidebar;
74618       sidebar = _;
74619       return mode;
74620     };
74621     mode.operations = function() {
74622       return [operationPaste(context)];
74623     };
74624     return mode;
74625   }
74626
74627   // modules/behavior/add_way.js
74628   function behaviorAddWay(context) {
74629     var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
74630     var draw = behaviorDraw(context);
74631     function behavior(surface) {
74632       draw.on("click", function() {
74633         dispatch10.apply("start", this, arguments);
74634       }).on("clickWay", function() {
74635         dispatch10.apply("startFromWay", this, arguments);
74636       }).on("clickNode", function() {
74637         dispatch10.apply("startFromNode", this, arguments);
74638       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
74639       context.map().dblclickZoomEnable(false);
74640       surface.call(draw);
74641     }
74642     behavior.off = function(surface) {
74643       surface.call(draw.off);
74644     };
74645     behavior.cancel = function() {
74646       window.setTimeout(function() {
74647         context.map().dblclickZoomEnable(true);
74648       }, 1e3);
74649       context.enter(modeBrowse(context));
74650     };
74651     return utilRebind(behavior, dispatch10, "on");
74652   }
74653
74654   // modules/behavior/hash.js
74655   function behaviorHash(context) {
74656     var _cachedHash = null;
74657     var _latitudeLimit = 90 - 1e-8;
74658     function computedHashParameters() {
74659       var map2 = context.map();
74660       var center = map2.center();
74661       var zoom = map2.zoom();
74662       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
74663       var oldParams = utilObjectOmit(utilStringQs(window.location.hash), ["comment", "source", "hashtags", "walkthrough"]);
74664       var newParams = {};
74665       delete oldParams.id;
74666       var selected = context.selectedIDs().filter(function(id2) {
74667         return context.hasEntity(id2);
74668       });
74669       if (selected.length) {
74670         newParams.id = selected.join(",");
74671       }
74672       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
74673       return Object.assign(oldParams, newParams);
74674     }
74675     function computedHash() {
74676       return "#" + utilQsString(computedHashParameters(), true);
74677     }
74678     function computedTitle(includeChangeCount) {
74679       var baseTitle = context.documentTitleBase() || "iD";
74680       var contextual;
74681       var changeCount;
74682       var titleID;
74683       var selected = context.selectedIDs().filter(function(id2) {
74684         return context.hasEntity(id2);
74685       });
74686       if (selected.length) {
74687         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
74688         if (selected.length > 1) {
74689           contextual = _t("title.labeled_and_more", {
74690             labeled: firstLabel,
74691             count: selected.length - 1
74692           });
74693         } else {
74694           contextual = firstLabel;
74695         }
74696         titleID = "context";
74697       }
74698       if (includeChangeCount) {
74699         changeCount = context.history().difference().summary().length;
74700         if (changeCount > 0) {
74701           titleID = contextual ? "changes_context" : "changes";
74702         }
74703       }
74704       if (titleID) {
74705         return _t("title.format." + titleID, {
74706           changes: changeCount,
74707           base: baseTitle,
74708           context: contextual
74709         });
74710       }
74711       return baseTitle;
74712     }
74713     function updateTitle(includeChangeCount) {
74714       if (!context.setsDocumentTitle())
74715         return;
74716       var newTitle = computedTitle(includeChangeCount);
74717       if (document.title !== newTitle) {
74718         document.title = newTitle;
74719       }
74720     }
74721     function updateHashIfNeeded() {
74722       if (context.inIntro())
74723         return;
74724       var latestHash = computedHash();
74725       if (_cachedHash !== latestHash) {
74726         _cachedHash = latestHash;
74727         window.history.replaceState(null, computedTitle(false), latestHash);
74728         updateTitle(true);
74729       }
74730     }
74731     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
74732     var _throttledUpdateTitle = throttle_default(function() {
74733       updateTitle(true);
74734     }, 500);
74735     function hashchange() {
74736       if (window.location.hash === _cachedHash)
74737         return;
74738       _cachedHash = window.location.hash;
74739       var q = utilStringQs(_cachedHash);
74740       var mapArgs = (q.map || "").split("/").map(Number);
74741       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
74742         updateHashIfNeeded();
74743       } else {
74744         if (_cachedHash === computedHash())
74745           return;
74746         var mode = context.mode();
74747         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
74748         if (q.id && mode) {
74749           var ids = q.id.split(",").filter(function(id2) {
74750             return context.hasEntity(id2);
74751           });
74752           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
74753             context.enter(modeSelect(context, ids));
74754             return;
74755           }
74756         }
74757         var center = context.map().center();
74758         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
74759         var maxdist = 500;
74760         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
74761           context.enter(modeBrowse(context));
74762           return;
74763         }
74764       }
74765     }
74766     function behavior() {
74767       context.map().on("move.behaviorHash", _throttledUpdate);
74768       context.history().on("change.behaviorHash", _throttledUpdateTitle);
74769       context.on("enter.behaviorHash", _throttledUpdate);
74770       select_default2(window).on("hashchange.behaviorHash", hashchange);
74771       if (window.location.hash) {
74772         var q = utilStringQs(window.location.hash);
74773         if (q.id) {
74774           context.zoomToEntity(q.id.split(",")[0], !q.map);
74775         }
74776         if (q.walkthrough === "true") {
74777           behavior.startWalkthrough = true;
74778         }
74779         if (q.map) {
74780           behavior.hadHash = true;
74781         }
74782         hashchange();
74783         updateTitle(false);
74784       }
74785     }
74786     behavior.off = function() {
74787       _throttledUpdate.cancel();
74788       _throttledUpdateTitle.cancel();
74789       context.map().on("move.behaviorHash", null);
74790       context.on("enter.behaviorHash", null);
74791       select_default2(window).on("hashchange.behaviorHash", null);
74792       window.location.hash = "";
74793     };
74794     return behavior;
74795   }
74796
74797   // node_modules/d3-brush/src/brush.js
74798   var { abs: abs2, max: max2, min: min2 } = Math;
74799   function number1(e) {
74800     return [+e[0], +e[1]];
74801   }
74802   function number22(e) {
74803     return [number1(e[0]), number1(e[1])];
74804   }
74805   var X = {
74806     name: "x",
74807     handles: ["w", "e"].map(type2),
74808     input: function(x, e) {
74809       return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
74810     },
74811     output: function(xy) {
74812       return xy && [xy[0][0], xy[1][0]];
74813     }
74814   };
74815   var Y = {
74816     name: "y",
74817     handles: ["n", "s"].map(type2),
74818     input: function(y, e) {
74819       return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
74820     },
74821     output: function(xy) {
74822       return xy && [xy[0][1], xy[1][1]];
74823     }
74824   };
74825   var XY = {
74826     name: "xy",
74827     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
74828     input: function(xy) {
74829       return xy == null ? null : number22(xy);
74830     },
74831     output: function(xy) {
74832       return xy;
74833     }
74834   };
74835   function type2(t) {
74836     return { type: t };
74837   }
74838
74839   // modules/index.js
74840   var debug = false;
74841   var d3 = {
74842     dispatch: dispatch_default,
74843     geoMercator: mercator_default,
74844     geoProjection: projection,
74845     polygonArea: area_default3,
74846     polygonCentroid: centroid_default2,
74847     select: select_default2,
74848     selectAll: selectAll_default2,
74849     timerFlush
74850   };
74851
74852   // modules/id.js
74853   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
74854     var start2 = Date.now();
74855     return window.requestAnimationFrame(function() {
74856       cb({
74857         didTimeout: false,
74858         timeRemaining: function() {
74859           return Math.max(0, 50 - (Date.now() - start2));
74860         }
74861       });
74862     });
74863   };
74864   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
74865     window.cancelAnimationFrame(id2);
74866   };
74867   window.iD = modules_exports;
74868 })();
74869 //# sourceMappingURL=iD.js.map